@runeya/runeya 2.0.145 → 2.0.146
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/agent/index.js +26 -21
- package/agent/index.js.map +1 -1
- package/agent-manager-R7BPQO6D.js +11 -0
- package/{chat-XYCHMTFE.js → chat-LPML22J5.js} +8 -7
- package/{chunk-NCO4OOYT.js → chunk-4LJQIQMN.js} +2 -2
- package/chunk-6IBPK6UE.js +1063 -0
- package/chunk-6IBPK6UE.js.map +1 -0
- package/{chunk-QF56Z6LI.js → chunk-KV4GJKXU.js} +3 -3
- package/{chunk-FE53XX4M.js → chunk-NPMSBYXC.js} +3 -3
- package/{chunk-ONVAH65J.js → chunk-SEPAURTQ.js} +283 -1266
- package/chunk-SEPAURTQ.js.map +1 -0
- package/{chunk-Q4RPY3VW.js → chunk-UD42LACH.js} +25 -11
- package/{chunk-Q4RPY3VW.js.map → chunk-UD42LACH.js.map} +1 -1
- package/{chunk-KS7A5CTW.js → chunk-VPSQJOSN.js} +12 -2
- package/{chunk-KS7A5CTW.js.map → chunk-VPSQJOSN.js.map} +1 -1
- package/{companion-HBYSY2D5.js → companion-W3UMZWGH.js} +5 -5
- package/external-NMKQPROK.js +387 -0
- package/external-NMKQPROK.js.map +1 -0
- package/index.js +15 -6
- package/index.js.map +1 -1
- package/{install-gate-JAEK4BDZ.js → install-gate-PVMGJDWE.js} +2 -2
- package/mcp-server/external.d.ts +44 -0
- package/mcp-server/external.js +2679 -0
- package/mcp-server/external.js.map +1 -0
- package/mcp-server/index.js +135 -39
- package/mcp-server/index.js.map +1 -1
- package/mcp-server/launch.d.ts +19 -1
- package/mcp-server/launch.js +20 -0
- package/mcp-server/launch.js.map +1 -1
- package/package.json +1 -1
- package/settings-manager-XPLBO35P.js +10 -0
- package/{src-IODFUZ7A.js → src-LEDGW5KP.js} +951 -499
- package/src-LEDGW5KP.js.map +1 -0
- package/{vault-resolver-PN3TYCLJ.js → vault-resolver-E7KPKA5C.js} +2 -2
- package/web/assets/{AgentScalarChatInterface.vue-npQgDxeP.js → AgentScalarChatInterface.vue-BYszptaB.js} +1 -1
- package/web/assets/{AgentTerminalPage-BTH3yCS2.js → AgentTerminalPage-C3TJ1NL9.js} +1 -1
- package/web/assets/{AiChatModals-It9jnB26.js → AiChatModals-D3scRE3S.js} +1 -1
- package/web/assets/{AppLayout-BTg2CADo.js → AppLayout-BMQUjPKe.js} +1 -1
- package/web/assets/{AuditPage-2PKKGLZs.js → AuditPage-CKcExBws.js} +1 -1
- package/web/assets/{CloudAccountPage-CHL61gLe.js → CloudAccountPage-B6oPg0BZ.js} +1 -1
- package/web/assets/{CloudMessagingPage-cgKnABPH.js → CloudMessagingPage-C5fwVe-F.js} +1 -1
- package/web/assets/{DashboardPage-CRntTMKY.js → DashboardPage-9RV7sx3e.js} +1 -1
- package/web/assets/{DirectoryPickerDialog-DCyhT3-W.js → DirectoryPickerDialog-C06BXyfJ.js} +1 -1
- package/web/assets/{EnvironmentForm-C96PFWRE.js → EnvironmentForm-CAvDoira.js} +1 -1
- package/web/assets/{EnvironmentFormPage-ChorAd63.js → EnvironmentFormPage-BmAxhN-m.js} +1 -1
- package/web/assets/{EnvironmentListPage-Dw9ziaI8.js → EnvironmentListPage-B8uATPBI.js} +1 -1
- package/web/assets/{KanbanBoardPage-BZHbEj-q.js → KanbanBoardPage-CQsOkRUf.js} +3 -3
- package/web/assets/{KanbanListPage-B0jlfKqs.js → KanbanListPage-CWZqkjD6.js} +1 -1
- package/web/assets/{LaunchProjectPage-BVs1JwbV.js → LaunchProjectPage-saSmC7Pr.js} +1 -1
- package/web/assets/{LaunchServicesPage-PBYJly9N.js → LaunchServicesPage-BkKyLMEz.js} +1 -1
- package/web/assets/{LaunchShell-CGNYr-do.js → LaunchShell-DUrSunB4.js} +1 -1
- package/web/assets/{LogViewer-BDObx29F.js → LogViewer-CZBYkH9J.js} +1 -1
- package/web/assets/{OrgKeyPrompt-BbcwiwGw.js → OrgKeyPrompt-DzQ7pwbs.js} +1 -1
- package/web/assets/{ProcessControls-DY0HTKde.js → ProcessControls-BEeoNlNV.js} +1 -1
- package/web/assets/{ProcessDetailPage-BZ9kIQqn.js → ProcessDetailPage-CQgu5uKm.js} +1 -1
- package/web/assets/{ProjectCreateDialog-C1wVDPcK.js → ProjectCreateDialog-BolrhRD-.js} +1 -1
- package/web/assets/{ProjectLocationGate-bUd_tFpI.js → ProjectLocationGate-DhMVdIjN.js} +1 -1
- package/web/assets/{ProjectPublishDialog-APUS1WEN.js → ProjectPublishDialog-DsZNWrfz.js} +1 -1
- package/web/assets/{RandomJobTestPage-BFNC827R.js → RandomJobTestPage-BUS2Ty6-.js} +1 -1
- package/web/assets/{ScenarioEditorPage-DFVsMVu5.js → ScenarioEditorPage-MIAGh2us.js} +1 -1
- package/web/assets/{SendToChatDialog-QHIkxNio.js → SendToChatDialog-BxWsyv29.js} +1 -1
- package/web/assets/{ServiceControlsBar-_UQXb6g0.js → ServiceControlsBar-DqDPAZt7.js} +1 -1
- package/web/assets/{ServiceDetailPage-DGIXgHwR.js → ServiceDetailPage-hkSAzZ-l.js} +1 -1
- package/web/assets/{ServiceFormPage-RliAfS3_.js → ServiceFormPage-DXqhqXg8.js} +1 -1
- package/web/assets/SettingsPage-4pKUgKPm.css +1 -0
- package/web/assets/SettingsPage-DS2YhMIM.js +2086 -0
- package/web/assets/{UnlockPage-17EgfpJs.js → UnlockPage-s8SgVcKk.js} +1 -1
- package/web/assets/{VaultMigrationPage-DeMxpXXJ.js → VaultMigrationPage-s0b44MDM.js} +1 -1
- package/web/assets/{VersionBadge-DBquJl76.js → VersionBadge-BmArk24p.js} +1 -1
- package/web/assets/{WikiPage-GtwpJPqf.js → WikiPage-DADu8WUA.js} +1 -1
- package/web/assets/{WikiView-BqaqxMxW.js → WikiView-DtGwIt_Q.js} +1 -1
- package/web/assets/{add-scalar-classes-DhSSqZ5l.js → add-scalar-classes-dWEWPlFD.js} +1 -1
- package/web/assets/{agent.store-Co44dMZf.js → agent.store-CKLAkF9a.js} +1 -1
- package/web/assets/{auth-Bk1GP5sB.js → auth-Cg9BWTfK.js} +2 -2
- package/web/assets/{cloud-chat.store-CadB14dZ.js → cloud-chat.store-b-BHGz7I.js} +1 -1
- package/web/assets/{cloud-client-0zD_NI6q.js → cloud-client-D_zCiW0s.js} +2 -2
- package/web/assets/{cloud-session-Cjw54Y--.js → cloud-session-DOaDpZTy.js} +2 -2
- package/web/assets/{editor.store-DmM6ZlTm.js → editor.store-DCAZSeVG.js} +1 -1
- package/web/assets/i18n-D0afQEGs.js +1 -0
- package/web/assets/{index-B9DJf2V0.js → index-D8VRbyoP.js} +36 -36
- package/web/assets/index-DsezNbSM.css +1 -0
- package/web/assets/{modal-UK8xRSnh.js → modal-qYgTMkYb.js} +1 -1
- package/web/assets/{project-launch.store-B5nhdGdh.js → project-launch.store-y7JBMNiE.js} +1 -1
- package/web/assets/{project.store-Bm2JWNbd.js → project.store-DGJr0Qr9.js} +1 -1
- package/web/assets/{scenario.store-88w6P6s2.js → scenario.store-YWHL2_wu.js} +3 -3
- package/web/assets/{service.store-XS50iGKo.js → service.store-5jWsJxPx.js} +1 -1
- package/web/assets/{settings-scope-CKPq86HZ.js → settings-scope-Bv7QGPrt.js} +1 -1
- package/web/assets/{settings.store-BCJ0LJQA.js → settings.store-bEsB7oKb.js} +1 -1
- package/web/assets/{src-DBipSD56.js → src-C-D_y7ou.js} +1 -1
- package/web/assets/{src-Cgix2VOi.js → src-Dnwk6NpV.js} +2 -2
- package/web/assets/{src-BDZKZr9n.css → src-g1DRo8xZ.css} +1 -1
- package/web/assets/{trpc-CfuFkKgp.js → trpc-Drabzwpd.js} +3 -3
- package/web/assets/{useCloudOrg-J8DAnocE.js → useCloudOrg-BAQEtFPl.js} +1 -1
- package/web/assets/{useEnvVarAutocomplete-C6zOXYqi.js → useEnvVarAutocomplete-BqGTODUv.js} +1 -1
- package/web/assets/{useProjectCatalog-BB5IR6o8.js → useProjectCatalog-yocjIKt6.js} +1 -1
- package/web/assets/{useProjectCloudOrg-BnlKts7x.js → useProjectCloudOrg-CEN9-_OA.js} +1 -1
- package/web/assets/{useServiceUrlHost-hKbKtPMu.js → useServiceUrlHost-BuoPEXZX.js} +1 -1
- package/web/assets/{vue-draggable-plus-D5ni4jMk.js → vue-draggable-plus-DX4rTBiu.js} +1 -1
- package/web/index.html +17 -17
- package/agent-manager-THV3LJOF.js +0 -11
- package/chunk-ONVAH65J.js.map +0 -1
- package/settings-manager-QVQRJO6V.js +0 -10
- package/src-IODFUZ7A.js.map +0 -1
- package/web/assets/SettingsPage-BSSHxxjM.js +0 -2086
- package/web/assets/SettingsPage-W8YszhUL.css +0 -1
- package/web/assets/i18n-8FjeJaKW.js +0 -1
- package/web/assets/index-teBqdnuv.css +0 -1
- /package/{agent-manager-THV3LJOF.js.map → agent-manager-R7BPQO6D.js.map} +0 -0
- /package/{chat-XYCHMTFE.js.map → chat-LPML22J5.js.map} +0 -0
- /package/{chunk-NCO4OOYT.js.map → chunk-4LJQIQMN.js.map} +0 -0
- /package/{chunk-QF56Z6LI.js.map → chunk-KV4GJKXU.js.map} +0 -0
- /package/{chunk-FE53XX4M.js.map → chunk-NPMSBYXC.js.map} +0 -0
- /package/{companion-HBYSY2D5.js.map → companion-W3UMZWGH.js.map} +0 -0
- /package/{install-gate-JAEK4BDZ.js.map → install-gate-PVMGJDWE.js.map} +0 -0
- /package/{settings-manager-QVQRJO6V.js.map → settings-manager-XPLBO35P.js.map} +0 -0
- /package/{vault-resolver-PN3TYCLJ.js.map → vault-resolver-E7KPKA5C.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UnlockPage-
|
|
2
|
-
import{i as e,n as t,t as n}from"./rolldown-runtime-Dd_uD5pT.js";import{B as r,C as i,F as a,N as o,O as s,P as c,S as l,_ as u,c as d,g as f,l as p,m,o as h,x as g}from"./reactivity.esm-bundler-BQ9SB2vv.js";import{$ as _,B as v,Ct as y,D as b,E as x,Ft as S,Ht as C,J as w,L as T,Lt as E,Nt as D,S as ee,St as O,Ut as k,Y as A,Yt as j,_ as M,b as N,bt as P,ct as F,en as I,et as L,ft as te,g as R,gt as ne,it as re,k as z,mt as B,nn as ie,o as V,pt as ae,qt as H,rn as U,rt as oe,st as se,tn as ce,tt as le,u as ue,v as W,wt as de,xt as fe,y as G,z as pe}from"./runtime-core.esm-bundler-DujKY9QV.js";import{F as me,I as he,P as ge,g as _e,p as ve}from"./floating-ui.dom-DWhsZyqT.js";import{$ as ye,A as be,C as xe,H as Se,J as Ce,L as we,M as Te,N as Ee,P as De,Q as Oe,S as ke,U as Ae,W as je,X as Me,Y as Ne,at as Pe,ct as Fe,d as Ie,dt as Le,et as Re,ft as ze,it as Be,lt as Ve,mt as He,nt as Ue,o as We,ot as Ge,q as Ke,rt as qe,st as Je,t as Ye,tt as Xe,u as Ze,ut as Qe}from"./src--GO-VSJ0.js";import{a as $e,i as et,n as tt,r as nt}from"./project-launch.store-B5nhdGdh.js";import{r as rt}from"./i18n-8FjeJaKW.js";import{g as it}from"./useApi-s_02lHjl-DZYO2tHU.js";import{i as at,n as ot,r as st}from"./vue-router-fin80h5W.js";import{a as ct,n as lt,r as ut,t as dt}from"./scenario.store-88w6P6s2.js";import{a as ft,i as pt,n as mt,r as ht,t as gt}from"./app-mode-BVpTuh0i.js";import{n as _t,o as vt,r as yt,t as bt}from"./trpc-CfuFkKgp.js";import{t as xt}from"./preload-helper-BZ1Pz5am.js";import{c as St,i as Ct,n as wt,r as Tt,s as Et}from"./auth-Bk1GP5sB.js";import{n as Dt,r as Ot}from"./project.store-Bm2JWNbd.js";import{a as kt}from"./cloud-auth-D_am4FlK.js";import{i as At,n as jt,r as Mt,t as Nt}from"./useProjectCatalog-BB5IR6o8.js";import{n as Pt,r as Ft}from"./error-DpF7X5iu.js";import{n as It,r as Lt}from"./cloud-client-0zD_NI6q.js";import{t as Rt}from"./use-polling-CEkhIY_9.js";import{r as zt,t as Bt}from"./AiChatModals-It9jnB26.js";import{n as Vt,t as Ht}from"./vue-draggable-plus-D5ni4jMk.js";import{t as Ut}from"./useAiChatDrawer-D_ofn8Eo.js";import{t as Wt}from"./settings-scope-CKPq86HZ.js";import{g as Gt,n as Kt}from"./schemas-68I2iCLF.js";import{a as qt,n as Jt,r as Yt}from"./dist-N4nrnbnA.js";import{t as Xt}from"./service.store-XS50iGKo.js";import{t as Zt}from"./agent.store-Co44dMZf.js";import{n as Qt}from"./process-BWkHpZOM.js";import{a as $t,c as en,d as tn,f as nn,i as rn,l as an,n as on,o as sn,p as cn,r as ln,s as un,t as dn,u as fn}from"./theme-BZCAxfJD.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var pn=n((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){for(var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),mn=n((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),hn=n((e=>{var t=pn(),n=mn(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(G(e,ArrayBuffer)||e&&G(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(G(e,SharedArrayBuffer)||e&&G(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(G(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||pe(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(G(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),G(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(G(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||G(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return le(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return de(e).length;default:if(i)return r?-1:le(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return P(this,t,n);case`utf8`:case`utf-8`:return k(this,t,n);case`ascii`:return M(this,t,n);case`latin1`:case`binary`:return N(this,t,n);case`base64`:return O(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return F(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?k(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(G(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,pe(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(i)n=0;else return-1}if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:C(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):C(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function C(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function w(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o=0;for(;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(pe(r))return o;e[n+o]=r}return o}function T(e,t,n,r){return fe(le(t,e.length-n),e,n,r)}function E(e,t,n,r){return fe(ue(t),e,n,r)}function D(e,t,n,r){return fe(de(t),e,n,r)}function ee(e,t,n,r){return fe(W(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return w(this,e,t,n);case`utf8`:case`utf-8`:return T(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return E(this,e,t,n);case`base64`:return D(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ee(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function O(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function k(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return j(r)}var A=4096;function j(e){let t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=A));return n}function M(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function N(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function P(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=me[e[r]];return i}function F(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function I(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=he(function(e){e>>>=0,U(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=t+this[++e]*256+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*256+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=he(function(e){e>>>=0,U(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*256+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*256+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||I(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||I(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=he(function(e){e>>>=0,U(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=this[e+4]+this[e+5]*256+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*256+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=he(function(e){e>>>=0,U(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*256+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*256+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!1,52,8)};function L(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;L(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;L(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function te(e,t,n,r,i){H(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function R(e,t,n,r,i){H(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=he(function(e,t=0){return te(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=he(function(e,t=0){return R(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);L(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);L(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=he(function(e,t=0){return te(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=he(function(e,t=0){return R(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ne(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function re(e,t,r,i,a){return t=+t,r>>>=0,a||ne(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return re(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return re(this,e,t,!1,n)};function z(e,t,r,i,a){return t=+t,r>>>=0,a||ne(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return z(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return z(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var B={};function ie(e,t,n){B[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}ie(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),ie(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),ie(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=V(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function V(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function ae(e,t,n){U(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&oe(t,e.length-(n+1))}function H(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new B.ERR_OUT_OF_RANGE(`value`,i,e)}ae(r,i,a)}function U(e,t){if(typeof e!=`number`)throw new B.ERR_INVALID_ARG_TYPE(t,`number`,e)}function oe(e,t,n){throw Math.floor(e)===e?t<0?new B.ERR_BUFFER_OUT_OF_BOUNDS:new B.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(U(e,n),new B.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var se=/[^+/0-9A-Za-z-_]/g;function ce(e){if(e=e.split(`=`)[0],e=e.trim().replace(se,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function le(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function ue(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function W(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function de(e){return t.toByteArray(ce(e))}function fe(e,t,n,r){let i=0;for(;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function G(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function pe(e){return e!==e}var me=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function he(e){return typeof BigInt>`u`?ge:e}function ge(){throw Error(`BigInt not supported`)}}))(),gn=z({__name:`PopoverTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,n=qe(),{forwardRef:i,currentElement:a}=Qe();return n.triggerId||=Ve(void 0,`reka-popover-trigger`),n.contentId||=Ve(void 0,`reka-popover-content`),F(()=>{n.triggerElement.value=a.value}),(e,a)=>(B(),W(de(r(n).hasCustomAnchor.value?r(Fe):r(Je)),{"as-child":``},{default:H(()=>[b(r(Fe),{id:r(n).triggerId,ref:r(i),type:e.as===`button`?`button`:void 0,"aria-haspopup":`dialog`,"aria-expanded":r(n).open.value,"aria-controls":r(n).open.value?r(n).contentId:void 0,"data-state":r(n).open.value?`open`:`closed`,as:e.as,"as-child":t.asChild,onClick:r(n).onOpenToggle},{default:H(()=>[fe(e.$slots,`default`)]),_:3},8,[`id`,`type`,`aria-expanded`,`aria-controls`,`data-state`,`as`,`as-child`,`onClick`])]),_:3}))}}),_n={key:0,class:`error-boundary`},vn={class:`error-content`},yn={class:`error-message`},bn=ze(z({__name:`ErrorBoundary`,setup(e){let{t}=He(),n=i(null);se(e=>(n.value=e instanceof Error?e:Error(String(e)),console.error(`[ErrorBoundary]`,e),!1));function a(){n.value=null}return(e,i)=>n.value?(B(),N(`div`,_n,[M(`div`,vn,[i[0]||=M(`i`,{class:`ti ti-alert-triangle error-icon`},null,-1),M(`h3`,null,U(r(t)(`errorBoundary.title`)),1),M(`p`,yn,U(n.value.message),1),b(r(Le),{label:r(t)(`errorBoundary.tryAgain`),icon:`ti ti-refresh`,onClick:a},null,8,[`label`])])])):fe(e.$slots,`default`,{key:1},void 0,!0)}}),[[`__scopeId`,`data-v-1e77a5b4`]]),xn=i(null),Sn=i(null),Cn=i(`unknown`),wn=i(!0),Tn=null;async function En(e){wn.value=!0;try{let t=await yt.health.versionInfo.query(e?{force:!0}:void 0);xn.value=t.current,Sn.value=t.latest,Cn.value=t.status}catch{Cn.value=`unknown`}finally{wn.value=!1}}async function Dn(e={}){e.force?Tn=En(!0):Tn??=En(!1);let t=Tn;try{await t}finally{Tn===t&&(Tn=null)}}function On(){return{current:xn,latest:Sn,status:Cn,loading:wn,outdated:R(()=>Cn.value===`outdated`),check:Dn}}var kn={class:`update-dialog__lead`},An={key:0,class:`update-dialog__row`},jn={key:1,class:`update-dialog__prereqs`},Mn={class:`update-dialog__prereq`},Nn={class:`update-dialog__prereq`},Pn={key:0},Fn={key:1},In={key:0,class:`update-dialog__prereq`},Ln={key:4,class:`update-dialog__row`},Rn={key:7,class:`update-dialog__output`},zn=ze(z({__name:`AppUpdateDialog`,props:{visible:{type:Boolean},currentVersion:{},latestVersion:{}},emits:[`update:visible`,`updated`],setup(e,{emit:t}){let{t:n}=He(),a=e,o=t,s=i(`checking`),c=i(null),l=i(``),u=i(null),d=i(``);async function f(){s.value=`checking`,l.value=``,d.value=``;try{let e=await yt.appUpdate.prerequisites.query();c.value=e,s.value=e.ready?`ready`:`blocked`}catch(e){d.value=e.message,s.value=`blocked`}}async function p(){s.value=`installing`;try{let e=await yt.appUpdate.install.mutate();l.value=e.output,u.value=e.installedVersion,s.value=e.ok?`installed`:`failed`,e.ok&&o(`updated`)}catch(e){d.value=e.message,s.value=`failed`}}async function m(){s.value=`restarting`;try{await yt.appUpdate.restart.mutate()}catch{}}return C(()=>a.visible,e=>{e&&f()}),(t,i)=>(B(),W(r(Ne),{visible:e.visible,header:r(n)(`appUpdate.dialogTitle`),modal:``,closable:s.value!==`installing`&&s.value!==`restarting`,style:{width:`34rem`},"onUpdate:visible":i[1]||=e=>o(`update:visible`,e)},{footer:H(()=>[s.value===`blocked`||s.value===`failed`?(B(),W(r(Le),{key:0,label:r(n)(`appUpdate.retry`),severity:`secondary`,onClick:f},null,8,[`label`])):G(``,!0),s.value===`ready`?(B(),W(r(Le),{key:1,label:r(n)(`appUpdate.install`),icon:`ti ti-download`,onClick:p},null,8,[`label`])):G(``,!0),s.value===`installed`?(B(),W(r(Le),{key:2,label:r(n)(`appUpdate.restartLater`),severity:`secondary`,onClick:i[0]||=e=>o(`update:visible`,!1)},null,8,[`label`])):G(``,!0),s.value===`installed`?(B(),W(r(Le),{key:3,label:r(n)(`appUpdate.restartNow`),icon:`ti ti-refresh`,onClick:m},null,8,[`label`])):G(``,!0),s.value===`restarting`?(B(),W(r(Le),{key:4,label:r(n)(`appUpdate.restarting`),icon:`ti ti-spin ti-loader-2`,disabled:``},null,8,[`label`])):G(``,!0)]),default:H(()=>[M(`p`,kn,U(r(n)(`appUpdate.dialogLead`,{current:e.currentVersion??`—`,latest:e.latestVersion??`—`})),1),s.value===`checking`?(B(),N(`div`,An,[b(r(Se),{style:{width:`1.5rem`,height:`1.5rem`},strokeWidth:`6`}),M(`span`,null,U(r(n)(`appUpdate.checking`)),1)])):c.value?(B(),N(`div`,jn,[M(`div`,Mn,[i[2]||=M(`i`,{class:`ti ti-circle-check update-dialog__ok`},null,-1),M(`span`,null,U(r(n)(`appUpdate.nodeFound`,{version:c.value.nodeVersion})),1)]),M(`div`,Nn,[M(`i`,{class:I(c.value.npmVersion?`ti ti-circle-check update-dialog__ok`:`ti ti-circle-x update-dialog__ko`)},null,2),c.value.npmVersion?(B(),N(`span`,Pn,U(r(n)(`appUpdate.npmFound`,{version:c.value.npmVersion,path:c.value.npmPath})),1)):(B(),N(`span`,Fn,U(r(n)(`appUpdate.npmMissing`)),1))]),c.value.globalPrefix?(B(),N(`div`,In,[i[3]||=M(`i`,{class:`ti ti-folder update-dialog__info`},null,-1),M(`span`,null,U(r(n)(`appUpdate.installTarget`,{prefix:c.value.globalPrefix})),1)])):G(``,!0)])):G(``,!0),s.value===`blocked`&&!c.value?.npmVersion?(B(),W(r(je),{key:2,severity:`warn`},{default:H(()=>[x(U(r(n)(`appUpdate.npmMissingHelp`)),1)]),_:1})):G(``,!0),d.value?(B(),W(r(je),{key:3,severity:`error`},{default:H(()=>[x(U(d.value),1)]),_:1})):G(``,!0),s.value===`installing`?(B(),N(`div`,Ln,[b(r(Se),{style:{width:`1.5rem`,height:`1.5rem`},strokeWidth:`6`}),M(`span`,null,U(r(n)(`appUpdate.installing`)),1)])):G(``,!0),s.value===`installed`?(B(),W(r(je),{key:5,severity:`success`},{default:H(()=>[x(U(r(n)(`appUpdate.installed`,{version:u.value??e.latestVersion??``})),1)]),_:1})):G(``,!0),s.value===`failed`?(B(),W(r(je),{key:6,severity:`error`},{default:H(()=>[x(U(r(n)(`appUpdate.installFailed`)),1)]),_:1})):G(``,!0),l.value?(B(),N(`pre`,Rn,U(l.value),1)):G(``,!0),s.value===`installed`?(B(),W(r(je),{key:8,severity:`info`},{default:H(()=>[x(U(r(n)(`appUpdate.restartNeeded`)),1)]),_:1})):G(``,!0)]),_:1},8,[`visible`,`header`,`closable`]))}}),[[`__scopeId`,`data-v-bcce910d`]]),Bn={key:0,class:`update-banner`},Vn=3e5,Hn=ze(z({__name:`AppUpdateBanner`,setup(e){let{t}=He(),{isDesktop:n}=ft(),{current:a,latest:o,outdated:s,check:c}=On(),l=i(!1),u=null;function d(){document.visibilityState===`visible`&&c()}return F(()=>{n.value&&(c(),u=setInterval(()=>void c(),Vn),document.addEventListener(`visibilitychange`,d))}),te(()=>{u!==null&&clearInterval(u),document.removeEventListener(`visibilitychange`,d)}),(e,i)=>(B(),N(V,null,[r(n)&&r(s)?(B(),N(`div`,Bn,[i[3]||=M(`i`,{class:`ti ti-circle-arrow-up update-banner__icon`},null,-1),M(`span`,null,U(r(t)(`appUpdate.bannerText`,{current:r(a),latest:r(o)})),1),b(r(Le),{label:r(t)(`appUpdate.bannerAction`),size:`small`,severity:`contrast`,onClick:i[0]||=e=>l.value=!0},null,8,[`label`])])):G(``,!0),b(zn,{visible:l.value,"onUpdate:visible":i[1]||=e=>l.value=e,"current-version":r(a),"latest-version":r(o),onUpdated:i[2]||=()=>r(c)({force:!0})},null,8,[`visible`,`current-version`,`latest-version`])],64))}}),[[`__scopeId`,`data-v-23af4c89`]]),Un=`runeya:changelog-seen:`;function Wn(e){return`${Un}${e}`}function Gn(e){try{return localStorage.getItem(Wn(e))}catch{return null}}function Kn(e,t){try{localStorage.setItem(Wn(e),t)}catch{}}async function qn(){let e=Gn(`app`);try{if(e===null){let{releases:e}=await yt.changelog.index.query({surface:`app`,since:null});return Kn(`app`,e[0]?.version??`0`),[]}let{releases:t}=await yt.changelog.releases.query({surface:`app`,since:e});return t}catch{return[]}}function Jn(e){let t=i([]),n=i(!1),r=i(!1);async function a(){n.value=!0,r.value=!1;try{let n=await yt.changelog.releases.query({surface:e,since:null});t.value=n.releases}catch{r.value=!0,t.value=[]}finally{n.value=!1}}return{releases:t,loading:n,failed:r,load:a}}var Yn={class:`changelog`},Xn={class:`release__head`},Zn={key:0,class:`release__version`},Qn={key:0,class:`release__title`},$n={class:`release__changes`},er=ze(z({__name:`ChangelogReleases`,props:{releases:{}},setup(e){let{t,locale:n}=He(),i={feature:`changelog.kindFeature`,improvement:`changelog.kindImprovement`,fix:`changelog.kindFix`,breaking:`changelog.kindBreaking`};function a(e){return e.version.startsWith(e.date)?null:e.version}function o(e){return n.value===`fr`?e.fr:e.en}return(n,s)=>(B(),N(`ol`,Yn,[(B(!0),N(V,null,P(e.releases,e=>(B(),N(`li`,{key:`${e.surface}-${e.version}`,class:`release`},[M(`header`,Xn,[a(e)?(B(),N(`span`,Zn,U(a(e)),1)):G(``,!0),M(`span`,{class:I([`release__date`,{"release__date--lead":!a(e)}])},U(e.date),3)]),e.title?(B(),N(`h4`,Qn,U(o(e.title)),1)):G(``,!0),M(`ul`,$n,[(B(!0),N(V,null,P(e.changes,(e,n)=>(B(),N(`li`,{key:n,class:`change`},[M(`span`,{class:I([`change__kind`,`change__kind--${e.kind}`])},U(r(t)(i[e.kind])),3),M(`span`,null,U(o(e.text)),1)]))),128))])]))),128))]))}}),[[`__scopeId`,`data-v-ad6af3bd`]]),tr={class:`lead`},nr=ze(z({__name:`AppChangelogDialog`,setup(e){let{t}=He(),n=i(!1),a=i([]);return F(async()=>{let e=await qn(),t=e[0];t&&(a.value=e,n.value=!0,Kn(`app`,t.version))}),(e,i)=>(B(),W(r(Ne),{visible:n.value,"onUpdate:visible":i[1]||=e=>n.value=e,modal:``,"dismissable-mask":``,header:r(t)(`changelog.title`),style:{width:`38rem`,maxWidth:`95vw`}},{footer:H(()=>[b(r(Le),{label:r(t)(`changelog.close`),onClick:i[0]||=e=>n.value=!1},null,8,[`label`])]),default:H(()=>[M(`p`,tr,U(r(t)(`changelog.dialogLead`)),1),b(er,{releases:a.value},null,8,[`releases`])]),_:1},8,[`visible`,`header`]))}}),[[`__scopeId`,`data-v-fd0c0bd5`]]);function rr(e){this.content=e}rr.prototype={constructor:rr,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new rr(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new rr(n)},addToStart:function(e,t){return new rr([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new rr(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new rr(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=rr.from(e),e.size?new rr(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=rr.from(e),e.size?new rr(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=rr.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},rr.from=function(e){if(e instanceof rr)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new rr(t)};function ir(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&sr(e.charCodeAt(r-1))&&or(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=ir(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function ar(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&sr(e.charCodeAt(i-1))&&or(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=ar(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function or(e){return e>=56320&&e<57344}function sr(e){return e>=55296&&e<56320}var K=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return ir(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return ar(this,e,t,n)}findIndex(e){if(e==0)return lr(0,e);if(e==this.size)return lr(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?lr(t+1,i):lr(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};K.empty=new K([],0);var cr={index:0,offset:0};function lr(e,t){return cr.index=e,cr.offset=t,cr}function ur(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!ur(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!ur(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var dr=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ur(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};dr.none=[];var fr=class extends Error{},q=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=mr(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(pr(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(K.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};q.empty=new q(K.empty,0,0);function pr(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(pr(a.content,t-i-1,n-i-1)))}function mr(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=mr(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function hr(e,t,n){if(n.openStart>e.depth)throw new fr(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new fr(`Inconsistent open depths`);return gr(e,t,n,0)}function gr(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=gr(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}if(!n.content.size)return xr(a,Cr(e,t,r));if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return xr(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}{let{start:i,end:o}=wr(n,e);return xr(a,Sr(e,i,o,t,r))}}function _r(e,t){if(!t.type.compatibleContent(e.type))throw new fr(`Cannot join `+t.type.name+` onto `+e.type.name)}function vr(e,t,n){let r=e.node(n);return _r(r,t.node(n)),r}function yr(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function br(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(yr(e.nodeAfter,r),a++));for(let e=a;e<o;e++)yr(i.child(e),r);t&&t.depth==n&&t.textOffset&&yr(t.nodeBefore,r)}function xr(e,t){if(!e.type.validContent(t))throw new fr(`Invalid content for node `+e.type.name);return e.copy(t)}function Sr(e,t,n,r,i){let a=e.depth>i&&vr(e,t,i+1),o=r.depth>i&&vr(n,r,i+1),s=[];return br(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(_r(a,o),yr(xr(a,Sr(e,t,n,r,i+1)),s)):(a&&yr(xr(a,Cr(e,t,i+1)),s),br(t,n,i,s),o&&yr(xr(o,Cr(n,r,i+1)),s)),br(r,null,i,s),new K(s)}function Cr(e,t,n){let r=[];return br(null,e,n,r),e.depth>n&&yr(xr(vr(e,t,n+1),Cr(e,t,n+1)),r),br(t,null,n,r),new K(r)}function wr(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(K.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Tr=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return dr.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new kr(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Or.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Or.set(t,r=new Er);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Dr,i}},Er=class{constructor(){this.elts=[],this.i=0}},Dr=12,Or=new WeakMap,kr=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},Ar=Object.create(null),jr=class e{constructor(e,t,n,r=dr.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||K.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&ur(this.attrs,t||e.defaultAttrs||Ar)&&dr.sameSet(this.marks,n||dr.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return q.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new q(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return hr(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Tr.resolveCached(this,e)}resolveNoCache(e){return Tr.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),Nr(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=K.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=dr.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!dr.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=K.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};jr.prototype.text=void 0;var Mr=class e extends jr{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Nr(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Nr(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Pr=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Fr(t,n);if(r.next==null)return e.empty;let i=Ir(r);r.next&&r.err(`Unexpected trailing text`);let a=Kr(Ur(i));return qr(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return K.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UnlockPage-s8SgVcKk.js","assets/reactivity.esm-bundler-BQ9SB2vv.js","assets/runtime-core.esm-bundler-DujKY9QV.js","assets/floating-ui.dom-DWhsZyqT.js","assets/src--GO-VSJ0.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/src-CcvmgMAA.css","assets/useApi-s_02lHjl-DZYO2tHU.js","assets/trpc-Drabzwpd.js","assets/preload-helper-BZ1Pz5am.js","assets/auth-Cg9BWTfK.js","assets/VersionBadge-BmArk24p.js","assets/VersionBadge-CtFji3sv.css","assets/UnlockPage-Ce0qsHfn.css","assets/VaultMigrationPage-s0b44MDM.js","assets/error-DpF7X5iu.js","assets/VaultMigrationPage-DMiPJOSR.css","assets/LaunchProjectPage-saSmC7Pr.js","assets/project-launch.store-y7JBMNiE.js","assets/project.store-DGJr0Qr9.js","assets/useProjectCatalog-yocjIKt6.js","assets/cloud-auth-D_am4FlK.js","assets/cloud-session-DOaDpZTy.js","assets/cloud-client-D_zCiW0s.js","assets/OrgKeyPrompt-DzQ7pwbs.js","assets/OrgKeyPrompt-FmlWgsj4.css","assets/DirectoryPickerDialog-C06BXyfJ.js","assets/DirectoryPickerDialog-3lnhU2DU.css","assets/ProjectCreateDialog-BolrhRD-.js","assets/ProjectCreateDialog-BfY7qA0G.css","assets/LaunchShell-DUrSunB4.js","assets/LaunchShell-y_3rrtGa.css","assets/LaunchProjectPage-CyKA9pY5.css","assets/LaunchServicesPage-BkKyLMEz.js","assets/app-mode-BVpTuh0i.js","assets/service.store-5jWsJxPx.js","assets/agent.store-CKLAkF9a.js","assets/dist-N4nrnbnA.js","assets/schemas-68I2iCLF.js","assets/process-BWkHpZOM.js","assets/ProjectLocationGate-DhMVdIjN.js","assets/LaunchServicesPage-DoLDPqQq.css","assets/AppLayout-BMQUjPKe.js","assets/i18n-D0afQEGs.js","assets/vue-router-fin80h5W.js","assets/composables-DiiOYol8.js","assets/use-polling-CEkhIY_9.js","assets/editor.store-DCAZSeVG.js","assets/useAiChatDrawer-D_ofn8Eo.js","assets/cloud-chat.store-b-BHGz7I.js","assets/shared-sse-Dcj_cNvF.js","assets/src-C-D_y7ou.js","assets/src-16-vEwhK.css","assets/page-actions-CSvO7j9F.js","assets/EditorIcon-CypGLV6w.js","assets/EditorIcon-84kLQJ1r.css","assets/useServiceUrlHost-BuoPEXZX.js","assets/ServiceControlsBar-DqDPAZt7.js","assets/ProcessControls-BEeoNlNV.js","assets/ProcessControls-BlpnVylq.css","assets/ServiceControlsBar-CRwt-Xry.css","assets/ProjectPublishDialog-DsZNWrfz.js","assets/ProjectPublishDialog-Cd-9yn6d.css","assets/AppLayout-tsw5Ow0w.css","assets/DashboardPage-9RV7sx3e.js","assets/DashboardPage-FvNuC_e4.css","assets/CloudAccountPage-B6oPg0BZ.js","assets/CloudAccountPage-Ctf2gtpm.css","assets/CloudMessagingPage-C5fwVe-F.js","assets/scenario.store-YWHL2_wu.js","assets/settings-scope-Bv7QGPrt.js","assets/scenario-DOeZsRCE.css","assets/AiChatModals-D3scRE3S.js","assets/editor.api-Bef3xeth.js","assets/editor-8AbsNvUX.css","assets/toggleHighContrast-Dqz1Qao1.js","assets/toggleHighContrast--ixms01u.css","assets/register-BLGIM2pN.js","assets/AiChatModals-EfRuvId7.css","assets/useCloudOrg-BAQEtFPl.js","assets/useProjectCloudOrg-CEN9-_OA.js","assets/CloudMessagingPage-Cn3JhJsY.css","assets/KanbanListPage-CWZqkjD6.js","assets/src-Dnwk6NpV.js","assets/src-g1DRo8xZ.css","assets/KanbanListPage-BigioApQ.css","assets/KanbanBoardPage-CQsOkRUf.js","assets/SendToChatDialog-BxWsyv29.js","assets/KanbanBoardPage-eHmsrFGA.css","assets/AgentTerminalPage-C3TJ1NL9.js","assets/uuid-XipkJWQw.js","assets/AgentTerminalPage-DbPtGy0f.css","assets/AuditPage-CKcExBws.js","assets/AuditPage-DRnnuzwq.css","assets/SettingsPage-DS2YhMIM.js","assets/FlagChip-R_T5qYpL.js","assets/FlagChip-hKL2frzh.css","assets/LogViewer-CZBYkH9J.js","assets/LogViewer-OHdSLleq.css","assets/settings.store-bEsB7oKb.js","assets/add-scalar-classes-dWEWPlFD.js","assets/interface-content-folder.svg-CnsmgXBU.js","assets/browser-BpWB_ayN.js","assets/SettingsPage-4pKUgKPm.css","assets/ScenarioEditorPage-MIAGh2us.js","assets/ScenarioEditorPage-vMoRt0Qn.css","assets/ServiceFormPage-DXqhqXg8.js","assets/ServiceFormPage-CQ6xL0Rr.css","assets/ServiceDetailPage-hkSAzZ-l.js","assets/vue-draggable-plus-DX4rTBiu.js","assets/vue-draggable-plus-BHsveB8w.css","assets/useEnvVarAutocomplete-BqGTODUv.js","assets/useEnvVarAutocomplete-Czt8ZZ1E.css","assets/ProcessMetrics-Crlfkelj.js","assets/ProcessMetrics-kCY31aHV.css","assets/WikiView-DtGwIt_Q.js","assets/WikiView-CGsHxjvn.css","assets/ServiceDetailPage-COdaCZ6r.css","assets/EnvironmentListPage-B8uATPBI.js","assets/EnvironmentForm-CAvDoira.js","assets/EnvironmentForm-CkKVSiT7.css","assets/EnvironmentListPage-BKhq_xXN.css","assets/EnvironmentFormPage-BmAxhN-m.js","assets/EnvironmentFormPage-C1gS0BI_.css","assets/ProcessDetailPage-CQgu5uKm.js","assets/ProcessDetailPage-CJcIxbLm.css","assets/WikiPage-DADu8WUA.js","assets/RandomJobTestPage-BUS2Ty6-.js","assets/RandomJobTestPage-ES23jzac.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,n as t,t as n}from"./rolldown-runtime-Dd_uD5pT.js";import{B as r,C as i,F as a,N as o,O as s,P as c,S as l,_ as u,c as d,g as f,l as p,m,o as h,x as g}from"./reactivity.esm-bundler-BQ9SB2vv.js";import{$ as _,B as v,Ct as y,D as b,E as x,Ft as S,Ht as C,J as w,L as T,Lt as E,Nt as D,S as ee,St as O,Ut as k,Y as A,Yt as j,_ as M,b as N,bt as P,ct as F,en as I,et as L,ft as te,g as R,gt as ne,it as re,k as z,mt as B,nn as ie,o as V,pt as ae,qt as H,rn as U,rt as oe,st as se,tn as ce,tt as le,u as ue,v as W,wt as de,xt as fe,y as G,z as pe}from"./runtime-core.esm-bundler-DujKY9QV.js";import{F as me,I as he,P as ge,g as _e,p as ve}from"./floating-ui.dom-DWhsZyqT.js";import{$ as ye,A as be,C as xe,H as Se,J as Ce,L as we,M as Te,N as Ee,P as De,Q as Oe,S as ke,U as Ae,W as je,X as Me,Y as Ne,at as Pe,ct as Fe,d as Ie,dt as Le,et as Re,ft as ze,it as Be,lt as Ve,mt as He,nt as Ue,o as We,ot as Ge,q as Ke,rt as qe,st as Je,t as Ye,tt as Xe,u as Ze,ut as Qe}from"./src--GO-VSJ0.js";import{a as $e,i as et,n as tt,r as nt}from"./project-launch.store-y7JBMNiE.js";import{r as rt}from"./i18n-D0afQEGs.js";import{g as it}from"./useApi-s_02lHjl-DZYO2tHU.js";import{i as at,n as ot,r as st}from"./vue-router-fin80h5W.js";import{a as ct,n as lt,r as ut,t as dt}from"./scenario.store-YWHL2_wu.js";import{a as ft,i as pt,n as mt,r as ht,t as gt}from"./app-mode-BVpTuh0i.js";import{n as _t,o as vt,r as yt,t as bt}from"./trpc-Drabzwpd.js";import{t as xt}from"./preload-helper-BZ1Pz5am.js";import{c as St,i as Ct,n as wt,r as Tt,s as Et}from"./auth-Cg9BWTfK.js";import{n as Dt,r as Ot}from"./project.store-DGJr0Qr9.js";import{a as kt}from"./cloud-auth-D_am4FlK.js";import{i as At,n as jt,r as Mt,t as Nt}from"./useProjectCatalog-yocjIKt6.js";import{n as Pt,r as Ft}from"./error-DpF7X5iu.js";import{n as It,r as Lt}from"./cloud-client-D_zCiW0s.js";import{t as Rt}from"./use-polling-CEkhIY_9.js";import{r as zt,t as Bt}from"./AiChatModals-D3scRE3S.js";import{n as Vt,t as Ht}from"./vue-draggable-plus-DX4rTBiu.js";import{t as Ut}from"./useAiChatDrawer-D_ofn8Eo.js";import{t as Wt}from"./settings-scope-Bv7QGPrt.js";import{g as Gt,n as Kt}from"./schemas-68I2iCLF.js";import{a as qt,n as Jt,r as Yt}from"./dist-N4nrnbnA.js";import{t as Xt}from"./service.store-5jWsJxPx.js";import{t as Zt}from"./agent.store-CKLAkF9a.js";import{n as Qt}from"./process-BWkHpZOM.js";import{a as $t,c as en,d as tn,f as nn,i as rn,l as an,n as on,o as sn,p as cn,r as ln,s as un,t as dn,u as fn}from"./theme-BZCAxfJD.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var pn=n((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){for(var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),mn=n((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),hn=n((e=>{var t=pn(),n=mn(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(G(e,ArrayBuffer)||e&&G(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(G(e,SharedArrayBuffer)||e&&G(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(G(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||pe(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(G(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),G(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(G(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||G(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return le(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return de(e).length;default:if(i)return r?-1:le(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return P(this,t,n);case`utf8`:case`utf-8`:return k(this,t,n);case`ascii`:return M(this,t,n);case`latin1`:case`binary`:return N(this,t,n);case`base64`:return O(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return F(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?k(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(G(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,pe(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(i)n=0;else return-1}if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:C(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):C(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function C(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function w(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o=0;for(;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(pe(r))return o;e[n+o]=r}return o}function T(e,t,n,r){return fe(le(t,e.length-n),e,n,r)}function E(e,t,n,r){return fe(ue(t),e,n,r)}function D(e,t,n,r){return fe(de(t),e,n,r)}function ee(e,t,n,r){return fe(W(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return w(this,e,t,n);case`utf8`:case`utf-8`:return T(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return E(this,e,t,n);case`base64`:return D(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ee(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function O(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function k(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return j(r)}var A=4096;function j(e){let t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=A));return n}function M(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function N(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function P(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=me[e[r]];return i}function F(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function I(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=he(function(e){e>>>=0,U(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=t+this[++e]*256+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*256+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=he(function(e){e>>>=0,U(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*256+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*256+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||I(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||I(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=he(function(e){e>>>=0,U(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=this[e+4]+this[e+5]*256+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*256+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=he(function(e){e>>>=0,U(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*256+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*256+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!1,52,8)};function L(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;L(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;L(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function te(e,t,n,r,i){H(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function R(e,t,n,r,i){H(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=he(function(e,t=0){return te(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=he(function(e,t=0){return R(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);L(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);L(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=he(function(e,t=0){return te(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=he(function(e,t=0){return R(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ne(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function re(e,t,r,i,a){return t=+t,r>>>=0,a||ne(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return re(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return re(this,e,t,!1,n)};function z(e,t,r,i,a){return t=+t,r>>>=0,a||ne(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return z(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return z(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var B={};function ie(e,t,n){B[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}ie(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),ie(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),ie(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=V(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function V(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function ae(e,t,n){U(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&oe(t,e.length-(n+1))}function H(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new B.ERR_OUT_OF_RANGE(`value`,i,e)}ae(r,i,a)}function U(e,t){if(typeof e!=`number`)throw new B.ERR_INVALID_ARG_TYPE(t,`number`,e)}function oe(e,t,n){throw Math.floor(e)===e?t<0?new B.ERR_BUFFER_OUT_OF_BOUNDS:new B.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(U(e,n),new B.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var se=/[^+/0-9A-Za-z-_]/g;function ce(e){if(e=e.split(`=`)[0],e=e.trim().replace(se,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function le(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function ue(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function W(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function de(e){return t.toByteArray(ce(e))}function fe(e,t,n,r){let i=0;for(;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function G(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function pe(e){return e!==e}var me=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function he(e){return typeof BigInt>`u`?ge:e}function ge(){throw Error(`BigInt not supported`)}}))(),gn=z({__name:`PopoverTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,n=qe(),{forwardRef:i,currentElement:a}=Qe();return n.triggerId||=Ve(void 0,`reka-popover-trigger`),n.contentId||=Ve(void 0,`reka-popover-content`),F(()=>{n.triggerElement.value=a.value}),(e,a)=>(B(),W(de(r(n).hasCustomAnchor.value?r(Fe):r(Je)),{"as-child":``},{default:H(()=>[b(r(Fe),{id:r(n).triggerId,ref:r(i),type:e.as===`button`?`button`:void 0,"aria-haspopup":`dialog`,"aria-expanded":r(n).open.value,"aria-controls":r(n).open.value?r(n).contentId:void 0,"data-state":r(n).open.value?`open`:`closed`,as:e.as,"as-child":t.asChild,onClick:r(n).onOpenToggle},{default:H(()=>[fe(e.$slots,`default`)]),_:3},8,[`id`,`type`,`aria-expanded`,`aria-controls`,`data-state`,`as`,`as-child`,`onClick`])]),_:3}))}}),_n={key:0,class:`error-boundary`},vn={class:`error-content`},yn={class:`error-message`},bn=ze(z({__name:`ErrorBoundary`,setup(e){let{t}=He(),n=i(null);se(e=>(n.value=e instanceof Error?e:Error(String(e)),console.error(`[ErrorBoundary]`,e),!1));function a(){n.value=null}return(e,i)=>n.value?(B(),N(`div`,_n,[M(`div`,vn,[i[0]||=M(`i`,{class:`ti ti-alert-triangle error-icon`},null,-1),M(`h3`,null,U(r(t)(`errorBoundary.title`)),1),M(`p`,yn,U(n.value.message),1),b(r(Le),{label:r(t)(`errorBoundary.tryAgain`),icon:`ti ti-refresh`,onClick:a},null,8,[`label`])])])):fe(e.$slots,`default`,{key:1},void 0,!0)}}),[[`__scopeId`,`data-v-1e77a5b4`]]),xn=i(null),Sn=i(null),Cn=i(`unknown`),wn=i(!0),Tn=null;async function En(e){wn.value=!0;try{let t=await yt.health.versionInfo.query(e?{force:!0}:void 0);xn.value=t.current,Sn.value=t.latest,Cn.value=t.status}catch{Cn.value=`unknown`}finally{wn.value=!1}}async function Dn(e={}){e.force?Tn=En(!0):Tn??=En(!1);let t=Tn;try{await t}finally{Tn===t&&(Tn=null)}}function On(){return{current:xn,latest:Sn,status:Cn,loading:wn,outdated:R(()=>Cn.value===`outdated`),check:Dn}}var kn={class:`update-dialog__lead`},An={key:0,class:`update-dialog__row`},jn={key:1,class:`update-dialog__prereqs`},Mn={class:`update-dialog__prereq`},Nn={class:`update-dialog__prereq`},Pn={key:0},Fn={key:1},In={key:0,class:`update-dialog__prereq`},Ln={key:4,class:`update-dialog__row`},Rn={key:7,class:`update-dialog__output`},zn=ze(z({__name:`AppUpdateDialog`,props:{visible:{type:Boolean},currentVersion:{},latestVersion:{}},emits:[`update:visible`,`updated`],setup(e,{emit:t}){let{t:n}=He(),a=e,o=t,s=i(`checking`),c=i(null),l=i(``),u=i(null),d=i(``);async function f(){s.value=`checking`,l.value=``,d.value=``;try{let e=await yt.appUpdate.prerequisites.query();c.value=e,s.value=e.ready?`ready`:`blocked`}catch(e){d.value=e.message,s.value=`blocked`}}async function p(){s.value=`installing`;try{let e=await yt.appUpdate.install.mutate();l.value=e.output,u.value=e.installedVersion,s.value=e.ok?`installed`:`failed`,e.ok&&o(`updated`)}catch(e){d.value=e.message,s.value=`failed`}}async function m(){s.value=`restarting`;try{await yt.appUpdate.restart.mutate()}catch{}}return C(()=>a.visible,e=>{e&&f()}),(t,i)=>(B(),W(r(Ne),{visible:e.visible,header:r(n)(`appUpdate.dialogTitle`),modal:``,closable:s.value!==`installing`&&s.value!==`restarting`,style:{width:`34rem`},"onUpdate:visible":i[1]||=e=>o(`update:visible`,e)},{footer:H(()=>[s.value===`blocked`||s.value===`failed`?(B(),W(r(Le),{key:0,label:r(n)(`appUpdate.retry`),severity:`secondary`,onClick:f},null,8,[`label`])):G(``,!0),s.value===`ready`?(B(),W(r(Le),{key:1,label:r(n)(`appUpdate.install`),icon:`ti ti-download`,onClick:p},null,8,[`label`])):G(``,!0),s.value===`installed`?(B(),W(r(Le),{key:2,label:r(n)(`appUpdate.restartLater`),severity:`secondary`,onClick:i[0]||=e=>o(`update:visible`,!1)},null,8,[`label`])):G(``,!0),s.value===`installed`?(B(),W(r(Le),{key:3,label:r(n)(`appUpdate.restartNow`),icon:`ti ti-refresh`,onClick:m},null,8,[`label`])):G(``,!0),s.value===`restarting`?(B(),W(r(Le),{key:4,label:r(n)(`appUpdate.restarting`),icon:`ti ti-spin ti-loader-2`,disabled:``},null,8,[`label`])):G(``,!0)]),default:H(()=>[M(`p`,kn,U(r(n)(`appUpdate.dialogLead`,{current:e.currentVersion??`—`,latest:e.latestVersion??`—`})),1),s.value===`checking`?(B(),N(`div`,An,[b(r(Se),{style:{width:`1.5rem`,height:`1.5rem`},strokeWidth:`6`}),M(`span`,null,U(r(n)(`appUpdate.checking`)),1)])):c.value?(B(),N(`div`,jn,[M(`div`,Mn,[i[2]||=M(`i`,{class:`ti ti-circle-check update-dialog__ok`},null,-1),M(`span`,null,U(r(n)(`appUpdate.nodeFound`,{version:c.value.nodeVersion})),1)]),M(`div`,Nn,[M(`i`,{class:I(c.value.npmVersion?`ti ti-circle-check update-dialog__ok`:`ti ti-circle-x update-dialog__ko`)},null,2),c.value.npmVersion?(B(),N(`span`,Pn,U(r(n)(`appUpdate.npmFound`,{version:c.value.npmVersion,path:c.value.npmPath})),1)):(B(),N(`span`,Fn,U(r(n)(`appUpdate.npmMissing`)),1))]),c.value.globalPrefix?(B(),N(`div`,In,[i[3]||=M(`i`,{class:`ti ti-folder update-dialog__info`},null,-1),M(`span`,null,U(r(n)(`appUpdate.installTarget`,{prefix:c.value.globalPrefix})),1)])):G(``,!0)])):G(``,!0),s.value===`blocked`&&!c.value?.npmVersion?(B(),W(r(je),{key:2,severity:`warn`},{default:H(()=>[x(U(r(n)(`appUpdate.npmMissingHelp`)),1)]),_:1})):G(``,!0),d.value?(B(),W(r(je),{key:3,severity:`error`},{default:H(()=>[x(U(d.value),1)]),_:1})):G(``,!0),s.value===`installing`?(B(),N(`div`,Ln,[b(r(Se),{style:{width:`1.5rem`,height:`1.5rem`},strokeWidth:`6`}),M(`span`,null,U(r(n)(`appUpdate.installing`)),1)])):G(``,!0),s.value===`installed`?(B(),W(r(je),{key:5,severity:`success`},{default:H(()=>[x(U(r(n)(`appUpdate.installed`,{version:u.value??e.latestVersion??``})),1)]),_:1})):G(``,!0),s.value===`failed`?(B(),W(r(je),{key:6,severity:`error`},{default:H(()=>[x(U(r(n)(`appUpdate.installFailed`)),1)]),_:1})):G(``,!0),l.value?(B(),N(`pre`,Rn,U(l.value),1)):G(``,!0),s.value===`installed`?(B(),W(r(je),{key:8,severity:`info`},{default:H(()=>[x(U(r(n)(`appUpdate.restartNeeded`)),1)]),_:1})):G(``,!0)]),_:1},8,[`visible`,`header`,`closable`]))}}),[[`__scopeId`,`data-v-bcce910d`]]),Bn={key:0,class:`update-banner`},Vn=3e5,Hn=ze(z({__name:`AppUpdateBanner`,setup(e){let{t}=He(),{isDesktop:n}=ft(),{current:a,latest:o,outdated:s,check:c}=On(),l=i(!1),u=null;function d(){document.visibilityState===`visible`&&c()}return F(()=>{n.value&&(c(),u=setInterval(()=>void c(),Vn),document.addEventListener(`visibilitychange`,d))}),te(()=>{u!==null&&clearInterval(u),document.removeEventListener(`visibilitychange`,d)}),(e,i)=>(B(),N(V,null,[r(n)&&r(s)?(B(),N(`div`,Bn,[i[3]||=M(`i`,{class:`ti ti-circle-arrow-up update-banner__icon`},null,-1),M(`span`,null,U(r(t)(`appUpdate.bannerText`,{current:r(a),latest:r(o)})),1),b(r(Le),{label:r(t)(`appUpdate.bannerAction`),size:`small`,severity:`contrast`,onClick:i[0]||=e=>l.value=!0},null,8,[`label`])])):G(``,!0),b(zn,{visible:l.value,"onUpdate:visible":i[1]||=e=>l.value=e,"current-version":r(a),"latest-version":r(o),onUpdated:i[2]||=()=>r(c)({force:!0})},null,8,[`visible`,`current-version`,`latest-version`])],64))}}),[[`__scopeId`,`data-v-23af4c89`]]),Un=`runeya:changelog-seen:`;function Wn(e){return`${Un}${e}`}function Gn(e){try{return localStorage.getItem(Wn(e))}catch{return null}}function Kn(e,t){try{localStorage.setItem(Wn(e),t)}catch{}}async function qn(){let e=Gn(`app`);try{if(e===null){let{releases:e}=await yt.changelog.index.query({surface:`app`,since:null});return Kn(`app`,e[0]?.version??`0`),[]}let{releases:t}=await yt.changelog.releases.query({surface:`app`,since:e});return t}catch{return[]}}function Jn(e){let t=i([]),n=i(!1),r=i(!1);async function a(){n.value=!0,r.value=!1;try{let n=await yt.changelog.releases.query({surface:e,since:null});t.value=n.releases}catch{r.value=!0,t.value=[]}finally{n.value=!1}}return{releases:t,loading:n,failed:r,load:a}}var Yn={class:`changelog`},Xn={class:`release__head`},Zn={key:0,class:`release__version`},Qn={key:0,class:`release__title`},$n={class:`release__changes`},er=ze(z({__name:`ChangelogReleases`,props:{releases:{}},setup(e){let{t,locale:n}=He(),i={feature:`changelog.kindFeature`,improvement:`changelog.kindImprovement`,fix:`changelog.kindFix`,breaking:`changelog.kindBreaking`};function a(e){return e.version.startsWith(e.date)?null:e.version}function o(e){return n.value===`fr`?e.fr:e.en}return(n,s)=>(B(),N(`ol`,Yn,[(B(!0),N(V,null,P(e.releases,e=>(B(),N(`li`,{key:`${e.surface}-${e.version}`,class:`release`},[M(`header`,Xn,[a(e)?(B(),N(`span`,Zn,U(a(e)),1)):G(``,!0),M(`span`,{class:I([`release__date`,{"release__date--lead":!a(e)}])},U(e.date),3)]),e.title?(B(),N(`h4`,Qn,U(o(e.title)),1)):G(``,!0),M(`ul`,$n,[(B(!0),N(V,null,P(e.changes,(e,n)=>(B(),N(`li`,{key:n,class:`change`},[M(`span`,{class:I([`change__kind`,`change__kind--${e.kind}`])},U(r(t)(i[e.kind])),3),M(`span`,null,U(o(e.text)),1)]))),128))])]))),128))]))}}),[[`__scopeId`,`data-v-ad6af3bd`]]),tr={class:`lead`},nr=ze(z({__name:`AppChangelogDialog`,setup(e){let{t}=He(),n=i(!1),a=i([]);return F(async()=>{let e=await qn(),t=e[0];t&&(a.value=e,n.value=!0,Kn(`app`,t.version))}),(e,i)=>(B(),W(r(Ne),{visible:n.value,"onUpdate:visible":i[1]||=e=>n.value=e,modal:``,"dismissable-mask":``,header:r(t)(`changelog.title`),style:{width:`38rem`,maxWidth:`95vw`}},{footer:H(()=>[b(r(Le),{label:r(t)(`changelog.close`),onClick:i[0]||=e=>n.value=!1},null,8,[`label`])]),default:H(()=>[M(`p`,tr,U(r(t)(`changelog.dialogLead`)),1),b(er,{releases:a.value},null,8,[`releases`])]),_:1},8,[`visible`,`header`]))}}),[[`__scopeId`,`data-v-fd0c0bd5`]]);function rr(e){this.content=e}rr.prototype={constructor:rr,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new rr(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new rr(n)},addToStart:function(e,t){return new rr([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new rr(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new rr(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=rr.from(e),e.size?new rr(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=rr.from(e),e.size?new rr(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=rr.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},rr.from=function(e){if(e instanceof rr)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new rr(t)};function ir(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&sr(e.charCodeAt(r-1))&&or(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=ir(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function ar(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&sr(e.charCodeAt(i-1))&&or(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=ar(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function or(e){return e>=56320&&e<57344}function sr(e){return e>=55296&&e<56320}var K=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return ir(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return ar(this,e,t,n)}findIndex(e){if(e==0)return lr(0,e);if(e==this.size)return lr(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?lr(t+1,i):lr(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};K.empty=new K([],0);var cr={index:0,offset:0};function lr(e,t){return cr.index=e,cr.offset=t,cr}function ur(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!ur(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!ur(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var dr=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ur(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};dr.none=[];var fr=class extends Error{},q=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=mr(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(pr(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(K.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};q.empty=new q(K.empty,0,0);function pr(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(pr(a.content,t-i-1,n-i-1)))}function mr(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=mr(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function hr(e,t,n){if(n.openStart>e.depth)throw new fr(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new fr(`Inconsistent open depths`);return gr(e,t,n,0)}function gr(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=gr(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}if(!n.content.size)return xr(a,Cr(e,t,r));if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return xr(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}{let{start:i,end:o}=wr(n,e);return xr(a,Sr(e,i,o,t,r))}}function _r(e,t){if(!t.type.compatibleContent(e.type))throw new fr(`Cannot join `+t.type.name+` onto `+e.type.name)}function vr(e,t,n){let r=e.node(n);return _r(r,t.node(n)),r}function yr(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function br(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(yr(e.nodeAfter,r),a++));for(let e=a;e<o;e++)yr(i.child(e),r);t&&t.depth==n&&t.textOffset&&yr(t.nodeBefore,r)}function xr(e,t){if(!e.type.validContent(t))throw new fr(`Invalid content for node `+e.type.name);return e.copy(t)}function Sr(e,t,n,r,i){let a=e.depth>i&&vr(e,t,i+1),o=r.depth>i&&vr(n,r,i+1),s=[];return br(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(_r(a,o),yr(xr(a,Sr(e,t,n,r,i+1)),s)):(a&&yr(xr(a,Cr(e,t,i+1)),s),br(t,n,i,s),o&&yr(xr(o,Cr(n,r,i+1)),s)),br(r,null,i,s),new K(s)}function Cr(e,t,n){let r=[];return br(null,e,n,r),e.depth>n&&yr(xr(vr(e,t,n+1),Cr(e,t,n+1)),r),br(t,null,n,r),new K(r)}function wr(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(K.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Tr=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return dr.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new kr(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Or.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Or.set(t,r=new Er);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Dr,i}},Er=class{constructor(){this.elts=[],this.i=0}},Dr=12,Or=new WeakMap,kr=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},Ar=Object.create(null),jr=class e{constructor(e,t,n,r=dr.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||K.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&ur(this.attrs,t||e.defaultAttrs||Ar)&&dr.sameSet(this.marks,n||dr.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return q.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new q(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return hr(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Tr.resolveCached(this,e)}resolveNoCache(e){return Tr.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),Nr(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=K.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=dr.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!dr.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=K.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};jr.prototype.text=void 0;var Mr=class e extends jr{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Nr(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Nr(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Pr=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Fr(t,n);if(r.next==null)return e.empty;let i=Ir(r);r.next&&r.err(`Unexpected trailing text`);let a=Kr(Ur(i));return qr(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return K.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
3
3
|
`)}};Pr.empty=new Pr(!0);var Fr=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function Ir(e){let t=[];do t.push(Lr(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Lr(e){let t=[];do t.push(Rr(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Rr(e){let t=Hr(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Br(e,t);else break;return t}function zr(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Br(e,t){let n=zr(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:zr(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Vr(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function Hr(e){if(e.eat(`(`)){let t=Ir(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Vr(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Ur(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function Wr(e,t){return t-e}function Gr(e,t){let n=[];return r(t),n.sort(Wr);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function Kr(e){let t=Object.create(null);return n(Gr(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Gr(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Pr(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Wr);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function qr(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Jr(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function Yr(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function Xr(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function Zr(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new ei(e,r,t[r]);return n}var Qr=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=Zr(e,n.attrs),this.defaultAttrs=Jr(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Pr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Yr(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new jr(this,this.computeAttrs(e),K.from(t),dr.setFrom(n))}createChecked(e=null,t,n){return t=K.from(t),this.checkContent(t),new jr(this,this.computeAttrs(e),t,dr.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=K.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(K.empty,!0);return i?new jr(this,e,t.append(i),dr.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Xr(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:dr.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function $r(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var ei=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?$r(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},ti=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Zr(e,r.attrs),this.excluded=null;let i=Jr(this.attrs);this.instance=i?new dr(this,i):null}create(e=null){return!e&&this.instance?this.instance:new dr(this,Yr(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Xr(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},ni=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=rr.from(e.nodes),t.marks=rr.from(e.marks||{}),this.nodes=Qr.compile(this.spec.nodes,this),this.marks=ti.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=Pr.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?ri(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:ri(this,n.split(` `))}this.nodeFromJSON=e=>jr.fromJSON(this,e),this.markFromJSON=e=>dr.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Qr))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new Mr(n,n.defaultAttrs,e,dr.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function ri(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function ii(e){return e.tag!=null}function ai(e){return e.style!=null}var oi=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(ii(e))this.tags.push(e);else if(ai(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new hi(this,t,!1);return n.addAll(e,dr.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new hi(this,t,!0);return n.addAll(e,dr.none,t.from,t.to),q.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(_i(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=vi(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=vi(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},si={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ci={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},li={ol:!0,ul:!0},ui=1,di=2,fi=4;function pi(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?ui:0)|(t===`full`?di:0)}var mi=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=dr.none,this.match=i||(a&fi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(K.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ui)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=K.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(K.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!si.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},hi=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=pi(null,t.preserveWhitespace,0)|(n?fi:0);i=r?new mi(r.type,r.attrs,dr.none,!0,t.topMatch||r.type.contentMatch,a):n?new mi(null,null,dr.none,!0,null,a):new mi(e.schema.topNodeType,null,dr.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&di?`full`:this.localPreserveWS||(r.options&ui)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
|
|
4
4
|
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;li.hasOwnProperty(a)&&this.parser.normalizeLists&&gi(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:ci.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(si.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
5
5
|
`),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node){if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=dr.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):yi(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=pi(e,i,a.options);a.options&fi&&a.content.length==0&&(o|=fi);let s=dr.none;return n=n.filter(t=>!(a.type?a.type.allowsMarkType(t.type):yi(t.type,e))||(s=t.addToSet(s),!1)),this.nodes.push(new mi(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=ui);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function gi(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&li.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function _i(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function vi(e){let t={};for(let n in e)t[n]=e[n];return t}function yi(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var bi=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=Si(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return Si(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Ei(Si(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Ei(Si(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:Ei(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=xi(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return xi(e.marks)}};function xi(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Si(e){return e.document||window.document}var Ci=new WeakMap;function wi(e){let t=Ci.get(e);return t===void 0&&Ci.set(e,t=Ti(e)),t}function Ti(e){let t=null;function n(e){if(e&&typeof e==`object`){if(Array.isArray(e)){if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t])}else for(let t in e)n(e[t])}}return n(e),t}function Ei(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=wi(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=Ei(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Di=65535,Oi=2**16;function ki(e,t){return e+t*Oi}function Ai(e){return e&Di}function ji(e){return(e-(e&Di))/Oi}var Mi=1,Ni=2,Pi=4,Fi=8,Ii=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Fi)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&Pi)>0}},Li=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=Ai(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+ji(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:ki(o/3,e-s),f=e==s?Ni:e==u?Mi:Pi;return(t<0?e!=s:e!=u)&&(f|=Fi),new Ii(a,f,d)}r+=l-c}return n?e+r:new Ii(e+r,0,null)}touches(e,t){let n=0,r=Ai(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};Li.empty=new Li([]);var Ri=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new Ii(e,r,null)}},zi=Object.create(null),Bi=class{getMap(){return Li.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=zi[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in zi)throw RangeError(`Duplicate use of step JSON ID `+e);return zi[e]=t,t.prototype.jsonID=e,t}},Vi=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof fr)return e.fail(t.message);throw t}}};function Hi(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(Hi(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return K.fromArray(r)}var Ui=class e extends Bi{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new q(Hi(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return Vi.fromReplace(e,this.from,this.to,i)}invert(){return new Wi(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};Bi.jsonID(`addMark`,Ui);var Wi=class e extends Bi{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new q(Hi(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return Vi.fromReplace(e,this.from,this.to,n)}invert(){return new Ui(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};Bi.jsonID(`removeMark`,Wi);var Gi=class e extends Bi{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Vi.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Vi.fromReplace(e,this.pos,this.pos+1,new q(K.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new Ki(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};Bi.jsonID(`addNodeMark`,Gi);var Ki=class e extends Bi{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Vi.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Vi.fromReplace(e,this.pos,this.pos+1,new q(K.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Gi(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};Bi.jsonID(`removeNodeMark`,Ki);var qi=class e extends Bi{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Yi(e,this.from,this.to)?Vi.fail(`Structure replace would overwrite content`):Vi.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Li([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?q.empty:new q(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?q.empty:new q(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,q.fromJSON(t,n.slice),!!n.structure)}};qi.MAP_BIAS=1,Bi.jsonID(`replace`,qi);var Ji=class e extends Bi{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(Yi(e,this.from,this.gapFrom)||Yi(e,this.gapTo,this.to)))return Vi.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Vi.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?Vi.fromReplace(e,this.from,this.to,n):Vi.fail(`Content does not fit in gap`)}getMap(){return new Li([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,q.fromJSON(t,n.slice),n.insert,!!n.structure)}};Bi.jsonID(`replaceAround`,Ji);function Yi(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function Xi(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new Wi(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new Ui(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function Zi(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof ti){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new Wi(t.from,t.to,t.style)))}function Qi(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new qi(s,l,q.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new Wi(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new q(K.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new qi(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(K.empty,!0);e.replace(s,s,new q(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function $i(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function ea(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!$i(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function ta(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=K.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=K.from(r.node(e).copy(u)),d++):c--;let f=K.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=K.from(i.node(e).copy(f)),p++):l++;e.step(new Ji(c,l,o,s,new q(u.append(f),d,p),u.size-d,!0))}function na(e,t,n=null,r=e){let i=ia(e,t),a=i&&aa(r,t);return a?i.map(ra).concat({type:t,attrs:n}).concat(a.map(ra)):null}function ra(e){return{type:e,attrs:null}}function ia(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function aa(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function oa(e,t,n){let r=K.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=K.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new Ji(i,a,i,a,new q(r,0,0),n.length,!0))}function sa(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&ua(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&la(e,t,n,a),Qi(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new Ji(c,l,c+1,l-1,new q(K.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&ca(e,t,n,a),!1}})}function ca(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function la(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
|
|
@@ -195,14 +195,14 @@ ${t.innerHTML}
|
|
|
195
195
|
`?t.slice(0,-1):t};return e.renderer.rules.hardbreak=t(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=t(e.renderer.rules.softbreak),e.renderer.rules.fence=t(e.renderer.rules.fence),e.renderer.rules.code_block=t(e.renderer.rules.code_block),e.renderer.renderToken=t(e.renderer.renderToken.bind(e.renderer)),e}},ej=uh.create({name:`markdownClipboard`,addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new lo({key:new po(`markdownClipboard`),props:{clipboardTextParser:(e,t,n)=>{if(n||!this.options.transformPastedText)return null;let r=this.editor.storage.markdown.parser.parse(e,{inline:!0});return oi.fromSchema(this.editor.schema).parseSlice(DA(r),{preserveWhitespace:!0,context:t})},clipboardTextSerializer:e=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(e.content):null}})]}}),tj=uh.create({name:`markdown`,priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:`tight`,bulletListMarker:`-`,linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){let e=lh.Commands.config.addCommands();return{setContent:(t,n)=>r=>e.setContent(r.editor.storage.markdown.parser.parse(t),n)(r),insertContentAt:(t,n,r)=>i=>e.insertContentAt(t,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new $A(this.editor,this.options),serializer:new QA(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[_A.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),ej.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),nj=`attachment:`;function rj(e){if(typeof e!=`string`||!e.startsWith(nj))return null;let t=e.slice(11).trim();return t.length>0?t:null}function ij(e){let t=e.regex,n=e.COMMENT(`//`,`$`,{contains:[{begin:/\\\n/}]}),r=`[a-zA-Z_]\\w*::`,i=`(?!struct)(decltype\\(auto\\)|`+t.optional(r)+`[a-zA-Z_]\\w*`+t.optional(`<[^<>]+>`)+`)`,a={className:`type`,begin:`\\b[a-z\\d_]*_t\\b`},o={className:`string`,variants:[{begin:`(u8?|U|L)?"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]},{begin:`(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)`,end:`'`,illegal:`.`},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},s={className:`number`,variants:[{begin:`[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)`},{begin:`[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)`}],relevance:0},c={className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(o,{className:`string`}),{className:`string`,begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},l={className:`title`,begin:t.optional(r)+e.IDENT_RE,relevance:0},u=t.optional(r)+e.IDENT_RE+`\\s*\\(`,d=`alignas.alignof.and.and_eq.asm.atomic_cancel.atomic_commit.atomic_noexcept.auto.bitand.bitor.break.case.catch.class.co_await.co_return.co_yield.compl.concept.const_cast|10.consteval.constexpr.constinit.continue.decltype.default.delete.do.dynamic_cast|10.else.enum.explicit.export.extern.false.final.for.friend.goto.if.import.inline.module.mutable.namespace.new.noexcept.not.not_eq.nullptr.operator.or.or_eq.override.private.protected.public.reflexpr.register.reinterpret_cast|10.requires.return.sizeof.static_assert.static_cast|10.struct.switch.synchronized.template.this.thread_local.throw.transaction_safe.transaction_safe_dynamic.true.try.typedef.typeid.typename.union.using.virtual.volatile.while.xor.xor_eq`.split(`.`),f=[`bool`,`char`,`char16_t`,`char32_t`,`char8_t`,`double`,`float`,`int`,`long`,`short`,`void`,`wchar_t`,`unsigned`,`signed`,`const`,`static`],p=`any.auto_ptr.barrier.binary_semaphore.bitset.complex.condition_variable.condition_variable_any.counting_semaphore.deque.false_type.flat_map.flat_set.future.imaginary.initializer_list.istringstream.jthread.latch.lock_guard.multimap.multiset.mutex.optional.ostringstream.packaged_task.pair.promise.priority_queue.queue.recursive_mutex.recursive_timed_mutex.scoped_lock.set.shared_future.shared_lock.shared_mutex.shared_timed_mutex.shared_ptr.stack.string_view.stringstream.timed_mutex.thread.true_type.tuple.unique_lock.unique_ptr.unordered_map.unordered_multimap.unordered_multiset.unordered_set.variant.vector.weak_ptr.wstring.wstring_view`.split(`.`),m=`abort.abs.acos.apply.as_const.asin.atan.atan2.calloc.ceil.cerr.cin.clog.cos.cosh.cout.declval.endl.exchange.exit.exp.fabs.floor.fmod.forward.fprintf.fputs.free.frexp.fscanf.future.invoke.isalnum.isalpha.iscntrl.isdigit.isgraph.islower.isprint.ispunct.isspace.isupper.isxdigit.labs.launder.ldexp.log.log10.make_pair.make_shared.make_shared_for_overwrite.make_tuple.make_unique.malloc.memchr.memcmp.memcpy.memset.modf.move.pow.printf.putchar.puts.realloc.scanf.sin.sinh.snprintf.sprintf.sqrt.sscanf.std.stderr.stdin.stdout.strcat.strchr.strcmp.strcpy.strcspn.strlen.strncat.strncmp.strncpy.strpbrk.strrchr.strspn.strstr.swap.tan.tanh.terminate.to_underlying.tolower.toupper.vfprintf.visit.vprintf.vsprintf`.split(`.`),h={type:f,keyword:d,literal:[`NULL`,`false`,`nullopt`,`nullptr`,`true`],built_in:[`_Pragma`],_type_hints:p},g={className:`function.dispatch`,relevance:0,keywords:{_hint:m},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[g,c,a,n,e.C_BLOCK_COMMENT_MODE,s,o],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:`new throw return else`,end:/;/}],keywords:h,contains:_.concat([{begin:/\(/,end:/\)/,keywords:h,contains:_.concat([`self`]),relevance:0}]),relevance:0},y={className:`function`,begin:`(`+i+`[\\*&\\s]+)+`+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:h,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:`decltype\\(auto\\)`,keywords:h,relevance:0},{begin:u,returnBegin:!0,contains:[l],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[o,s]},{relevance:0,match:/,/},{className:`params`,begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,o,s,a,{begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[`self`,n,e.C_BLOCK_COMMENT_MODE,o,s,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:`C++`,aliases:[`cc`,`c++`,`h++`,`hpp`,`hh`,`hxx`,`cxx`],keywords:h,illegal:`</`,classNameAliases:{"function.dispatch":`built_in`},contains:[].concat(v,y,g,_,[c,{begin:`\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)`,end:`>`,keywords:h,contains:[`self`,a]},{begin:e.IDENT_RE+`::`,keywords:h},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:`keyword`,3:`title.class`}}])}}function aj(e){let t={type:[`boolean`,`byte`,`word`,`String`],built_in:`KeyboardController.MouseController.SoftwareSerial.EthernetServer.EthernetClient.LiquidCrystal.RobotControl.GSMVoiceCall.EthernetUDP.EsploraTFT.HttpClient.RobotMotor.WiFiClient.GSMScanner.FileSystem.Scheduler.GSMServer.YunClient.YunServer.IPAddress.GSMClient.GSMModem.Keyboard.Ethernet.Console.GSMBand.Esplora.Stepper.Process.WiFiUDP.GSM_SMS.Mailbox.USBHost.Firmata.PImage.Client.Server.GSMPIN.FileIO.Bridge.Serial.EEPROM.Stream.Mouse.Audio.Servo.File.Task.GPRS.WiFi.Wire.TFT.GSM.SPI.SD`.split(`.`),_hints:`setup.loop.runShellCommandAsynchronously.analogWriteResolution.retrieveCallingNumber.printFirmwareVersion.analogReadResolution.sendDigitalPortPair.noListenOnLocalhost.readJoystickButton.setFirmwareVersion.readJoystickSwitch.scrollDisplayRight.getVoiceCallStatus.scrollDisplayLeft.writeMicroseconds.delayMicroseconds.beginTransmission.getSignalStrength.runAsynchronously.getAsynchronously.listenOnLocalhost.getCurrentCarrier.readAccelerometer.messageAvailable.sendDigitalPorts.lineFollowConfig.countryNameWrite.runShellCommand.readStringUntil.rewindDirectory.readTemperature.setClockDivider.readLightSensor.endTransmission.analogReference.detachInterrupt.countryNameRead.attachInterrupt.encryptionType.readBytesUntil.robotNameWrite.readMicrophone.robotNameRead.cityNameWrite.userNameWrite.readJoystickY.readJoystickX.mouseReleased.openNextFile.scanNetworks.noInterrupts.digitalWrite.beginSpeaker.mousePressed.isActionDone.mouseDragged.displayLogos.noAutoscroll.addParameter.remoteNumber.getModifiers.keyboardRead.userNameRead.waitContinue.processInput.parseCommand.printVersion.readNetworks.writeMessage.blinkVersion.cityNameRead.readMessage.setDataMode.parsePacket.isListening.setBitOrder.beginPacket.isDirectory.motorsWrite.drawCompass.digitalRead.clearScreen.serialEvent.rightToLeft.setTextSize.leftToRight.requestFrom.keyReleased.compassRead.analogWrite.interrupts.WiFiServer.disconnect.playMelody.parseFloat.autoscroll.getPINUsed.setPINUsed.setTimeout.sendAnalog.readSlider.analogRead.beginWrite.createChar.motorsStop.keyPressed.tempoWrite.readButton.subnetMask.debugPrint.macAddress.writeGreen.randomSeed.attachGPRS.readString.sendString.remotePort.releaseAll.mouseMoved.background.getXChange.getYChange.answerCall.getResult.voiceCall.endPacket.constrain.getSocket.writeJSON.getButton.available.connected.findUntil.readBytes.exitValue.readGreen.writeBlue.startLoop.IPAddress.isPressed.sendSysex.pauseMode.gatewayIP.setCursor.getOemKey.tuneWrite.noDisplay.loadImage.switchPIN.onRequest.onReceive.changePIN.playFile.noBuffer.parseInt.overflow.checkPIN.knobRead.beginTFT.bitClear.updateIR.bitWrite.position.writeRGB.highByte.writeRed.setSpeed.readBlue.noStroke.remoteIP.transfer.shutdown.hangCall.beginSMS.endWrite.attached.maintain.noCursor.checkReg.checkPUK.shiftOut.isValid.shiftIn.pulseIn.connect.println.localIP.pinMode.getIMEI.display.noBlink.process.getBand.running.beginSD.drawBMP.lowByte.setBand.release.bitRead.prepare.pointTo.readRed.setMode.noFill.remove.listen.stroke.detach.attach.noTone.exists.buffer.height.bitSet.circle.config.cursor.random.IRread.setDNS.endSMS.getKey.micros.millis.begin.print.write.ready.flush.width.isPIN.blink.clear.press.mkdir.rmdir.close.point.yield.image.BSSID.click.delay.read.text.move.peek.beep.rect.line.open.seek.fill.size.turn.stop.home.find.step.tone.sqrt.RSSI.SSID.end.bit.tan.cos.sin.pow.map.abs.max.min.get.run.put`.split(`.`),literal:[`DIGITAL_MESSAGE`,`FIRMATA_STRING`,`ANALOG_MESSAGE`,`REPORT_DIGITAL`,`REPORT_ANALOG`,`INPUT_PULLUP`,`SET_PIN_MODE`,`INTERNAL2V56`,`SYSTEM_RESET`,`LED_BUILTIN`,`INTERNAL1V1`,`SYSEX_START`,`INTERNAL`,`EXTERNAL`,`DEFAULT`,`OUTPUT`,`INPUT`,`HIGH`,`LOW`]},n=ij(e),r=n.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,n.name=`Arduino`,n.aliases=[`ino`],n.supersetOf=`cpp`,n}function oj(e){let t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:[`self`,{begin:/:-/,contains:[n]}]};Object.assign(n,{className:`variable`,variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,`(?![\\w\\d])(?![$])`)},r]});let i={className:`subst`,begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},a=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:`comment`}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:`string`})]}},s={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(s);let c={match:/\\"/},l={className:`string`,begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:`number`},e.NUMBER_MODE,n]},f=e.SHEBANG({binary:`(${[`fish`,`bash`,`zsh`,`sh`,`csh`,`ksh`,`tcsh`,`dash`,`scsh`].join(`|`)})`,relevance:10}),p={className:`function`,begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=[`if`,`then`,`else`,`elif`,`fi`,`time`,`for`,`while`,`until`,`in`,`do`,`done`,`case`,`esac`,`coproc`,`function`,`select`],h=[`true`,`false`],g={match:/(\/[a-z._-]+)+/},_=[`break`,`cd`,`continue`,`eval`,`exec`,`exit`,`export`,`getopts`,`hash`,`pwd`,`readonly`,`return`,`shift`,`test`,`times`,`trap`,`umask`,`unset`],v=[`alias`,`bind`,`builtin`,`caller`,`command`,`declare`,`echo`,`enable`,`help`,`let`,`local`,`logout`,`mapfile`,`printf`,`read`,`readarray`,`source`,`sudo`,`type`,`typeset`,`ulimit`,`unalias`],y=`autoload.bg.bindkey.bye.cap.chdir.clone.comparguments.compcall.compctl.compdescribe.compfiles.compgroups.compquote.comptags.comptry.compvalues.dirs.disable.disown.echotc.echoti.emulate.fc.fg.float.functions.getcap.getln.history.integer.jobs.kill.limit.log.noglob.popd.print.pushd.pushln.rehash.sched.setcap.setopt.stat.suspend.ttyctl.unfunction.unhash.unlimit.unsetopt.vared.wait.whence.where.which.zcompile.zformat.zftp.zle.zmodload.zparseopts.zprof.zpty.zregexparse.zsocket.zstyle.ztcp`.split(`.`),b=`chcon.chgrp.chown.chmod.cp.dd.df.dir.dircolors.ln.ls.mkdir.mkfifo.mknod.mktemp.mv.realpath.rm.rmdir.shred.sync.touch.truncate.vdir.b2sum.base32.base64.cat.cksum.comm.csplit.cut.expand.fmt.fold.head.join.md5sum.nl.numfmt.od.paste.ptx.pr.sha1sum.sha224sum.sha256sum.sha384sum.sha512sum.shuf.sort.split.sum.tac.tail.tr.tsort.unexpand.uniq.wc.arch.basename.chroot.date.dirname.du.echo.env.expr.factor.groups.hostid.id.link.logname.nice.nohup.nproc.pathchk.pinky.printenv.printf.pwd.readlink.runcon.seq.sleep.stat.stdbuf.stty.tee.test.timeout.tty.uname.unlink.uptime.users.who.whoami.yes`.split(`.`);return{name:`Bash`,aliases:[`sh`,`zsh`],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:h,built_in:[..._,...v,`set`,`shopt`,...y,...b]},contains:[f,e.SHEBANG(),p,d,a,o,g,s,c,l,u,n]}}function sj(e){let t=e.regex,n=e.COMMENT(`//`,`$`,{contains:[{begin:/\\\n/}]}),r=`[a-zA-Z_]\\w*::`,i=`(decltype\\(auto\\)|`+t.optional(r)+`[a-zA-Z_]\\w*`+t.optional(`<[^<>]+>`)+`)`,a={className:`type`,variants:[{begin:`\\b[a-z\\d_]*_t\\b`},{match:/\batomic_[a-z]{3,6}\b/}]},o={className:`string`,variants:[{begin:`(u8?|U|L)?"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]},{begin:`(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)`,end:`'`,illegal:`.`},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},s={className:`number`,variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},c={className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(o,{className:`string`}),{className:`string`,begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},l={className:`title`,begin:t.optional(r)+e.IDENT_RE,relevance:0},u=t.optional(r)+e.IDENT_RE+`\\s*\\(`,d={keyword:`asm.auto.break.case.continue.default.do.else.enum.extern.for.fortran.goto.if.inline.register.restrict.return.sizeof.typeof.typeof_unqual.struct.switch.typedef.union.volatile.while._Alignas._Alignof._Atomic._Generic._Noreturn._Static_assert._Thread_local.alignas.alignof.noreturn.static_assert.thread_local._Pragma`.split(`.`),type:`float.double.signed.unsigned.int.short.long.char.void._Bool._BitInt._Complex._Imaginary._Decimal32._Decimal64._Decimal96._Decimal128._Decimal64x._Decimal128x._Float16._Float32._Float64._Float128._Float32x._Float64x._Float128x.const.static.constexpr.complex.bool.imaginary`.split(`.`),literal:`true false NULL`,built_in:`std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr`},f=[c,a,n,e.C_BLOCK_COMMENT_MODE,s,o],p={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:`new throw return else`,end:/;/}],keywords:d,contains:f.concat([{begin:/\(/,end:/\)/,keywords:d,contains:f.concat([`self`]),relevance:0}]),relevance:0},m={begin:`(`+i+`[\\*&\\s]+)+`+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:d,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:`decltype\\(auto\\)`,keywords:d,relevance:0},{begin:u,returnBegin:!0,contains:[e.inherit(l,{className:`title.function`})],relevance:0},{relevance:0,match:/,/},{className:`params`,begin:/\(/,end:/\)/,keywords:d,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,o,s,a,{begin:/\(/,end:/\)/,keywords:d,relevance:0,contains:[`self`,n,e.C_BLOCK_COMMENT_MODE,o,s,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:`C`,aliases:[`h`],keywords:d,disableAutodetect:!0,illegal:`</`,contains:[].concat(p,m,f,[c,{begin:e.IDENT_RE+`::`,keywords:d},{className:`class`,beginKeywords:`enum class struct union`,end:/[{;:<>=]/,contains:[{beginKeywords:`final class struct`},e.TITLE_MODE]}]),exports:{preprocessor:c,strings:o,keywords:d}}}function cj(e){let t=e.regex,n=e.COMMENT(`//`,`$`,{contains:[{begin:/\\\n/}]}),r=`[a-zA-Z_]\\w*::`,i=`(?!struct)(decltype\\(auto\\)|`+t.optional(r)+`[a-zA-Z_]\\w*`+t.optional(`<[^<>]+>`)+`)`,a={className:`type`,begin:`\\b[a-z\\d_]*_t\\b`},o={className:`string`,variants:[{begin:`(u8?|U|L)?"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]},{begin:`(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)`,end:`'`,illegal:`.`},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},s={className:`number`,variants:[{begin:`[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)`},{begin:`[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)`}],relevance:0},c={className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(o,{className:`string`}),{className:`string`,begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},l={className:`title`,begin:t.optional(r)+e.IDENT_RE,relevance:0},u=t.optional(r)+e.IDENT_RE+`\\s*\\(`,d=`alignas.alignof.and.and_eq.asm.atomic_cancel.atomic_commit.atomic_noexcept.auto.bitand.bitor.break.case.catch.class.co_await.co_return.co_yield.compl.concept.const_cast|10.consteval.constexpr.constinit.continue.decltype.default.delete.do.dynamic_cast|10.else.enum.explicit.export.extern.false.final.for.friend.goto.if.import.inline.module.mutable.namespace.new.noexcept.not.not_eq.nullptr.operator.or.or_eq.override.private.protected.public.reflexpr.register.reinterpret_cast|10.requires.return.sizeof.static_assert.static_cast|10.struct.switch.synchronized.template.this.thread_local.throw.transaction_safe.transaction_safe_dynamic.true.try.typedef.typeid.typename.union.using.virtual.volatile.while.xor.xor_eq`.split(`.`),f=[`bool`,`char`,`char16_t`,`char32_t`,`char8_t`,`double`,`float`,`int`,`long`,`short`,`void`,`wchar_t`,`unsigned`,`signed`,`const`,`static`],p=`any.auto_ptr.barrier.binary_semaphore.bitset.complex.condition_variable.condition_variable_any.counting_semaphore.deque.false_type.flat_map.flat_set.future.imaginary.initializer_list.istringstream.jthread.latch.lock_guard.multimap.multiset.mutex.optional.ostringstream.packaged_task.pair.promise.priority_queue.queue.recursive_mutex.recursive_timed_mutex.scoped_lock.set.shared_future.shared_lock.shared_mutex.shared_timed_mutex.shared_ptr.stack.string_view.stringstream.timed_mutex.thread.true_type.tuple.unique_lock.unique_ptr.unordered_map.unordered_multimap.unordered_multiset.unordered_set.variant.vector.weak_ptr.wstring.wstring_view`.split(`.`),m=`abort.abs.acos.apply.as_const.asin.atan.atan2.calloc.ceil.cerr.cin.clog.cos.cosh.cout.declval.endl.exchange.exit.exp.fabs.floor.fmod.forward.fprintf.fputs.free.frexp.fscanf.future.invoke.isalnum.isalpha.iscntrl.isdigit.isgraph.islower.isprint.ispunct.isspace.isupper.isxdigit.labs.launder.ldexp.log.log10.make_pair.make_shared.make_shared_for_overwrite.make_tuple.make_unique.malloc.memchr.memcmp.memcpy.memset.modf.move.pow.printf.putchar.puts.realloc.scanf.sin.sinh.snprintf.sprintf.sqrt.sscanf.std.stderr.stdin.stdout.strcat.strchr.strcmp.strcpy.strcspn.strlen.strncat.strncmp.strncpy.strpbrk.strrchr.strspn.strstr.swap.tan.tanh.terminate.to_underlying.tolower.toupper.vfprintf.visit.vprintf.vsprintf`.split(`.`),h={type:f,keyword:d,literal:[`NULL`,`false`,`nullopt`,`nullptr`,`true`],built_in:[`_Pragma`],_type_hints:p},g={className:`function.dispatch`,relevance:0,keywords:{_hint:m},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[g,c,a,n,e.C_BLOCK_COMMENT_MODE,s,o],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:`new throw return else`,end:/;/}],keywords:h,contains:_.concat([{begin:/\(/,end:/\)/,keywords:h,contains:_.concat([`self`]),relevance:0}]),relevance:0},y={className:`function`,begin:`(`+i+`[\\*&\\s]+)+`+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:h,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:`decltype\\(auto\\)`,keywords:h,relevance:0},{begin:u,returnBegin:!0,contains:[l],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[o,s]},{relevance:0,match:/,/},{className:`params`,begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,o,s,a,{begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[`self`,n,e.C_BLOCK_COMMENT_MODE,o,s,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:`C++`,aliases:[`cc`,`c++`,`h++`,`hpp`,`hh`,`hxx`,`cxx`],keywords:h,illegal:`</`,classNameAliases:{"function.dispatch":`built_in`},contains:[].concat(v,y,g,_,[c,{begin:`\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)`,end:`>`,keywords:h,contains:[`self`,a]},{begin:e.IDENT_RE+`::`,keywords:h},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:`keyword`,3:`title.class`}}])}}function lj(e){let t=[`bool`,`byte`,`char`,`decimal`,`delegate`,`double`,`dynamic`,`enum`,`float`,`int`,`long`,`nint`,`nuint`,`object`,`sbyte`,`short`,`string`,`ulong`,`uint`,`ushort`],n=[`public`,`private`,`protected`,`static`,`internal`,`protected`,`abstract`,`async`,`extern`,`override`,`unsafe`,`virtual`,`new`,`sealed`,`partial`],r={keyword:`abstract.as.base.break.case.catch.class.const.continue.do.else.event.explicit.extern.finally.fixed.for.foreach.goto.if.implicit.in.interface.internal.is.lock.namespace.new.operator.out.override.params.private.protected.public.readonly.record.ref.return.scoped.sealed.sizeof.stackalloc.static.struct.switch.this.throw.try.typeof.unchecked.unsafe.using.virtual.void.volatile.while`.split(`.`).concat(`add.alias.and.ascending.args.async.await.by.descending.dynamic.equals.file.from.get.global.group.init.into.join.let.nameof.not.notnull.on.or.orderby.partial.record.remove.required.scoped.select.set.unmanaged.value|0.var.when.where.with.yield`.split(`.`)),built_in:t,literal:[`default`,`false`,`null`,`true`]},i=e.inherit(e.TITLE_MODE,{begin:`[a-zA-Z](\\.?\\w)*`}),a={className:`number`,variants:[{begin:`\\b(0b[01']+)`},{begin:`(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)`},{begin:`(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)`}],relevance:0},o={className:`string`,begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},s={className:`string`,begin:`@"`,end:`"`,contains:[{begin:`""`}]},c=e.inherit(s,{illegal:/\n/}),l={className:`subst`,begin:/\{/,end:/\}/,keywords:r},u=e.inherit(l,{illegal:/\n/}),d={className:`string`,begin:/\$"/,end:`"`,illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,u]},f={className:`string`,begin:/\$@"/,end:`"`,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:`""`},l]},p=e.inherit(f,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:`""`},u]});l.contains=[f,d,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.C_BLOCK_COMMENT_MODE],u.contains=[p,d,c,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let m={variants:[o,f,d,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h={begin:`<`,end:`>`,contains:[{beginKeywords:`in out`},i]},g=e.IDENT_RE+`(<`+e.IDENT_RE+`(\\s*,\\s*`+e.IDENT_RE+`)*>)?(\\[\\])?`,_={begin:`@`+e.IDENT_RE,relevance:0};return{name:`C#`,aliases:[`cs`,`c#`],keywords:r,illegal:/::/,contains:[e.COMMENT(`///`,`$`,{returnBegin:!0,contains:[{className:`doctag`,variants:[{begin:`///`,relevance:0},{begin:`<!--|-->`},{begin:`</?`,end:`>`}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:`meta`,begin:`#`,end:`$`,keywords:{keyword:`if else elif endif define undef warning error line region endregion pragma checksum`}},m,a,{beginKeywords:`class interface`,relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:`where class`},i,h,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`namespace`,relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[i,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`record`,relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[i,h,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:`meta`,begin:`^\\s*\\[(?=[\\w])`,excludeBegin:!0,end:`\\]`,excludeEnd:!0,contains:[{className:`string`,begin:/"/,end:/"/}]},{beginKeywords:`new return throw await else`,relevance:0},{className:`function`,begin:`(`+g+`\\s+)+`+e.IDENT_RE+`\\s*(<[^=]+>\\s*)?\\(`,returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:r,contains:[{beginKeywords:n.join(` `),relevance:0},{begin:e.IDENT_RE+`\\s*(<[^=]+>\\s*)?\\(`,returnBegin:!0,contains:[e.TITLE_MODE,h],relevance:0},{match:/\(\)/},{className:`params`,begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:r,relevance:0,contains:[m,a,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},_]}}var uj=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),dj=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),fj=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),pj=[...dj,...fj],mj=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),hj=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),gj=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),_j=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function vj(e){let t=e.regex,n=uj(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i=/@-?\w[\w]*(-\w+)*/,a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:`CSS`,case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:`from to`},classNameAliases:{keyframePosition:`selector-tag`},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:`selector-id`,begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:`selector-class`,begin:`\\.[a-zA-Z-][a-zA-Z0-9_-]*`,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,variants:[{begin:`:(`+hj.join(`|`)+`)`},{begin:`:(:)?(`+gj.join(`|`)+`)`}]},n.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+_j.join(`|`)+`)\\b`},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:`url data-uri`},contains:[...a,{className:`string`,begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:`[{;]`,relevance:0,illegal:/:/,contains:[{className:`keyword`,begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:mj.join(` `)},contains:[{begin:/[a-z-]+(?=:)/,className:`attribute`},...a,n.CSS_NUMBER_MODE]}]},{className:`selector-tag`,begin:`\\b(`+pj.join(`|`)+`)\\b`}]}}function yj(e){let t=e.regex;return{name:`Diff`,aliases:[`patch`],contains:[{className:`meta`,relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:`comment`,variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:`addition`,begin:/^\+/,end:/$/},{className:`deletion`,begin:/^-/,end:/$/},{className:`addition`,begin:/^!/,end:/$/}]}}function bj(e){let t={keyword:[`break`,`case`,`chan`,`const`,`continue`,`default`,`defer`,`else`,`fallthrough`,`for`,`func`,`go`,`goto`,`if`,`import`,`interface`,`map`,`package`,`range`,`return`,`select`,`struct`,`switch`,`type`,`var`],type:[`bool`,`byte`,`complex64`,`complex128`,`error`,`float32`,`float64`,`int8`,`int16`,`int32`,`int64`,`string`,`uint8`,`uint16`,`uint32`,`uint64`,`int`,`uint`,`uintptr`,`rune`],literal:[`true`,`false`,`iota`,`nil`],built_in:[`append`,`cap`,`close`,`complex`,`copy`,`imag`,`len`,`make`,`new`,`panic`,`print`,`println`,`real`,`recover`,`delete`]};return{name:`Go`,aliases:[`golang`],keywords:t,illegal:`</`,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:`string`,variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:`number`,variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:`function`,beginKeywords:`func`,end:`\\s*(\\{|$)`,excludeEnd:!0,contains:[e.TITLE_MODE,{className:`params`,begin:/\(/,end:/\)/,endsParent:!0,keywords:t,illegal:/["']/}]}]}}function xj(e){let t=e.regex;return{name:`GraphQL`,aliases:[`gql`],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:[`query`,`mutation`,`subscription`,`type`,`input`,`schema`,`directive`,`interface`,`union`,`scalar`,`fragment`,`enum`,`on`],literal:[`true`,`false`,`null`]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:`punctuation`,match:/[.]{3}/,relevance:0},{scope:`punctuation`,begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:`variable`,begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:`meta`,match:/@\w+/,excludeEnd:!0},{scope:`symbol`,begin:t.concat(/[_A-Za-z][_0-9A-Za-z]*/,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function Sj(e){let t=e.regex,n={className:`number`,relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let i={className:`variable`,variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},a={className:`literal`,begin:/\bon|off|true|false|yes|no\b/},o={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:`'''`,end:`'''`,relevance:10},{begin:`"""`,end:`"""`,relevance:10},{begin:`"`,end:`"`},{begin:`'`,end:`'`}]},s={begin:/\[/,end:/\]/,contains:[r,a,i,o,n,`self`],relevance:0},c=t.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{name:`TOML, also INI`,aliases:[`toml`],case_insensitive:!0,illegal:/\S/,contains:[r,{className:`section`,begin:/\[+/,end:/\]+/},{begin:t.concat(c,`(\\s*\\.\\s*`,c,`)*`,t.lookahead(/\s*=\s*[^#\s]/)),className:`attr`,starts:{end:/$/,contains:[r,s,a,i,o,n]}}]}}var Cj=`[0-9](_*[0-9])*`,wj=`\\.(${Cj})`,Tj=`[0-9a-fA-F](_*[0-9a-fA-F])*`,Ej={className:`number`,variants:[{begin:`(\\b(${Cj})((${wj})|\\.)?|(${wj}))[eE][+-]?(${Cj})[fFdD]?\\b`},{begin:`\\b(${Cj})((${wj})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${wj})[fFdD]?\\b`},{begin:`\\b(${Cj})[fFdD]\\b`},{begin:`\\b0[xX]((${Tj})\\.?|(${Tj})?\\.(${Tj}))[pP][+-]?(${Cj})[fFdD]?\\b`},{begin:`\\b(0|[1-9](_*[0-9])*)[lL]?\\b`},{begin:`\\b0[xX](${Tj})[lL]?\\b`},{begin:`\\b0(_*[0-7])*[lL]?\\b`},{begin:`\\b0[bB][01](_*[01])*[lL]?\\b`}],relevance:0};function Dj(e,t,n){return n===-1?``:e.replace(t,r=>Dj(e,t,n-1))}function Oj(e){let t=e.regex,n=`[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*`,r=n+Dj(`(?:<`+n+`~~~(?:\\s*,\\s*`+n+`~~~)*>)?`,/~~~/g,2),i={keyword:`synchronized.abstract.private.var.static.if.const .for.while.strictfp.finally.protected.import.native.final.void.enum.else.break.transient.catch.instanceof.volatile.case.assert.package.default.public.try.switch.continue.throws.protected.public.private.module.requires.exports.do.sealed.yield.permits.goto.when`.split(`.`),literal:[`false`,`true`,`null`],type:[`char`,`boolean`,`long`,`float`,`int`,`byte`,`short`,`double`],built_in:[`super`,`this`]},a={className:`meta`,begin:`@`+n,contains:[{begin:/\(/,end:/\)/,contains:[`self`]}]},o={className:`params`,begin:/\(/,end:/\)/,keywords:i,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:`Java`,aliases:[`jsp`],keywords:i,illegal:/<\/|#/,contains:[e.COMMENT(`/\\*\\*`,`\\*/`,{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:`doctag`,begin:`@[A-Za-z]+`}]}),{begin:/import java\.[a-z]+\./,keywords:`import`,relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:`string`,contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:`keyword`,3:`title.class`}},{match:/non-sealed/,scope:`keyword`},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:`type`,3:`variable`,5:`operator`}},{begin:[/record/,/\s+/,n],className:{1:`keyword`,3:`title.class`},contains:[o,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`new throw return else`,relevance:0},{begin:[`(?:`+r+`\\s+)`,e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:`title.function`},keywords:i,contains:[{className:`params`,begin:/\(/,end:/\)/,keywords:i,relevance:0,contains:[a,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,Ej,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Ej,a]}}var kj=`[A-Za-z$_][0-9A-Za-z$_]*`,Aj=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),jj=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],Mj=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),Nj=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],Pj=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],Fj=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],Ij=[].concat(Pj,Mj,Nj);function Lj(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=kj,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:kj,keyword:Aj,literal:jj,built_in:Ij,"variable.language":Fj},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:r+`(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...Mj,...Nj]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let ee={match:t.concat(/\b/,D([...Pj,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},O={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},k={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},A=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,j={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},j,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:A,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},O,{match:`\\$`+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},ee,E,S,k,{match:/\$[(.]/}]}}function Rj(e){let t={className:`attr`,begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:`punctuation`,relevance:0},r=[`true`,`false`,`null`],i={scope:`literal`,beginKeywords:r.join(` `)};return{name:`JSON`,aliases:[`jsonc`],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:`\\S`}}var zj=`[0-9](_*[0-9])*`,Bj=`\\.(${zj})`,Vj=`[0-9a-fA-F](_*[0-9a-fA-F])*`,Hj={className:`number`,variants:[{begin:`(\\b(${zj})((${Bj})|\\.)?|(${Bj}))[eE][+-]?(${zj})[fFdD]?\\b`},{begin:`\\b(${zj})((${Bj})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Bj})[fFdD]?\\b`},{begin:`\\b(${zj})[fFdD]\\b`},{begin:`\\b0[xX]((${Vj})\\.?|(${Vj})?\\.(${Vj}))[pP][+-]?(${zj})[fFdD]?\\b`},{begin:`\\b(0|[1-9](_*[0-9])*)[lL]?\\b`},{begin:`\\b0[xX](${Vj})[lL]?\\b`},{begin:`\\b0(_*[0-7])*[lL]?\\b`},{begin:`\\b0[bB][01](_*[01])*[lL]?\\b`}],relevance:0};function Uj(e){let t={keyword:`abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual`,built_in:`Byte Short Char Int Long Boolean Float Double Void Unit Nothing`,literal:`true false null`},n={className:`keyword`,begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:`symbol`,begin:/@\w+/}]}},r={className:`symbol`,begin:e.UNDERSCORE_IDENT_RE+`@`},i={className:`subst`,begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},a={className:`variable`,begin:`\\$`+e.UNDERSCORE_IDENT_RE},o={className:`string`,variants:[{begin:`"""`,end:`"""(?=[^"])`,contains:[a,i]},{begin:`'`,end:`'`,illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:`"`,end:`"`,illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,a,i]}]};i.contains.push(o);let s={className:`meta`,begin:`@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*`+e.UNDERSCORE_IDENT_RE+`)?`},c={className:`meta`,begin:`@`+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(o,{className:`string`}),`self`]}]},l=Hj,u=e.COMMENT(`/\\*`,`\\*/`,{contains:[e.C_BLOCK_COMMENT_MODE]}),d={variants:[{className:`type`,begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=d;return f.variants[1].contains=[d],d.variants[1].contains=[f],{name:`Kotlin`,aliases:[`kt`,`kts`],keywords:t,contains:[e.COMMENT(`/\\*\\*`,`\\*/`,{relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`}]}),e.C_LINE_COMMENT_MODE,u,n,r,s,c,{className:`function`,beginKeywords:`fun`,end:`[(]|$`,returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+`\\s*\\(`,returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:`type`,begin:/</,end:/>/,keywords:`reified`,relevance:0},{className:`params`,begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[d,e.C_LINE_COMMENT_MODE,u],relevance:0},e.C_LINE_COMMENT_MODE,u,s,c,o,e.C_NUMBER_MODE]},u]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:`title.class`},keywords:`class interface trait`,end:/[:\{(]|$/,excludeEnd:!0,illegal:`extends implements`,contains:[{beginKeywords:`public protected internal private constructor`},e.UNDERSCORE_TITLE_MODE,{className:`type`,begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},s,c]},o,{className:`meta`,begin:`^#!/usr/bin/env`,end:`$`,illegal:`
|
|
196
196
|
`},l]}}var Wj=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Gj=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),Kj=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),qj=[...Gj,...Kj],Jj=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),Yj=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),Xj=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),Zj=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse(),Qj=Yj.concat(Xj).sort().reverse();function $j(e){let t=Wj(e),n=Qj,r=`([\\w-]+|@\\{[\\w-]+\\})`,i=[],a=[],o=function(e){return{className:`string`,begin:`~?`+e+`.*?`+e}},s=function(e,t,n){return{className:e,begin:t,relevance:n}},c={$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:Jj.join(` `)},l={begin:`\\(`,end:`\\)`,contains:a,keywords:c,relevance:0};a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,o(`'`),o(`"`),t.CSS_NUMBER_MODE,{begin:`(url|data-uri)\\(`,starts:{className:`string`,end:`[\\)\\n]`,excludeEnd:!0}},t.HEXCOLOR,l,s(`variable`,`@@?[\\w-]+`,10),s(`variable`,`@\\{[\\w-]+\\}`),s(`built_in`,"~?`[^`]*?`"),{className:`attribute`,begin:`[\\w-]+\\s*:`,end:`:`,returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:`and not`},t.FUNCTION_DISPATCH);let u=a.concat({begin:/\{/,end:/\}/,contains:i}),d={beginKeywords:`when`,endsWithParent:!0,contains:[{beginKeywords:`and not`}].concat(a)},f={begin:r+`\\s*:`,returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+Zj.join(`|`)+`)\\b`,end:/(?=:)/,starts:{endsWithParent:!0,illegal:`[<=$]`,relevance:0,contains:a}}]},p={className:`keyword`,begin:`@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b`,starts:{end:`[;{}]`,keywords:c,returnEnd:!0,contains:a,relevance:0}},m={className:`variable`,variants:[{begin:`@[\\w-]+\\s*:`,relevance:15},{begin:`@[\\w-]+`}],starts:{end:`[;}]`,returnEnd:!0,contains:u}},h={variants:[{begin:`[\\.#:&\\[>]`,end:`[;{}]`},{begin:r,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,d,s(`keyword`,`all\\b`),s(`variable`,`@\\{[\\w-]+\\}`),{begin:`\\b(`+qj.join(`|`)+`)\\b`,className:`selector-tag`},t.CSS_NUMBER_MODE,s(`selector-tag`,r,0),s(`selector-id`,`#`+r),s(`selector-class`,`\\.`+r,0),s(`selector-tag`,`&`,0),t.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,begin:`:(`+Yj.join(`|`)+`)`},{className:`selector-pseudo`,begin:`:(:)?(`+Xj.join(`|`)+`)`},{begin:/\(/,end:/\)/,relevance:0,contains:u},{begin:`!important`},t.FUNCTION_DISPATCH]},g={begin:`[\\w-]+:(:)?(${n.join(`|`)})`,returnBegin:!0,contains:[h]};return i.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,m,g,f,h,d,t.FUNCTION_DISPATCH),{name:`Less`,case_insensitive:!0,illegal:`[=>'/<($"]`,contains:i}}function eM(e){let t=`\\[=*\\[`,n=`\\]=*\\]`,r={begin:t,end:n,contains:[`self`]},i=[e.COMMENT(`--(?!\\[=*\\[)`,`$`),e.COMMENT(`--\\[=*\\[`,n,{contains:[r],relevance:10})];return{name:`Lua`,aliases:[`pluto`],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:`true false nil`,keyword:`and break do else elseif end for goto if in local not or repeat return then until while`,built_in:`_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove`},contains:i.concat([{className:`function`,beginKeywords:`function`,end:`\\)`,contains:[e.inherit(e.TITLE_MODE,{begin:`([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*`}),{className:`params`,begin:`\\(`,endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:`string`,begin:t,end:n,contains:[r],relevance:5}])}}function tM(e){let t={className:`variable`,variants:[{begin:`\\$\\(`+e.UNDERSCORE_IDENT_RE+`\\)`,contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={className:`variable`,begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:`subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value`},contains:[t,n]},i={begin:`^`+e.UNDERSCORE_IDENT_RE+`\\s*(?=[:+?]?=)`},a={className:`meta`,begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:`.PHONY`}},o={className:`section`,begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:`Makefile`,aliases:[`mk`,`mak`,`make`],keywords:{$pattern:/[\w-]+/,keyword:`define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath`},contains:[e.HASH_COMMENT_MODE,t,n,r,i,a,o]}}function nM(e){let t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:`>`,subLanguage:`xml`,relevance:0},r={begin:`^[-\\*]{3,}`,end:`$`},i={className:`code`,variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:`(~{3,})[^~](.|\\n)*?\\1~*[ ]*`},{begin:"```",end:"```+[ ]*$"},{begin:`~~~`,end:`~~~+[ ]*$`},{begin:"`.+?`"},{begin:`(?=^( {4}|\\t))`,contains:[{begin:`^( {4}|\\t)`,end:`(\\n)$`}],relevance:0}]},a={className:`bullet`,begin:`^[ ]*([*+-]|(\\d+\\.))(?=\\s+)`,end:`\\s+`,excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:`symbol`,begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:`link`,begin:/:\s*/,end:/$/,excludeBegin:!0}]},s={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:`string`,relevance:0,begin:`\\[`,end:`\\]`,excludeBegin:!0,returnEnd:!0},{className:`link`,relevance:0,begin:`\\]\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0},{className:`symbol`,relevance:0,begin:`\\]\\[`,end:`\\]`,excludeBegin:!0,excludeEnd:!0}]},c={className:`strong`,contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},l={className:`emphasis`,contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=e.inherit(c,{contains:[]}),d=e.inherit(l,{contains:[]});c.contains.push(d),l.contains.push(u);let f=[n,s];return[c,l,u,d].forEach(e=>{e.contains=e.contains.concat(f)}),f=f.concat(c,l),{name:`Markdown`,aliases:[`md`,`mkdown`,`mkd`],contains:[{className:`section`,variants:[{begin:`^#{1,6}`,end:`$`,contains:f},{begin:`(?=^.+?\\n[=-]{2,}$)`,contains:[{begin:`^[=-]*$`},{begin:`^`,end:`\\n`,contains:f}]}]},n,a,c,l,{className:`quote`,begin:`^>\\s+`,contains:f,end:`$`},i,r,s,o,{scope:`literal`,match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function rM(e){let t={className:`built_in`,begin:`\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+`},n=/[a-zA-Z@][a-zA-Z0-9_]*/,r={"variable.language":[`this`,`super`],$pattern:n,keyword:`while.export.sizeof.typedef.const.struct.for.union.volatile.static.mutable.if.do.return.goto.enum.else.break.extern.asm.case.default.register.explicit.typename.switch.continue.inline.readonly.assign.readwrite.self.@synchronized.id.typeof.nonatomic.IBOutlet.IBAction.strong.weak.copy.in.out.inout.bycopy.byref.oneway.__strong.__weak.__block.__autoreleasing.@private.@protected.@public.@try.@property.@end.@throw.@catch.@finally.@autoreleasepool.@synthesize.@dynamic.@selector.@optional.@required.@encode.@package.@import.@defs.@compatibility_alias.__bridge.__bridge_transfer.__bridge_retained.__bridge_retain.__covariant.__contravariant.__kindof._Nonnull._Nullable._Null_unspecified.__FUNCTION__.__PRETTY_FUNCTION__.__attribute__.getter.setter.retain.unsafe_unretained.nonnull.nullable.null_unspecified.null_resettable.class.instancetype.NS_DESIGNATED_INITIALIZER.NS_UNAVAILABLE.NS_REQUIRES_SUPER.NS_RETURNS_INNER_POINTER.NS_INLINE.NS_AVAILABLE.NS_DEPRECATED.NS_ENUM.NS_OPTIONS.NS_SWIFT_UNAVAILABLE.NS_ASSUME_NONNULL_BEGIN.NS_ASSUME_NONNULL_END.NS_REFINED_FOR_SWIFT.NS_SWIFT_NAME.NS_SWIFT_NOTHROW.NS_DURING.NS_HANDLER.NS_ENDHANDLER.NS_VALUERETURN.NS_VOIDRETURN`.split(`.`),literal:[`false`,`true`,`FALSE`,`TRUE`,`nil`,`YES`,`NO`,`NULL`],built_in:[`dispatch_once_t`,`dispatch_queue_t`,`dispatch_sync`,`dispatch_async`,`dispatch_once`],type:[`int`,`float`,`char`,`unsigned`,`signed`,`short`,`long`,`double`,`wchar_t`,`unichar`,`void`,`bool`,`BOOL`,`id|0`,`_Bool`]},i={$pattern:n,keyword:[`@interface`,`@class`,`@protocol`,`@implementation`]};return{name:`Objective-C`,aliases:[`mm`,`objc`,`obj-c`,`obj-c++`,`objective-c++`],keywords:r,illegal:`</`,contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:`string`,variants:[{begin:`@"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]}]},{className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma ifdef ifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),{className:`string`,begin:/<.*?>/,end:/$/,illegal:`\\n`},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:`class`,begin:`(`+i.keyword.join(`|`)+`)\\b`,end:/(\{|$)/,excludeEnd:!0,keywords:i,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:`\\.`+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function iM(e){let t=e.regex,n=`abs.accept.alarm.and.atan2.bind.binmode.bless.break.caller.chdir.chmod.chomp.chop.chown.chr.chroot.class.close.closedir.connect.continue.cos.crypt.dbmclose.dbmopen.defined.delete.die.do.dump.each.else.elsif.endgrent.endhostent.endnetent.endprotoent.endpwent.endservent.eof.eval.exec.exists.exit.exp.fcntl.field.fileno.flock.for.foreach.fork.format.formline.getc.getgrent.getgrgid.getgrnam.gethostbyaddr.gethostbyname.gethostent.getlogin.getnetbyaddr.getnetbyname.getnetent.getpeername.getpgrp.getpriority.getprotobyname.getprotobynumber.getprotoent.getpwent.getpwnam.getpwuid.getservbyname.getservbyport.getservent.getsockname.getsockopt.given.glob.gmtime.goto.grep.gt.hex.if.index.int.ioctl.join.keys.kill.last.lc.lcfirst.length.link.listen.local.localtime.log.lstat.lt.ma.map.method.mkdir.msgctl.msgget.msgrcv.msgsnd.my.ne.next.no.not.oct.open.opendir.or.ord.our.pack.package.pipe.pop.pos.print.printf.prototype.push.q|0.qq.quotemeta.qw.qx.rand.read.readdir.readline.readlink.readpipe.recv.redo.ref.rename.require.reset.return.reverse.rewinddir.rindex.rmdir.say.scalar.seek.seekdir.select.semctl.semget.semop.send.setgrent.sethostent.setnetent.setpgrp.setpriority.setprotoent.setpwent.setservent.setsockopt.shift.shmctl.shmget.shmread.shmwrite.shutdown.sin.sleep.socket.socketpair.sort.splice.split.sprintf.sqrt.srand.stat.state.study.sub.substr.symlink.syscall.sysopen.sysread.sysseek.system.syswrite.tell.telldir.tie.tied.time.times.tr.truncate.uc.ucfirst.umask.undef.unless.unlink.unpack.unshift.untie.until.use.utime.values.vec.wait.waitpid.wantarray.warn.when.while.write.x|0.xor.y|0`.split(`.`),r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(` `)},a={className:`subst`,begin:`[$@]\\{`,end:`\\}`,keywords:i},o={begin:/->\{/,end:/\}/},s={scope:`attr`,match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:`variable`,variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,`(?![A-Za-z])(?![@$%])`)},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[s]},l={className:`number`,variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},u=[e.BACKSLASH_ESCAPE,a,c],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(e,n,i=`\\1`)=>{let a=i===`\\1`?i:t.concat(i,n);return t.concat(t.concat(`(?:`,e,`)`),n,/(?:\\.|[^\\\/])*?/,a,/(?:\\.|[^\\\/])*?/,i,r)},p=(e,n,i)=>t.concat(t.concat(`(?:`,e,`)`),n,/(?:\\.|[^\\\/])*?/,i,r),m=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:`string`,contains:u,variants:[{begin:`q[qwxr]?\\s*\\(`,end:`\\)`,relevance:5},{begin:`q[qwxr]?\\s*\\[`,end:`\\]`,relevance:5},{begin:`q[qwxr]?\\s*\\{`,end:`\\}`,relevance:5},{begin:`q[qwxr]?\\s*\\|`,end:`\\|`,relevance:5},{begin:`q[qwxr]?\\s*<`,end:`>`,relevance:5},{begin:`qw\\s+q`,end:`q`,relevance:5},{begin:`'`,end:`'`,contains:[e.BACKSLASH_ESCAPE]},{begin:`"`,end:`"`},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:`-?\\w+\\s*=>`,relevance:0}]},l,{begin:`(\\/\\/|`+e.RE_STARTERS_RE+`|\\b(split|return|print|reverse|grep)\\b)\\s*`,keywords:`split return print reverse grep`,relevance:0,contains:[e.HASH_COMMENT_MODE,{className:`regexp`,variants:[{begin:f(`s|tr|y`,t.either(...d,{capture:!0}))},{begin:f(`s|tr|y`,`\\(`,`\\)`)},{begin:f(`s|tr|y`,`\\[`,`\\]`)},{begin:f(`s|tr|y`,`\\{`,`\\}`)}],relevance:2},{className:`regexp`,variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p(`(?:m|qr)?`,/\//,/\//)},{begin:p(`m|qr`,t.either(...d,{capture:!0}),/\1/)},{begin:p(`m|qr`,/\(/,/\)/)},{begin:p(`m|qr`,/\[/,/\]/)},{begin:p(`m|qr`,/\{/,/\}/)}]}]},{className:`function`,beginKeywords:`sub method`,end:`(\\s*\\(.*?\\))?[;{]`,excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s]},{className:`class`,beginKeywords:`class`,end:`[;{]`,excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s,l]},{begin:`-\\w\\b`,relevance:0},{begin:`^__DATA__$`,end:`^__END__$`,subLanguage:`mojolicious`,contains:[{begin:`^@@.*`,end:`$`,className:`comment`}]}];return a.contains=m,o.contains=m,{name:`Perl`,aliases:[`pl`,`pm`],keywords:i,contains:m}}function aM(e){let t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),a=t.concat(/[A-Z]+/,n),o={scope:`variable`,match:`\\$+`+r},s={scope:`meta`,variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:`subst`,variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},l=e.inherit(e.APOS_STRING_MODE,{illegal:null}),u=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(e,t)=>{t.data._beginMatch=e[1]||e[2]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}},f=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[
|
|
197
197
|
]`,m={scope:`string`,variants:[u,l,d,f]},h={scope:`number`,variants:[{begin:`\\b0[bB][01]+(?:_[01]+)*\\b`},{begin:`\\b0[oO][0-7]+(?:_[0-7]+)*\\b`},{begin:`\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b`},{begin:`(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?`}],relevance:0},g=[`false`,`null`,`true`],_=`__CLASS__.__DIR__.__FILE__.__FUNCTION__.__COMPILER_HALT_OFFSET__.__LINE__.__METHOD__.__NAMESPACE__.__TRAIT__.die.echo.exit.include.include_once.print.require.require_once.array.abstract.and.as.binary.bool.boolean.break.callable.case.catch.class.clone.const.continue.declare.default.do.double.else.elseif.empty.enddeclare.endfor.endforeach.endif.endswitch.endwhile.enum.eval.extends.final.finally.float.for.foreach.from.global.goto.if.implements.instanceof.insteadof.int.integer.interface.isset.iterable.list.match|0.mixed.new.never.object.or.private.protected.public.readonly.real.return.string.switch.throw.trait.try.unset.use.var.void.while.xor.yield`.split(`.`),v=`Error|0.AppendIterator.ArgumentCountError.ArithmeticError.ArrayIterator.ArrayObject.AssertionError.BadFunctionCallException.BadMethodCallException.CachingIterator.CallbackFilterIterator.CompileError.Countable.DirectoryIterator.DivisionByZeroError.DomainException.EmptyIterator.ErrorException.Exception.FilesystemIterator.FilterIterator.GlobIterator.InfiniteIterator.InvalidArgumentException.IteratorIterator.LengthException.LimitIterator.LogicException.MultipleIterator.NoRewindIterator.OutOfBoundsException.OutOfRangeException.OuterIterator.OverflowException.ParentIterator.ParseError.RangeException.RecursiveArrayIterator.RecursiveCachingIterator.RecursiveCallbackFilterIterator.RecursiveDirectoryIterator.RecursiveFilterIterator.RecursiveIterator.RecursiveIteratorIterator.RecursiveRegexIterator.RecursiveTreeIterator.RegexIterator.RuntimeException.SeekableIterator.SplDoublyLinkedList.SplFileInfo.SplFileObject.SplFixedArray.SplHeap.SplMaxHeap.SplMinHeap.SplObjectStorage.SplObserver.SplPriorityQueue.SplQueue.SplStack.SplSubject.SplTempFileObject.TypeError.UnderflowException.UnexpectedValueException.UnhandledMatchError.ArrayAccess.BackedEnum.Closure.Fiber.Generator.Iterator.IteratorAggregate.Serializable.Stringable.Throwable.Traversable.UnitEnum.WeakReference.WeakMap.Directory.__PHP_Incomplete_Class.parent.php_user_filter.self.static.stdClass`.split(`.`),y={keyword:_,literal:(e=>{let t=[];return e.forEach(e=>{t.push(e),e.toLowerCase()===e?t.push(e.toUpperCase()):t.push(e.toLowerCase())}),t})(g),built_in:v},b=e=>e.map(e=>e.replace(/\|\d+$/,``)),x={variants:[{match:[/new/,t.concat(p,`+`),t.concat(`(?!`,b(v).join(`\\b|`),`\\b)`),i],scope:{1:`keyword`,4:`title.class`}}]},S=t.concat(r,`\\b(?!\\()`),C={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),S],scope:{2:`variable.constant`}},{match:[/::/,/class/],scope:{2:`variable.language`}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),S],scope:{1:`title.class`,3:`variable.constant`}},{match:[i,t.concat(`::`,t.lookahead(/(?!class\b)/))],scope:{1:`title.class`}},{match:[i,/::/,/class/],scope:{1:`title.class`,3:`variable.language`}}]},w={scope:`attr`,match:t.concat(r,t.lookahead(`:`),t.lookahead(/(?!::)/))},T={relevance:0,begin:/\(/,end:/\)/,keywords:y,contains:[w,o,C,e.C_BLOCK_COMMENT_MODE,m,h,x]},E={relevance:0,match:[/\b/,t.concat(`(?!fn\\b|function\\b|`,b(_).join(`\\b|`),`|`,b(v).join(`\\b|`),`\\b)`),r,t.concat(p,`*`),t.lookahead(/(?=\()/)],scope:{3:`title.function.invoke`},contains:[T]};T.contains.push(E);let D=[w,C,e.C_BLOCK_COMMENT_MODE,m,h,x],ee={begin:t.concat(/#\[\s*\\?/,t.either(i,a)),beginScope:`meta`,end:/]/,endScope:`meta`,keywords:{literal:g,keyword:[`new`,`array`]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:[`new`,`array`]},contains:[`self`,...D]},...D,{scope:`meta`,variants:[{match:i},{match:a}]}]};return{case_insensitive:!1,keywords:y,contains:[ee,e.HASH_COMMENT_MODE,e.COMMENT(`//`,`$`),e.COMMENT(`/\\*`,`\\*/`,{contains:[{scope:`doctag`,match:`@[A-Za-z]+`}]}),{match:/__halt_compiler\(\);/,keywords:`__halt_compiler`,starts:{scope:`comment`,end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:`meta`,endsParent:!0}]}},s,{scope:`variable.language`,match:/\$this\b/},o,E,C,{match:[/const/,/\s/,r],scope:{1:`keyword`,3:`variable.constant`}},x,{scope:`function`,relevance:0,beginKeywords:`fn function`,end:/[;{]/,excludeEnd:!0,illegal:`[$%\\[]`,contains:[{beginKeywords:`use`},e.UNDERSCORE_TITLE_MODE,{begin:`=>`,endsParent:!0},{scope:`params`,begin:`\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0,keywords:y,contains:[`self`,ee,o,C,e.C_BLOCK_COMMENT_MODE,m,h]}]},{scope:`class`,variants:[{beginKeywords:`enum`,illegal:/[($"]/},{beginKeywords:`class interface trait`,illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:`extends implements`},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:`namespace`,relevance:0,end:`;`,illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:`title.class`})]},{beginKeywords:`use`,relevance:0,end:`;`,contains:[{match:/\b(as|const|function)\b/,scope:`keyword`},e.UNDERSCORE_TITLE_MODE]},m,h]}}function oM(e){return{name:`PHP template`,subLanguage:`xml`,contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:`php`,contains:[{begin:`/\\*`,end:`\\*/`,skip:!0},{begin:`b"`,end:`"`,skip:!0},{begin:`b'`,end:`'`,skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function sM(e){return{name:`Plain text`,aliases:[`text`,`txt`],disableAutodetect:!0}}function cM(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=`and.as.assert.async.await.break.case.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.match.nonlocal|10.not.or.pass.raise.return.try.while.with.yield`.split(`.`),i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:`__import__.abs.all.any.ascii.bin.bool.breakpoint.bytearray.bytes.callable.chr.classmethod.compile.complex.delattr.dict.dir.divmod.enumerate.eval.exec.filter.float.format.frozenset.getattr.globals.hasattr.hash.help.hex.id.input.int.isinstance.issubclass.iter.len.list.locals.map.max.memoryview.min.next.object.oct.open.ord.pow.print.property.range.repr.reversed.round.set.setattr.slice.sorted.staticmethod.str.sum.super.tuple.type.vars.zip`.split(`.`),literal:[`__debug__`,`Ellipsis`,`False`,`None`,`NotImplemented`,`True`],type:[`Any`,`Callable`,`Coroutine`,`Dict`,`List`,`Literal`,`Generic`,`Optional`,`Sequence`,`Set`,`Tuple`,`Type`,`Union`]},a={className:`meta`,begin:/^(>>>|\.\.\.) /},o={className:`subst`,begin:/\{/,end:/\}/,keywords:i,illegal:/#/},s={begin:/\{\{/,relevance:0},c={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,o]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l=`[0-9](_?[0-9])*`,u=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,d=`\\b|${r.join(`|`)}`,f={className:`number`,relevance:0,variants:[{begin:`(\\b(${l})|(${u}))[eE][+-]?(${l})[jJ]?(?=${d})`},{begin:`(${u})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${l})[jJ](?=${d})`}]},p={className:`comment`,begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:`params`,variants:[{className:``,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:[`self`,a,f,c,e.HASH_COMMENT_MODE]}]};return o.contains=[c,f,a],{name:`Python`,aliases:[`py`,`gyp`,`ipython`],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[a,f,{scope:`variable.language`,match:/\bself\b/},{beginKeywords:`if`,relevance:0},{match:/\bor\b/,scope:`keyword`},c,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:`keyword`,3:`title.class`,6:`title.class.inherited`}},{className:`meta`,begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[f,m,c]}]}}function lM(e){return{aliases:[`pycon`],contains:[{className:`meta.prompt`,starts:{end:/ |$/,starts:{end:`$`,subLanguage:`python`}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function uM(e){let t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,a=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:`R`,keywords:{$pattern:n,keyword:`function if in break next repeat else for while`,literal:`NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10`,built_in:`LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm`},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:`doctag`,match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:`doctag`,begin:`@param`,end:/$/,contains:[{scope:`variable`,variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:`doctag`,match:/@[a-zA-Z]+/},{scope:`keyword`,match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:`"`,end:`"`,relevance:0},{begin:`'`,end:`'`,relevance:0}]},{relevance:0,variants:[{scope:{1:`operator`,2:`number`},match:[i,r]},{scope:{1:`operator`,2:`number`},match:[/%[^%]*%/,r]},{scope:{1:`punctuation`,2:`number`},match:[a,r]},{scope:{2:`number`},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:`operator`},match:[n,/\s+/,/<-/,/\s+/]},{scope:`operator`,relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:`punctuation`,relevance:0,match:a},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function dM(e){let t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(r,/(::\w+)*/),a={"variable.constant":[`__FILE__`,`__LINE__`,`__ENCODING__`],"variable.language":[`self`,`super`],keyword:`alias.and.begin.BEGIN.break.case.class.defined.do.else.elsif.end.END.ensure.for.if.in.module.next.not.or.redo.require.rescue.retry.return.then.undef.unless.until.when.while.yield.include.extend.prepend.public.private.protected.raise.throw`.split(`.`),built_in:[`proc`,`lambda`,`attr_accessor`,`attr_reader`,`attr_writer`,`define_method`,`private_constant`,`module_function`],literal:[`true`,`false`,`nil`]},o={className:`doctag`,begin:`@[A-Za-z]+`},s={begin:`#<`,end:`>`},c=[e.COMMENT(`#`,`$`,{contains:[o]}),e.COMMENT(`^=begin`,`^=end`,{contains:[o],relevance:10}),e.COMMENT(`^__END__`,e.MATCH_NOTHING_RE)],l={className:`subst`,begin:/#\{/,end:/\}/,keywords:a},u={className:`string`,contains:[e.BACKSLASH_ESCAPE,l],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,l]})]}]},d=`[0-9](_?[0-9])*`,f={className:`number`,relevance:0,variants:[{begin:`\\b([1-9](_?[0-9])*|0)(\\.(${d}))?([eE][+-]?(${d})|r)?i?\\b`},{begin:`\\b0[dD][0-9](_?[0-9])*r?i?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*r?i?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*r?i?\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b`},{begin:`\\b0(_?[0-7])+r?i?\\b`}]},p={variants:[{match:/\(\)/},{className:`params`,begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},m=[u,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:`title.class`,4:`title.class.inherited`},keywords:a},{match:[/(include|extend)\s+/,i],scope:{2:`title.class`},keywords:a},{relevance:0,match:[i,/\.new[. (]/],scope:{1:`title.class`}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`},{relevance:0,match:r,scope:`title.class`},{match:[/def/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[p]},{begin:e.IDENT_RE+`::`},{className:`symbol`,begin:e.UNDERSCORE_IDENT_RE+`(!|\\?)?:`,relevance:0},{className:`symbol`,begin:`:(?!\\s)`,contains:[u,{begin:n}],relevance:0},f,{className:`variable`,begin:`(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])`},{className:`params`,begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:`(`+e.RE_STARTERS_RE+`|unless)\\s*`,keywords:`unless`,contains:[{className:`regexp`,contains:[e.BACKSLASH_ESCAPE,l],illegal:/\n/,variants:[{begin:`/`,end:`/[a-z]*`},{begin:/%r\{/,end:/\}[a-z]*/},{begin:`%r\\(`,end:`\\)[a-z]*`},{begin:`%r!`,end:`![a-z]*`},{begin:`%r\\[`,end:`\\][a-z]*`}]}].concat(s,c),relevance:0}].concat(s,c);l.contains=m,p.contains=m;let h=[{begin:/^\s*=>/,starts:{end:`$`,contains:m}},{className:`meta.prompt`,begin:`^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])`,starts:{end:`$`,keywords:a,contains:m}}];return c.unshift(s),{name:`Ruby`,aliases:[`rb`,`gemspec`,`podspec`,`thor`,`irb`],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:`ruby`})].concat(h,c,m)}}function fM(e){let t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),a={className:`title.function.invoke`,relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},o=`([ui](8|16|32|64|128|size)|f(32|64))?`,s=`abstract.as.async.await.become.box.break.const.continue.crate.do.dyn.else.enum.extern.false.final.fn.for.if.impl.in.let.loop.macro.match.mod.move.mut.override.priv.pub.ref.return.self.Self.static.struct.super.trait.true.try.type.typeof.union.unsafe.unsized.use.virtual.where.while.yield`.split(`.`),c=[`true`,`false`,`Some`,`None`,`Ok`,`Err`],l=`drop .Copy.Send.Sized.Sync.Drop.Fn.FnMut.FnOnce.ToOwned.Clone.Debug.PartialEq.PartialOrd.Eq.Ord.AsRef.AsMut.Into.From.Default.Iterator.Extend.IntoIterator.DoubleEndedIterator.ExactSizeIterator.SliceConcatExt.ToString.assert!.assert_eq!.bitflags!.bytes!.cfg!.col!.concat!.concat_idents!.debug_assert!.debug_assert_eq!.env!.eprintln!.panic!.file!.format!.format_args!.include_bytes!.include_str!.line!.local_data_key!.module_path!.option_env!.print!.println!.select!.stringify!.try!.unimplemented!.unreachable!.vec!.write!.writeln!.macro_rules!.assert_ne!.debug_assert_ne!`.split(`.`),u=[`i8`,`i16`,`i32`,`i64`,`i128`,`isize`,`u8`,`u16`,`u32`,`u64`,`u128`,`usize`,`f32`,`f64`,`str`,`char`,`bool`,`Box`,`Option`,`Result`,`String`,`Vec`];return{name:`Rust`,aliases:[`rs`],keywords:{$pattern:e.IDENT_RE+`!?`,type:u,keyword:s,literal:c,built_in:l},illegal:`</`,contains:[e.C_LINE_COMMENT_MODE,e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:`symbol`,begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:`string`,variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:`char.escape`,match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:`number`,variants:[{begin:`\\b0b([01_]+)`+o},{begin:`\\b0o([0-7_]+)`+o},{begin:`\\b0x([A-Fa-f0-9_]+)`+o},{begin:`\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)`+o}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:`keyword`,3:`title.function`}},{className:`meta`,begin:`#!?\\[`,end:`\\]`,contains:[{className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:`keyword`,3:`keyword`,4:`variable`}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:`keyword`,3:`variable`,5:`keyword`}},{begin:[/type/,/\s+/,r],className:{1:`keyword`,3:`title.class`}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:`keyword`,3:`title.class`}},{begin:e.IDENT_RE+`::`,keywords:{keyword:`Self`,built_in:l,type:u}},{className:`punctuation`,begin:`->`},a]}}var pM=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),mM=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),hM=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),gM=[...mM,...hM],_M=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),vM=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),yM=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),bM=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function xM(e){let t=pM(e),n=yM,r=vM,i=`@[a-z-]+`,a={className:`variable`,begin:`(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b`,relevance:0};return{name:`SCSS`,case_insensitive:!0,illegal:`[=/|']`,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:`selector-id`,begin:`#[A-Za-z0-9_-]+`,relevance:0},{className:`selector-class`,begin:`\\.[A-Za-z0-9_-]+`,relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:`selector-tag`,begin:`\\b(`+gM.join(`|`)+`)\\b`,relevance:0},{className:`selector-pseudo`,begin:`:(`+r.join(`|`)+`)`},{className:`selector-pseudo`,begin:`:(:)?(`+n.join(`|`)+`)`},a,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+bM.join(`|`)+`)\\b`},{begin:`\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b`},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,a,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:`@(page|font-face)`,keywords:{$pattern:i,keyword:`@page @font-face`}},{begin:`@`,end:`[{;]`,returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:_M.join(` `)},contains:[{begin:i,className:`keyword`},{begin:/[a-z-]+(?=:)/,className:`attribute`},a,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function SM(e){return{name:`Shell Session`,aliases:[`console`,`shellsession`],contains:[{className:`meta.prompt`,begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:`bash`}}]}}function CM(e){let t=e.regex,n=e.COMMENT(`--`,`$`),r={scope:`string`,variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},a=[`true`,`false`,`unknown`],o=[`double precision`,`large object`,`with timezone`,`without timezone`],s=`bigint.binary.blob.boolean.char.character.clob.date.dec.decfloat.decimal.float.int.integer.interval.nchar.nclob.national.numeric.real.row.smallint.time.timestamp.varchar.varying.varbinary`.split(`.`),c=[`add`,`asc`,`collation`,`desc`,`final`,`first`,`last`,`view`],l=`abs.acos.all.allocate.alter.and.any.are.array.array_agg.array_max_cardinality.as.asensitive.asin.asymmetric.at.atan.atomic.authorization.avg.begin.begin_frame.begin_partition.between.bigint.binary.blob.boolean.both.by.call.called.cardinality.cascaded.case.cast.ceil.ceiling.char.char_length.character.character_length.check.classifier.clob.close.coalesce.collate.collect.column.commit.condition.connect.constraint.contains.convert.copy.corr.corresponding.cos.cosh.count.covar_pop.covar_samp.create.cross.cube.cume_dist.current.current_catalog.current_date.current_default_transform_group.current_path.current_role.current_row.current_schema.current_time.current_timestamp.current_path.current_role.current_transform_group_for_type.current_user.cursor.cycle.date.day.deallocate.dec.decimal.decfloat.declare.default.define.delete.dense_rank.deref.describe.deterministic.disconnect.distinct.double.drop.dynamic.each.element.else.empty.end.end_frame.end_partition.end-exec.equals.escape.every.except.exec.execute.exists.exp.external.extract.false.fetch.filter.first_value.float.floor.for.foreign.frame_row.free.from.full.function.fusion.get.global.grant.group.grouping.groups.having.hold.hour.identity.in.indicator.initial.inner.inout.insensitive.insert.int.integer.intersect.intersection.interval.into.is.join.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.language.large.last_value.lateral.lead.leading.left.like.like_regex.listagg.ln.local.localtime.localtimestamp.log.log10.lower.match.match_number.match_recognize.matches.max.member.merge.method.min.minute.mod.modifies.module.month.multiset.national.natural.nchar.nclob.new.no.none.normalize.not.nth_value.ntile.null.nullif.numeric.octet_length.occurrences_regex.of.offset.old.omit.on.one.only.open.or.order.out.outer.over.overlaps.overlay.parameter.partition.pattern.per.percent.percent_rank.percentile_cont.percentile_disc.period.portion.position.position_regex.power.precedes.precision.prepare.primary.procedure.ptf.range.rank.reads.real.recursive.ref.references.referencing.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.release.result.return.returns.revoke.right.rollback.rollup.row.row_number.rows.running.savepoint.scope.scroll.search.second.seek.select.sensitive.session_user.set.show.similar.sin.sinh.skip.smallint.some.specific.specifictype.sql.sqlexception.sqlstate.sqlwarning.sqrt.start.static.stddev_pop.stddev_samp.submultiset.subset.substring.substring_regex.succeeds.sum.symmetric.system.system_time.system_user.table.tablesample.tan.tanh.then.time.timestamp.timezone_hour.timezone_minute.to.trailing.translate.translate_regex.translation.treat.trigger.trim.trim_array.true.truncate.uescape.union.unique.unknown.unnest.update.upper.user.using.value.values.value_of.var_pop.var_samp.varbinary.varchar.varying.versioning.when.whenever.where.width_bucket.window.with.within.without.year`.split(`.`),u=`abs.acos.array_agg.asin.atan.avg.cast.ceil.ceiling.coalesce.corr.cos.cosh.count.covar_pop.covar_samp.cume_dist.dense_rank.deref.element.exp.extract.first_value.floor.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.last_value.lead.listagg.ln.log.log10.lower.max.min.mod.nth_value.ntile.nullif.percent_rank.percentile_cont.percentile_disc.position.position_regex.power.rank.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.row_number.sin.sinh.sqrt.stddev_pop.stddev_samp.substring.substring_regex.sum.tan.tanh.translate.translate_regex.treat.trim.trim_array.unnest.upper.value_of.var_pop.var_samp.width_bucket`.split(`.`),d=[`current_catalog`,`current_date`,`current_default_transform_group`,`current_path`,`current_role`,`current_schema`,`current_transform_group_for_type`,`current_user`,`session_user`,`system_time`,`system_user`,`current_time`,`localtime`,`current_timestamp`,`localtimestamp`],f=[`create table`,`insert into`,`primary key`,`foreign key`,`not null`,`alter table`,`add constraint`,`grouping sets`,`on overflow`,`character set`,`respect nulls`,`ignore nulls`,`nulls first`,`nulls last`,`depth first`,`breadth first`],p=u,m=[...l,...c].filter(e=>!u.includes(e)),h={scope:`variable`,match:/@[a-z0-9][a-z0-9_]*/},g={scope:`operator`,match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},_={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function v(e){return t.concat(/\b/,t.either(...e.map(e=>e.replace(/\s+/,`\\s+`))),/\b/)}let y={scope:`keyword`,match:v(f),relevance:0};function b(e,{exceptions:t,when:n}={}){let r=n;return t||=[],e.map(e=>e.match(/\|\d+$/)||t.includes(e)?e:r(e)?`${e}|0`:e)}return{name:`SQL`,case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:b(m,{when:e=>e.length<3}),literal:a,type:s,built_in:d},contains:[{scope:`type`,match:v(o)},y,_,h,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,g]}}function wM(e){return e?typeof e==`string`?e:e.source:null}function TM(e){return EM(`(?=`,e,`)`)}function EM(...e){return e.map(e=>wM(e)).join(``)}function DM(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function OM(...e){return`(`+(DM(e).capture?``:`?:`)+e.map(e=>wM(e)).join(`|`)+`)`}var kM=e=>EM(/\b/,e,/\w$/.test(e)?/\b/:/\B/),AM=[`Protocol`,`Type`].map(kM),jM=[`init`,`self`].map(kM),MM=[`Any`,`Self`],NM=[`actor`,`any`,`associatedtype`,`async`,`await`,/as\?/,/as!/,`as`,`borrowing`,`break`,`case`,`catch`,`class`,`consume`,`consuming`,`continue`,`convenience`,`copy`,`default`,`defer`,`deinit`,`didSet`,`distributed`,`do`,`dynamic`,`each`,`else`,`enum`,`extension`,`fallthrough`,/fileprivate\(set\)/,`fileprivate`,`final`,`for`,`func`,`get`,`guard`,`if`,`import`,`indirect`,`infix`,/init\?/,/init!/,`inout`,/internal\(set\)/,`internal`,`in`,`is`,`isolated`,`nonisolated`,`lazy`,`let`,`macro`,`mutating`,`nonmutating`,/open\(set\)/,`open`,`operator`,`optional`,`override`,`package`,`postfix`,`precedencegroup`,`prefix`,/private\(set\)/,`private`,`protocol`,/public\(set\)/,`public`,`repeat`,`required`,`rethrows`,`return`,`set`,`some`,`static`,`struct`,`subscript`,`super`,`switch`,`throws`,`throw`,/try\?/,/try!/,`try`,`typealias`,/unowned\(safe\)/,/unowned\(unsafe\)/,`unowned`,`var`,`weak`,`where`,`while`,`willSet`],PM=[`false`,`nil`,`true`],FM=[`assignment`,`associativity`,`higherThan`,`left`,`lowerThan`,`none`,`right`],IM=[`#colorLiteral`,`#column`,`#dsohandle`,`#else`,`#elseif`,`#endif`,`#error`,`#file`,`#fileID`,`#fileLiteral`,`#filePath`,`#function`,`#if`,`#imageLiteral`,`#keyPath`,`#line`,`#selector`,`#sourceLocation`,`#warning`],LM=`abs.all.any.assert.assertionFailure.debugPrint.dump.fatalError.getVaList.isKnownUniquelyReferenced.max.min.numericCast.pointwiseMax.pointwiseMin.precondition.preconditionFailure.print.readLine.repeatElement.sequence.stride.swap.swift_unboxFromSwiftValueWithType.transcode.type.unsafeBitCast.unsafeDowncast.withExtendedLifetime.withUnsafeMutablePointer.withUnsafePointer.withVaList.withoutActuallyEscaping.zip`.split(`.`),RM=OM(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),zM=OM(RM,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),BM=EM(RM,zM,`*`),VM=OM(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),HM=OM(VM,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),UM=EM(VM,HM,`*`),WM=EM(/[A-Z]/,HM,`*`),GM=[`attached`,`autoclosure`,EM(/convention\(/,OM(`swift`,`block`,`c`),/\)/),`discardableResult`,`dynamicCallable`,`dynamicMemberLookup`,`escaping`,`freestanding`,`frozen`,`GKInspectable`,`IBAction`,`IBDesignable`,`IBInspectable`,`IBOutlet`,`IBSegueAction`,`inlinable`,`main`,`nonobjc`,`NSApplicationMain`,`NSCopying`,`NSManaged`,EM(/objc\(/,UM,/\)/),`objc`,`objcMembers`,`propertyWrapper`,`requires_stored_property_inits`,`resultBuilder`,`Sendable`,`testable`,`UIApplicationMain`,`unchecked`,`unknown`,`usableFromInline`,`warn_unqualified_access`],KM=[`iOS`,`iOSApplicationExtension`,`macOS`,`macOSApplicationExtension`,`macCatalyst`,`macCatalystApplicationExtension`,`watchOS`,`watchOSApplicationExtension`,`tvOS`,`tvOSApplicationExtension`,`swift`];function qM(e){let t={match:/\s+/,relevance:0},n=e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,OM(...AM,...jM)],className:{2:`keyword`}},a={match:EM(/\./,OM(...NM)),relevance:0},o=NM.filter(e=>typeof e==`string`).concat([`_|0`]),s={variants:[{className:`keyword`,match:OM(...NM.filter(e=>typeof e!=`string`).concat(MM).map(kM),...jM)}]},c={$pattern:OM(/\b\w+/,/#\w+/),keyword:o.concat(IM),literal:PM},l=[i,a,s],u=[{match:EM(/\./,OM(...LM)),relevance:0},{className:`built_in`,match:EM(/\b/,OM(...LM),/(?=\()/)}],d={match:/->/,relevance:0},f=[d,{className:`operator`,relevance:0,variants:[{match:BM},{match:`\\.(\\.|${zM})+`}]}],p=`([0-9]_*)+`,m=`([0-9a-fA-F]_*)+`,h={className:`number`,relevance:0,variants:[{match:`\\b(${p})(\\.(${p}))?([eE][+-]?(${p}))?\\b`},{match:`\\b0x(${m})(\\.(${m}))?([pP][+-]?(${p}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},g=(e=``)=>({className:`subst`,variants:[{match:EM(/\\/,e,/[0\\tnr"']/)},{match:EM(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),_=(e=``)=>({className:`subst`,match:EM(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),v=(e=``)=>({className:`subst`,label:`interpol`,begin:EM(/\\/,e,/\(/),end:/\)/}),y=(e=``)=>({begin:EM(e,/"""/),end:EM(/"""/,e),contains:[g(e),_(e),v(e)]}),b=(e=``)=>({begin:EM(e,/"/),end:EM(/"/,e),contains:[g(e),v(e)]}),x={className:`string`,variants:[y(),y(`#`),y(`##`),y(`###`),b(),b(`#`),b(`##`),b(`###`)]},S=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],C={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:S},w=e=>{let t=EM(e,/\//),n=EM(/\//,e);return{begin:t,end:n,contains:[...S,{scope:`comment`,begin:`#(?!.*${n})`,end:/$/}]}},T={scope:`regexp`,variants:[w(`###`),w(`##`),w(`#`),C]},E={match:EM(/`/,UM,/`/)},D=[E,{className:`variable`,match:/\$\d+/},{className:`variable`,match:`\\$${HM}+`}],ee=[{match:/(@|#(un)?)available/,scope:`keyword`,starts:{contains:[{begin:/\(/,end:/\)/,keywords:KM,contains:[...f,h,x]}]}},{scope:`keyword`,match:EM(/@/,OM(...GM),TM(OM(/\(/,/\s+/)))},{scope:`meta`,match:EM(/@/,UM)}],O={match:TM(/\b[A-Z]/),relevance:0,contains:[{className:`type`,match:EM(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,HM,`+`)},{className:`type`,match:WM,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:EM(/\s+&\s+/,TM(WM)),relevance:0}]},k={begin:/</,end:/>/,keywords:c,contains:[...r,...l,...ee,d,O]};O.contains.push(k);let A={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:[`self`,{match:EM(UM,/\s*:/),keywords:`_|0`,relevance:0},...r,T,...l,...u,...f,h,x,...D,...ee,O]},j={begin:/</,end:/>/,keywords:`repeat each`,contains:[...r,O]},M={begin:/\(/,end:/\)/,keywords:c,contains:[{begin:OM(TM(EM(UM,/\s*:/)),TM(EM(UM,/\s+/,UM,/\s*:/))),end:/:/,relevance:0,contains:[{className:`keyword`,match:/\b_\b/},{className:`params`,match:UM}]},...r,...l,...f,h,x,...ee,O,A],endsParent:!0,illegal:/["']/},N={match:[/(func|macro)/,/\s+/,OM(E.match,UM,BM)],className:{1:`keyword`,3:`title.function`},contains:[j,M,t],illegal:[/\[/,/%/]},P={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:`keyword`},contains:[j,M,t],illegal:/\[|%/},F={match:[/operator/,/\s+/,BM],className:{1:`keyword`,3:`title`}},I={begin:[/precedencegroup/,/\s+/,WM],className:{1:`keyword`,3:`title`},contains:[O],keywords:[...FM,...PM],end:/}/},L={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:`keyword`,3:`keyword`,5:`title.function`}},te={match:[/class\b/,/\s+/,/var\b/],scope:{1:`keyword`,3:`keyword`}},R={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,UM,/\s*/],beginScope:{1:`keyword`,3:`title.class`},keywords:c,contains:[j,...l,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:`title.class.inherited`,match:WM},...l],relevance:0}]};for(let e of x.variants){let t=e.contains.find(e=>e.label===`interpol`);t.keywords=c;let n=[...l,...u,...f,h,x,...D];t.contains=[...n,{begin:/\(/,end:/\)/,contains:[`self`,...n]}]}return{name:`Swift`,keywords:c,contains:[...r,N,P,L,te,R,F,I,{beginKeywords:`import`,end:/$/,contains:[...r],relevance:0},T,...l,...u,...f,h,x,...D,...ee,O,A]}}var JM=`[A-Za-z$_][0-9A-Za-z$_]*`,YM=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),XM=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],ZM=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),QM=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],$M=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],eN=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],tN=[].concat($M,ZM,QM);function nN(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=JM,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:JM,keyword:YM,literal:XM,built_in:tN,"variable.language":eN},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:r+`(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...ZM,...QM]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let ee={match:t.concat(/\b/,D([...$M,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},O={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},k={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},A=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,j={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},j,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:A,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},O,{match:`\\$`+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},ee,E,S,k,{match:/\$[(.]/}]}}function rN(e){let t=e.regex,n=nN(e),r=JM,i=[`any`,`void`,`number`,`boolean`,`string`,`object`,`never`,`symbol`,`bigint`,`unknown`],a={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:`keyword`,3:`title.class`}},o={beginKeywords:`interface`,end:/\{/,excludeEnd:!0,keywords:{keyword:`interface extends`,built_in:i},contains:[n.exports.CLASS_REFERENCE]},s={className:`meta`,relevance:10,begin:/^\s*['"]use strict['"]/},c={$pattern:JM,keyword:YM.concat([`type`,`interface`,`public`,`private`,`protected`,`implements`,`declare`,`abstract`,`readonly`,`enum`,`override`,`satisfies`]),literal:XM,built_in:tN.concat(i),"variable.language":eN},l={className:`meta`,begin:`@`+r},u=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(r===-1)throw Error(`can not find mode to replace`);e.contains.splice(r,1,n)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(l);let d=n.contains.find(e=>e.scope===`attr`),f=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([l,a,o,f]),u(n,`shebang`,e.SHEBANG()),u(n,`use_strict`,s);let p=n.contains.find(e=>e.label===`func.def`);return p.relevance=0,Object.assign(n,{name:`TypeScript`,aliases:[`ts`,`tsx`,`mts`,`cts`]}),n}function iN(e){let t=e.regex,n={className:`string`,begin:/"(""|[^/n])"C\b/},r={className:`string`,begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,s=/\d{1,2}(:\d{1,2}){1,2}/,c={className:`literal`,variants:[{begin:t.concat(/# */,t.either(a,i),/ *#/)},{begin:t.concat(/# */,s,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(a,i),/ +/,t.either(o,s),/ *#/)}]},l={className:`number`,relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:`label`,begin:/^\w+:/},d=e.COMMENT(/'''/,/$/,{contains:[{className:`doctag`,begin:/<\/?/,end:/>/}]}),f=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:`Visual Basic .NET`,aliases:[`vb`],case_insensitive:!0,classNameAliases:{label:`symbol`},keywords:{keyword:`addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield`,built_in:`addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort`,type:`boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort`,literal:`true false nothing`},illegal:`//|\\{|\\}|endif|gosub|variant|wend|^\\$ `,contains:[n,r,c,l,u,d,f,{className:`meta`,begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:`const disable else elseif enable end externalsource if region then`},contains:[f]}]}}function aN(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);return t.contains.push(`self`),{name:`WebAssembly`,keywords:{$pattern:/[\w.]+/,keyword:`anyfunc,block,br,br_if,br_table,call,call_indirect,data,drop,elem,else,end,export,func,global.get,global.set,local.get,local.set,local.tee,get_global,get_local,global,if,import,local,loop,memory,memory.grow,memory.size,module,mut,nop,offset,param,result,return,select,set_global,set_local,start,table,tee_local,then,type,unreachable`.split(`,`)},contains:[e.COMMENT(/;;/,/$/),t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:`keyword`,3:`operator`}},{className:`variable`,begin:/\$[\w_]+/},{match:/(\((?!;)|\))+/,className:`punctuation`,relevance:0},{begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:`keyword`,3:`title.function`}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/,className:`type`},{className:`keyword`,match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/},{className:`number`,relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/}]}}function oN(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:`symbol`,begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:`keyword`,begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(a,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:`string`}),c=e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:`attr`,begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:`string`,endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:`HTML, XML`,aliases:[`html`,`xhtml`,`rss`,`atom`,`xjb`,`xsd`,`xsl`,`plist`,`wsf`,`svg`],case_insensitive:!0,unicodeRegex:!0,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,relevance:10,contains:[a,c,s,o,{begin:/\[/,end:/\]/,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,contains:[a,o,c,s]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:`meta`,end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:`tag`,begin:/<style(?=\s|>)/,end:/>/,keywords:{name:`style`},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:[`css`,`xml`]}},{className:`tag`,begin:/<script(?=\s|>)/,end:/>/,keywords:{name:`script`},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:[`javascript`,`handlebars`,`xml`]}},{className:`tag`,begin:/<>|<\/>/},{className:`tag`,begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:`name`,begin:n,relevance:0,starts:l}]},{className:`tag`,begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:`name`,begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function sN(e){let t=`true false yes no null`,n=`[\\w#;/?:@&=+$,.~*'()[\\]]+`,r={className:`attr`,variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:`template-variable`,variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},a={className:`string`,relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:`char.escape`,relevance:0}]},o={className:`string`,relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},s=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),c={className:`number`,begin:`\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b`},l={end:`,`,endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},u={begin:/\{/,end:/\}/,contains:[l],illegal:`\\n`,relevance:0},d={begin:`\\[`,end:`\\]`,contains:[l],illegal:`\\n`,relevance:0},f=[r,{className:`meta`,begin:`^---\\s*$`,relevance:10},{className:`string`,begin:`[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*`},{begin:`<%[%=-]?`,end:`[%-]?%>`,subLanguage:`ruby`,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:`!\\w+!`+n},{className:`type`,begin:`!<`+n+`>`},{className:`type`,begin:`!`+n},{className:`type`,begin:`!!`+n},{className:`meta`,begin:`&`+e.UNDERSCORE_IDENT_RE+`$`},{className:`meta`,begin:`\\*`+e.UNDERSCORE_IDENT_RE+`$`},{className:`bullet`,begin:`-(?=[ ]|$)`,relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},c,{className:`number`,begin:e.C_NUMBER_RE+`\\b`,relevance:0},u,d,a,o],p=[...f];return p.pop(),p.push(s),l.contains=p,{name:`YAML`,case_insensitive:!0,aliases:[`yml`],contains:f}}var cN={arduino:aj,bash:oj,c:sj,cpp:cj,csharp:lj,css:vj,diff:yj,go:bj,graphql:xj,ini:Sj,java:Oj,javascript:Lj,json:Rj,kotlin:Uj,less:$j,lua:eM,makefile:tM,markdown:nM,objectivec:rM,perl:iM,php:aM,"php-template":oM,plaintext:sM,python:cM,"python-repl":lM,r:uM,ruby:dM,rust:fM,scss:xM,shell:SM,sql:CM,swift:qM,typescript:rN,vbnet:iN,wasm:aN,xml:oN,yaml:sN},lN={},uN=`hljs-`;function dN(e){let t=TS.newInstance();return e&&a(e),{highlight:n,highlightAuto:r,listLanguages:i,register:a,registerAlias:o,registered:s};function n(e,n,r){let i=r||lN,a=typeof i.prefix==`string`?i.prefix:uN;if(!t.getLanguage(e))throw Error("Unknown language: `"+e+"` is not registered");t.configure({__emitter:fN,classPrefix:a});let o=t.highlight(n,{ignoreIllegals:!0,language:e});if(o.errorRaised)throw Error("Could not highlight with `Highlight.js`",{cause:o.errorRaised});let s=o._emitter.root,c=s.data;return c.language=o.language,c.relevance=o.relevance,s}function r(e,r){let a=(r||lN).subset||i(),o=-1,s=0,c;for(;++o<a.length;){let i=a[o];if(!t.getLanguage(i))continue;let l=n(i,e,r);l.data&&l.data.relevance!==void 0&&l.data.relevance>s&&(s=l.data.relevance,c=l)}return c||{type:`root`,children:[],data:{language:void 0,relevance:s}}}function i(){return t.listLanguages()}function a(e,n){if(typeof e==`string`)t.registerLanguage(e,n);else{let n;for(n in e)Object.hasOwn(e,n)&&t.registerLanguage(n,e[n])}}function o(e,n){if(typeof e==`string`)t.registerAliases(typeof n==`string`?n:[...n],{languageName:e});else{let n;for(n in e)if(Object.hasOwn(e,n)){let r=e[n];t.registerAliases(typeof r==`string`?r:[...r],{languageName:n})}}}function s(e){return!!t.getLanguage(e)}}var fN=class{constructor(e){this.options=e,this.root={type:`root`,children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e===``)return;let t=this.stack[this.stack.length-1],n=t.children[t.children.length-1];n&&n.type===`text`?n.value+=e:t.children.push({type:`text`,value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,t){let n=this.stack[this.stack.length-1],r=e.root.children;t?n.children.push({type:`element`,tagName:`span`,properties:{className:[t]},children:r}):n.children.push(...r)}openNode(e){let t=this,n=e.split(`.`).map(function(e,n){return n?e+`_`.repeat(n):t.options.classPrefix+e}),r=this.stack[this.stack.length-1],i={type:`element`,tagName:`span`,properties:{className:n},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return``}},pN={key:0,class:`tt-toolbar`},mN={class:`tt-toolbar__group`},hN=[`title`],gN=[`title`],_N=[`title`],vN=[`title`],yN=[`title`],bN={class:`tt-toolbar__group`},xN=[`title`],SN=[`title`],CN=[`title`],wN={class:`tt-toolbar__group`},TN=[`title`],EN=[`title`],DN=[`title`],ON={class:`tt-toolbar__group`},kN=[`title`],AN=[`title`],jN=[`title`],MN=[`title`],NN={class:`tt-toolbar__group`},PN=[`title`,`disabled`],FN=[`title`,`disabled`],IN={class:`tt-content-wrap`},LN=[`onMousedown`,`onMouseenter`],RN=288,zN=6,BN=ze(z({__name:`TiptapEditor`,props:{modelValue:{},placeholder:{default:`Write something...`},editable:{type:Boolean,default:!0},markdown:{type:Boolean,default:!1},minHeight:{default:`200px`},maxHeight:{default:`400px`},mentions:{default:()=>[]},handleFiles:{},attachmentSrc:{}},emits:[`update:modelValue`,`link-click`],setup(e,{expose:t,emit:n}){let a=dN(cN),o=e,s=n;function c(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}let l=uh.create({name:`mentionBadges`,addProseMirrorPlugins(){let e=e=>{let t=o.mentions.map(e=>e.label).filter(Boolean);if(!t.length)return Hu.empty;let n=[...t].sort((e,t)=>t.length-e.length).map(c).join(`|`),r=RegExp(`(^|[\\s([>])@(${n})(?![\\p{L}\\p{N}._'-])`,`gu`),i=[];return e.descendants((e,t)=>{if(!e.isText||!e.text)return;let n=e.text;r.lastIndex=0;let a;for(;(a=r.exec(n))!==null;){let e=t+a.index+(a[1]??``).length,n=e+1+(a[2]??``).length;i.push(zu.inline(e,n,{class:`tt-mention`}))}}),Hu.create(e,i)};return[new lo({props:{decorations(t){return e(t.doc)}}})]}}),u=uh.create({name:`mentionKeymap`,priority:1e3,addKeyboardShortcuts(){let e=e=>()=>w.value?(ee(e),!0):!1,t=()=>!w.value||!T.value&&!_.value?!1:(O(),!0);return{Escape:()=>w.value?(E(),!0):!1,ArrowDown:e(1),ArrowUp:e(-1),Enter:t,Tab:t}}});function d(e){return e?Array.from(e.files??[]):[]}let f=new Set,p=bS.extend({addNodeView(){let e=this.options.HTMLAttributes??{};return({node:t,HTMLAttributes:n})=>{let r=document.createElement(`img`);for(let[t,i]of Object.entries({...e,...n}))i!=null&&t!==`src`&&r.setAttribute(t,String(i));r.classList.add(`tt-img`);let i=rj(t.attrs.src);if(!i)return typeof t.attrs.src==`string`&&(r.src=t.attrs.src),{dom:r};r.dataset.attachmentId=i;let a=()=>{let e=o.attachmentSrc?.get(i);if(e){r.src=e,r.classList.remove(`tt-img--pending`);return}r.removeAttribute(`src`),r.classList.add(`tt-img--pending`)};return a(),f.add(a),{dom:r,destroy:()=>{f.delete(a)}}}}});C(()=>o.attachmentSrc,()=>{for(let e of f)e()},{deep:!0});let m=Ih({content:o.modelValue,editable:o.editable,extensions:[u,l,hS.configure({codeBlock:!1,link:{openOnClick:!1,autolink:!1,isAllowedUri:e=>{if(typeof e!=`string`)return!1;if(e.startsWith(`#wiki:`)||e.startsWith(`wiki:`)||e.startsWith(`#`))return!0;try{let t=new URL(e,window.location.origin);return[`http:`,`https:`,`mailto:`].includes(t.protocol)}catch{return!1}},HTMLAttributes:{class:`tt-link`,rel:`noopener`,target:null}}}),gS.configure({placeholder:o.placeholder}),_S,vS.configure({nested:!0}),p.configure({inline:!0,allowBase64:!0}),xS.configure({types:[`heading`,`paragraph`]}),wS.configure({multicolor:!0}),MS.configure({lowlight:a}),tj.configure({html:!0,tightLists:!0,linkify:!0,breaks:!0})],onSelectionUpdate({editor:e}){D(e)},onBlur(){E()},onUpdate({editor:e}){D(e);let t=o.markdown?e.storage.markdown.getMarkdown():e.getHTML();s(`update:modelValue`,t)},editorProps:{handlePaste(e,t){let n=d(t.clipboardData);return!n.length||!o.handleFiles?!1:(o.handleFiles(n),!0)},handleDrop(e,t){let n=d(t.dataTransfer);return!n.length||!o.handleFiles?!1:(t.preventDefault(),o.handleFiles(n),!0)},handleDOMEvents:{mousedown(e,t){let n=t.target?.closest(`a`);return!n||!n.getAttribute(`href`)?!1:(t.preventDefault(),!0)},auxclick(e,t){let n=t.target?.closest(`a`);return!n||!n.getAttribute(`href`)?!1:(t.preventDefault(),t.stopPropagation(),!0)},click(e,t){let n=t.target?.closest(`a`);if(!n)return!1;let r=n.getAttribute(`href`)??``;return r?(t.preventDefault(),t.stopPropagation(),s(`link-click`,r,t),!0):!1}}}}),h=i(null),g=i(0),_=i(!1),v=i({top:0,left:0}),y=/(?:^|[\s([>])@([\p{L}\p{N}._'-]*(?: [\p{L}\p{N}._'-]*)?)$/u;function x(e){return e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toLowerCase()}let S=R(()=>{if(h.value===null)return[];let e=x(h.value.trim());return o.mentions.filter(t=>!e||x(t.label).includes(e)).slice(0,zN)}),w=R(()=>h.value!==null&&S.value.length>0),T=R(()=>w.value&&(h.value??``).trim().length>0);function E(){h.value=null,g.value=0,_.value=!1}function D(e){if(!o.mentions.length||!o.editable){E();return}try{let t=e.state.selection;if(!t.empty){E();return}let n=t.from-Math.min(t.$from.parentOffset,60),r=e.state.doc.textBetween(n,t.from,`
|
|
198
|
-
`,``),i=y.exec(r);if(!i){E();return}let a=e.view.coordsAtPos(t.from),o=Math.max(8,window.innerWidth-RN-8);v.value={top:a.bottom+4,left:Math.min(Math.max(8,a.left),o)},h.value===null&&(g.value=0),h.value!==(i[1]??``)&&(_.value=!1),h.value=i[1]??``}catch{E()}}function ee(e){let t=S.value.length;t&&(_.value=!0,g.value=(g.value+e+t)%t)}function O(e){let t=m.value,n=e??S.value[g.value];if(!t||!n||h.value===null)return;let r=t.state.selection.from,i=r-h.value.length-1;E(),t.chain().focus().insertContentAt({from:i,to:r},`@${n.label} `).run()}C(()=>o.modelValue,e=>{if(!m.value)return;let t=m.value;(o.markdown?t.storage.markdown.getMarkdown():t.getHTML())!==e&&t.commands.setContent(e??``,{emitUpdate:!1})}),C(()=>o.mentions,()=>{let e=m.value;e&&e.view.dispatch(e.state.tr)},{deep:!0}),C(()=>o.editable,e=>{m.value?.setEditable(e)}),re(()=>m.value?.destroy());function k(e){m.value?.chain().focus().setImage({src:e}).run()}function A(){let e=m.value;if(!e)return;let t=e.getAttributes(`link`).href,n=window.prompt(`URL du lien`,t??`https://`);if(n!==null){if(n===``){e.chain().focus().extendMarkRange(`link`).unsetLink().run();return}e.chain().focus().extendMarkRange(`link`).setLink({href:n}).run()}}function j(e,t){let n=m.value;if(!n)return;let r=`#wiki:${e}`;n.state.selection.empty?n.chain().focus().insertContent({type:`text`,text:t,marks:[{type:`link`,attrs:{href:r}}]}).run():n.chain().focus().extendMarkRange(`link`).setLink({href:r}).run()}function F(){m.value?.commands.focus()}t({insertImage:k,insertWikiLink:j,promptExternalLink:A,focus:F});let{t:L}=He();return(t,n)=>r(m)?(B(),N(`div`,{key:0,class:I([`tt`,{"tt--readonly":!e.editable}]),style:ie({"--tt-min-h":e.minHeight,"--tt-max-h":e.maxHeight})},[e.editable?(B(),N(`div`,pN,[M(`div`,mN,[M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`bold`)}]),title:r(L)(`tiptapEditor.bold`),onClick:n[0]||=e=>r(m).chain().focus().toggleBold().run()},[...n[18]||=[M(`b`,null,`B`,-1)]],10,hN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`italic`)}]),title:r(L)(`tiptapEditor.italic`),onClick:n[1]||=e=>r(m).chain().focus().toggleItalic().run()},[...n[19]||=[M(`i`,null,`I`,-1)]],10,gN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`underline`)}]),title:r(L)(`tiptapEditor.underline`),onClick:n[2]||=e=>r(m).chain().focus().toggleUnderline().run()},[...n[20]||=[M(`u`,null,`U`,-1)]],10,_N),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`strike`)}]),title:r(L)(`tiptapEditor.strikethrough`),onClick:n[3]||=e=>r(m).chain().focus().toggleStrike().run()},[...n[21]||=[M(`s`,null,`S`,-1)]],10,vN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`highlight`)}]),title:r(L)(`tiptapEditor.highlight`),onClick:n[4]||=e=>r(m).chain().focus().toggleHighlight().run()},[...n[22]||=[M(`i`,{class:`ti ti-palette`},null,-1)]],10,yN)]),n[33]||=M(`span`,{class:`tt-toolbar__sep`},null,-1),M(`div`,bN,[M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`heading`,{level:1})}]),title:r(L)(`tiptapEditor.heading1`),onClick:n[5]||=e=>r(m).chain().focus().toggleHeading({level:1}).run()},`H1`,10,xN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`heading`,{level:2})}]),title:r(L)(`tiptapEditor.heading2`),onClick:n[6]||=e=>r(m).chain().focus().toggleHeading({level:2}).run()},`H2`,10,SN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`heading`,{level:3})}]),title:r(L)(`tiptapEditor.heading3`),onClick:n[7]||=e=>r(m).chain().focus().toggleHeading({level:3}).run()},`H3`,10,CN)]),n[34]||=M(`span`,{class:`tt-toolbar__sep`},null,-1),M(`div`,wN,[M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`bulletList`)}]),title:r(L)(`tiptapEditor.bulletList`),onClick:n[8]||=e=>r(m).chain().focus().toggleBulletList().run()},[...n[23]||=[M(`i`,{class:`ti ti-list`},null,-1)]],10,TN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`orderedList`)}]),title:r(L)(`tiptapEditor.orderedList`),onClick:n[9]||=e=>r(m).chain().focus().toggleOrderedList().run()},[...n[24]||=[M(`i`,{class:`ti ti-list-check`},null,-1)]],10,EN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`taskList`)}]),title:r(L)(`tiptapEditor.taskList`),onClick:n[10]||=e=>r(m).chain().focus().toggleTaskList().run()},[...n[25]||=[M(`i`,{class:`ti ti-square-check`},null,-1)]],10,DN)]),n[35]||=M(`span`,{class:`tt-toolbar__sep`},null,-1),M(`div`,ON,[M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`blockquote`)}]),title:r(L)(`tiptapEditor.quote`),onClick:n[11]||=e=>r(m).chain().focus().toggleBlockquote().run()},[...n[26]||=[M(`i`,{class:`ti ti-message`},null,-1)]],10,kN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`code`)}]),title:r(L)(`tiptapEditor.inlineCode`),onClick:n[12]||=e=>r(m).chain().focus().toggleCode().run()},[...n[27]||=[M(`i`,{class:`ti ti-code`},null,-1)]],10,AN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`codeBlock`)}]),title:r(L)(`tiptapEditor.codeBlock`),onClick:n[13]||=e=>r(m).chain().focus().toggleCodeBlock().run()},`</>`,10,jN),M(`button`,{class:`tt-btn`,title:r(L)(`tiptapEditor.horizontalRule`),onClick:n[14]||=e=>r(m).chain().focus().setHorizontalRule().run()},[...n[28]||=[M(`i`,{class:`ti ti-minus`},null,-1)]],8,MN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`link`)}]),title:`Lien`,onClick:A},[...n[29]||=[M(`i`,{class:`ti ti-link`},null,-1)]],2),r(m).isActive(`link`)?(B(),N(`button`,{key:0,class:`tt-btn`,title:`Supprimer le lien`,onClick:n[15]||=e=>r(m).chain().focus().extendMarkRange(`link`).unsetLink().run()},[...n[30]||=[M(`i`,{class:`ti ti-x`},null,-1)]])):G(``,!0)]),n[36]||=M(`span`,{class:`tt-toolbar__sep`},null,-1),M(`div`,NN,[M(`button`,{class:`tt-btn`,title:r(L)(`tiptapEditor.undo`),disabled:!r(m).can().undo(),onClick:n[16]||=e=>r(m).chain().focus().undo().run()},[...n[31]||=[M(`i`,{class:`ti ti-arrow-back-up`},null,-1)]],8,PN),M(`button`,{class:`tt-btn`,title:r(L)(`tiptapEditor.redo`),disabled:!r(m).can().redo(),onClick:n[17]||=e=>r(m).chain().focus().redo().run()},[...n[32]||=[M(`i`,{class:`ti ti-refresh`},null,-1)]],8,FN)])])):G(``,!0),M(`div`,IN,[b(r(Fh),{editor:r(m),class:`tt-content`},null,8,[`editor`]),(B(),W(ue,{to:`body`},[w.value?(B(),N(`ul`,{key:0,class:`tt-mentions`,style:ie({top:`${v.value.top}px`,left:`${v.value.left}px`})},[(B(!0),N(V,null,P(S.value,(e,t)=>(B(),N(`li`,{key:e.id,class:I([`tt-mentions__item`,{"tt-mentions__item--active":t===g.value}]),onMousedown:he(t=>O(e),[`prevent`]),onMouseenter:e=>g.value=t},U(e.label),43,LN))),128))],4)):G(``,!0)]))])],6)):G(``,!0)}}),[[`__scopeId`,`data-v-52e2b22a`]]);function VN(e){return/^(https?:|mailto:)/i.test(e)?(window.open(e,`_blank`,`noopener,noreferrer`),!0):!1}var HN={class:`wizard-intro`},UN={class:`wizard-steps`},WN={class:`wizard-step__head`},GN={class:`wizard-step__index`},KN={class:`wizard-step__key`},qN={class:`wizard-step__origin`},JN={key:0},YN=[`onClick`],XN=ze(z({__name:`MissingVariablesWizard`,props:{visible:{type:Boolean},missing:{}},emits:[`update:visible`],setup(e,{emit:t}){let n=e,a=t,{t:o}=He(),s=De(),c=Ot(),l=g({}),u=g({}),d=i(!1);C(()=>n.missing,e=>{for(let e of Object.keys(l))delete l[e];for(let e of Object.keys(u))delete u[e];for(let t of e)l[t.variableId]=``},{immediate:!0});let f=R(()=>n.missing.length>0&&n.missing.every(e=>(l[e.variableId]??``).trim()!==``));function p(e){d.value||a(`update:visible`,e)}async function m(){if(f.value&&!d.value){d.value=!0;try{for(let e of n.missing)await c.fillVariable(e.environmentId,e.variableId,l[e.variableId],e.reason);a(`update:visible`,!1)}catch(e){s.add({severity:`error`,summary:o(`common.error`),detail:e.message??o(`missingVariables.saveError`),life:5e3})}finally{d.value=!1}}}return(t,n)=>(B(),W(r(Ne),{visible:e.visible,modal:``,closable:!d.value,header:r(o)(`missingVariables.title`),style:{width:`38rem`,maxWidth:`95vw`},"onUpdate:visible":p},{footer:H(()=>[b(r(Le),{label:r(o)(`actions.cancel`),variant:`text`,disabled:d.value,onClick:n[0]||=e=>p(!1)},null,8,[`label`,`disabled`]),b(r(Le),{label:r(o)(`missingVariables.save`),loading:d.value,disabled:!f.value,onClick:m},null,8,[`label`,`loading`,`disabled`])]),default:H(()=>[M(`p`,HN,U(r(o)(`missingVariables.intro`,{count:e.missing.length})),1),M(`div`,UN,[(B(!0),N(V,null,P(e.missing,(t,n)=>(B(),N(`div`,{key:t.variableId,class:`wizard-step`},[M(`div`,WN,[M(`span`,GN,U(n+1)+`/`+U(e.missing.length),1),M(`code`,KN,U(t.key),1),b(r(Ae),{value:t.reason===`overrideOnly`?r(o)(`missingVariables.reasonOverrideOnly`):r(o)(`missingVariables.reasonRequired`),severity:t.reason===`overrideOnly`?`info`:`warn`},null,8,[`value`,`severity`])]),t.description?(B(),W(r(BN),{key:0,class:`wizard-step__description`,"model-value":t.description,markdown:``,editable:!1,"min-height":`0`,"max-height":`none`,onLinkClick:r(VN)},null,8,[`model-value`,`onLinkClick`])):G(``,!0),M(`p`,qN,[x(U(r(o)(`missingVariables.definedIn`,{environment:t.environmentName}))+` `,1),t.reason===`overrideOnly`?(B(),N(`span`,JN,` — `+U(r(o)(`missingVariables.machineOnly`)),1)):G(``,!0)]),b(r(Ce),{modelValue:l[t.variableId],"onUpdate:modelValue":e=>l[t.variableId]=e,type:t.isSecret&&!u[t.variableId]?`password`:`text`,class:`wizard-step__input`,disabled:d.value,placeholder:r(o)(`missingVariables.valuePlaceholder`),onKeydown:me(m,[`enter`])},null,8,[`modelValue`,`onUpdate:modelValue`,`type`,`disabled`,`placeholder`]),t.isSecret?(B(),N(`button`,{key:1,type:`button`,class:`wizard-step__reveal`,onClick:e=>u[t.variableId]=!u[t.variableId]},[M(`i`,{class:I(u[t.variableId]?`ti ti-eye-off`:`ti ti-eye`)},null,2),x(` `+U(u[t.variableId]?r(o)(`missingVariables.hide`):r(o)(`missingVariables.reveal`)),1)],8,YN)):G(``,!0)]))),128))])]),_:1},8,[`visible`,`closable`,`header`]))}}),[[`__scopeId`,`data-v-ada005d3`]]),ZN=[`src`],QN=ze(z({__name:`OrgLogo`,props:{orgId:{},name:{default:``},size:{default:20}},setup(e){let t=e,n=i(!1),r=Mt(),a=At(),o=R(()=>a.value[t.orgId]??jt(t.orgId,r.value[t.orgId])),s=R(()=>(t.name||`?`).charAt(0).toUpperCase());return C(o,()=>{n.value=!1}),(t,r)=>(B(),N(`span`,{class:`org-logo`,style:ie({"--org-logo-size":`${e.size}px`})},[n.value?(B(),N(V,{key:1},[x(U(s.value),1)],64)):(B(),N(`img`,{key:0,src:o.value,alt:``,onError:r[0]||=e=>n.value=!0},null,40,ZN))],4))}}),[[`__scopeId`,`data-v-53f6181c`]]);function $N(e){let t=Dt(),n=tt(),r=R(()=>{let n=t.projects.filter(e=>!e.orgId).map(e=>({id:e.id,orgId:null,name:e.name}));for(let t of e.orgGroups.value)for(let e of t.projects)n.push({id:e.projectId,orgId:t.orgId,...t.accountId?{accountId:t.accountId}:{},name:e.name,orgName:t.name});return n});return{all:r,recent:R(()=>n.recentProjects.filter(e=>e.id!==n.activeProjectId||e.orgId!==n.activeOrgId).map(e=>r.value.find(t=>t.id===e.id&&t.orgId===e.orgId)).filter(e=>!!e))}}var eP={key:1,class:`palette__section`},tP=[`aria-label`],nP=[`aria-selected`,`onMouseenter`,`onClick`],rP={key:1,class:`ti ti-folder`,"aria-hidden":`true`},iP={class:`palette__name`},aP={class:`palette__org`},oP={key:2,class:`ti ti-spin ti-loader-2`,"aria-hidden":`true`},sP={key:3,class:`palette__empty`},cP=ze(z({__name:`ProjectPalette`,setup(e){let{t}=He(),n=it(),a=tt(),o=Nt(),{all:s,recent:c}=$N(o),l=i(!1),u=i(``),d=i(0),f=i(!1),p=i(``),m=i(null),h=R(()=>{let e=u.value.trim().toLowerCase();if(!e)return c.value;let t=s.value.filter(t=>t.name.toLowerCase().includes(e)||t.orgName?.toLowerCase().includes(e)),n=e=>{let t=c.value.indexOf(e);return t===-1?c.value.length:t};return t.sort((e,t)=>n(e)-n(t)||e.name.localeCompare(t.name))});C(h,()=>{d.value=0});function g(){u.value=``,p.value=``,d.value=0,l.value=!0,o.refreshCloud()}function _(){(m.value?.$el)?.focus()}async function v(e){if(e&&!f.value){f.value=!0,p.value=``;try{e.orgId&&await o.pullProject(e.orgId,e.id,e.accountId),a.setActiveProject(e.id,e.orgId),l.value=!1;let t=n.currentRoute.value.path.startsWith(`/launch`);n.push(t?{name:`launch-services`}:{name:`dashboard`})}catch(e){p.value=Ft(e,t)}finally{f.value=!1}}}function y(e){let t=h.value.length;e.key===`ArrowDown`&&t?(e.preventDefault(),d.value=(d.value+1)%t):e.key===`ArrowUp`&&t?(e.preventDefault(),d.value=(d.value-1+t)%t):e.key===`Enter`&&(e.preventDefault(),v(h.value[d.value]))}function S(e){!(e.ctrlKey||e.metaKey)||e.shiftKey||e.altKey||e.key.toLowerCase()!==`k`||e.target instanceof Element&&e.target.closest(`.xterm`)||(e.preventDefault(),l.value?l.value=!1:g())}return F(()=>window.addEventListener(`keydown`,S)),te(()=>window.removeEventListener(`keydown`,S)),(e,n)=>(B(),W(r(Ne),{visible:l.value,"onUpdate:visible":n[1]||=e=>l.value=e,header:r(t)(`projectPalette.title`),"show-header":!1,"dismissable-mask":``,width:`32rem`,onShow:_},{default:H(()=>[b(r(Ce),{ref_key:`input`,ref:m,modelValue:u.value,"onUpdate:modelValue":n[0]||=e=>u.value=e,class:`palette__input`,placeholder:r(t)(`projectPalette.placeholder`),"aria-label":r(t)(`projectPalette.placeholder`),fluid:``,onKeydown:y},null,8,[`modelValue`,`placeholder`,`aria-label`]),p.value?(B(),W(r(je),{key:0,severity:`error`,class:`palette__error`},{default:H(()=>[x(U(p.value),1)]),_:1})):G(``,!0),!u.value.trim()&&h.value.length?(B(),N(`p`,eP,U(r(t)(`projectPalette.recent`)),1)):G(``,!0),h.value.length?(B(),N(`ul`,{key:2,class:`palette__list`,role:`listbox`,"aria-label":r(t)(`projectPalette.title`)},[(B(!0),N(V,null,P(h.value,(e,n)=>(B(),N(`li`,{key:`${e.orgId??`local`}:${e.id}`,role:`option`,class:I([`palette__item`,{"is-highlighted":n===d.value}]),"aria-selected":n===d.value,onMouseenter:e=>d.value=n,onClick:t=>v(e)},[e.orgId?(B(),W(QN,{key:0,"org-id":e.orgId,name:e.orgName??``,size:18},null,8,[`org-id`,`name`])):(B(),N(`i`,rP)),M(`span`,iP,U(e.name),1),M(`span`,aP,U(e.orgName??r(t)(`projectSwitcher.local`)),1),f.value&&n===d.value?(B(),N(`i`,oP)):G(``,!0)],42,nP))),128))],8,tP)):(B(),N(`p`,sP,U(u.value.trim()?r(t)(`projectPalette.noMatch`):r(t)(`projectPalette.noRecent`)),1))]),_:1},8,[`visible`,`header`]))}}),[[`__scopeId`,`data-v-0092875a`]]),lP=i([]),uP=i(!1);function dP(e){let t=e,n=t?.data?.cause??t?.cause;return n&&typeof n==`object`?n:null}function fP(){async function e(e){if(!e)return!1;try{let t=await Ot().missingVariables(e);return t.length!==0&&(lP.value=t,uP.value=!0,!0)}catch(t){return console.warn(`[missing-variables] Lecture impossible pour`,e,t),!1}}function t(e){let t=dP(e)?.missingVariables;return!Array.isArray(t)||t.length===0?!1:(lP.value=t,uP.value=!0,!0)}return{missing:lP,visible:uP,checkEnvironment:e,openFromError:t}}var pP=[`title`],mP=[`title`],hP=[`title`],gP=[`title`],_P=[`title`],vP=[`title`],yP={key:0,class:`ti ti-sitemap`,style:{"font-size":`0.7rem`,opacity:`0.6`,"margin-right":`4px`}},bP={key:1,class:`ti ti-table`,style:{"font-size":`0.7rem`,opacity:`0.6`,"margin-right":`4px`}},xP={class:`ai-chat-conv-item__actions`},SP=[`title`],CP=[`title`],wP=ze(z({__name:`AiChatConvItem`,props:{conv:{},active:{type:Boolean},archived:{type:Boolean},streaming:{type:Boolean},unread:{type:Boolean},companionThinking:{type:Boolean}},emits:[`select`,`rename`,`set-archived`,`delete`],setup(e,{emit:t}){let{t:n}=He(),a=it(),o=e;function s(e,t){a.push(t?{name:`kanban-card`,params:{id:e,cardId:t}}:{name:`kanban-board`,params:{id:e}})}let c=t,l=i(!1),u=i(``),d=i(null);function f(){u.value=o.conv.title,l.value=!0,le(()=>d.value?.$el?.select())}function p(){if(!l.value)return;l.value=!1;let e=u.value.trim();e&&e!==o.conv.title&&c(`rename`,o.conv.id,e)}return(t,i)=>(B(),N(`div`,{class:I([`ai-chat-conv-item`,{"ai-chat-conv-item--active":e.active}]),onClick:i[6]||=t=>c(`select`,e.conv.id)},[l.value?(B(),W(r(Ce),{key:0,ref_key:`inputEl`,ref:d,modelValue:u.value,"onUpdate:modelValue":i[0]||=e=>u.value=e,size:`small`,class:`ai-chat-conv-item__rename-input`,autofocus:``,onBlur:p,onKeydown:[me(he(p,[`prevent`]),[`enter`]),i[1]||=me(e=>l.value=!1,[`esc`])],onClick:i[2]||=he(()=>{},[`stop`])},null,8,[`modelValue`,`onKeydown`])):(B(),N(V,{key:1},[e.archived?G(``,!0):(B(),N(V,{key:0},[e.companionThinking?(B(),N(`span`,{key:0,class:`ai-chat-conv-item__badge ai-chat-conv-item__badge--companion`,title:r(n)(`aiChat.companionReadingNow`)},null,8,pP)):e.streaming?(B(),N(`span`,{key:1,class:`ai-chat-conv-item__badge ai-chat-conv-item__badge--streaming`,title:r(n)(`aiChatPage.generating`)},null,8,mP)):e.conv.workflowType===`scenario`&&e.conv.scenarioWaitingInputs&&Object.keys(e.conv.scenarioWaitingInputs).length>0?(B(),N(`span`,{key:2,class:`ai-chat-conv-item__badge ai-chat-conv-item__badge--scenario-waiting`,title:r(n)(`aiChatPage.waitingForResponse`)},null,8,hP)):e.conv.workflowType===`scenario`&&e.conv.scenarioRunning?(B(),N(`span`,{key:3,class:`ai-chat-conv-item__badge ai-chat-conv-item__badge--scenario-running`,title:r(n)(`aiChatPage.scenarioRunning`)},null,8,gP)):e.unread?(B(),N(`span`,{key:4,class:`ai-chat-conv-item__badge ai-chat-conv-item__badge--unread`,title:r(n)(`aiChatPage.unreadMessages`)},null,8,_P)):G(``,!0)],64)),M(`span`,{class:`ai-chat-conv-item__title`,title:r(n)(`aiChat.rename`),onDblclick:he(f,[`stop`])},[e.conv.workflowType===`scenario`?(B(),N(`i`,yP)):!e.archived&&e.conv.kanbanBoardId?(B(),N(`i`,bP)):G(``,!0),x(` `+U(e.conv.title),1)],40,vP),M(`div`,xP,[!e.archived&&e.conv.kanbanBoardId?(B(),N(`button`,{key:0,class:`ai-chat-conv-item__icon-btn`,title:`Ouvrir le tableau`,onClick:i[3]||=he(t=>s(e.conv.kanbanBoardId,e.conv.kanbanCardId),[`stop`])},[...i[7]||=[M(`i`,{class:`ti ti-arrow-up-right`},null,-1)]])):G(``,!0),M(`button`,{class:`ai-chat-conv-item__icon-btn`,title:e.archived?r(n)(`aiChatPage.unarchive`):r(n)(`aiChatPage.archive`),onClick:i[4]||=he(t=>c(`set-archived`,e.conv.id,!e.archived),[`stop`])},[M(`i`,{class:`ti ti-inbox`,style:ie(e.archived?`opacity:0.5`:void 0)},null,4)],8,SP),M(`button`,{class:`ai-chat-conv-item__icon-btn ai-chat-conv-item__icon-btn--danger`,title:r(n)(`actions.delete`),onClick:i[5]||=he(t=>c(`delete`,e.conv.id),[`stop`])},[...i[8]||=[M(`i`,{class:`ti ti-trash`},null,-1)]],8,CP)])],64))],2))}}),[[`__scopeId`,`data-v-2384a988`]]),TP=`ti ti-sparkles`,EP=`ti ti-messages`,DP={class:`ai-chat-sidebar`},OP={class:`ai-chat-sidebar__header`},kP={class:`ai-chat-sidebar__title`},AP={class:`ai-chat-sidebar__search`},jP={class:`ai-chat-sidebar__api-key-wrap`},MP={key:0,class:`ai-chat-sidebar__no-provider`},NP={class:`ai-chat-sidebar__conv-list`},PP={class:`ai-chat-sidebar__pinned-card-title`},FP={class:`ai-chat-sidebar__drop-wrap`},IP={key:0,class:`ai-chat-sidebar__pinned-hint`},LP=[`data-testid`],RP={class:`ai-chat-sidebar__section-header`},zP=[`title`],BP=[`onDblclick`],VP=[`title`,`aria-label`,`onClick`],HP={class:`ai-chat-sidebar__drop-wrap`},UP={key:0,class:`ai-chat-sidebar__pinned-hint`},WP={key:0,class:`ai-chat-sidebar__menu`},GP={class:`ai-chat-sidebar__drop-wrap ai-chat-sidebar__unpin-zone`},KP={class:`ai-chat-sidebar__pinned-hint`},qP={key:1,class:`ai-chat-sidebar__group-title`},JP={key:2,class:`ai-chat-sidebar__group-title`},YP={key:3,class:`ai-chat-sidebar__empty-list`},XP={key:0,class:`ai-chat-sidebar__archive-section`},ZP={key:0,class:`ai-chat-sidebar__archive-matches`},QP={key:0,class:`ai-chat-sidebar__archive-body`},$P={class:`ai-chat-sidebar__conv-list ai-chat-sidebar__conv-list--archive`},eF={key:0,class:`ai-chat-sidebar__empty-list`},tF=ze(z({__name:`AiChatSidebar`,emits:[`start-new`,`select-conversation`,`delete-conversation`],setup(e,{emit:t}){let{t:n}=He(),a=lt(),{activeId:o,filteredConversations:s,pinnedConversations:c,sections:l,sectionConversations:u,archivedConversations:d,streamingConvIds:f,unreadConvIds:p,claudeCodeAvailable:m,codexAvailable:h,providers:g}=$e(a),_=i(``),v=R(()=>_.value.trim().length>0),y=i(!1),S=0,w=()=>new Date().toISOString();function T(e){let t=_.value.trim().toLowerCase();return!t||e.title.toLowerCase().includes(t)}let E=R(()=>d.value.filter(T));function D(e,t){a.renameConversation(e,t)}let ee=R(()=>s.value.filter(T)),k=R(()=>ee.value.filter(ut)),A=R(()=>ee.value.filter(e=>!ut(e))),ne={animation:150,delay:300,delayOnTouchOnly:!0},re=i([]),z=i([]),ie=i([]),oe=i([]),se=R(()=>c.value.filter(T));C(se,e=>{re.value=[...e]},{immediate:!0}),C(k,e=>{z.value=[...e]},{immediate:!0}),C(A,e=>{ie.value=[...e]},{immediate:!0});let ce=i([]),ue=i({});C(l,e=>{ce.value=[...e]},{immediate:!0});let de=R(()=>{let e={};for(let[t,n]of Object.entries(u.value))e[t]=n.filter(T);return e});C(de,e=>{ue.value={...e}},{immediate:!0});let fe=i(!1),pe=R(()=>fe.value&&k.value.length===0&&A.value.length===0);function _e(){if(fe.value=!1,oe.value=[],v.value)return;let e={};for(let[t,n]of Object.entries(ue.value))e[t]=n.map(e=>e.id);a.applyLayout({pinned:re.value.map(e=>e.id),sections:e})}function ve(){v.value||a.reorderSections(ce.value.map(e=>e.id))}let ye=i(null),be=i(``);function Se(e){ye.value=e.id,be.value=e.name,le(()=>{let t=document.querySelector(`[data-section-input="${e.id}"]`);t?.focus(),t?.select()})}function we(){let e=ye.value;if(!e)return;ye.value=null;let t=be.value.trim(),n=l.value.find(t=>t.id===e);t&&n&&t!==n.name&&a.renameSection(e,t)}function Te(){ye.value=null}async function Ee(){let e=await a.createSection(n(`aiChat.newSectionName`));e&&Se(e)}let De=i(null),Oe=i(null);function ke(e,t){Oe.value=e,De.value?.toggle(t)}function Ae(e){let t=Oe.value;De.value?.hide(),t&&e(t)}let je=i(!1);C([v,E],([e,t])=>{y.value=e?je.value||t.length>0:je.value});function Me(){je.value=!y.value,y.value=!y.value}let Ne=t;function Pe(){Ne(`start-new`)}function Fe(e){Ne(`select-conversation`,e)}function Ie(e){Ne(`delete-conversation`,e)}return F(()=>{ct()&&console.log(`[ai-chat][sidebar]`,w(),`mounted`,{activeId:o.value,visible:s.value.length,archived:d.value.length,unread:p.value.size,streaming:f.value.size,visibleOrder:s.value.map(e=>e.id.slice(0,8))})}),ae(()=>{S+=1,ct()&&console.log(`[ai-chat][sidebar]`,w(),`updated`,{count:S,activeId:o.value,visible:s.value.length,archived:d.value.length,unread:p.value.size,streaming:f.value.size})}),te(()=>{ct()&&console.log(`[ai-chat][sidebar]`,w(),`unmounted`,{updates:S})}),(e,t)=>{let i=O(`router-link`);return B(),N(`aside`,DP,[M(`div`,OP,[M(`span`,kP,[M(`i`,{class:I(r(TP))},null,2),x(` `+U(r(n)(`aiChat.title`)),1)]),b(r(Le),{icon:`ti ti-plus`,variant:`text`,rounded:``,size:`small`,title:r(n)(`aiChat.newConversation`),onClick:Pe},null,8,[`title`])]),M(`div`,AP,[t[20]||=M(`i`,{class:`ti ti-search ai-chat-sidebar__search-icon`},null,-1),b(r(Ce),{modelValue:_.value,"onUpdate:modelValue":t[0]||=e=>_.value=e,type:`search`,placeholder:r(n)(`aiChat.searchPlaceholder`),class:`ai-chat-sidebar__search-input`,"data-testid":`ai-chat-search`},null,8,[`modelValue`,`placeholder`])]),M(`div`,jP,[!r(m)&&!r(h)&&r(g).length===0?(B(),N(`div`,MP,[t[21]||=M(`i`,{class:`ti ti-alert-triangle`},null,-1),M(`span`,null,[x(U(r(n)(`aiChatPage.configureProviderPrefix`))+` `,1),b(i,{to:{name:`settings`,query:{section:`ai`}}},{default:H(()=>[x(U(r(n)(`settings.title`)),1)]),_:1})])])):G(``,!0)]),M(`div`,NP,[M(`section`,{class:I([`ai-chat-sidebar__pinned-card`,{"ai-chat-sidebar__pinned-card--awaiting":re.value.length===0}])},[M(`div`,PP,[t[22]||=M(`i`,{class:`ti ti-pin`},null,-1),x(` `+U(r(n)(`aiChat.pinnedGroup`)),1)]),M(`div`,FP,[b(r(Ht),L({modelValue:re.value,"onUpdate:modelValue":t[2]||=e=>re.value=e,group:{name:`ai-chat-conversations`},disabled:v.value},ne,{class:`ai-chat-sidebar__pinned-drop`,onStart:t[3]||=e=>fe.value=!0,onEnd:_e,onAdd:_e}),{default:H(()=>[(B(!0),N(V,null,P(re.value,e=>(B(),W(wP,{key:e.id,conv:e,active:e.id===r(o),streaming:r(f).has(e.id),unread:r(p).has(e.id),"companion-thinking":r(a).isCompanionThinkingFor(e.id),onSelect:Fe,onRename:D,onSetArchived:t[1]||=(e,t)=>r(a).archiveConversation(e,t),onDelete:Ie},null,8,[`conv`,`active`,`streaming`,`unread`,`companion-thinking`]))),128))]),_:1},16,[`modelValue`,`disabled`]),re.value.length===0?(B(),N(`div`,IP,U(r(n)(`aiChat.pinnedDropHint`)),1)):G(``,!0)])],2),b(r(Ht),L({modelValue:ce.value,"onUpdate:modelValue":t[7]||=e=>ce.value=e,disabled:v.value},ne,{handle:`.ai-chat-sidebar__section-handle`,class:`ai-chat-sidebar__sections`,onEnd:ve}),{default:H(()=>[(B(!0),N(V,null,P(ce.value,e=>(B(),N(`section`,{key:e.id,class:`ai-chat-sidebar__section-card`,"data-testid":`ai-chat-section-${e.id}`},[M(`div`,RP,[M(`i`,{class:`ti ti-menu-2 ai-chat-sidebar__section-handle`,title:r(n)(`aiChat.sectionMove`)},null,8,zP),ye.value===e.id?(B(),W(r(Ce),{key:0,modelValue:be.value,"onUpdate:modelValue":t[4]||=e=>be.value=e,"data-section-input":e.id,maxlength:`80`,class:`ai-chat-sidebar__section-input`,onKeydown:[me(he(we,[`prevent`]),[`enter`]),me(he(Te,[`prevent`]),[`esc`])],onBlur:we},null,8,[`modelValue`,`data-section-input`,`onKeydown`])):(B(),N(`span`,{key:1,class:`ai-chat-sidebar__section-name`,onDblclick:t=>Se(e)},U(e.name),41,BP)),M(`button`,{class:`ai-chat-sidebar__section-menu`,title:r(n)(`aiChat.sectionMenu`),"aria-label":r(n)(`aiChat.sectionMenu`),onClick:t=>ke(e,t)},[...t[23]||=[M(`i`,{class:`ti ti-dots-vertical`},null,-1)]],8,VP)]),M(`div`,HP,[b(r(Ht),L({modelValue:ue.value[e.id],"onUpdate:modelValue":t=>ue.value[e.id]=t,group:{name:`ai-chat-conversations`},disabled:v.value},{ref_for:!0},ne,{class:`ai-chat-sidebar__pinned-drop`,onStart:t[6]||=e=>fe.value=!0,onEnd:_e,onAdd:_e}),{default:H(()=>[(B(!0),N(V,null,P(ue.value[e.id]??[],e=>(B(),W(wP,{key:e.id,conv:e,active:e.id===r(o),streaming:r(f).has(e.id),unread:r(p).has(e.id),"companion-thinking":r(a).isCompanionThinkingFor(e.id),onSelect:Fe,onRename:D,onSetArchived:t[5]||=(e,t)=>r(a).archiveConversation(e,t),onDelete:Ie},null,8,[`conv`,`active`,`streaming`,`unread`,`companion-thinking`]))),128))]),_:2},1040,[`modelValue`,`onUpdate:modelValue`,`disabled`]),(ue.value[e.id]??[]).length===0?(B(),N(`div`,UP,U(r(n)(`aiChat.sectionDropHint`)),1)):G(``,!0)])],8,LP))),128))]),_:1},16,[`modelValue`,`disabled`]),v.value?G(``,!0):(B(),N(`button`,{key:0,class:`ai-chat-sidebar__new-section`,"data-testid":`ai-chat-new-section`,onClick:Ee},[t[24]||=M(`i`,{class:`ti ti-plus`},null,-1),x(` `+U(r(n)(`aiChat.newSection`)),1)])),b(r(xe),{ref_key:`sectionMenu`,ref:De},{default:H(()=>[Oe.value?(B(),N(`div`,WP,[M(`button`,{class:`ai-chat-sidebar__menu-item`,onClick:t[8]||=e=>Ae(Se)},[t[25]||=M(`i`,{class:`ti ti-pencil`},null,-1),M(`span`,null,U(r(n)(`aiChat.sectionRename`)),1)]),M(`button`,{class:`ai-chat-sidebar__menu-item ai-chat-sidebar__menu-item--danger`,onClick:t[9]||=e=>Ae(e=>r(a).deleteSection(e.id))},[t[26]||=M(`i`,{class:`ti ti-trash`},null,-1),M(`span`,null,U(r(n)(`aiChat.sectionDelete`)),1)])])):G(``,!0)]),_:1},512),j(M(`div`,GP,[b(r(Ht),L({modelValue:oe.value,"onUpdate:modelValue":t[10]||=e=>oe.value=e,group:{name:`ai-chat-conversations`},disabled:v.value,sort:!1},ne,{class:`ai-chat-sidebar__unpinned-drop ai-chat-sidebar__unpin-drop`,onAdd:_e}),null,16,[`modelValue`,`disabled`]),M(`div`,KP,U(r(n)(`aiChat.unpinDropHint`)),1)],512),[[ge,pe.value]]),k.value.length>0&&A.value.length>0?(B(),N(`div`,qP,[t[27]||=M(`i`,{class:`ti ti-device-desktop`},null,-1),x(` `+U(r(n)(`scenarioSelector.cliGroup`)),1)])):G(``,!0),j(b(r(Ht),L({modelValue:z.value,"onUpdate:modelValue":t[12]||=e=>z.value=e,group:{name:`ai-chat-conversations`},disabled:v.value,sort:!1},ne,{class:`ai-chat-sidebar__unpinned-drop`,onStart:t[13]||=e=>fe.value=!0,onEnd:t[14]||=e=>fe.value=!1,onAdd:_e}),{default:H(()=>[(B(!0),N(V,null,P(z.value,e=>(B(),W(wP,{key:e.id,conv:e,active:e.id===r(o),streaming:r(f).has(e.id),unread:r(p).has(e.id),"companion-thinking":r(a).isCompanionThinkingFor(e.id),onSelect:Fe,onRename:D,onSetArchived:t[11]||=(e,t)=>r(a).archiveConversation(e,t),onDelete:Ie},null,8,[`conv`,`active`,`streaming`,`unread`,`companion-thinking`]))),128))]),_:1},16,[`modelValue`,`disabled`]),[[ge,k.value.length>0]]),A.value.length>0&&k.value.length>0?(B(),N(`div`,JP,[t[28]||=M(`i`,{class:`ti ti-cloud`},null,-1),x(` `+U(r(n)(`scenarioSelector.apiGroup`)),1)])):G(``,!0),j(b(r(Ht),L({modelValue:ie.value,"onUpdate:modelValue":t[16]||=e=>ie.value=e,group:{name:`ai-chat-conversations`},disabled:v.value,sort:!1},ne,{class:`ai-chat-sidebar__unpinned-drop`,onStart:t[17]||=e=>fe.value=!0,onEnd:t[18]||=e=>fe.value=!1,onAdd:_e}),{default:H(()=>[(B(!0),N(V,null,P(ie.value,e=>(B(),W(wP,{key:e.id,conv:e,active:e.id===r(o),streaming:r(f).has(e.id),unread:r(p).has(e.id),"companion-thinking":r(a).isCompanionThinkingFor(e.id),onSelect:Fe,onRename:D,onSetArchived:t[15]||=(e,t)=>r(a).archiveConversation(e,t),onDelete:Ie},null,8,[`conv`,`active`,`streaming`,`unread`,`companion-thinking`]))),128))]),_:1},16,[`modelValue`,`disabled`]),[[ge,A.value.length>0]]),ee.value.length===0&&re.value.length===0?(B(),N(`div`,YP,U(v.value?r(n)(`aiChat.searchNoMatch`):r(n)(`aiChat.noConversations`)),1)):G(``,!0)]),r(d).length>0?(B(),N(`div`,XP,[M(`button`,{class:`ai-chat-sidebar__archive-toggle`,onClick:Me},[t[29]||=M(`i`,{class:`ti ti-inbox`},null,-1),M(`span`,null,U(r(n)(`aiChatPage.archives`,{count:r(d).length})),1),v.value?(B(),N(`span`,ZP,U(r(n)(`aiChat.searchArchivedCount`,{count:E.value.length})),1)):G(``,!0),M(`i`,{class:I([y.value?`ti ti-chevron-up`:`ti ti-chevron-down`,`ai-chat-sidebar__archive-chevron`])},null,2)]),y.value?(B(),N(`div`,QP,[M(`div`,$P,[(B(!0),N(V,null,P(E.value,e=>(B(),W(wP,{key:e.id,conv:e,archived:``,active:e.id===r(o),onSelect:Fe,onRename:D,onSetArchived:t[19]||=(e,t)=>r(a).archiveConversation(e,t),onDelete:Ie},null,8,[`conv`,`active`]))),128)),E.value.length===0?(B(),N(`div`,eF,U(v.value?r(n)(`aiChat.searchNoMatch`):r(n)(`aiChat.noConversations`)),1)):G(``,!0)])])):G(``,!0)])):G(``,!0)])}}}),[[`__scopeId`,`data-v-e60b3dad`]]);function nF(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var rF=nF();function iF(e){rF=e}var aF={exec:()=>null};function oF(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function sF(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(lF.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var cF=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),lF={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:oF(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:oF(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:oF(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:oF(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:oF(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:oF(e=>RegExp(`^ {0,${e}}>`))},uF=/^(?:[ \t]*(?:\n|$))+/,dF=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fF=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,pF=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,mF=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hF=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,gF=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_F=sF(gF).replace(/bull/g,hF).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),vF=sF(gF).replace(/bull/g,hF).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),yF=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,bF=/^[^\n]+/,xF=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,SF=sF(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,xF).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),CF=sF(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,hF).getRegex(),wF=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,TF=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,EF=sF(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,TF).replace(`tag`,wF).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),DF=sF(yF).replace(`hr`,pF).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,wF).getRegex(),OF={blockquote:sF(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,DF).getRegex(),code:dF,def:SF,fences:fF,heading:mF,hr:pF,html:EF,lheading:_F,list:CF,newline:uF,paragraph:DF,table:aF,text:bF},kF=sF(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,pF).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,wF).getRegex(),AF={...OF,lheading:vF,table:kF,paragraph:sF(yF).replace(`hr`,pF).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,kF).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,wF).getRegex()},jF={...OF,html:sF(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,TF).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:aF,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:sF(yF).replace(`hr`,pF).replace(`heading`,` *#{1,6} *[^
|
|
199
|
-
]`).replace(`lheading`,
|
|
200
|
-
`),n=t.length-1;for(;n>=0&&
|
|
201
|
-
`)}function
|
|
198
|
+
`,``),i=y.exec(r);if(!i){E();return}let a=e.view.coordsAtPos(t.from),o=Math.max(8,window.innerWidth-RN-8);v.value={top:a.bottom+4,left:Math.min(Math.max(8,a.left),o)},h.value===null&&(g.value=0),h.value!==(i[1]??``)&&(_.value=!1),h.value=i[1]??``}catch{E()}}function ee(e){let t=S.value.length;t&&(_.value=!0,g.value=(g.value+e+t)%t)}function O(e){let t=m.value,n=e??S.value[g.value];if(!t||!n||h.value===null)return;let r=t.state.selection.from,i=r-h.value.length-1;E(),t.chain().focus().insertContentAt({from:i,to:r},`@${n.label} `).run()}C(()=>o.modelValue,e=>{if(!m.value)return;let t=m.value;(o.markdown?t.storage.markdown.getMarkdown():t.getHTML())!==e&&t.commands.setContent(e??``,{emitUpdate:!1})}),C(()=>o.mentions,()=>{let e=m.value;e&&e.view.dispatch(e.state.tr)},{deep:!0}),C(()=>o.editable,e=>{m.value?.setEditable(e)}),re(()=>m.value?.destroy());function k(e){m.value?.chain().focus().setImage({src:e}).run()}function A(){let e=m.value;if(!e)return;let t=e.getAttributes(`link`).href,n=window.prompt(`URL du lien`,t??`https://`);if(n!==null){if(n===``){e.chain().focus().extendMarkRange(`link`).unsetLink().run();return}e.chain().focus().extendMarkRange(`link`).setLink({href:n}).run()}}function j(e,t){let n=m.value;if(!n)return;let r=`#wiki:${e}`;n.state.selection.empty?n.chain().focus().insertContent({type:`text`,text:t,marks:[{type:`link`,attrs:{href:r}}]}).run():n.chain().focus().extendMarkRange(`link`).setLink({href:r}).run()}function F(){m.value?.commands.focus()}t({insertImage:k,insertWikiLink:j,promptExternalLink:A,focus:F});let{t:L}=He();return(t,n)=>r(m)?(B(),N(`div`,{key:0,class:I([`tt`,{"tt--readonly":!e.editable}]),style:ie({"--tt-min-h":e.minHeight,"--tt-max-h":e.maxHeight})},[e.editable?(B(),N(`div`,pN,[M(`div`,mN,[M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`bold`)}]),title:r(L)(`tiptapEditor.bold`),onClick:n[0]||=e=>r(m).chain().focus().toggleBold().run()},[...n[18]||=[M(`b`,null,`B`,-1)]],10,hN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`italic`)}]),title:r(L)(`tiptapEditor.italic`),onClick:n[1]||=e=>r(m).chain().focus().toggleItalic().run()},[...n[19]||=[M(`i`,null,`I`,-1)]],10,gN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`underline`)}]),title:r(L)(`tiptapEditor.underline`),onClick:n[2]||=e=>r(m).chain().focus().toggleUnderline().run()},[...n[20]||=[M(`u`,null,`U`,-1)]],10,_N),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`strike`)}]),title:r(L)(`tiptapEditor.strikethrough`),onClick:n[3]||=e=>r(m).chain().focus().toggleStrike().run()},[...n[21]||=[M(`s`,null,`S`,-1)]],10,vN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`highlight`)}]),title:r(L)(`tiptapEditor.highlight`),onClick:n[4]||=e=>r(m).chain().focus().toggleHighlight().run()},[...n[22]||=[M(`i`,{class:`ti ti-palette`},null,-1)]],10,yN)]),n[33]||=M(`span`,{class:`tt-toolbar__sep`},null,-1),M(`div`,bN,[M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`heading`,{level:1})}]),title:r(L)(`tiptapEditor.heading1`),onClick:n[5]||=e=>r(m).chain().focus().toggleHeading({level:1}).run()},`H1`,10,xN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`heading`,{level:2})}]),title:r(L)(`tiptapEditor.heading2`),onClick:n[6]||=e=>r(m).chain().focus().toggleHeading({level:2}).run()},`H2`,10,SN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`heading`,{level:3})}]),title:r(L)(`tiptapEditor.heading3`),onClick:n[7]||=e=>r(m).chain().focus().toggleHeading({level:3}).run()},`H3`,10,CN)]),n[34]||=M(`span`,{class:`tt-toolbar__sep`},null,-1),M(`div`,wN,[M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`bulletList`)}]),title:r(L)(`tiptapEditor.bulletList`),onClick:n[8]||=e=>r(m).chain().focus().toggleBulletList().run()},[...n[23]||=[M(`i`,{class:`ti ti-list`},null,-1)]],10,TN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`orderedList`)}]),title:r(L)(`tiptapEditor.orderedList`),onClick:n[9]||=e=>r(m).chain().focus().toggleOrderedList().run()},[...n[24]||=[M(`i`,{class:`ti ti-list-check`},null,-1)]],10,EN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`taskList`)}]),title:r(L)(`tiptapEditor.taskList`),onClick:n[10]||=e=>r(m).chain().focus().toggleTaskList().run()},[...n[25]||=[M(`i`,{class:`ti ti-square-check`},null,-1)]],10,DN)]),n[35]||=M(`span`,{class:`tt-toolbar__sep`},null,-1),M(`div`,ON,[M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`blockquote`)}]),title:r(L)(`tiptapEditor.quote`),onClick:n[11]||=e=>r(m).chain().focus().toggleBlockquote().run()},[...n[26]||=[M(`i`,{class:`ti ti-message`},null,-1)]],10,kN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`code`)}]),title:r(L)(`tiptapEditor.inlineCode`),onClick:n[12]||=e=>r(m).chain().focus().toggleCode().run()},[...n[27]||=[M(`i`,{class:`ti ti-code`},null,-1)]],10,AN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`codeBlock`)}]),title:r(L)(`tiptapEditor.codeBlock`),onClick:n[13]||=e=>r(m).chain().focus().toggleCodeBlock().run()},`</>`,10,jN),M(`button`,{class:`tt-btn`,title:r(L)(`tiptapEditor.horizontalRule`),onClick:n[14]||=e=>r(m).chain().focus().setHorizontalRule().run()},[...n[28]||=[M(`i`,{class:`ti ti-minus`},null,-1)]],8,MN),M(`button`,{class:I([`tt-btn`,{"tt-btn--active":r(m).isActive(`link`)}]),title:`Lien`,onClick:A},[...n[29]||=[M(`i`,{class:`ti ti-link`},null,-1)]],2),r(m).isActive(`link`)?(B(),N(`button`,{key:0,class:`tt-btn`,title:`Supprimer le lien`,onClick:n[15]||=e=>r(m).chain().focus().extendMarkRange(`link`).unsetLink().run()},[...n[30]||=[M(`i`,{class:`ti ti-x`},null,-1)]])):G(``,!0)]),n[36]||=M(`span`,{class:`tt-toolbar__sep`},null,-1),M(`div`,NN,[M(`button`,{class:`tt-btn`,title:r(L)(`tiptapEditor.undo`),disabled:!r(m).can().undo(),onClick:n[16]||=e=>r(m).chain().focus().undo().run()},[...n[31]||=[M(`i`,{class:`ti ti-arrow-back-up`},null,-1)]],8,PN),M(`button`,{class:`tt-btn`,title:r(L)(`tiptapEditor.redo`),disabled:!r(m).can().redo(),onClick:n[17]||=e=>r(m).chain().focus().redo().run()},[...n[32]||=[M(`i`,{class:`ti ti-refresh`},null,-1)]],8,FN)])])):G(``,!0),M(`div`,IN,[b(r(Fh),{editor:r(m),class:`tt-content`},null,8,[`editor`]),(B(),W(ue,{to:`body`},[w.value?(B(),N(`ul`,{key:0,class:`tt-mentions`,style:ie({top:`${v.value.top}px`,left:`${v.value.left}px`})},[(B(!0),N(V,null,P(S.value,(e,t)=>(B(),N(`li`,{key:e.id,class:I([`tt-mentions__item`,{"tt-mentions__item--active":t===g.value}]),onMousedown:he(t=>O(e),[`prevent`]),onMouseenter:e=>g.value=t},U(e.label),43,LN))),128))],4)):G(``,!0)]))])],6)):G(``,!0)}}),[[`__scopeId`,`data-v-52e2b22a`]]);function VN(e){return/^(https?:|mailto:)/i.test(e)?(window.open(e,`_blank`,`noopener,noreferrer`),!0):!1}var HN={class:`wizard-intro`},UN={class:`wizard-steps`},WN={class:`wizard-step__head`},GN={class:`wizard-step__index`},KN={class:`wizard-step__key`},qN={class:`wizard-step__origin`},JN={key:0},YN=[`onClick`],XN=ze(z({__name:`MissingVariablesWizard`,props:{visible:{type:Boolean},missing:{}},emits:[`update:visible`],setup(e,{emit:t}){let n=e,a=t,{t:o}=He(),s=De(),c=Ot(),l=g({}),u=g({}),d=i(!1);C(()=>n.missing,e=>{for(let e of Object.keys(l))delete l[e];for(let e of Object.keys(u))delete u[e];for(let t of e)l[t.variableId]=``},{immediate:!0});let f=R(()=>n.missing.length>0&&n.missing.every(e=>(l[e.variableId]??``).trim()!==``));function p(e){d.value||a(`update:visible`,e)}async function m(){if(f.value&&!d.value){d.value=!0;try{for(let e of n.missing)await c.fillVariable(e.environmentId,e.variableId,l[e.variableId],e.reason);a(`update:visible`,!1)}catch(e){s.add({severity:`error`,summary:o(`common.error`),detail:e.message??o(`missingVariables.saveError`),life:5e3})}finally{d.value=!1}}}return(t,n)=>(B(),W(r(Ne),{visible:e.visible,modal:``,closable:!d.value,header:r(o)(`missingVariables.title`),style:{width:`38rem`,maxWidth:`95vw`},"onUpdate:visible":p},{footer:H(()=>[b(r(Le),{label:r(o)(`actions.cancel`),variant:`text`,disabled:d.value,onClick:n[0]||=e=>p(!1)},null,8,[`label`,`disabled`]),b(r(Le),{label:r(o)(`missingVariables.save`),loading:d.value,disabled:!f.value,onClick:m},null,8,[`label`,`loading`,`disabled`])]),default:H(()=>[M(`p`,HN,U(r(o)(`missingVariables.intro`,{count:e.missing.length})),1),M(`div`,UN,[(B(!0),N(V,null,P(e.missing,(t,n)=>(B(),N(`div`,{key:t.variableId,class:`wizard-step`},[M(`div`,WN,[M(`span`,GN,U(n+1)+`/`+U(e.missing.length),1),M(`code`,KN,U(t.key),1),b(r(Ae),{value:t.reason===`overrideOnly`?r(o)(`missingVariables.reasonOverrideOnly`):r(o)(`missingVariables.reasonRequired`),severity:t.reason===`overrideOnly`?`info`:`warn`},null,8,[`value`,`severity`])]),t.description?(B(),W(r(BN),{key:0,class:`wizard-step__description`,"model-value":t.description,markdown:``,editable:!1,"min-height":`0`,"max-height":`none`,onLinkClick:r(VN)},null,8,[`model-value`,`onLinkClick`])):G(``,!0),M(`p`,qN,[x(U(r(o)(`missingVariables.definedIn`,{environment:t.environmentName}))+` `,1),t.reason===`overrideOnly`?(B(),N(`span`,JN,` — `+U(r(o)(`missingVariables.machineOnly`)),1)):G(``,!0)]),b(r(Ce),{modelValue:l[t.variableId],"onUpdate:modelValue":e=>l[t.variableId]=e,type:t.isSecret&&!u[t.variableId]?`password`:`text`,class:`wizard-step__input`,disabled:d.value,placeholder:r(o)(`missingVariables.valuePlaceholder`),onKeydown:me(m,[`enter`])},null,8,[`modelValue`,`onUpdate:modelValue`,`type`,`disabled`,`placeholder`]),t.isSecret?(B(),N(`button`,{key:1,type:`button`,class:`wizard-step__reveal`,onClick:e=>u[t.variableId]=!u[t.variableId]},[M(`i`,{class:I(u[t.variableId]?`ti ti-eye-off`:`ti ti-eye`)},null,2),x(` `+U(u[t.variableId]?r(o)(`missingVariables.hide`):r(o)(`missingVariables.reveal`)),1)],8,YN)):G(``,!0)]))),128))])]),_:1},8,[`visible`,`closable`,`header`]))}}),[[`__scopeId`,`data-v-ada005d3`]]),ZN=[`src`],QN=ze(z({__name:`OrgLogo`,props:{orgId:{},name:{default:``},size:{default:20}},setup(e){let t=e,n=i(!1),r=Mt(),a=At(),o=R(()=>a.value[t.orgId]??jt(t.orgId,r.value[t.orgId])),s=R(()=>(t.name||`?`).charAt(0).toUpperCase());return C(o,()=>{n.value=!1}),(t,r)=>(B(),N(`span`,{class:`org-logo`,style:ie({"--org-logo-size":`${e.size}px`})},[n.value?(B(),N(V,{key:1},[x(U(s.value),1)],64)):(B(),N(`img`,{key:0,src:o.value,alt:``,onError:r[0]||=e=>n.value=!0},null,40,ZN))],4))}}),[[`__scopeId`,`data-v-53f6181c`]]);function $N(e){let t=Dt(),n=tt(),r=R(()=>{let n=t.projects.filter(e=>!e.orgId).map(e=>({id:e.id,orgId:null,name:e.name}));for(let t of e.orgGroups.value)for(let e of t.projects)n.push({id:e.projectId,orgId:t.orgId,...t.accountId?{accountId:t.accountId}:{},name:e.name,orgName:t.name});return n});return{all:r,recent:R(()=>n.recentProjects.filter(e=>e.id!==n.activeProjectId||e.orgId!==n.activeOrgId).map(e=>r.value.find(t=>t.id===e.id&&t.orgId===e.orgId)).filter(e=>!!e))}}var eP={key:1,class:`palette__section`},tP=[`aria-label`],nP=[`aria-selected`,`onMouseenter`,`onClick`],rP={key:1,class:`ti ti-folder`,"aria-hidden":`true`},iP={class:`palette__name`},aP={class:`palette__org`},oP={key:2,class:`ti ti-spin ti-loader-2`,"aria-hidden":`true`},sP={key:3,class:`palette__empty`},cP=ze(z({__name:`ProjectPalette`,setup(e){let{t}=He(),n=it(),a=tt(),o=Nt(),{all:s,recent:c}=$N(o),l=i(!1),u=i(``),d=i(0),f=i(!1),p=i(``),m=i(null),h=R(()=>{let e=u.value.trim().toLowerCase();if(!e)return c.value;let t=s.value.filter(t=>t.name.toLowerCase().includes(e)||t.orgName?.toLowerCase().includes(e)),n=e=>{let t=c.value.indexOf(e);return t===-1?c.value.length:t};return t.sort((e,t)=>n(e)-n(t)||e.name.localeCompare(t.name))});C(h,()=>{d.value=0});function g(){u.value=``,p.value=``,d.value=0,l.value=!0,o.refreshCloud()}function _(){(m.value?.$el)?.focus()}async function v(e){if(e&&!f.value){f.value=!0,p.value=``;try{e.orgId&&await o.pullProject(e.orgId,e.id,e.accountId),a.setActiveProject(e.id,e.orgId),l.value=!1;let t=n.currentRoute.value.path.startsWith(`/launch`);n.push(t?{name:`launch-services`}:{name:`dashboard`})}catch(e){p.value=Ft(e,t)}finally{f.value=!1}}}function y(e){let t=h.value.length;e.key===`ArrowDown`&&t?(e.preventDefault(),d.value=(d.value+1)%t):e.key===`ArrowUp`&&t?(e.preventDefault(),d.value=(d.value-1+t)%t):e.key===`Enter`&&(e.preventDefault(),v(h.value[d.value]))}function S(e){!(e.ctrlKey||e.metaKey)||e.shiftKey||e.altKey||e.key.toLowerCase()!==`k`||e.target instanceof Element&&e.target.closest(`.xterm`)||(e.preventDefault(),l.value?l.value=!1:g())}return F(()=>window.addEventListener(`keydown`,S)),te(()=>window.removeEventListener(`keydown`,S)),(e,n)=>(B(),W(r(Ne),{visible:l.value,"onUpdate:visible":n[1]||=e=>l.value=e,header:r(t)(`projectPalette.title`),"show-header":!1,"dismissable-mask":``,width:`32rem`,onShow:_},{default:H(()=>[b(r(Ce),{ref_key:`input`,ref:m,modelValue:u.value,"onUpdate:modelValue":n[0]||=e=>u.value=e,class:`palette__input`,placeholder:r(t)(`projectPalette.placeholder`),"aria-label":r(t)(`projectPalette.placeholder`),fluid:``,onKeydown:y},null,8,[`modelValue`,`placeholder`,`aria-label`]),p.value?(B(),W(r(je),{key:0,severity:`error`,class:`palette__error`},{default:H(()=>[x(U(p.value),1)]),_:1})):G(``,!0),!u.value.trim()&&h.value.length?(B(),N(`p`,eP,U(r(t)(`projectPalette.recent`)),1)):G(``,!0),h.value.length?(B(),N(`ul`,{key:2,class:`palette__list`,role:`listbox`,"aria-label":r(t)(`projectPalette.title`)},[(B(!0),N(V,null,P(h.value,(e,n)=>(B(),N(`li`,{key:`${e.orgId??`local`}:${e.id}`,role:`option`,class:I([`palette__item`,{"is-highlighted":n===d.value}]),"aria-selected":n===d.value,onMouseenter:e=>d.value=n,onClick:t=>v(e)},[e.orgId?(B(),W(QN,{key:0,"org-id":e.orgId,name:e.orgName??``,size:18},null,8,[`org-id`,`name`])):(B(),N(`i`,rP)),M(`span`,iP,U(e.name),1),M(`span`,aP,U(e.orgName??r(t)(`projectSwitcher.local`)),1),f.value&&n===d.value?(B(),N(`i`,oP)):G(``,!0)],42,nP))),128))],8,tP)):(B(),N(`p`,sP,U(u.value.trim()?r(t)(`projectPalette.noMatch`):r(t)(`projectPalette.noRecent`)),1))]),_:1},8,[`visible`,`header`]))}}),[[`__scopeId`,`data-v-0092875a`]]),lP={class:`mcp-pairing__cwd`},uP={class:`mcp-pairing__code`},dP={class:`mcp-pairing__hint`},fP=3e3,pP=ze(z({__name:`McpPairingPrompt`,setup(e){let{t}=He(),n=De(),a=i(null),o=i(!1),s=null,c=R(()=>a.value!==null);async function l(){if(!(document.visibilityState!==`visible`||o.value))try{let[e]=await yt.mcpPairing.pending.query();a.value=e??null}catch{}}async function u(e){let r=a.value;if(r){o.value=!0;try{await yt.mcpPairing.decide.mutate({requestId:r.id,approve:e}),e&&n.add({severity:`success`,summary:t(`mcpPairing.approved`,{name:r.name}),life:4e3})}catch{n.add({severity:`error`,summary:t(`mcpPairing.failed`),life:5e3})}finally{a.value=null,o.value=!1}}}return F(()=>{l(),s=setInterval(()=>{l()},fP)}),te(()=>{s&&clearInterval(s)}),(e,n)=>(B(),W(r(Ne),{visible:c.value,modal:``,closable:!1,header:r(t)(`mcpPairing.title`),style:{width:`32rem`,maxWidth:`95vw`}},{footer:H(()=>[b(r(Le),{label:r(t)(`mcpPairing.deny`),variant:`text`,disabled:o.value,onClick:n[0]||=e=>u(!1)},null,8,[`label`,`disabled`]),b(r(Le),{label:r(t)(`mcpPairing.approve`),loading:o.value,onClick:n[1]||=e=>u(!0)},null,8,[`label`,`loading`])]),default:H(()=>[a.value?(B(),N(V,{key:0},[M(`p`,null,U(r(t)(`mcpPairing.intro`,{name:a.value.name})),1),M(`code`,lP,U(a.value.cwd),1),M(`div`,uP,[M(`span`,null,U(r(t)(`mcpPairing.code`)),1),M(`strong`,null,U(a.value.code),1)]),M(`p`,dP,U(r(t)(`mcpPairing.codeHint`))+` `+U(r(t)(`mcpPairing.unknownHint`)),1)],64)):G(``,!0)]),_:1},8,[`visible`,`header`]))}}),[[`__scopeId`,`data-v-9fb41eab`]]),mP=i([]),hP=i(!1);function gP(e){let t=e,n=t?.data?.cause??t?.cause;return n&&typeof n==`object`?n:null}function _P(){async function e(e){if(!e)return!1;try{let t=await Ot().missingVariables(e);return t.length!==0&&(mP.value=t,hP.value=!0,!0)}catch(t){return console.warn(`[missing-variables] Lecture impossible pour`,e,t),!1}}function t(e){let t=gP(e)?.missingVariables;return!Array.isArray(t)||t.length===0?!1:(mP.value=t,hP.value=!0,!0)}return{missing:mP,visible:hP,checkEnvironment:e,openFromError:t}}var vP=[`title`],yP=[`title`],bP=[`title`],xP=[`title`],SP=[`title`],CP=[`title`],wP={key:0,class:`ti ti-sitemap`,style:{"font-size":`0.7rem`,opacity:`0.6`,"margin-right":`4px`}},TP={key:1,class:`ti ti-table`,style:{"font-size":`0.7rem`,opacity:`0.6`,"margin-right":`4px`}},EP={class:`ai-chat-conv-item__actions`},DP=[`title`],OP=[`title`],kP=ze(z({__name:`AiChatConvItem`,props:{conv:{},active:{type:Boolean},archived:{type:Boolean},streaming:{type:Boolean},unread:{type:Boolean},companionThinking:{type:Boolean}},emits:[`select`,`rename`,`set-archived`,`delete`],setup(e,{emit:t}){let{t:n}=He(),a=it(),o=e;function s(e,t){a.push(t?{name:`kanban-card`,params:{id:e,cardId:t}}:{name:`kanban-board`,params:{id:e}})}let c=t,l=i(!1),u=i(``),d=i(null);function f(){u.value=o.conv.title,l.value=!0,le(()=>d.value?.$el?.select())}function p(){if(!l.value)return;l.value=!1;let e=u.value.trim();e&&e!==o.conv.title&&c(`rename`,o.conv.id,e)}return(t,i)=>(B(),N(`div`,{class:I([`ai-chat-conv-item`,{"ai-chat-conv-item--active":e.active}]),onClick:i[6]||=t=>c(`select`,e.conv.id)},[l.value?(B(),W(r(Ce),{key:0,ref_key:`inputEl`,ref:d,modelValue:u.value,"onUpdate:modelValue":i[0]||=e=>u.value=e,size:`small`,class:`ai-chat-conv-item__rename-input`,autofocus:``,onBlur:p,onKeydown:[me(he(p,[`prevent`]),[`enter`]),i[1]||=me(e=>l.value=!1,[`esc`])],onClick:i[2]||=he(()=>{},[`stop`])},null,8,[`modelValue`,`onKeydown`])):(B(),N(V,{key:1},[e.archived?G(``,!0):(B(),N(V,{key:0},[e.companionThinking?(B(),N(`span`,{key:0,class:`ai-chat-conv-item__badge ai-chat-conv-item__badge--companion`,title:r(n)(`aiChat.companionReadingNow`)},null,8,vP)):e.streaming?(B(),N(`span`,{key:1,class:`ai-chat-conv-item__badge ai-chat-conv-item__badge--streaming`,title:r(n)(`aiChatPage.generating`)},null,8,yP)):e.conv.workflowType===`scenario`&&e.conv.scenarioWaitingInputs&&Object.keys(e.conv.scenarioWaitingInputs).length>0?(B(),N(`span`,{key:2,class:`ai-chat-conv-item__badge ai-chat-conv-item__badge--scenario-waiting`,title:r(n)(`aiChatPage.waitingForResponse`)},null,8,bP)):e.conv.workflowType===`scenario`&&e.conv.scenarioRunning?(B(),N(`span`,{key:3,class:`ai-chat-conv-item__badge ai-chat-conv-item__badge--scenario-running`,title:r(n)(`aiChatPage.scenarioRunning`)},null,8,xP)):e.unread?(B(),N(`span`,{key:4,class:`ai-chat-conv-item__badge ai-chat-conv-item__badge--unread`,title:r(n)(`aiChatPage.unreadMessages`)},null,8,SP)):G(``,!0)],64)),M(`span`,{class:`ai-chat-conv-item__title`,title:r(n)(`aiChat.rename`),onDblclick:he(f,[`stop`])},[e.conv.workflowType===`scenario`?(B(),N(`i`,wP)):!e.archived&&e.conv.kanbanBoardId?(B(),N(`i`,TP)):G(``,!0),x(` `+U(e.conv.title),1)],40,CP),M(`div`,EP,[!e.archived&&e.conv.kanbanBoardId?(B(),N(`button`,{key:0,class:`ai-chat-conv-item__icon-btn`,title:`Ouvrir le tableau`,onClick:i[3]||=he(t=>s(e.conv.kanbanBoardId,e.conv.kanbanCardId),[`stop`])},[...i[7]||=[M(`i`,{class:`ti ti-arrow-up-right`},null,-1)]])):G(``,!0),M(`button`,{class:`ai-chat-conv-item__icon-btn`,title:e.archived?r(n)(`aiChatPage.unarchive`):r(n)(`aiChatPage.archive`),onClick:i[4]||=he(t=>c(`set-archived`,e.conv.id,!e.archived),[`stop`])},[M(`i`,{class:`ti ti-inbox`,style:ie(e.archived?`opacity:0.5`:void 0)},null,4)],8,DP),M(`button`,{class:`ai-chat-conv-item__icon-btn ai-chat-conv-item__icon-btn--danger`,title:r(n)(`actions.delete`),onClick:i[5]||=he(t=>c(`delete`,e.conv.id),[`stop`])},[...i[8]||=[M(`i`,{class:`ti ti-trash`},null,-1)]],8,OP)])],64))],2))}}),[[`__scopeId`,`data-v-2384a988`]]),AP=`ti ti-sparkles`,jP=`ti ti-messages`,MP={class:`ai-chat-sidebar`},NP={class:`ai-chat-sidebar__header`},PP={class:`ai-chat-sidebar__title`},FP={class:`ai-chat-sidebar__search`},IP={class:`ai-chat-sidebar__api-key-wrap`},LP={key:0,class:`ai-chat-sidebar__no-provider`},RP={class:`ai-chat-sidebar__conv-list`},zP={class:`ai-chat-sidebar__pinned-card-title`},BP={class:`ai-chat-sidebar__drop-wrap`},VP={key:0,class:`ai-chat-sidebar__pinned-hint`},HP=[`data-testid`],UP={class:`ai-chat-sidebar__section-header`},WP=[`title`],GP=[`onDblclick`],KP=[`title`,`aria-label`,`onClick`],qP={class:`ai-chat-sidebar__drop-wrap`},JP={key:0,class:`ai-chat-sidebar__pinned-hint`},YP={key:0,class:`ai-chat-sidebar__menu`},XP={class:`ai-chat-sidebar__drop-wrap ai-chat-sidebar__unpin-zone`},ZP={class:`ai-chat-sidebar__pinned-hint`},QP={key:1,class:`ai-chat-sidebar__group-title`},$P={key:2,class:`ai-chat-sidebar__group-title`},eF={key:3,class:`ai-chat-sidebar__empty-list`},tF={key:0,class:`ai-chat-sidebar__archive-section`},nF={key:0,class:`ai-chat-sidebar__archive-matches`},rF={key:0,class:`ai-chat-sidebar__archive-body`},iF={class:`ai-chat-sidebar__conv-list ai-chat-sidebar__conv-list--archive`},aF={key:0,class:`ai-chat-sidebar__empty-list`},oF=ze(z({__name:`AiChatSidebar`,emits:[`start-new`,`select-conversation`,`delete-conversation`],setup(e,{emit:t}){let{t:n}=He(),a=lt(),{activeId:o,filteredConversations:s,pinnedConversations:c,sections:l,sectionConversations:u,archivedConversations:d,streamingConvIds:f,unreadConvIds:p,claudeCodeAvailable:m,codexAvailable:h,providers:g}=$e(a),_=i(``),v=R(()=>_.value.trim().length>0),y=i(!1),S=0,w=()=>new Date().toISOString();function T(e){let t=_.value.trim().toLowerCase();return!t||e.title.toLowerCase().includes(t)}let E=R(()=>d.value.filter(T));function D(e,t){a.renameConversation(e,t)}let ee=R(()=>s.value.filter(T)),k=R(()=>ee.value.filter(ut)),A=R(()=>ee.value.filter(e=>!ut(e))),ne={animation:150,delay:300,delayOnTouchOnly:!0},re=i([]),z=i([]),ie=i([]),oe=i([]),se=R(()=>c.value.filter(T));C(se,e=>{re.value=[...e]},{immediate:!0}),C(k,e=>{z.value=[...e]},{immediate:!0}),C(A,e=>{ie.value=[...e]},{immediate:!0});let ce=i([]),ue=i({});C(l,e=>{ce.value=[...e]},{immediate:!0});let de=R(()=>{let e={};for(let[t,n]of Object.entries(u.value))e[t]=n.filter(T);return e});C(de,e=>{ue.value={...e}},{immediate:!0});let fe=i(!1),pe=R(()=>fe.value&&k.value.length===0&&A.value.length===0);function _e(){if(fe.value=!1,oe.value=[],v.value)return;let e={};for(let[t,n]of Object.entries(ue.value))e[t]=n.map(e=>e.id);a.applyLayout({pinned:re.value.map(e=>e.id),sections:e})}function ve(){v.value||a.reorderSections(ce.value.map(e=>e.id))}let ye=i(null),be=i(``);function Se(e){ye.value=e.id,be.value=e.name,le(()=>{let t=document.querySelector(`[data-section-input="${e.id}"]`);t?.focus(),t?.select()})}function we(){let e=ye.value;if(!e)return;ye.value=null;let t=be.value.trim(),n=l.value.find(t=>t.id===e);t&&n&&t!==n.name&&a.renameSection(e,t)}function Te(){ye.value=null}async function Ee(){let e=await a.createSection(n(`aiChat.newSectionName`));e&&Se(e)}let De=i(null),Oe=i(null);function ke(e,t){Oe.value=e,De.value?.toggle(t)}function Ae(e){let t=Oe.value;De.value?.hide(),t&&e(t)}let je=i(!1);C([v,E],([e,t])=>{y.value=e?je.value||t.length>0:je.value});function Me(){je.value=!y.value,y.value=!y.value}let Ne=t;function Pe(){Ne(`start-new`)}function Fe(e){Ne(`select-conversation`,e)}function Ie(e){Ne(`delete-conversation`,e)}return F(()=>{ct()&&console.log(`[ai-chat][sidebar]`,w(),`mounted`,{activeId:o.value,visible:s.value.length,archived:d.value.length,unread:p.value.size,streaming:f.value.size,visibleOrder:s.value.map(e=>e.id.slice(0,8))})}),ae(()=>{S+=1,ct()&&console.log(`[ai-chat][sidebar]`,w(),`updated`,{count:S,activeId:o.value,visible:s.value.length,archived:d.value.length,unread:p.value.size,streaming:f.value.size})}),te(()=>{ct()&&console.log(`[ai-chat][sidebar]`,w(),`unmounted`,{updates:S})}),(e,t)=>{let i=O(`router-link`);return B(),N(`aside`,MP,[M(`div`,NP,[M(`span`,PP,[M(`i`,{class:I(r(AP))},null,2),x(` `+U(r(n)(`aiChat.title`)),1)]),b(r(Le),{icon:`ti ti-plus`,variant:`text`,rounded:``,size:`small`,title:r(n)(`aiChat.newConversation`),onClick:Pe},null,8,[`title`])]),M(`div`,FP,[t[20]||=M(`i`,{class:`ti ti-search ai-chat-sidebar__search-icon`},null,-1),b(r(Ce),{modelValue:_.value,"onUpdate:modelValue":t[0]||=e=>_.value=e,type:`search`,placeholder:r(n)(`aiChat.searchPlaceholder`),class:`ai-chat-sidebar__search-input`,"data-testid":`ai-chat-search`},null,8,[`modelValue`,`placeholder`])]),M(`div`,IP,[!r(m)&&!r(h)&&r(g).length===0?(B(),N(`div`,LP,[t[21]||=M(`i`,{class:`ti ti-alert-triangle`},null,-1),M(`span`,null,[x(U(r(n)(`aiChatPage.configureProviderPrefix`))+` `,1),b(i,{to:{name:`settings`,query:{section:`ai`}}},{default:H(()=>[x(U(r(n)(`settings.title`)),1)]),_:1})])])):G(``,!0)]),M(`div`,RP,[M(`section`,{class:I([`ai-chat-sidebar__pinned-card`,{"ai-chat-sidebar__pinned-card--awaiting":re.value.length===0}])},[M(`div`,zP,[t[22]||=M(`i`,{class:`ti ti-pin`},null,-1),x(` `+U(r(n)(`aiChat.pinnedGroup`)),1)]),M(`div`,BP,[b(r(Ht),L({modelValue:re.value,"onUpdate:modelValue":t[2]||=e=>re.value=e,group:{name:`ai-chat-conversations`},disabled:v.value},ne,{class:`ai-chat-sidebar__pinned-drop`,onStart:t[3]||=e=>fe.value=!0,onEnd:_e,onAdd:_e}),{default:H(()=>[(B(!0),N(V,null,P(re.value,e=>(B(),W(kP,{key:e.id,conv:e,active:e.id===r(o),streaming:r(f).has(e.id),unread:r(p).has(e.id),"companion-thinking":r(a).isCompanionThinkingFor(e.id),onSelect:Fe,onRename:D,onSetArchived:t[1]||=(e,t)=>r(a).archiveConversation(e,t),onDelete:Ie},null,8,[`conv`,`active`,`streaming`,`unread`,`companion-thinking`]))),128))]),_:1},16,[`modelValue`,`disabled`]),re.value.length===0?(B(),N(`div`,VP,U(r(n)(`aiChat.pinnedDropHint`)),1)):G(``,!0)])],2),b(r(Ht),L({modelValue:ce.value,"onUpdate:modelValue":t[7]||=e=>ce.value=e,disabled:v.value},ne,{handle:`.ai-chat-sidebar__section-handle`,class:`ai-chat-sidebar__sections`,onEnd:ve}),{default:H(()=>[(B(!0),N(V,null,P(ce.value,e=>(B(),N(`section`,{key:e.id,class:`ai-chat-sidebar__section-card`,"data-testid":`ai-chat-section-${e.id}`},[M(`div`,UP,[M(`i`,{class:`ti ti-menu-2 ai-chat-sidebar__section-handle`,title:r(n)(`aiChat.sectionMove`)},null,8,WP),ye.value===e.id?(B(),W(r(Ce),{key:0,modelValue:be.value,"onUpdate:modelValue":t[4]||=e=>be.value=e,"data-section-input":e.id,maxlength:`80`,class:`ai-chat-sidebar__section-input`,onKeydown:[me(he(we,[`prevent`]),[`enter`]),me(he(Te,[`prevent`]),[`esc`])],onBlur:we},null,8,[`modelValue`,`data-section-input`,`onKeydown`])):(B(),N(`span`,{key:1,class:`ai-chat-sidebar__section-name`,onDblclick:t=>Se(e)},U(e.name),41,GP)),M(`button`,{class:`ai-chat-sidebar__section-menu`,title:r(n)(`aiChat.sectionMenu`),"aria-label":r(n)(`aiChat.sectionMenu`),onClick:t=>ke(e,t)},[...t[23]||=[M(`i`,{class:`ti ti-dots-vertical`},null,-1)]],8,KP)]),M(`div`,qP,[b(r(Ht),L({modelValue:ue.value[e.id],"onUpdate:modelValue":t=>ue.value[e.id]=t,group:{name:`ai-chat-conversations`},disabled:v.value},{ref_for:!0},ne,{class:`ai-chat-sidebar__pinned-drop`,onStart:t[6]||=e=>fe.value=!0,onEnd:_e,onAdd:_e}),{default:H(()=>[(B(!0),N(V,null,P(ue.value[e.id]??[],e=>(B(),W(kP,{key:e.id,conv:e,active:e.id===r(o),streaming:r(f).has(e.id),unread:r(p).has(e.id),"companion-thinking":r(a).isCompanionThinkingFor(e.id),onSelect:Fe,onRename:D,onSetArchived:t[5]||=(e,t)=>r(a).archiveConversation(e,t),onDelete:Ie},null,8,[`conv`,`active`,`streaming`,`unread`,`companion-thinking`]))),128))]),_:2},1040,[`modelValue`,`onUpdate:modelValue`,`disabled`]),(ue.value[e.id]??[]).length===0?(B(),N(`div`,JP,U(r(n)(`aiChat.sectionDropHint`)),1)):G(``,!0)])],8,HP))),128))]),_:1},16,[`modelValue`,`disabled`]),v.value?G(``,!0):(B(),N(`button`,{key:0,class:`ai-chat-sidebar__new-section`,"data-testid":`ai-chat-new-section`,onClick:Ee},[t[24]||=M(`i`,{class:`ti ti-plus`},null,-1),x(` `+U(r(n)(`aiChat.newSection`)),1)])),b(r(xe),{ref_key:`sectionMenu`,ref:De},{default:H(()=>[Oe.value?(B(),N(`div`,YP,[M(`button`,{class:`ai-chat-sidebar__menu-item`,onClick:t[8]||=e=>Ae(Se)},[t[25]||=M(`i`,{class:`ti ti-pencil`},null,-1),M(`span`,null,U(r(n)(`aiChat.sectionRename`)),1)]),M(`button`,{class:`ai-chat-sidebar__menu-item ai-chat-sidebar__menu-item--danger`,onClick:t[9]||=e=>Ae(e=>r(a).deleteSection(e.id))},[t[26]||=M(`i`,{class:`ti ti-trash`},null,-1),M(`span`,null,U(r(n)(`aiChat.sectionDelete`)),1)])])):G(``,!0)]),_:1},512),j(M(`div`,XP,[b(r(Ht),L({modelValue:oe.value,"onUpdate:modelValue":t[10]||=e=>oe.value=e,group:{name:`ai-chat-conversations`},disabled:v.value,sort:!1},ne,{class:`ai-chat-sidebar__unpinned-drop ai-chat-sidebar__unpin-drop`,onAdd:_e}),null,16,[`modelValue`,`disabled`]),M(`div`,ZP,U(r(n)(`aiChat.unpinDropHint`)),1)],512),[[ge,pe.value]]),k.value.length>0&&A.value.length>0?(B(),N(`div`,QP,[t[27]||=M(`i`,{class:`ti ti-device-desktop`},null,-1),x(` `+U(r(n)(`scenarioSelector.cliGroup`)),1)])):G(``,!0),j(b(r(Ht),L({modelValue:z.value,"onUpdate:modelValue":t[12]||=e=>z.value=e,group:{name:`ai-chat-conversations`},disabled:v.value,sort:!1},ne,{class:`ai-chat-sidebar__unpinned-drop`,onStart:t[13]||=e=>fe.value=!0,onEnd:t[14]||=e=>fe.value=!1,onAdd:_e}),{default:H(()=>[(B(!0),N(V,null,P(z.value,e=>(B(),W(kP,{key:e.id,conv:e,active:e.id===r(o),streaming:r(f).has(e.id),unread:r(p).has(e.id),"companion-thinking":r(a).isCompanionThinkingFor(e.id),onSelect:Fe,onRename:D,onSetArchived:t[11]||=(e,t)=>r(a).archiveConversation(e,t),onDelete:Ie},null,8,[`conv`,`active`,`streaming`,`unread`,`companion-thinking`]))),128))]),_:1},16,[`modelValue`,`disabled`]),[[ge,k.value.length>0]]),A.value.length>0&&k.value.length>0?(B(),N(`div`,$P,[t[28]||=M(`i`,{class:`ti ti-cloud`},null,-1),x(` `+U(r(n)(`scenarioSelector.apiGroup`)),1)])):G(``,!0),j(b(r(Ht),L({modelValue:ie.value,"onUpdate:modelValue":t[16]||=e=>ie.value=e,group:{name:`ai-chat-conversations`},disabled:v.value,sort:!1},ne,{class:`ai-chat-sidebar__unpinned-drop`,onStart:t[17]||=e=>fe.value=!0,onEnd:t[18]||=e=>fe.value=!1,onAdd:_e}),{default:H(()=>[(B(!0),N(V,null,P(ie.value,e=>(B(),W(kP,{key:e.id,conv:e,active:e.id===r(o),streaming:r(f).has(e.id),unread:r(p).has(e.id),"companion-thinking":r(a).isCompanionThinkingFor(e.id),onSelect:Fe,onRename:D,onSetArchived:t[15]||=(e,t)=>r(a).archiveConversation(e,t),onDelete:Ie},null,8,[`conv`,`active`,`streaming`,`unread`,`companion-thinking`]))),128))]),_:1},16,[`modelValue`,`disabled`]),[[ge,A.value.length>0]]),ee.value.length===0&&re.value.length===0?(B(),N(`div`,eF,U(v.value?r(n)(`aiChat.searchNoMatch`):r(n)(`aiChat.noConversations`)),1)):G(``,!0)]),r(d).length>0?(B(),N(`div`,tF,[M(`button`,{class:`ai-chat-sidebar__archive-toggle`,onClick:Me},[t[29]||=M(`i`,{class:`ti ti-inbox`},null,-1),M(`span`,null,U(r(n)(`aiChatPage.archives`,{count:r(d).length})),1),v.value?(B(),N(`span`,nF,U(r(n)(`aiChat.searchArchivedCount`,{count:E.value.length})),1)):G(``,!0),M(`i`,{class:I([y.value?`ti ti-chevron-up`:`ti ti-chevron-down`,`ai-chat-sidebar__archive-chevron`])},null,2)]),y.value?(B(),N(`div`,rF,[M(`div`,iF,[(B(!0),N(V,null,P(E.value,e=>(B(),W(kP,{key:e.id,conv:e,archived:``,active:e.id===r(o),onSelect:Fe,onRename:D,onSetArchived:t[19]||=(e,t)=>r(a).archiveConversation(e,t),onDelete:Ie},null,8,[`conv`,`active`]))),128)),E.value.length===0?(B(),N(`div`,aF,U(v.value?r(n)(`aiChat.searchNoMatch`):r(n)(`aiChat.noConversations`)),1)):G(``,!0)])])):G(``,!0)])):G(``,!0)])}}}),[[`__scopeId`,`data-v-e60b3dad`]]);function sF(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var cF=sF();function lF(e){cF=e}var uF={exec:()=>null};function dF(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function fF(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(mF.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var pF=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),mF={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:dF(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:dF(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:dF(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:dF(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:dF(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:dF(e=>RegExp(`^ {0,${e}}>`))},hF=/^(?:[ \t]*(?:\n|$))+/,gF=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,_F=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,vF=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,yF=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bF=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,xF=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,SF=fF(xF).replace(/bull/g,bF).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),CF=fF(xF).replace(/bull/g,bF).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),wF=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,TF=/^[^\n]+/,EF=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,DF=fF(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,EF).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),OF=fF(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,bF).getRegex(),kF=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,AF=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,jF=fF(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,AF).replace(`tag`,kF).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),MF=fF(wF).replace(`hr`,vF).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,kF).getRegex(),NF={blockquote:fF(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,MF).getRegex(),code:gF,def:DF,fences:_F,heading:yF,hr:vF,html:jF,lheading:SF,list:OF,newline:hF,paragraph:MF,table:uF,text:TF},PF=fF(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,vF).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,kF).getRegex(),FF={...NF,lheading:CF,table:PF,paragraph:fF(wF).replace(`hr`,vF).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,PF).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,kF).getRegex()},IF={...NF,html:fF(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,AF).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:uF,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:fF(wF).replace(`hr`,vF).replace(`heading`,` *#{1,6} *[^
|
|
199
|
+
]`).replace(`lheading`,SF).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},LF=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,RF=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,zF=/^( {2,}|\\)\n(?!\s*$)/,BF=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,VF=/[\p{P}\p{S}]/u,HF=/[\s\p{P}\p{S}]/u,UF=/[^\s\p{P}\p{S}]/u,WF=fF(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,HF).getRegex(),GF=/(?!~)[\p{P}\p{S}]/u,KF=/(?!~)[\s\p{P}\p{S}]/u,qF=/(?:[^\s\p{P}\p{S}]|~)/u,JF=fF(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,pF?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),YF=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,XF=fF(YF,`u`).replace(/punct/g,VF).getRegex(),ZF=fF(YF,`u`).replace(/punct/g,GF).getRegex(),QF=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,$F=fF(QF,`gu`).replace(/notPunctSpace/g,UF).replace(/punctSpace/g,HF).replace(/punct/g,VF).getRegex(),eI=fF(QF,`gu`).replace(/notPunctSpace/g,qF).replace(/punctSpace/g,KF).replace(/punct/g,GF).getRegex(),tI=fF(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,UF).replace(/punctSpace/g,HF).replace(/punct/g,VF).getRegex(),nI=fF(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,VF).getRegex(),rI=fF(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,UF).replace(/punctSpace/g,HF).replace(/punct/g,VF).getRegex(),iI=fF(/\\(punct)/,`gu`).replace(/punct/g,VF).getRegex(),aI=fF(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),oI=fF(AF).replace(`(?:-->|$)`,`-->`).getRegex(),sI=fF(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,oI).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),cI=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,lI=fF(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,cI).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),uI=fF(/^!?\[(label)\]\[(ref)\]/).replace(`label`,cI).replace(`ref`,EF).getRegex(),dI=fF(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,EF).getRegex(),fI=fF(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,uI).replace(`nolink`,dI).getRegex(),pI=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,mI={_backpedal:uF,anyPunctuation:iI,autolink:aI,blockSkip:JF,br:zF,code:RF,del:uF,delLDelim:uF,delRDelim:uF,emStrongLDelim:XF,emStrongRDelimAst:$F,emStrongRDelimUnd:tI,escape:LF,link:lI,nolink:dI,punctuation:WF,reflink:uI,reflinkSearch:fI,tag:sI,text:BF,url:uF},hI={...mI,link:fF(/^!?\[(label)\]\((.*?)\)/).replace(`label`,cI).getRegex(),reflink:fF(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,cI).getRegex()},gI={...mI,emStrongRDelimAst:eI,emStrongLDelim:ZF,delLDelim:nI,delRDelim:rI,url:fF(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,pI).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:fF(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,pI).getRegex()},_I={...gI,br:fF(zF).replace(`{2,}`,`*`).getRegex(),text:fF(gI.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},vI={normal:NF,gfm:FF,pedantic:IF},yI={normal:mI,gfm:gI,breaks:_I,pedantic:hI},bI={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},xI=e=>bI[e];function SI(e,t){if(t){if(mF.escapeTest.test(e))return e.replace(mF.escapeReplace,xI)}else if(mF.escapeTestNoEncode.test(e))return e.replace(mF.escapeReplaceNoEncode,xI);return e}function CI(e){try{e=encodeURI(e).replace(mF.percentDecode,`%`)}catch{return null}return e}function wI(e,t){let n=e.replace(mF.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(mF.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(mF.slashPipe,`|`);return n}function TI(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function EI(e){let t=e.split(`
|
|
200
|
+
`),n=t.length-1;for(;n>=0&&mF.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
201
|
+
`)}function DI(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function OI(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function kI(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function AI(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
202
202
|
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
203
|
-
`)}var
|
|
204
|
-
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:
|
|
205
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=
|
|
203
|
+
`)}var jI=class{options;rules;lexer;constructor(e){this.options=e||cF}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:EI(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=AI(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=TI(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:TI(t[0],`
|
|
204
|
+
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:TI(t[0],`
|
|
205
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=TI(t[0],`
|
|
206
206
|
`).split(`
|
|
207
207
|
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
208
208
|
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
@@ -213,20 +213,20 @@ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
213
213
|
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
214
214
|
`+e.join(`
|
|
215
215
|
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
216
|
-
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=
|
|
216
|
+
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=OI(t[2].split(`
|
|
217
217
|
`,1)[0],t[1].length),l=e.split(`
|
|
218
218
|
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
219
219
|
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
|
|
220
220
|
`,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
221
221
|
`+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
222
222
|
`+l}u=!l.trim(),r+=p+`
|
|
223
|
-
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1;if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=
|
|
224
|
-
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=
|
|
225
|
-
`):[],a={type:`table`,raw:
|
|
226
|
-
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(
|
|
223
|
+
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1;if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=EI(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:TI(t[0],`
|
|
224
|
+
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=wI(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
225
|
+
`):[],a={type:`table`,raw:TI(t[0],`
|
|
226
|
+
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(wI(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:TI(t[0],`
|
|
227
227
|
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
228
|
-
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=
|
|
229
|
-
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(
|
|
228
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=TI(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=DI(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),kI(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return kI(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},MI=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||cF,this.options.tokenizer=this.options.tokenizer||new jI,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:mF,block:vI.normal,inline:yI.normal};this.options.pedantic?(t.block=vI.pedantic,t.inline=yI.pedantic):this.options.gfm&&(t.block=vI.gfm,t.inline=this.options.breaks?yI.breaks:yI.gfm),this.tokenizer.rules=t}static get rules(){return{block:vI,inline:yI}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(mF.carriageReturn,`
|
|
229
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(mF.tabCharGlobal,` `).replace(mF.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
|
|
230
230
|
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
231
231
|
`)?``:`
|
|
232
232
|
`)+i.raw,n.text+=`
|
|
@@ -239,9 +239,9 @@ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
239
239
|
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
240
240
|
`)?``:`
|
|
241
241
|
`)+i.raw,n.text+=`
|
|
242
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``,s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},
|
|
243
|
-
`;return r?`<pre><code class="language-`+
|
|
244
|
-
`:`<pre><code>`+(n?i:
|
|
242
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``,s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},NI=class{options;parser;constructor(e){this.options=e||cF}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(mF.notSpaceStart)?.[0],i=e.replace(mF.endingNewline,``)+`
|
|
243
|
+
`;return r?`<pre><code class="language-`+SI(r)+`">`+(n?i:SI(i,!0))+`</code></pre>
|
|
244
|
+
`:`<pre><code>`+(n?i:SI(i,!0))+`</code></pre>
|
|
245
245
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
246
246
|
${this.parser.parse(e)}</blockquote>
|
|
247
247
|
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
@@ -257,34 +257,34 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
257
257
|
`}tablerow({text:e}){return`<tr>
|
|
258
258
|
${e}</tr>
|
|
259
259
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
260
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${
|
|
261
|
-
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+
|
|
262
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RI(e,t){return FI(e)||II(e,t)||zI(e,t)||LI()}function zI(e,t){if(e){if(typeof e==`string`)return PI(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?PI(e,t):void 0}}var BI=Object.entries,VI=Object.setPrototypeOf,HI=Object.isFrozen,UI=Object.getPrototypeOf,WI=Object.getOwnPropertyDescriptor,GI=Object.freeze,KI=Object.seal,qI=Object.create,JI=typeof Reflect<`u`&&Reflect,YI=JI.apply,XI=JI.construct;GI||=function(e){return e},KI||=function(e){return e},YI||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},XI||=function(e){return new e(...[...arguments].slice(1))};var ZI=_L(Array.prototype.forEach),QI=_L(Array.prototype.lastIndexOf),$I=_L(Array.prototype.pop),eL=_L(Array.prototype.push),tL=_L(Array.prototype.splice),nL=Array.isArray,rL=_L(String.prototype.toLowerCase),iL=_L(String.prototype.toString),aL=_L(String.prototype.match),oL=_L(String.prototype.replace),sL=_L(String.prototype.indexOf),cL=_L(String.prototype.trim),lL=_L(Number.prototype.toString),uL=_L(Boolean.prototype.toString),dL=typeof BigInt>`u`?null:_L(BigInt.prototype.toString),fL=typeof Symbol>`u`?null:_L(Symbol.prototype.toString),pL=_L(Object.prototype.hasOwnProperty),mL=_L(Object.prototype.toString),hL=_L(RegExp.prototype.test),gL=vL(TypeError);function _L(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return YI(e,t,n)}}function vL(e){return function(){return XI(e,[...arguments])}}function yL(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:rL;if(VI&&VI(e,null),!nL(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(HI(t)||(t[r]=e),i=e)}e[i]=!0}return e}function bL(e){for(let t=0;t<e.length;t++)pL(e,t)||(e[t]=null);return e}function xL(e){let t=qI(null);for(let r of BI(e)){var n=RI(r,2);let i=n[0],a=n[1];pL(e,i)&&(t[i]=nL(a)?bL(a):a&&typeof a==`object`&&a.constructor===Object?xL(a):a)}return t}function SL(e){switch(typeof e){case`string`:return e;case`number`:return lL(e);case`boolean`:return uL(e);case`bigint`:return dL?dL(e):`0`;case`symbol`:return fL?fL(e):`Symbol()`;case`undefined`:return mL(e);case`function`:case`object`:{if(e===null)return mL(e);let t=e,n=CL(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:mL(e)}return mL(e)}default:return mL(e)}}function CL(e,t){for(;e!==null;){let n=WI(e,t);if(n){if(n.get)return _L(n.get);if(typeof n.value==`function`)return _L(n.value)}e=UI(e)}function n(){return null}return n}function wL(e){try{return hL(e,``),!0}catch{return!1}}var TL=GI(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),EL=GI(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),DL=GI([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),OL=GI([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),kL=GI(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),AL=GI([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),jL=GI([`#text`]),ML=GI(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),NL=GI(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),PL=GI(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),FL=GI([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),IL=KI(/{{[\w\W]*|^[\w\W]*}}/g),LL=KI(/<%[\w\W]*|^[\w\W]*%>/g),RL=KI(/\${[\w\W]*/g),zL=KI(/^data-[\-\w.\u00B7-\uFFFF]+$/),BL=KI(/^aria-[\-\w]+$/),VL=KI(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),HL=KI(/^(?:\w+script|data):/i),UL=KI(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),WL=KI(/^html$/i),GL=KI(/^[a-z][.\w]*(-[.\w]+)+$/i),KL=KI(/<[/\w!]/g),qL=KI(/<[/\w]/g),JL=KI(/<\/no(script|embed|frames)/i),YL=KI(/\/>/i),XL={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ZL=function(){return typeof window>`u`?null:window},QL=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},$L=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},eR=function(e,t,n,r){return pL(e,t)&&nL(e[t])?yL(r.base?xL(r.base):{},e[t],r.transform):n};function tR(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ZL(),t=e=>tR(e);if(t.version=`3.4.11`,t.removed=[],!e||!e.document||e.document.nodeType!==XL.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=CL(d,`cloneNode`),p=CL(d,`remove`),m=CL(d,`nextSibling`),h=CL(d,`childNodes`),g=CL(d,`parentNode`),_=CL(d,`shadowRoot`),v=CL(d,`attributes`),y=o&&o.prototype?CL(o.prototype,`nodeType`):null,b=o&&o.prototype?CL(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S=``,C,w=!1,T=0,E=function(){if(T>0)throw gL(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},D=function(e){E(),T++;try{return x.createHTML(e)}finally{T--}},ee=function(e){E(),T++;try{return x.createScriptURL(e)}finally{T--}},O=function(){return w||=(C=QL(u,i),!0),C},k=n,A=k.implementation,j=k.createNodeIterator,M=k.createDocumentFragment,N=k.getElementsByTagName,P=r.importNode,F=$L();t.isSupported=typeof BI==`function`&&typeof g==`function`&&A&&A.createHTMLDocument!==void 0;let I=IL,L=LL,te=RL,R=zL,ne=BL,re=HL,z=UL,B=GL,ie=VL,V=null,ae=yL({},[...TL,...EL,...DL,...kL,...jL]),H=null,U=yL({},[...ML,...NL,...PL,...FL]),oe=Object.seal(qI(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),se=null,ce=null,le=Object.seal(qI(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ue=!0,W=!0,de=!1,fe=!0,G=!1,pe=!0,me=!1,he=!1,ge=null,_e=null,ve=!1,ye=!1,be=!1,xe=!1,Se=!0,Ce=!1,we=`user-content-`,Te=!0,Ee=!1,De={},Oe=null,ke=yL({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ae=null,je=yL({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Me=null,Ne=yL({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Pe=`http://www.w3.org/1998/Math/MathML`,Fe=`http://www.w3.org/2000/svg`,Ie=`http://www.w3.org/1999/xhtml`,Le=Ie,Re=!1,ze=null,Be=yL({},[Pe,Fe,Ie],iL),Ve=GI([`mi`,`mo`,`mn`,`ms`,`mtext`]),He=yL({},Ve),Ue=GI([`annotation-xml`]),We=yL({},Ue),Ge=yL({},[`title`,`style`,`font`,`a`,`script`]),Ke=null,qe=[`application/xhtml+xml`,`text/html`],Je=null,Ye=null,Xe=n.createElement(`form`),Ze=function(e){return e instanceof RegExp||e instanceof Function},Qe=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ye&&Ye===e)return;(!e||typeof e!=`object`)&&(e={}),e=xL(e),Ke=qe.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Je=Ke===`application/xhtml+xml`?iL:rL,V=eR(e,`ALLOWED_TAGS`,ae,{transform:Je}),H=eR(e,`ALLOWED_ATTR`,U,{transform:Je}),ze=eR(e,`ALLOWED_NAMESPACES`,Be,{transform:iL}),Me=eR(e,`ADD_URI_SAFE_ATTR`,Ne,{transform:Je,base:Ne}),Ae=eR(e,`ADD_DATA_URI_TAGS`,je,{transform:Je,base:je}),Oe=eR(e,`FORBID_CONTENTS`,ke,{transform:Je}),se=eR(e,`FORBID_TAGS`,xL({}),{transform:Je}),ce=eR(e,`FORBID_ATTR`,xL({}),{transform:Je}),De=pL(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?xL(e.USE_PROFILES):e.USE_PROFILES:!1,ue=e.ALLOW_ARIA_ATTR!==!1,W=e.ALLOW_DATA_ATTR!==!1,de=e.ALLOW_UNKNOWN_PROTOCOLS||!1,fe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,G=e.SAFE_FOR_TEMPLATES||!1,pe=e.SAFE_FOR_XML!==!1,me=e.WHOLE_DOCUMENT||!1,ye=e.RETURN_DOM||!1,be=e.RETURN_DOM_FRAGMENT||!1,xe=e.RETURN_TRUSTED_TYPE||!1,ve=e.FORCE_BODY||!1,Se=e.SANITIZE_DOM!==!1,Ce=e.SANITIZE_NAMED_PROPS||!1,Te=e.KEEP_CONTENT!==!1,Ee=e.IN_PLACE||!1,ie=wL(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:VL,Le=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ie,He=pL(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?xL(e.MATHML_TEXT_INTEGRATION_POINTS):yL({},Ve),We=pL(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?xL(e.HTML_INTEGRATION_POINTS):yL({},Ue);let t=pL(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?xL(e.CUSTOM_ELEMENT_HANDLING):qI(null);if(oe=qI(null),pL(t,`tagNameCheck`)&&Ze(t.tagNameCheck)&&(oe.tagNameCheck=t.tagNameCheck),pL(t,`attributeNameCheck`)&&Ze(t.attributeNameCheck)&&(oe.attributeNameCheck=t.attributeNameCheck),pL(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(oe.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),KI(oe),G&&(W=!1),be&&(ye=!0),De&&(V=yL({},jL),H=qI(null),De.html===!0&&(yL(V,TL),yL(H,ML)),De.svg===!0&&(yL(V,EL),yL(H,NL),yL(H,FL)),De.svgFilters===!0&&(yL(V,DL),yL(H,NL),yL(H,FL)),De.mathMl===!0&&(yL(V,kL),yL(H,PL),yL(H,FL))),le.tagCheck=null,le.attributeCheck=null,pL(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?le.tagCheck=e.ADD_TAGS:nL(e.ADD_TAGS)&&(V===ae&&(V=xL(V)),yL(V,e.ADD_TAGS,Je))),pL(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?le.attributeCheck=e.ADD_ATTR:nL(e.ADD_ATTR)&&(H===U&&(H=xL(H)),yL(H,e.ADD_ATTR,Je))),pL(e,`ADD_URI_SAFE_ATTR`)&&nL(e.ADD_URI_SAFE_ATTR)&&yL(Me,e.ADD_URI_SAFE_ATTR,Je),pL(e,`FORBID_CONTENTS`)&&nL(e.FORBID_CONTENTS)&&(Oe===ke&&(Oe=xL(Oe)),yL(Oe,e.FORBID_CONTENTS,Je)),pL(e,`ADD_FORBID_CONTENTS`)&&nL(e.ADD_FORBID_CONTENTS)&&(Oe===ke&&(Oe=xL(Oe)),yL(Oe,e.ADD_FORBID_CONTENTS,Je)),Te&&(V[`#text`]=!0),me&&yL(V,[`html`,`head`,`body`]),V.table&&(yL(V,[`tbody`]),delete se.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw gL(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw gL(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=x;x=e.TRUSTED_TYPES_POLICY;try{S=D(``)}catch(e){throw x=t,e}}else e.TRUSTED_TYPES_POLICY===null?(x=void 0,S=``):(x===void 0&&(x=O()),x&&typeof S==`string`&&(S=D(``)));GI&&GI(e),Ye=e},$e=yL({},[...EL,...DL,...OL]),et=yL({},[...kL,...AL]),tt=function(e,t,n){return t.namespaceURI===Ie?e===`svg`:t.namespaceURI===Pe?e===`svg`&&(n===`annotation-xml`||He[n]):!!$e[e]},nt=function(e,t,n){return t.namespaceURI===Ie?e===`math`:t.namespaceURI===Fe?e===`math`&&We[n]:!!et[e]},rt=function(e,t,n){return t.namespaceURI===Fe&&!We[n]||t.namespaceURI===Pe&&!He[n]?!1:!et[e]&&(Ge[e]||!$e[e])},it=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Le,tagName:`template`});let n=rL(e.tagName),r=rL(t.tagName);return ze[e.namespaceURI]?e.namespaceURI===Fe?tt(n,t,r):e.namespaceURI===Pe?nt(n,t,r):e.namespaceURI===Ie?rt(n,t,r):!!(Ke===`application/xhtml+xml`&&ze[e.namespaceURI]):!1},at=function(e){eL(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw gL(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},ot=function(e){let t=h(e);if(t){let e=[];ZI(t,t=>{eL(e,t)}),ZI(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},st=function(e,n){try{eL(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{eL(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`){if(ye||be)try{at(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},ct=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||H[Je(i)]))try{e.removeAttribute(i)}catch{}}},lt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===XL.element&&ct(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},ut=function(e){let t=null,r=null;if(ve)e=`<remove></remove>`+e;else{let t=aL(e,/^[\r\n\t ]+/);r=t&&t[0]}Ke===`application/xhtml+xml`&&Le===Ie&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?D(e):e;if(Le===Ie)try{t=new l().parseFromString(i,Ke)}catch{}if(!t||!t.documentElement){t=A.createDocument(Le,`template`,null);try{t.documentElement.innerHTML=Re?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Le===Ie?N.call(t,me?`html`:`body`)[0]:me?t.documentElement:a},dt=function(e){return j.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ft=function(e){return e=oL(e,I,` `),e=oL(e,L,` `),e=oL(e,te,` `),e},pt=function(e){e.normalize();let t=j.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=ft(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&ZI(r,e=>{ht(e.content)&&pt(e.content)})},mt=function(e){let t=b?b(e):null;return typeof t!=`string`||Je(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},ht=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===XL.documentFragment}catch{return!1}},gt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function _t(e,n,r){e.length!==0&&ZI(e,e=>{e.call(t,n,r,Ye)})}let vt=function(e,t){return!!(pe&&e.hasChildNodes()&&!gt(e.firstElementChild)&&hL(KL,e.textContent)&&hL(KL,e.innerHTML)||pe&&e.namespaceURI===Ie&&t===`style`&>(e.firstElementChild)||e.nodeType===XL.processingInstruction||pe&&e.nodeType===XL.comment&&hL(qL,e.data))},yt=function(e,t){if(!se[t]&&Ct(t)&&(oe.tagNameCheck instanceof RegExp&&hL(oe.tagNameCheck,t)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(t)))return!1;if(Te&&!Oe[t]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=Ee?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return at(e),!0},bt=function(e){if(_t(F.beforeSanitizeElements,e,null),mt(e))return at(e),!0;let n=Je(b?b(e):e.nodeName);if(_t(F.uponSanitizeElement,e,{tagName:n,allowedTags:V}),vt(e,n))return at(e),!0;if(se[n]||!(le.tagCheck instanceof Function&&le.tagCheck(n))&&!V[n])return yt(e,n);if((y?y(e):e.nodeType)===XL.element&&!it(e)||(n===`noscript`||n===`noembed`||n===`noframes`)&&hL(JL,e.innerHTML))return at(e),!0;if(G&&e.nodeType===XL.text){let n=ft(e.textContent);e.textContent!==n&&(eL(t.removed,{element:e.cloneNode()}),e.textContent=n)}return _t(F.afterSanitizeElements,e,null),!1},xt=function(e,t,r){if(ce[t]||Se&&(t===`id`||t===`name`)&&(r in n||r in Xe))return!1;let i=H[t]||le.attributeCheck instanceof Function&&le.attributeCheck(t,e);if(!(W&&hL(R,t))&&!(ue&&hL(ne,t))){if(!i){if(!(Ct(e)&&(oe.tagNameCheck instanceof RegExp&&hL(oe.tagNameCheck,e)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(e))&&(oe.attributeNameCheck instanceof RegExp&&hL(oe.attributeNameCheck,t)||oe.attributeNameCheck instanceof Function&&oe.attributeNameCheck(t,e))||t===`is`&&oe.allowCustomizedBuiltInElements&&(oe.tagNameCheck instanceof RegExp&&hL(oe.tagNameCheck,r)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(r))))return!1}else if(!Me[t]&&!hL(ie,oL(r,z,``))&&(t!==`src`&&t!==`xlink:href`&&t!==`href`||e===`script`||sL(r,`data:`)!==0||!Ae[e])&&(!de||hL(re,oL(r,z,``)))&&r)return!1}return!0},St=yL({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Ct=function(e){return!St[rL(e)]&&hL(B,e)},wt=function(e,t,n,r){if(x&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return D(r);case`TrustedScriptURL`:return ee(r)}return r},Tt=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),mt(e)?at(e):$I(t.removed)}catch{st(n,e)}},Et=function(e){_t(F.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||mt(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0},r=t.length,i=Je(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=Je(o),u=c,d=o===`value`?u:cL(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,_t(F.uponSanitizeAttribute,e,n),d=n.attrValue,Ce&&(l===`id`||l===`name`)&&sL(d,we)!==0&&(st(o,e),d=we+d),pe&&hL(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){st(o,e);continue}if(l===`attributename`&&aL(d,`href`)){st(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){st(o,e);continue}if(!fe&&hL(YL,d)){st(o,e);continue}if(G&&(d=ft(d)),!xt(i,l,d)){st(o,e);continue}d=wt(i,l,s,d),d!==u&&Tt(e,o,s,d)}}_t(F.afterSanitizeAttributes,e,null)},Dt=function(e){let t=null,n=dt(e);for(_t(F.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(_t(F.uponSanitizeShadowNode,t,null),bt(t),Et(t),ht(t.content)&&Dt(t.content),(y?y(t):t.nodeType)===XL.element){let e=_(t);ht(e)&&(Ot(e),Dt(e))}_t(F.afterSanitizeShadowDOM,e,null)},Ot=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Dt(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===XL.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&Je(e)===`template`){let e=n.content;ht(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);ht(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Re=!e,Re&&(e=`<!-->`),typeof e!=`string`&&!gt(e)&&(e=SL(e),typeof e!=`string`))throw gL(`dirty is not a string, aborting`);if(!t.isSupported)return e;he?(V=ge,H=_e):Qe(n),(F.uponSanitizeElement.length>0||F.uponSanitizeAttribute.length>0)&&(V=xL(V)),F.uponSanitizeAttribute.length>0&&(H=xL(H)),t.removed=[];let c=Ee&&typeof e!=`string`&>(e);if(c){let t=b?b(e):e.nodeName;if(typeof t==`string`){let e=Je(t);if(!V[e]||se[e])throw gL(`root node is forbidden and cannot be sanitized in-place`)}if(mt(e))throw gL(`root node is clobbered and cannot be sanitized in-place`);try{Ot(e)}catch(t){throw ot(e),t}}else if(gt(e))i=ut(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===XL.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Ot(a);else{if(!ye&&!G&&!me&&e.indexOf(`<`)===-1)return x&&xe?D(e):e;if(i=ut(e),!i)return ye?null:xe?S:``}i&&ve&&at(i.firstChild);let l=dt(c?e:i);try{for(;o=l.nextNode();)bt(o),Et(o),ht(o.content)&&Dt(o.content)}catch(t){throw c&&ot(e),t}if(c)return ZI(t.removed,e=>{e.element&<(e.element)}),G&&pt(e),e;if(ye){if(G&&pt(i),be)for(s=M.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(H.shadowroot||H.shadowrootmode)&&(s=P.call(r,s,!0)),s}let u=me?i.outerHTML:i.innerHTML;return me&&V[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&hL(WL,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
263
|
-
`+u),G&&(u=ft(u)),x&&xe?D(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Qe(e),he=!0,ge=V,_e=H},t.clearConfig=function(){Ye=null,he=!1,ge=null,_e=null,x=C,S=``},t.isValidAttribute=function(e,t,n){Ye||Qe({});let r=Je(e),i=Je(t);return xt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&
|
|
260
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${SI(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=CI(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+SI(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=CI(e);if(i===null)return SI(n);e=i;let a=`<img src="${e}" alt="${SI(n)}"`;return t&&(a+=` title="${SI(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:SI(e.text)}},PI=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},FI=class e{options;renderer;textRenderer;constructor(e){this.options=e||cF,this.options.renderer=this.options.renderer||new NI,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new PI}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},II=class{options;block;constructor(e){this.options=e||cF}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?MI.lex:MI.lexInline}provideParser(e=this.block){return e?FI.parse:FI.parseInline}},LI=new class{defaults=sF();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=FI;Renderer=NI;TextRenderer=PI;Lexer=MI;Tokenizer=jI;Hooks=II;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new NI(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new jI(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new II;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=II.passThroughHooks.has(n)?e=>{if(this.defaults.async&&II.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return MI.lex(e,t??this.defaults)}parser(e,t){return FI.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?MI.lex:MI.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?FI.parse:FI.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?MI.lex:MI.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?FI.parse:FI.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
261
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+SI(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function RI(e,t){return LI.parse(e,t)}RI.options=RI.setOptions=function(e){return LI.setOptions(e),RI.defaults=LI.defaults,lF(RI.defaults),RI},RI.getDefaults=sF,RI.defaults=cF,RI.use=function(...e){return LI.use(...e),RI.defaults=LI.defaults,lF(RI.defaults),RI},RI.walkTokens=function(e,t){return LI.walkTokens(e,t)},RI.parseInline=LI.parseInline,RI.Parser=FI,RI.parser=FI.parse,RI.Renderer=NI,RI.TextRenderer=PI,RI.Lexer=MI,RI.lexer=MI.lex,RI.Tokenizer=jI,RI.Hooks=II,RI.parse=RI,RI.options,RI.setOptions,RI.use,RI.walkTokens,RI.parseInline,FI.parse,MI.lex;function zI(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function BI(e){if(Array.isArray(e))return e}function VI(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function HI(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
262
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UI(e,t){return BI(e)||VI(e,t)||WI(e,t)||HI()}function WI(e,t){if(e){if(typeof e==`string`)return zI(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zI(e,t):void 0}}var GI=Object.entries,KI=Object.setPrototypeOf,qI=Object.isFrozen,JI=Object.getPrototypeOf,YI=Object.getOwnPropertyDescriptor,XI=Object.freeze,ZI=Object.seal,QI=Object.create,$I=typeof Reflect<`u`&&Reflect,eL=$I.apply,tL=$I.construct;XI||=function(e){return e},ZI||=function(e){return e},eL||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},tL||=function(e){return new e(...[...arguments].slice(1))};var nL=SL(Array.prototype.forEach),rL=SL(Array.prototype.lastIndexOf),iL=SL(Array.prototype.pop),aL=SL(Array.prototype.push),oL=SL(Array.prototype.splice),sL=Array.isArray,cL=SL(String.prototype.toLowerCase),lL=SL(String.prototype.toString),uL=SL(String.prototype.match),dL=SL(String.prototype.replace),fL=SL(String.prototype.indexOf),pL=SL(String.prototype.trim),mL=SL(Number.prototype.toString),hL=SL(Boolean.prototype.toString),gL=typeof BigInt>`u`?null:SL(BigInt.prototype.toString),_L=typeof Symbol>`u`?null:SL(Symbol.prototype.toString),vL=SL(Object.prototype.hasOwnProperty),yL=SL(Object.prototype.toString),bL=SL(RegExp.prototype.test),xL=CL(TypeError);function SL(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return eL(e,t,n)}}function CL(e){return function(){return tL(e,[...arguments])}}function wL(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:cL;if(KI&&KI(e,null),!sL(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(qI(t)||(t[r]=e),i=e)}e[i]=!0}return e}function TL(e){for(let t=0;t<e.length;t++)vL(e,t)||(e[t]=null);return e}function EL(e){let t=QI(null);for(let r of GI(e)){var n=UI(r,2);let i=n[0],a=n[1];vL(e,i)&&(t[i]=sL(a)?TL(a):a&&typeof a==`object`&&a.constructor===Object?EL(a):a)}return t}function DL(e){switch(typeof e){case`string`:return e;case`number`:return mL(e);case`boolean`:return hL(e);case`bigint`:return gL?gL(e):`0`;case`symbol`:return _L?_L(e):`Symbol()`;case`undefined`:return yL(e);case`function`:case`object`:{if(e===null)return yL(e);let t=e,n=OL(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:yL(e)}return yL(e)}default:return yL(e)}}function OL(e,t){for(;e!==null;){let n=YI(e,t);if(n){if(n.get)return SL(n.get);if(typeof n.value==`function`)return SL(n.value)}e=JI(e)}function n(){return null}return n}function kL(e){try{return bL(e,``),!0}catch{return!1}}var AL=XI(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),jL=XI(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),ML=XI([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),NL=XI([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),PL=XI(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),FL=XI([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),IL=XI([`#text`]),LL=XI(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),RL=XI(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),zL=XI(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),BL=XI([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),VL=ZI(/{{[\w\W]*|^[\w\W]*}}/g),HL=ZI(/<%[\w\W]*|^[\w\W]*%>/g),UL=ZI(/\${[\w\W]*/g),WL=ZI(/^data-[\-\w.\u00B7-\uFFFF]+$/),GL=ZI(/^aria-[\-\w]+$/),KL=ZI(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),qL=ZI(/^(?:\w+script|data):/i),JL=ZI(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),YL=ZI(/^html$/i),XL=ZI(/^[a-z][.\w]*(-[.\w]+)+$/i),ZL=ZI(/<[/\w!]/g),QL=ZI(/<[/\w]/g),$L=ZI(/<\/no(script|embed|frames)/i),eR=ZI(/\/>/i),tR={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},nR=function(){return typeof window>`u`?null:window},rR=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},iR=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},aR=function(e,t,n,r){return vL(e,t)&&sL(e[t])?wL(r.base?EL(r.base):{},e[t],r.transform):n};function oR(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:nR(),t=e=>oR(e);if(t.version=`3.4.11`,t.removed=[],!e||!e.document||e.document.nodeType!==tR.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=OL(d,`cloneNode`),p=OL(d,`remove`),m=OL(d,`nextSibling`),h=OL(d,`childNodes`),g=OL(d,`parentNode`),_=OL(d,`shadowRoot`),v=OL(d,`attributes`),y=o&&o.prototype?OL(o.prototype,`nodeType`):null,b=o&&o.prototype?OL(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S=``,C,w=!1,T=0,E=function(){if(T>0)throw xL(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},D=function(e){E(),T++;try{return x.createHTML(e)}finally{T--}},ee=function(e){E(),T++;try{return x.createScriptURL(e)}finally{T--}},O=function(){return w||=(C=rR(u,i),!0),C},k=n,A=k.implementation,j=k.createNodeIterator,M=k.createDocumentFragment,N=k.getElementsByTagName,P=r.importNode,F=iR();t.isSupported=typeof GI==`function`&&typeof g==`function`&&A&&A.createHTMLDocument!==void 0;let I=VL,L=HL,te=UL,R=WL,ne=GL,re=qL,z=JL,B=XL,ie=KL,V=null,ae=wL({},[...AL,...jL,...ML,...PL,...IL]),H=null,U=wL({},[...LL,...RL,...zL,...BL]),oe=Object.seal(QI(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),se=null,ce=null,le=Object.seal(QI(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ue=!0,W=!0,de=!1,fe=!0,G=!1,pe=!0,me=!1,he=!1,ge=null,_e=null,ve=!1,ye=!1,be=!1,xe=!1,Se=!0,Ce=!1,we=`user-content-`,Te=!0,Ee=!1,De={},Oe=null,ke=wL({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ae=null,je=wL({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Me=null,Ne=wL({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Pe=`http://www.w3.org/1998/Math/MathML`,Fe=`http://www.w3.org/2000/svg`,Ie=`http://www.w3.org/1999/xhtml`,Le=Ie,Re=!1,ze=null,Be=wL({},[Pe,Fe,Ie],lL),Ve=XI([`mi`,`mo`,`mn`,`ms`,`mtext`]),He=wL({},Ve),Ue=XI([`annotation-xml`]),We=wL({},Ue),Ge=wL({},[`title`,`style`,`font`,`a`,`script`]),Ke=null,qe=[`application/xhtml+xml`,`text/html`],Je=null,Ye=null,Xe=n.createElement(`form`),Ze=function(e){return e instanceof RegExp||e instanceof Function},Qe=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ye&&Ye===e)return;(!e||typeof e!=`object`)&&(e={}),e=EL(e),Ke=qe.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Je=Ke===`application/xhtml+xml`?lL:cL,V=aR(e,`ALLOWED_TAGS`,ae,{transform:Je}),H=aR(e,`ALLOWED_ATTR`,U,{transform:Je}),ze=aR(e,`ALLOWED_NAMESPACES`,Be,{transform:lL}),Me=aR(e,`ADD_URI_SAFE_ATTR`,Ne,{transform:Je,base:Ne}),Ae=aR(e,`ADD_DATA_URI_TAGS`,je,{transform:Je,base:je}),Oe=aR(e,`FORBID_CONTENTS`,ke,{transform:Je}),se=aR(e,`FORBID_TAGS`,EL({}),{transform:Je}),ce=aR(e,`FORBID_ATTR`,EL({}),{transform:Je}),De=vL(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?EL(e.USE_PROFILES):e.USE_PROFILES:!1,ue=e.ALLOW_ARIA_ATTR!==!1,W=e.ALLOW_DATA_ATTR!==!1,de=e.ALLOW_UNKNOWN_PROTOCOLS||!1,fe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,G=e.SAFE_FOR_TEMPLATES||!1,pe=e.SAFE_FOR_XML!==!1,me=e.WHOLE_DOCUMENT||!1,ye=e.RETURN_DOM||!1,be=e.RETURN_DOM_FRAGMENT||!1,xe=e.RETURN_TRUSTED_TYPE||!1,ve=e.FORCE_BODY||!1,Se=e.SANITIZE_DOM!==!1,Ce=e.SANITIZE_NAMED_PROPS||!1,Te=e.KEEP_CONTENT!==!1,Ee=e.IN_PLACE||!1,ie=kL(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:KL,Le=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ie,He=vL(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?EL(e.MATHML_TEXT_INTEGRATION_POINTS):wL({},Ve),We=vL(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?EL(e.HTML_INTEGRATION_POINTS):wL({},Ue);let t=vL(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?EL(e.CUSTOM_ELEMENT_HANDLING):QI(null);if(oe=QI(null),vL(t,`tagNameCheck`)&&Ze(t.tagNameCheck)&&(oe.tagNameCheck=t.tagNameCheck),vL(t,`attributeNameCheck`)&&Ze(t.attributeNameCheck)&&(oe.attributeNameCheck=t.attributeNameCheck),vL(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(oe.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),ZI(oe),G&&(W=!1),be&&(ye=!0),De&&(V=wL({},IL),H=QI(null),De.html===!0&&(wL(V,AL),wL(H,LL)),De.svg===!0&&(wL(V,jL),wL(H,RL),wL(H,BL)),De.svgFilters===!0&&(wL(V,ML),wL(H,RL),wL(H,BL)),De.mathMl===!0&&(wL(V,PL),wL(H,zL),wL(H,BL))),le.tagCheck=null,le.attributeCheck=null,vL(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?le.tagCheck=e.ADD_TAGS:sL(e.ADD_TAGS)&&(V===ae&&(V=EL(V)),wL(V,e.ADD_TAGS,Je))),vL(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?le.attributeCheck=e.ADD_ATTR:sL(e.ADD_ATTR)&&(H===U&&(H=EL(H)),wL(H,e.ADD_ATTR,Je))),vL(e,`ADD_URI_SAFE_ATTR`)&&sL(e.ADD_URI_SAFE_ATTR)&&wL(Me,e.ADD_URI_SAFE_ATTR,Je),vL(e,`FORBID_CONTENTS`)&&sL(e.FORBID_CONTENTS)&&(Oe===ke&&(Oe=EL(Oe)),wL(Oe,e.FORBID_CONTENTS,Je)),vL(e,`ADD_FORBID_CONTENTS`)&&sL(e.ADD_FORBID_CONTENTS)&&(Oe===ke&&(Oe=EL(Oe)),wL(Oe,e.ADD_FORBID_CONTENTS,Je)),Te&&(V[`#text`]=!0),me&&wL(V,[`html`,`head`,`body`]),V.table&&(wL(V,[`tbody`]),delete se.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw xL(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw xL(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=x;x=e.TRUSTED_TYPES_POLICY;try{S=D(``)}catch(e){throw x=t,e}}else e.TRUSTED_TYPES_POLICY===null?(x=void 0,S=``):(x===void 0&&(x=O()),x&&typeof S==`string`&&(S=D(``)));XI&&XI(e),Ye=e},$e=wL({},[...jL,...ML,...NL]),et=wL({},[...PL,...FL]),tt=function(e,t,n){return t.namespaceURI===Ie?e===`svg`:t.namespaceURI===Pe?e===`svg`&&(n===`annotation-xml`||He[n]):!!$e[e]},nt=function(e,t,n){return t.namespaceURI===Ie?e===`math`:t.namespaceURI===Fe?e===`math`&&We[n]:!!et[e]},rt=function(e,t,n){return t.namespaceURI===Fe&&!We[n]||t.namespaceURI===Pe&&!He[n]?!1:!et[e]&&(Ge[e]||!$e[e])},it=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Le,tagName:`template`});let n=cL(e.tagName),r=cL(t.tagName);return ze[e.namespaceURI]?e.namespaceURI===Fe?tt(n,t,r):e.namespaceURI===Pe?nt(n,t,r):e.namespaceURI===Ie?rt(n,t,r):!!(Ke===`application/xhtml+xml`&&ze[e.namespaceURI]):!1},at=function(e){aL(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw xL(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},ot=function(e){let t=h(e);if(t){let e=[];nL(t,t=>{aL(e,t)}),nL(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},st=function(e,n){try{aL(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{aL(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`){if(ye||be)try{at(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},ct=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||H[Je(i)]))try{e.removeAttribute(i)}catch{}}},lt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===tR.element&&ct(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},ut=function(e){let t=null,r=null;if(ve)e=`<remove></remove>`+e;else{let t=uL(e,/^[\r\n\t ]+/);r=t&&t[0]}Ke===`application/xhtml+xml`&&Le===Ie&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?D(e):e;if(Le===Ie)try{t=new l().parseFromString(i,Ke)}catch{}if(!t||!t.documentElement){t=A.createDocument(Le,`template`,null);try{t.documentElement.innerHTML=Re?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Le===Ie?N.call(t,me?`html`:`body`)[0]:me?t.documentElement:a},dt=function(e){return j.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ft=function(e){return e=dL(e,I,` `),e=dL(e,L,` `),e=dL(e,te,` `),e},pt=function(e){e.normalize();let t=j.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=ft(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&nL(r,e=>{ht(e.content)&&pt(e.content)})},mt=function(e){let t=b?b(e):null;return typeof t!=`string`||Je(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},ht=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===tR.documentFragment}catch{return!1}},gt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function _t(e,n,r){e.length!==0&&nL(e,e=>{e.call(t,n,r,Ye)})}let vt=function(e,t){return!!(pe&&e.hasChildNodes()&&!gt(e.firstElementChild)&&bL(ZL,e.textContent)&&bL(ZL,e.innerHTML)||pe&&e.namespaceURI===Ie&&t===`style`&>(e.firstElementChild)||e.nodeType===tR.processingInstruction||pe&&e.nodeType===tR.comment&&bL(QL,e.data))},yt=function(e,t){if(!se[t]&&Ct(t)&&(oe.tagNameCheck instanceof RegExp&&bL(oe.tagNameCheck,t)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(t)))return!1;if(Te&&!Oe[t]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=Ee?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return at(e),!0},bt=function(e){if(_t(F.beforeSanitizeElements,e,null),mt(e))return at(e),!0;let n=Je(b?b(e):e.nodeName);if(_t(F.uponSanitizeElement,e,{tagName:n,allowedTags:V}),vt(e,n))return at(e),!0;if(se[n]||!(le.tagCheck instanceof Function&&le.tagCheck(n))&&!V[n])return yt(e,n);if((y?y(e):e.nodeType)===tR.element&&!it(e)||(n===`noscript`||n===`noembed`||n===`noframes`)&&bL($L,e.innerHTML))return at(e),!0;if(G&&e.nodeType===tR.text){let n=ft(e.textContent);e.textContent!==n&&(aL(t.removed,{element:e.cloneNode()}),e.textContent=n)}return _t(F.afterSanitizeElements,e,null),!1},xt=function(e,t,r){if(ce[t]||Se&&(t===`id`||t===`name`)&&(r in n||r in Xe))return!1;let i=H[t]||le.attributeCheck instanceof Function&&le.attributeCheck(t,e);if(!(W&&bL(R,t))&&!(ue&&bL(ne,t))){if(!i){if(!(Ct(e)&&(oe.tagNameCheck instanceof RegExp&&bL(oe.tagNameCheck,e)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(e))&&(oe.attributeNameCheck instanceof RegExp&&bL(oe.attributeNameCheck,t)||oe.attributeNameCheck instanceof Function&&oe.attributeNameCheck(t,e))||t===`is`&&oe.allowCustomizedBuiltInElements&&(oe.tagNameCheck instanceof RegExp&&bL(oe.tagNameCheck,r)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(r))))return!1}else if(!Me[t]&&!bL(ie,dL(r,z,``))&&(t!==`src`&&t!==`xlink:href`&&t!==`href`||e===`script`||fL(r,`data:`)!==0||!Ae[e])&&(!de||bL(re,dL(r,z,``)))&&r)return!1}return!0},St=wL({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Ct=function(e){return!St[cL(e)]&&bL(B,e)},wt=function(e,t,n,r){if(x&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return D(r);case`TrustedScriptURL`:return ee(r)}return r},Tt=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),mt(e)?at(e):iL(t.removed)}catch{st(n,e)}},Et=function(e){_t(F.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||mt(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0},r=t.length,i=Je(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=Je(o),u=c,d=o===`value`?u:pL(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,_t(F.uponSanitizeAttribute,e,n),d=n.attrValue,Ce&&(l===`id`||l===`name`)&&fL(d,we)!==0&&(st(o,e),d=we+d),pe&&bL(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){st(o,e);continue}if(l===`attributename`&&uL(d,`href`)){st(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){st(o,e);continue}if(!fe&&bL(eR,d)){st(o,e);continue}if(G&&(d=ft(d)),!xt(i,l,d)){st(o,e);continue}d=wt(i,l,s,d),d!==u&&Tt(e,o,s,d)}}_t(F.afterSanitizeAttributes,e,null)},Dt=function(e){let t=null,n=dt(e);for(_t(F.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(_t(F.uponSanitizeShadowNode,t,null),bt(t),Et(t),ht(t.content)&&Dt(t.content),(y?y(t):t.nodeType)===tR.element){let e=_(t);ht(e)&&(Ot(e),Dt(e))}_t(F.afterSanitizeShadowDOM,e,null)},Ot=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Dt(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===tR.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&Je(e)===`template`){let e=n.content;ht(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);ht(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Re=!e,Re&&(e=`<!-->`),typeof e!=`string`&&!gt(e)&&(e=DL(e),typeof e!=`string`))throw xL(`dirty is not a string, aborting`);if(!t.isSupported)return e;he?(V=ge,H=_e):Qe(n),(F.uponSanitizeElement.length>0||F.uponSanitizeAttribute.length>0)&&(V=EL(V)),F.uponSanitizeAttribute.length>0&&(H=EL(H)),t.removed=[];let c=Ee&&typeof e!=`string`&>(e);if(c){let t=b?b(e):e.nodeName;if(typeof t==`string`){let e=Je(t);if(!V[e]||se[e])throw xL(`root node is forbidden and cannot be sanitized in-place`)}if(mt(e))throw xL(`root node is clobbered and cannot be sanitized in-place`);try{Ot(e)}catch(t){throw ot(e),t}}else if(gt(e))i=ut(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===tR.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Ot(a);else{if(!ye&&!G&&!me&&e.indexOf(`<`)===-1)return x&&xe?D(e):e;if(i=ut(e),!i)return ye?null:xe?S:``}i&&ve&&at(i.firstChild);let l=dt(c?e:i);try{for(;o=l.nextNode();)bt(o),Et(o),ht(o.content)&&Dt(o.content)}catch(t){throw c&&ot(e),t}if(c)return nL(t.removed,e=>{e.element&<(e.element)}),G&&pt(e),e;if(ye){if(G&&pt(i),be)for(s=M.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(H.shadowroot||H.shadowrootmode)&&(s=P.call(r,s,!0)),s}let u=me?i.outerHTML:i.innerHTML;return me&&V[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&bL(YL,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
263
|
+
`+u),G&&(u=ft(u)),x&&xe?D(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Qe(e),he=!0,ge=V,_e=H},t.clearConfig=function(){Ye=null,he=!1,ge=null,_e=null,x=C,S=``},t.isValidAttribute=function(e,t,n){Ye||Qe({});let r=Je(e),i=Je(t);return xt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&vL(F,e)&&aL(F[e],t)},t.removeHook=function(e,t){if(vL(F,e)){if(t!==void 0){let n=rL(F[e],t);return n===-1?void 0:oL(F[e],n,1)[0]}return iL(F[e])}},t.removeHooks=function(e){vL(F,e)&&(F[e]=[])},t.removeAllHooks=function(){F=iR()},t}var sR=oR(),cR={class:`kanban-preview-dialog`},lR={class:`kanban-preview-header`},uR={class:`kanban-preview-body`},dR={class:`ai-chat-message-list__msg-role`},fR={key:0,class:`ai-chat-message-list__context-note`},pR=[`onClick`],mR=[`innerHTML`],hR={key:0,class:`ai-chat-message-list__thinking-block`},gR=[`onClick`],_R={key:0,class:`ai-chat-message-list__thinking-content`},vR=[`onClick`],yR={class:`ai-chat-message-list__tool-event-name`},bR={key:0,class:`ai-chat-message-list__tool-event-args ai-chat-message-list__tool-event-args--streaming`},xR={key:1,class:`ai-chat-message-list__tool-event-args`},SR={class:`ai-chat-message-list__tool-param-key`},CR={class:`ai-chat-message-list__tool-param-value`},wR=[`onClick`],TR={key:0,class:`ai-chat-message-list__tool-diff-path`},ER={class:`ai-chat-message-list__tool-diff-body`},DR={class:`ai-chat-message-list__tool-diff-sign`},OR=[`onClick`],kR={key:2,class:`ai-chat-message-list__user-text`},AR=[`innerHTML`],jR={key:4,class:`ai-chat-message-list__image-part`},MR=[`src`,`alt`,`onClick`],NR=[`aria-label`],PR={key:0,class:`ai-chat-message-list__status`},FR={key:1,class:`ai-chat-message-list__cursor`},IR={key:0,class:`ai-chat-message-list__status`},LR=[`innerHTML`],RR={key:2,class:`ai-chat-message-list__user-text`},zR={key:3,class:`ai-chat-message-list__cursor`},BR={key:0,class:`ai-chat-message-list__empty-chat`},VR=524288,HR=ze(z({__name:`AiChatMessageList`,props:{messages:{},isStreaming:{type:Boolean}},emits:[`open-image-preview`],setup(e,{expose:t,emit:n}){let a=e,o=n,{t:s}=He(),c=i(null);t({messagesEl:c});let l=new Map;function u(e){return e.replaceAll(`&`,`&`).replaceAll(`"`,`"`).replaceAll(`<`,`<`).replaceAll(`>`,`>`)}function d(e){return e.replace(/<pass\s+branch="(\d+)"\s*\/>/g,(e,t)=>`<span class="scenario-flag scenario-flag--pass">PASS ${t}</span>`).replace(/<pass\s*\/>/g,`<span class="scenario-flag scenario-flag--pass">PASS</span>`).replace(/<error>([\s\S]*?)<\/error>/g,(e,t)=>`<span class="scenario-flag scenario-flag--error">ERROR: ${t.trim()}</span>`).replace(/<ask_user>([\s\S]*?)<\/ask_user>/g,(e,t)=>`<span class="scenario-flag scenario-flag--ask">${t.trim()}</span>`).replace(/<kanban_move\s+column="([^"]*?)"\s*\/>/g,(e,t)=>`<span class="scenario-flag scenario-flag--kanban">📋 Move → ${t}</span>`).replace(/<kanban_comment>([\s\S]*?)<\/kanban_comment>/g,(e,t)=>`<span class="scenario-flag scenario-flag--kanban-comment">💬 ${t.trim()}</span>`).replace(/<kanban_add_card\s+column="([^"]*?)"\s+title="([^"]*?)">([\s\S]*?)<\/kanban_add_card>/g,(e,t,n,r)=>`<span class="scenario-flag scenario-flag--kanban" data-kanban-content="${u(r.trim())}" style="cursor:pointer" title="Cliquer pour voir le contenu">➕ Card "${n}" → ${t}</span>`).replace(/<next_person\s+name="([^"]*?)"\s*\/>/g,(e,t)=>`<span class="scenario-flag scenario-flag--delegate">🔀 ${t}</span>`).replace(/<next_person\s+name="([^"]*?)">([\s\S]*?)<\/next_person>/g,(e,t,n)=>`<span class="scenario-flag scenario-flag--delegate">🔀 <strong>${t}</strong> — ${n.trim()}</span>`).replace(/<hire_person\s+label="([^"]*?)"\s+role="([^"]*?)">([\s\S]*?)<\/hire_person>/g,(e,t,n)=>`<span class="scenario-flag scenario-flag--hire">🧑💼 Hire ${t} (${n})</span>`)}function f(e){let t=l.get(e);return t===void 0&&(t=sR.sanitize(RI.parse(d(e),{async:!1}),{ALLOW_DATA_ATTR:!0}),l.set(e,t)),t}let p=i(null);function m(e){let t=e.target.closest(`[data-kanban-content]`);t&&(p.value=t.dataset.kanbanContent??``)}let h=i(new Set),g=i(new Set),_=i(new Set);C(()=>a.messages,e=>{if(e.length===0)return;let t=e[e.length-1];for(let e of t.parts??[])e.type===`tool`&&!e.pending&&ee(e)&&(h.value=new Set([...h.value,e.id]))});function v(e){let t=new Set(_.value);t.has(e)?t.delete(e):t.add(e),_.value=t}function y(e){let t=new Set(g.value);t.has(e)?t.delete(e):t.add(e),g.value=t}function b(e){let t=new Set(h.value);t.has(e)?t.delete(e):t.add(e),h.value=t}function S(e,t){let n;if(typeof e==`string`)n=e;else try{n=JSON.stringify(e,null,2)}catch{n=`[unserializable result]`}return n.length>VR&&(n=n.slice(-524288)),n.split(`
|
|
264
264
|
`).slice(-t).join(`
|
|
265
265
|
`)}function w(e){let t=e.target;t.style.display=`none`;let n=t.nextElementSibling;n&&(n.style.display=`flex`)}function T(e,t){let n=e.split(`
|
|
266
266
|
`),r=t.split(`
|
|
267
|
-
`),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array.from({length:a+1},()=>0));for(let e=i-1;e>=0;e--)for(let t=a-1;t>=0;t--)o[e][t]=n[e]===r[t]?o[e+1][t+1]+1:Math.max(o[e+1][t],o[e][t+1]);let s=[],c=0,l=0;for(;c<i||l<a;)c<i&&l<a&&n[c]===r[l]?(s.push({type:`context`,text:n[c]}),c++,l++):l<a&&(c>=i||o[c][l+1]>=o[c+1][l])?(s.push({type:`add`,text:r[l]}),l++):(s.push({type:`remove`,text:n[c]}),c++);return s}function E(e){return[`Edit`,`str_replace_based_edit_tool`,`str_replace_editor`,`Write`,`create_file`].includes(e)}function D(e){return e.name===`command_execution`&&typeof e.input?.command==`string`}function ee(e){return E(e.name)||D(e)}function O(e){return D(e)?`shell`:e.name}function k(e){return!e.input||Object.keys(e.input).length===0?``:D(e)?String(e.input.command??``):Object.entries(e.input).map(([e,t])=>`${e}=${t}`).join(`, `)}function A(e){if(!E(e.name)||!e.input)return null;let t=e.input.old_string??``,n=e.input.new_string??e.input.content??``;return n?T(t,n):null}return(t,n)=>(B(),N(V,null,[(B(),W(ue,{to:`body`},[p.value===null?G(``,!0):(B(),N(`div`,{key:0,class:`kanban-preview-overlay`,onClick:n[1]||=he(e=>p.value=null,[`self`])},[M(`div`,rR,[M(`div`,iR,[n[3]||=M(`span`,null,`Contenu de la carte`,-1),M(`button`,{class:`kanban-preview-close`,onClick:n[0]||=e=>p.value=null},`✕`)]),M(`pre`,aR,U(p.value||`(vide)`),1)])]))])),M(`div`,{ref_key:`messagesEl`,ref:c,class:`ai-chat-message-list`,onClick:m},[(B(!0),N(V,null,P(e.messages,(t,i)=>(B(),N(`div`,{key:i,class:I([`ai-chat-message-list__msg`,`is-${t.role}`])},[M(`div`,oR,U(t.role===`user`?r(s)(`aiChatPage.you`):r(s)(`aiChatPage.assistant`)),1),t.contextNote?(B(),N(`div`,sR,[M(`div`,{class:`ai-chat-message-list__context-note-header`,onClick:e=>v(i)},[n[4]||=M(`i`,{class:`ti ti-paperclip`},null,-1),M(`span`,null,U(r(s)(`aiChat.attachedContext`)),1),M(`i`,{class:I([`ti`,_.value.has(i)?`ti-chevron-up`:`ti-chevron-down`])},null,2)],8,cR),_.value.has(i)?(B(),N(`div`,{key:0,class:`ai-chat-message-list__context-note-body`,innerHTML:r(nR).sanitize(t.contextNote??``)},null,8,lR)):G(``,!0)])):G(``,!0),t.parts?.length?(B(),N(V,{key:1},[(B(!0),N(V,null,P(t.parts,(a,c)=>(B(),N(V,{key:c},[a.type===`thinking`?(B(),N(`div`,uR,[M(`div`,{class:`ai-chat-message-list__thinking-header`,onClick:e=>y(`${i}-${c}`)},[n[5]||=M(`i`,{class:`ti ti-sparkles`},null,-1),M(`span`,null,U(r(s)(`aiChatPage.thinking`)),1),M(`i`,{class:I([`ti`,g.value.has(`${i}-${c}`)?`ti-chevron-up`:`ti-chevron-down`])},null,2)],8,dR),g.value.has(`${i}-${c}`)||e.isStreaming&&i===e.messages.length-1&&c===t.parts.length-1?(B(),N(`pre`,fR,U(a.text),1)):G(``,!0)])):a.type===`tool`?(B(),N(`div`,{key:1,class:I([`ai-chat-message-list__tool-event`,{"ai-chat-message-list__tool-event--pending":a.pending,"ai-chat-message-list__tool-event--error":!a.pending&&a.isError,"ai-chat-message-list__tool-event--ok":!a.pending&&!a.isError}])},[M(`div`,{class:`ai-chat-message-list__tool-event-header`,onClick:e=>!a.pending&&b(a.id)},[M(`i`,{class:I(a.pending?`ti ti-spin ti-loader-2`:a.isError?`ti ti-circle-x`:`ti ti-circle-check`)},null,2),M(`span`,mR,U(O(a)),1),a.pending&&a.rawInput?(B(),N(`span`,hR,[x(U(a.rawInput),1),n[6]||=M(`span`,{class:`ai-chat-message-list__cursor`},null,-1)])):k(a)?(B(),N(`span`,gR,U(k(a)),1)):G(``,!0),a.pending?G(``,!0):(B(),N(`i`,{key:2,class:I([`ai-chat-message-list__tool-event-chevron ti`,h.value.has(a.id)?`ti-chevron-up`:`ti-chevron-down`])},null,2))],8,pR),!a.pending&&h.value.has(a.id)?(B(),N(V,{key:0},[a.input&&Object.keys(a.input).length>0&&!E(a.name)?(B(),N(`div`,{key:0,class:`ai-chat-message-list__tool-params`,onClick:n[2]||=he(()=>{},[`stop`])},[(B(!0),N(V,null,P(Object.entries(a.input),([e,t])=>(B(),N(`div`,{key:e,class:`ai-chat-message-list__tool-param-row`},[M(`span`,_R,U(e),1),M(`span`,vR,U(typeof t==`object`?JSON.stringify(t):String(t)),1)]))),128))])):G(``,!0),A(a)?(B(),N(`div`,{key:1,class:`ai-chat-message-list__tool-diff`,onClick:he(e=>b(a.id),[`stop`])},[a.input?.file_path?(B(),N(`div`,bR,U(a.input.file_path),1)):G(``,!0),M(`div`,xR,[(B(!0),N(V,null,P(A(a),(e,t)=>(B(),N(`div`,{key:t,class:I([`ai-chat-message-list__tool-diff-line`,`ai-chat-message-list__tool-diff-line--${e.type}`])},[M(`span`,SR,U(e.type===`add`?`+`:e.type===`remove`?`-`:` `),1),x(U(e.text),1)],2))),128))])],8,yR)):a.result===void 0?G(``,!0):(B(),N(`pre`,{key:2,class:`ai-chat-message-list__tool-event-result ai-chat-message-list__tool-event-result--expanded`,onClick:he(e=>b(a.id),[`stop`])},U(S(a.result,20)),9,CR))],64)):G(``,!0)],2)):a.type===`text`&&t.role===`user`?(B(),N(`div`,wR,U(a.text),1)):a.type===`text`?(B(),N(`div`,{key:3,class:`ai-chat-message-list__markdown`,innerHTML:f(a.text)},null,8,TR)):a.type===`image`?(B(),N(`div`,ER,[M(`img`,{src:a.url,alt:a.altText||r(s)(`imageHistory.expired`),class:`ai-chat-message-list__image-thumb`,onClick:e=>o(`open-image-preview`,a.url,a.altText||`image`),onError:w},null,40,DR),M(`div`,{class:`ai-chat-message-list__image-expired`,role:`img`,"aria-label":r(s)(`imageHistory.expired`),style:{display:`none`}},[n[7]||=M(`i`,{class:`ti ti-photo`},null,-1),n[8]||=M(`i`,{class:`ti ti-alert-triangle`},null,-1),M(`span`,null,U(r(s)(`imageHistory.expired`)),1)],8,OR)])):G(``,!0)],64))),128)),t.status&&e.isStreaming&&i===e.messages.length-1?(B(),N(`div`,kR,[n[9]||=M(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),M(`span`,null,U(t.status),1)])):G(``,!0),e.isStreaming&&i===e.messages.length-1&&t.role===`assistant`?(B(),N(`span`,AR)):G(``,!0)],64)):(B(),N(V,{key:2},[t.status&&e.isStreaming&&i===e.messages.length-1?(B(),N(`div`,jR,[n[10]||=M(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),M(`span`,null,U(t.status),1)])):G(``,!0),t.role===`assistant`?(B(),N(`div`,{key:1,class:`ai-chat-message-list__markdown`,innerHTML:f(t.content)},null,8,MR)):(B(),N(`div`,NR,U(t.content),1)),e.isStreaming&&i===e.messages.length-1&&t.role===`assistant`?(B(),N(`span`,PR)):G(``,!0)],64))],2))),128)),e.messages.length===0?(B(),N(`div`,FR,[...n[11]||=[M(`i`,{class:`ti ti-send`,style:{"font-size":`2rem`,opacity:`0.2`}},null,-1)]])):G(``,!0)],512)],64))}}),[[`__scopeId`,`data-v-dc6da04d`]]),RR={class:`image-upload-bar`},zR=[`aria-label`],BR={key:2,class:`image-upload-bar__spinner-slot`},VR=[`onClick`],HR=[`src`,`alt`],UR={key:3,class:`image-upload-bar__limit-msg`},WR=ze(z({__name:`ImageUploadBar`,emits:[`preview`],setup(e,{emit:t}){let{t:n}=He(),a=lt(),{pendingImages:o,isUploadingImage:s}=$e(a),c=i(null);function l(){c.value?.click()}async function u(e){let t=e.target;if(!t.files)return;let n=Array.from(t.files);for(let e of n)await a.uploadImage(e);t.value=``}let d=t;return(e,t)=>{let i=y(`tooltip`);return B(),N(`div`,RR,[M(`input`,{ref_key:`fileInput`,ref:c,type:`file`,accept:`image/png,image/jpeg,image/webp,image/gif`,multiple:``,"aria-label":r(n)(`imageUpload.selectImages`),style:{display:`none`},onChange:u},null,40,zR),r(o).length>0?(B(),W(r(we),{key:0,value:r(o).length,severity:`contrast`},{default:H(()=>[b(r(Le),{icon:`ti ti-paperclip`,label:r(n)(`imageUpload.attachButton`),size:`small`,severity:`secondary`,variant:`text`,disabled:r(s)||r(o).length>=5,onClick:l},null,8,[`label`,`disabled`])]),_:1},8,[`value`])):(B(),W(r(Le),{key:1,icon:`ti ti-paperclip`,label:r(n)(`imageUpload.attachButton`),size:`small`,severity:`secondary`,variant:`text`,disabled:r(s),onClick:l},null,8,[`label`,`disabled`])),r(s)?(B(),N(`div`,BR,[b(r(Se),{style:{width:`40px`,height:`40px`}})])):G(``,!0),(B(!0),N(V,null,P(r(o),e=>j((B(),N(`div`,{key:e.imageId,class:`image-upload-bar__thumb`,onClick:t=>d(`preview`,e.localPreviewUrl||e.url,e.fileName)},[M(`img`,{src:e.localPreviewUrl||e.url,alt:e.fileName,class:`image-upload-bar__thumb-img`},null,8,HR),b(r(Le),{icon:`ti ti-x`,severity:`danger`,variant:`text`,rounded:``,size:`small`,class:`image-upload-bar__thumb-remove`,"aria-label":r(n)(`imageUpload.removeImage`,{name:e.fileName}),onClick:he(t=>r(a).removePendingImage(e.imageId),[`stop`])},null,8,[`aria-label`,`onClick`])],8,VR)),[[i,e.fileName,void 0,{top:!0}]])),128)),r(o).length>=5?(B(),N(`span`,UR,U(r(n)(`imageUpload.limitReached`)),1)):G(``,!0)])}}}),[[`__scopeId`,`data-v-a23dc663`]]),GR={class:`ai-chat-composer__context-preview`},KR=ze(z({__name:`ContextBadge`,props:{label:{},icon:{},text:{},removable:{type:Boolean},variant:{}},emits:[`remove`],setup(e,{emit:t}){let n=e,a=t,o=i(null);function s(e){n.text&&o.value?.toggle(e)}function c(){o.value?.hide(),a(`remove`)}return(t,n)=>(B(),N(V,null,[M(`div`,{class:I([`ai-chat-composer__context-badge`,{"ai-chat-composer__context-badge--service":e.variant===`service`}]),onClick:s},[M(`i`,{class:I(`ti ${e.icon}`)},null,2),M(`span`,null,U(e.label),1),e.removable?(B(),N(`button`,{key:0,class:`ai-chat-composer__context-remove`,title:`Remove`,onClick:he(c,[`stop`])},[...n[0]||=[M(`i`,{class:`ti ti-x`},null,-1)]])):G(``,!0)],2),e.text?(B(),W(r(xe),{key:0,ref_key:`popover`,ref:o},{default:H(()=>[M(`pre`,GR,U(e.text),1)]),_:1},512)):G(``,!0)],64))}}),[[`__scopeId`,`data-v-b6f5b293`]]),qR={class:`ai-chat-composer`},JR={class:`ai-chat-composer__row`},YR=[`title`],XR={class:`ai-chat-composer__model-picker`},ZR=[`onClick`],QR=ze(z({__name:`AiChatComposer`,props:_({isStreaming:{type:Boolean},isStreamingCurrentConv:{type:Boolean},activeConversationId:{}},{input:{default:``},inputModifiers:{}}),emits:_([`submit`,`open-image-preview`],[`update:input`]),setup(e,{emit:t}){let n=t,a=lt(),{t:o}=He(),{claudeCodeAvailable:s,claudeCodeModel:c,selectedModel:l,availableModels:u,isUploadingImage:d}=$e(a),f=S(e,`input`),p=R(()=>a.activeConversation?.runner===`codex`),m=R(()=>{let e=a.activeConversation;return e?.runner===`claude-code`||e?.isCli===!0&&!e.runner&&!e.providerId}),h=R(()=>p.value?[]:m.value?Jt:u.value),g=R({get:()=>m.value?c.value??`sonnet`:l.value,set:e=>{m.value?c.value=e:l.value=e}}),_=i(null);function v(e){_.value?.toggle(e)}function y(e){g.value=e,_.value?.hide()}let{pendingDiffContext:x,pendingInput:w,pendingContext:T,pendingPopulateContext:E,contextServiceId:D}=Ut(),ee=Xt(),O=R(()=>D.value?ee.getById(D.value):null);async function k(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(e=>e.type.startsWith(`image/`));if(n.length!==0){e.preventDefault();for(let e of n){let t=e.getAsFile();t&&await a.uploadImage(t)}}}C(w,e=>{e&&(f.value=e,w.value=null)},{immediate:!0});function A(){x.value=null}function j(){T.value=null}return(t,i)=>(B(),N(`footer`,qR,[b(WR,{class:`ai-chat-composer__image-upload-bar`,onPreview:i[0]||=(e,t)=>n(`open-image-preview`,e,t)}),O.value?(B(),W(KR,{key:0,variant:`service`,icon:`ti-server`,label:O.value.name},null,8,[`label`])):G(``,!0),r(x)?(B(),W(KR,{key:1,icon:`ti-code`,label:r(o)(`aiChatPage.diffContextAttached`),text:r(x),removable:``,onRemove:A},null,8,[`label`,`text`])):G(``,!0),r(T)?(B(),W(KR,{key:2,icon:r(T).icon,label:r(T).label,text:r(T).text,removable:``,onRemove:j},null,8,[`icon`,`label`,`text`])):G(``,!0),M(`div`,JR,[b(r(Ke),{modelValue:f.value,"onUpdate:modelValue":i[1]||=e=>f.value=e,rows:`1`,"auto-resize":``,disabled:e.isStreamingCurrentConv,placeholder:r(o)(`aiChatPage.messagePlaceholder`),class:`ai-chat-composer__input`,onKeydown:i[2]||=me(he(e=>n(`submit`),[`exact`,`prevent`]),[`enter`]),onPaste:k},null,8,[`modelValue`,`disabled`,`placeholder`]),!p.value&&h.value.length>0?(B(),N(V,{key:0},[M(`button`,{class:`ai-chat-composer__model-btn`,title:g.value,onClick:v},[i[5]||=M(`i`,{class:`ti ti-brain`},null,-1),M(`span`,null,U(g.value),1)],8,YR),b(r(xe),{ref_key:`modelPopover`,ref:_},{default:H(()=>[M(`div`,XR,[(B(!0),N(V,null,P(h.value,e=>(B(),N(`div`,{key:e,class:I([`ai-chat-composer__model-option`,{"ai-chat-composer__model-option--active":e===g.value}]),onClick:t=>y(e)},U(e),11,ZR))),128))])]),_:1},512)],64)):G(``,!0),e.isStreamingCurrentConv?(B(),W(r(Le),{key:1,icon:`ti ti-player-stop`,severity:`danger`,onClick:i[3]||=e=>r(a).stopStreaming()})):(B(),W(r(Le),{key:2,icon:`ti ti-send`,disabled:r(d),onClick:i[4]||=e=>n(`submit`)},null,8,[`disabled`]))])]))}}),[[`__scopeId`,`data-v-13b0846a`]]),$R=Object.defineProperty,ez=Object.getOwnPropertyDescriptor,tz=(e,t)=>{for(var n in t)$R(e,n,{get:t[n],enumerable:!0})},nz=(e,t,n,r)=>{for(var i=r>1?void 0:r?ez(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&$R(t,n,i),i},Y=(e,t)=>(n,r)=>t(n,r,e),rz=`Terminal input`,iz={get:()=>rz,set:e=>rz=e},az=`Too much output to announce, navigate to rows manually to read`,oz={get:()=>az,set:e=>az=e};function sz(e){return e.replace(/\r?\n/g,`\r`)}function cz(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function lz(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function uz(e,t,n,r){e.stopPropagation(),e.clipboardData&&dz(e.clipboardData.getData(`text/plain`),t,n,r)}function dz(e,t,n,r){e=sz(e),e=cz(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function fz(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function pz(e,t,n,r,i){fz(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function mz(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function hz(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var gz=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},_z=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},vz=``,yz=` `,bz=class e{constructor(){this.fg=0,this.bg=0,this.extended=new xz}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 t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}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):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},xz=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}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 e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Sz=class e extends bz{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new xz,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?mz(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 t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Cz=`di$target`,wz=`di$dependencies`,Tz=new Map;function Ez(e){return e[wz]||[]}function Dz(e){if(Tz.has(e))return Tz.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Oz(t,e,r)};return t._id=e,Tz.set(e,t),t}function Oz(e,t,n){t[Cz]===t?t[wz].push({id:e,index:n}):(t[wz]=[{id:e,index:n}],t[Cz]=t)}var kz=Dz(`BufferService`),Az=Dz(`CoreMouseService`),jz=Dz(`CoreService`),Mz=Dz(`CharsetService`),Nz=Dz(`InstantiationService`),Pz=Dz(`LogService`),Fz=Dz(`OptionsService`),Iz=Dz(`OscLinkService`),Lz=Dz(`UnicodeService`),Rz=Dz(`DecorationService`),zz=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new Sz,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Bz(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};zz=nz([Y(0,kz),Y(1,Fz),Y(2,Iz)],zz);function Bz(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
267
|
+
`),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array.from({length:a+1},()=>0));for(let e=i-1;e>=0;e--)for(let t=a-1;t>=0;t--)o[e][t]=n[e]===r[t]?o[e+1][t+1]+1:Math.max(o[e+1][t],o[e][t+1]);let s=[],c=0,l=0;for(;c<i||l<a;)c<i&&l<a&&n[c]===r[l]?(s.push({type:`context`,text:n[c]}),c++,l++):l<a&&(c>=i||o[c][l+1]>=o[c+1][l])?(s.push({type:`add`,text:r[l]}),l++):(s.push({type:`remove`,text:n[c]}),c++);return s}function E(e){return[`Edit`,`str_replace_based_edit_tool`,`str_replace_editor`,`Write`,`create_file`].includes(e)}function D(e){return e.name===`command_execution`&&typeof e.input?.command==`string`}function ee(e){return E(e.name)||D(e)}function O(e){return D(e)?`shell`:e.name}function k(e){return!e.input||Object.keys(e.input).length===0?``:D(e)?String(e.input.command??``):Object.entries(e.input).map(([e,t])=>`${e}=${t}`).join(`, `)}function A(e){if(!E(e.name)||!e.input)return null;let t=e.input.old_string??``,n=e.input.new_string??e.input.content??``;return n?T(t,n):null}return(t,n)=>(B(),N(V,null,[(B(),W(ue,{to:`body`},[p.value===null?G(``,!0):(B(),N(`div`,{key:0,class:`kanban-preview-overlay`,onClick:n[1]||=he(e=>p.value=null,[`self`])},[M(`div`,cR,[M(`div`,lR,[n[3]||=M(`span`,null,`Contenu de la carte`,-1),M(`button`,{class:`kanban-preview-close`,onClick:n[0]||=e=>p.value=null},`✕`)]),M(`pre`,uR,U(p.value||`(vide)`),1)])]))])),M(`div`,{ref_key:`messagesEl`,ref:c,class:`ai-chat-message-list`,onClick:m},[(B(!0),N(V,null,P(e.messages,(t,i)=>(B(),N(`div`,{key:i,class:I([`ai-chat-message-list__msg`,`is-${t.role}`])},[M(`div`,dR,U(t.role===`user`?r(s)(`aiChatPage.you`):r(s)(`aiChatPage.assistant`)),1),t.contextNote?(B(),N(`div`,fR,[M(`div`,{class:`ai-chat-message-list__context-note-header`,onClick:e=>v(i)},[n[4]||=M(`i`,{class:`ti ti-paperclip`},null,-1),M(`span`,null,U(r(s)(`aiChat.attachedContext`)),1),M(`i`,{class:I([`ti`,_.value.has(i)?`ti-chevron-up`:`ti-chevron-down`])},null,2)],8,pR),_.value.has(i)?(B(),N(`div`,{key:0,class:`ai-chat-message-list__context-note-body`,innerHTML:r(sR).sanitize(t.contextNote??``)},null,8,mR)):G(``,!0)])):G(``,!0),t.parts?.length?(B(),N(V,{key:1},[(B(!0),N(V,null,P(t.parts,(a,c)=>(B(),N(V,{key:c},[a.type===`thinking`?(B(),N(`div`,hR,[M(`div`,{class:`ai-chat-message-list__thinking-header`,onClick:e=>y(`${i}-${c}`)},[n[5]||=M(`i`,{class:`ti ti-sparkles`},null,-1),M(`span`,null,U(r(s)(`aiChatPage.thinking`)),1),M(`i`,{class:I([`ti`,g.value.has(`${i}-${c}`)?`ti-chevron-up`:`ti-chevron-down`])},null,2)],8,gR),g.value.has(`${i}-${c}`)||e.isStreaming&&i===e.messages.length-1&&c===t.parts.length-1?(B(),N(`pre`,_R,U(a.text),1)):G(``,!0)])):a.type===`tool`?(B(),N(`div`,{key:1,class:I([`ai-chat-message-list__tool-event`,{"ai-chat-message-list__tool-event--pending":a.pending,"ai-chat-message-list__tool-event--error":!a.pending&&a.isError,"ai-chat-message-list__tool-event--ok":!a.pending&&!a.isError}])},[M(`div`,{class:`ai-chat-message-list__tool-event-header`,onClick:e=>!a.pending&&b(a.id)},[M(`i`,{class:I(a.pending?`ti ti-spin ti-loader-2`:a.isError?`ti ti-circle-x`:`ti ti-circle-check`)},null,2),M(`span`,yR,U(O(a)),1),a.pending&&a.rawInput?(B(),N(`span`,bR,[x(U(a.rawInput),1),n[6]||=M(`span`,{class:`ai-chat-message-list__cursor`},null,-1)])):k(a)?(B(),N(`span`,xR,U(k(a)),1)):G(``,!0),a.pending?G(``,!0):(B(),N(`i`,{key:2,class:I([`ai-chat-message-list__tool-event-chevron ti`,h.value.has(a.id)?`ti-chevron-up`:`ti-chevron-down`])},null,2))],8,vR),!a.pending&&h.value.has(a.id)?(B(),N(V,{key:0},[a.input&&Object.keys(a.input).length>0&&!E(a.name)?(B(),N(`div`,{key:0,class:`ai-chat-message-list__tool-params`,onClick:n[2]||=he(()=>{},[`stop`])},[(B(!0),N(V,null,P(Object.entries(a.input),([e,t])=>(B(),N(`div`,{key:e,class:`ai-chat-message-list__tool-param-row`},[M(`span`,SR,U(e),1),M(`span`,CR,U(typeof t==`object`?JSON.stringify(t):String(t)),1)]))),128))])):G(``,!0),A(a)?(B(),N(`div`,{key:1,class:`ai-chat-message-list__tool-diff`,onClick:he(e=>b(a.id),[`stop`])},[a.input?.file_path?(B(),N(`div`,TR,U(a.input.file_path),1)):G(``,!0),M(`div`,ER,[(B(!0),N(V,null,P(A(a),(e,t)=>(B(),N(`div`,{key:t,class:I([`ai-chat-message-list__tool-diff-line`,`ai-chat-message-list__tool-diff-line--${e.type}`])},[M(`span`,DR,U(e.type===`add`?`+`:e.type===`remove`?`-`:` `),1),x(U(e.text),1)],2))),128))])],8,wR)):a.result===void 0?G(``,!0):(B(),N(`pre`,{key:2,class:`ai-chat-message-list__tool-event-result ai-chat-message-list__tool-event-result--expanded`,onClick:he(e=>b(a.id),[`stop`])},U(S(a.result,20)),9,OR))],64)):G(``,!0)],2)):a.type===`text`&&t.role===`user`?(B(),N(`div`,kR,U(a.text),1)):a.type===`text`?(B(),N(`div`,{key:3,class:`ai-chat-message-list__markdown`,innerHTML:f(a.text)},null,8,AR)):a.type===`image`?(B(),N(`div`,jR,[M(`img`,{src:a.url,alt:a.altText||r(s)(`imageHistory.expired`),class:`ai-chat-message-list__image-thumb`,onClick:e=>o(`open-image-preview`,a.url,a.altText||`image`),onError:w},null,40,MR),M(`div`,{class:`ai-chat-message-list__image-expired`,role:`img`,"aria-label":r(s)(`imageHistory.expired`),style:{display:`none`}},[n[7]||=M(`i`,{class:`ti ti-photo`},null,-1),n[8]||=M(`i`,{class:`ti ti-alert-triangle`},null,-1),M(`span`,null,U(r(s)(`imageHistory.expired`)),1)],8,NR)])):G(``,!0)],64))),128)),t.status&&e.isStreaming&&i===e.messages.length-1?(B(),N(`div`,PR,[n[9]||=M(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),M(`span`,null,U(t.status),1)])):G(``,!0),e.isStreaming&&i===e.messages.length-1&&t.role===`assistant`?(B(),N(`span`,FR)):G(``,!0)],64)):(B(),N(V,{key:2},[t.status&&e.isStreaming&&i===e.messages.length-1?(B(),N(`div`,IR,[n[10]||=M(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),M(`span`,null,U(t.status),1)])):G(``,!0),t.role===`assistant`?(B(),N(`div`,{key:1,class:`ai-chat-message-list__markdown`,innerHTML:f(t.content)},null,8,LR)):(B(),N(`div`,RR,U(t.content),1)),e.isStreaming&&i===e.messages.length-1&&t.role===`assistant`?(B(),N(`span`,zR)):G(``,!0)],64))],2))),128)),e.messages.length===0?(B(),N(`div`,BR,[...n[11]||=[M(`i`,{class:`ti ti-send`,style:{"font-size":`2rem`,opacity:`0.2`}},null,-1)]])):G(``,!0)],512)],64))}}),[[`__scopeId`,`data-v-dc6da04d`]]),UR={class:`image-upload-bar`},WR=[`aria-label`],GR={key:2,class:`image-upload-bar__spinner-slot`},KR=[`onClick`],qR=[`src`,`alt`],JR={key:3,class:`image-upload-bar__limit-msg`},YR=ze(z({__name:`ImageUploadBar`,emits:[`preview`],setup(e,{emit:t}){let{t:n}=He(),a=lt(),{pendingImages:o,isUploadingImage:s}=$e(a),c=i(null);function l(){c.value?.click()}async function u(e){let t=e.target;if(!t.files)return;let n=Array.from(t.files);for(let e of n)await a.uploadImage(e);t.value=``}let d=t;return(e,t)=>{let i=y(`tooltip`);return B(),N(`div`,UR,[M(`input`,{ref_key:`fileInput`,ref:c,type:`file`,accept:`image/png,image/jpeg,image/webp,image/gif`,multiple:``,"aria-label":r(n)(`imageUpload.selectImages`),style:{display:`none`},onChange:u},null,40,WR),r(o).length>0?(B(),W(r(we),{key:0,value:r(o).length,severity:`contrast`},{default:H(()=>[b(r(Le),{icon:`ti ti-paperclip`,label:r(n)(`imageUpload.attachButton`),size:`small`,severity:`secondary`,variant:`text`,disabled:r(s)||r(o).length>=5,onClick:l},null,8,[`label`,`disabled`])]),_:1},8,[`value`])):(B(),W(r(Le),{key:1,icon:`ti ti-paperclip`,label:r(n)(`imageUpload.attachButton`),size:`small`,severity:`secondary`,variant:`text`,disabled:r(s),onClick:l},null,8,[`label`,`disabled`])),r(s)?(B(),N(`div`,GR,[b(r(Se),{style:{width:`40px`,height:`40px`}})])):G(``,!0),(B(!0),N(V,null,P(r(o),e=>j((B(),N(`div`,{key:e.imageId,class:`image-upload-bar__thumb`,onClick:t=>d(`preview`,e.localPreviewUrl||e.url,e.fileName)},[M(`img`,{src:e.localPreviewUrl||e.url,alt:e.fileName,class:`image-upload-bar__thumb-img`},null,8,qR),b(r(Le),{icon:`ti ti-x`,severity:`danger`,variant:`text`,rounded:``,size:`small`,class:`image-upload-bar__thumb-remove`,"aria-label":r(n)(`imageUpload.removeImage`,{name:e.fileName}),onClick:he(t=>r(a).removePendingImage(e.imageId),[`stop`])},null,8,[`aria-label`,`onClick`])],8,KR)),[[i,e.fileName,void 0,{top:!0}]])),128)),r(o).length>=5?(B(),N(`span`,JR,U(r(n)(`imageUpload.limitReached`)),1)):G(``,!0)])}}}),[[`__scopeId`,`data-v-a23dc663`]]),XR={class:`ai-chat-composer__context-preview`},ZR=ze(z({__name:`ContextBadge`,props:{label:{},icon:{},text:{},removable:{type:Boolean},variant:{}},emits:[`remove`],setup(e,{emit:t}){let n=e,a=t,o=i(null);function s(e){n.text&&o.value?.toggle(e)}function c(){o.value?.hide(),a(`remove`)}return(t,n)=>(B(),N(V,null,[M(`div`,{class:I([`ai-chat-composer__context-badge`,{"ai-chat-composer__context-badge--service":e.variant===`service`}]),onClick:s},[M(`i`,{class:I(`ti ${e.icon}`)},null,2),M(`span`,null,U(e.label),1),e.removable?(B(),N(`button`,{key:0,class:`ai-chat-composer__context-remove`,title:`Remove`,onClick:he(c,[`stop`])},[...n[0]||=[M(`i`,{class:`ti ti-x`},null,-1)]])):G(``,!0)],2),e.text?(B(),W(r(xe),{key:0,ref_key:`popover`,ref:o},{default:H(()=>[M(`pre`,XR,U(e.text),1)]),_:1},512)):G(``,!0)],64))}}),[[`__scopeId`,`data-v-b6f5b293`]]),QR={class:`ai-chat-composer`},$R={class:`ai-chat-composer__row`},ez=[`title`],tz={class:`ai-chat-composer__model-picker`},nz=[`onClick`],rz=ze(z({__name:`AiChatComposer`,props:_({isStreaming:{type:Boolean},isStreamingCurrentConv:{type:Boolean},activeConversationId:{}},{input:{default:``},inputModifiers:{}}),emits:_([`submit`,`open-image-preview`],[`update:input`]),setup(e,{emit:t}){let n=t,a=lt(),{t:o}=He(),{claudeCodeAvailable:s,claudeCodeModel:c,selectedModel:l,availableModels:u,isUploadingImage:d}=$e(a),f=S(e,`input`),p=R(()=>a.activeConversation?.runner===`codex`),m=R(()=>{let e=a.activeConversation;return e?.runner===`claude-code`||e?.isCli===!0&&!e.runner&&!e.providerId}),h=R(()=>p.value?[]:m.value?Jt:u.value),g=R({get:()=>m.value?c.value??`sonnet`:l.value,set:e=>{m.value?c.value=e:l.value=e}}),_=i(null);function v(e){_.value?.toggle(e)}function y(e){g.value=e,_.value?.hide()}let{pendingDiffContext:x,pendingInput:w,pendingContext:T,pendingPopulateContext:E,contextServiceId:D}=Ut(),ee=Xt(),O=R(()=>D.value?ee.getById(D.value):null);async function k(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(e=>e.type.startsWith(`image/`));if(n.length!==0){e.preventDefault();for(let e of n){let t=e.getAsFile();t&&await a.uploadImage(t)}}}C(w,e=>{e&&(f.value=e,w.value=null)},{immediate:!0});function A(){x.value=null}function j(){T.value=null}return(t,i)=>(B(),N(`footer`,QR,[b(YR,{class:`ai-chat-composer__image-upload-bar`,onPreview:i[0]||=(e,t)=>n(`open-image-preview`,e,t)}),O.value?(B(),W(ZR,{key:0,variant:`service`,icon:`ti-server`,label:O.value.name},null,8,[`label`])):G(``,!0),r(x)?(B(),W(ZR,{key:1,icon:`ti-code`,label:r(o)(`aiChatPage.diffContextAttached`),text:r(x),removable:``,onRemove:A},null,8,[`label`,`text`])):G(``,!0),r(T)?(B(),W(ZR,{key:2,icon:r(T).icon,label:r(T).label,text:r(T).text,removable:``,onRemove:j},null,8,[`icon`,`label`,`text`])):G(``,!0),M(`div`,$R,[b(r(Ke),{modelValue:f.value,"onUpdate:modelValue":i[1]||=e=>f.value=e,rows:`1`,"auto-resize":``,disabled:e.isStreamingCurrentConv,placeholder:r(o)(`aiChatPage.messagePlaceholder`),class:`ai-chat-composer__input`,onKeydown:i[2]||=me(he(e=>n(`submit`),[`exact`,`prevent`]),[`enter`]),onPaste:k},null,8,[`modelValue`,`disabled`,`placeholder`]),!p.value&&h.value.length>0?(B(),N(V,{key:0},[M(`button`,{class:`ai-chat-composer__model-btn`,title:g.value,onClick:v},[i[5]||=M(`i`,{class:`ti ti-brain`},null,-1),M(`span`,null,U(g.value),1)],8,ez),b(r(xe),{ref_key:`modelPopover`,ref:_},{default:H(()=>[M(`div`,tz,[(B(!0),N(V,null,P(h.value,e=>(B(),N(`div`,{key:e,class:I([`ai-chat-composer__model-option`,{"ai-chat-composer__model-option--active":e===g.value}]),onClick:t=>y(e)},U(e),11,nz))),128))])]),_:1},512)],64)):G(``,!0),e.isStreamingCurrentConv?(B(),W(r(Le),{key:1,icon:`ti ti-player-stop`,severity:`danger`,onClick:i[3]||=e=>r(a).stopStreaming()})):(B(),W(r(Le),{key:2,icon:`ti ti-send`,disabled:r(d),onClick:i[4]||=e=>n(`submit`)},null,8,[`disabled`]))])]))}}),[[`__scopeId`,`data-v-13b0846a`]]),iz=Object.defineProperty,az=Object.getOwnPropertyDescriptor,oz=(e,t)=>{for(var n in t)iz(e,n,{get:t[n],enumerable:!0})},sz=(e,t,n,r)=>{for(var i=r>1?void 0:r?az(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&iz(t,n,i),i},Y=(e,t)=>(n,r)=>t(n,r,e),cz=`Terminal input`,lz={get:()=>cz,set:e=>cz=e},uz=`Too much output to announce, navigate to rows manually to read`,dz={get:()=>uz,set:e=>uz=e};function fz(e){return e.replace(/\r?\n/g,`\r`)}function pz(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function mz(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function hz(e,t,n,r){e.stopPropagation(),e.clipboardData&&gz(e.clipboardData.getData(`text/plain`),t,n,r)}function gz(e,t,n,r){e=fz(e),e=pz(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function _z(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function vz(e,t,n,r,i){_z(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function yz(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function bz(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var xz=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},Sz=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},Cz=``,wz=` `,Tz=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Ez}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 t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}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):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Ez=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}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 e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Dz=class e extends Tz{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ez,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?yz(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 t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Oz=`di$target`,kz=`di$dependencies`,Az=new Map;function jz(e){return e[kz]||[]}function Mz(e){if(Az.has(e))return Az.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Nz(t,e,r)};return t._id=e,Az.set(e,t),t}function Nz(e,t,n){t[Oz]===t?t[kz].push({id:e,index:n}):(t[kz]=[{id:e,index:n}],t[Oz]=t)}var Pz=Mz(`BufferService`),Fz=Mz(`CoreMouseService`),Iz=Mz(`CoreService`),Lz=Mz(`CharsetService`),Rz=Mz(`InstantiationService`),zz=Mz(`LogService`),Bz=Mz(`OptionsService`),Vz=Mz(`OscLinkService`),Hz=Mz(`UnicodeService`),Uz=Mz(`DecorationService`),Wz=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new Dz,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Gz(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Wz=sz([Y(0,Pz),Y(1,Bz),Y(2,Vz)],Wz);function Gz(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
268
268
|
|
|
269
|
-
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var
|
|
269
|
+
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Kz=Mz(`CharSizeService`),qz=Mz(`CoreBrowserService`),Jz=Mz(`MouseService`),Yz=Mz(`RenderService`),Xz=Mz(`SelectionService`),Zz=Mz(`CharacterJoinerService`),Qz=Mz(`ThemeService`),$z=Mz(`LinkProviderService`),eB=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?oB.isErrorNoTelemetry(e)?new oB(e.message+`
|
|
270
270
|
|
|
271
271
|
`+e.stack):Error(e.message+`
|
|
272
272
|
|
|
273
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function Xz(e){Qz(e)||Yz.onUnexpectedError(e)}var Zz=`Canceled`;function Qz(e){return e instanceof $z||e instanceof Error&&e.name===Zz&&e.message===Zz}var $z=class extends Error{constructor(){super(Zz),this.name=this.message}};function eB(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var tB=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},nB=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function rB(e,t=0){return e[e.length-(1+t)]}var iB;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(iB||={});var aB=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||iB.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};aB.empty=new aB(e=>{});function oB(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var sB;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(sB||={});var cB=null;function lB(e){return cB?.trackDisposable(e),e}function uB(e){cB?.markAsDisposed(e)}function dB(e,t){cB?.setParent(e,t)}function fB(e){return cB?.markAsSingleton(e),e}function pB(e){if(sB.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function mB(...e){return hB(()=>pB(e))}function hB(e){let t=lB({dispose:oB(()=>{uB(t),e()})});return t}var gB=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,lB(this)}dispose(){this._isDisposed||(uB(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{pB(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return dB(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),dB(e,null))}};gB.DISABLE_DISPOSED_WARNING=!1;var _B=gB,vB=class{constructor(){this._store=new _B,lB(this),dB(this._store,this)}dispose(){uB(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};vB.None=Object.freeze({dispose(){}});var yB=class{constructor(){this._isDisposed=!1,lB(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&dB(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,uB(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&dB(e,null),e}},bB=typeof window==`object`?window:globalThis,xB=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};xB.Undefined=new xB(void 0);var SB=xB,CB=class{constructor(){this._first=SB.Undefined,this._last=SB.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===SB.Undefined}clear(){let e=this._first;for(;e!==SB.Undefined;){let t=e.next;e.prev=SB.Undefined,e.next=SB.Undefined,e=t}this._first=SB.Undefined,this._last=SB.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new SB(e);if(this._first===SB.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==SB.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==SB.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==SB.Undefined&&e.next!==SB.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===SB.Undefined&&e.next===SB.Undefined?(this._first=SB.Undefined,this._last=SB.Undefined):e.next===SB.Undefined?(this._last=this._last.prev,this._last.next=SB.Undefined):e.prev===SB.Undefined&&(this._first=this._first.next,this._first.prev=SB.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==SB.Undefined;)yield e.element,e=e.next}},wB=globalThis.performance&&typeof globalThis.performance.now==`function`,TB=class e{static create(t){return new e(t)}constructor(e){this._now=wB&&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._now()-this._startTime:this._stopTime-this._startTime}},EB;(e=>{e.None=()=>vB.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(mB(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new X({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new X({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new X({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new X({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new X({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new X;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new X(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof _B?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(EB||={});var DB=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new TB,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}}};DB.all=new Set,DB._idPool=0;var OB=DB,kB=-1,AB=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new NB(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};AB._idPool=1;var jB=AB,MB=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
273
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function tB(e){rB(e)||eB.onUnexpectedError(e)}var nB=`Canceled`;function rB(e){return e instanceof iB||e instanceof Error&&e.name===nB&&e.message===nB}var iB=class extends Error{constructor(){super(nB),this.name=this.message}};function aB(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var oB=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},sB=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function cB(e,t=0){return e[e.length-(1+t)]}var lB;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(lB||={});var uB=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||lB.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};uB.empty=new uB(e=>{});function dB(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var fB;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(fB||={});var pB=null;function mB(e){return pB?.trackDisposable(e),e}function hB(e){pB?.markAsDisposed(e)}function gB(e,t){pB?.setParent(e,t)}function _B(e){return pB?.markAsSingleton(e),e}function vB(e){if(fB.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function yB(...e){return bB(()=>vB(e))}function bB(e){let t=mB({dispose:dB(()=>{hB(t),e()})});return t}var xB=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,mB(this)}dispose(){this._isDisposed||(hB(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{vB(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return gB(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),gB(e,null))}};xB.DISABLE_DISPOSED_WARNING=!1;var SB=xB,CB=class{constructor(){this._store=new SB,mB(this),gB(this._store,this)}dispose(){hB(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};CB.None=Object.freeze({dispose(){}});var wB=class{constructor(){this._isDisposed=!1,mB(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&gB(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,hB(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&gB(e,null),e}},TB=typeof window==`object`?window:globalThis,EB=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};EB.Undefined=new EB(void 0);var DB=EB,OB=class{constructor(){this._first=DB.Undefined,this._last=DB.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===DB.Undefined}clear(){let e=this._first;for(;e!==DB.Undefined;){let t=e.next;e.prev=DB.Undefined,e.next=DB.Undefined,e=t}this._first=DB.Undefined,this._last=DB.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new DB(e);if(this._first===DB.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==DB.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==DB.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==DB.Undefined&&e.next!==DB.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===DB.Undefined&&e.next===DB.Undefined?(this._first=DB.Undefined,this._last=DB.Undefined):e.next===DB.Undefined?(this._last=this._last.prev,this._last.next=DB.Undefined):e.prev===DB.Undefined&&(this._first=this._first.next,this._first.prev=DB.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==DB.Undefined;)yield e.element,e=e.next}},kB=globalThis.performance&&typeof globalThis.performance.now==`function`,AB=class e{static create(t){return new e(t)}constructor(e){this._now=kB&&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._now()-this._startTime:this._stopTime-this._startTime}},jB;(e=>{e.None=()=>CB.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(yB(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new X({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new X({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new X({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new X({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new X({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new X;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new X(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof SB?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(jB||={});var MB=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new AB,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}}};MB.all=new Set,MB._idPool=0;var NB=MB,PB=-1,FB=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new RB(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};FB._idPool=1;var IB=FB,LB=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
274
274
|
`).slice(2).join(`
|
|
275
|
-
`))}},NB=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},PB=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},FB=0,IB=class{constructor(e){this.value=e,this.id=FB++}},LB=2,X=class{constructor(e){this._size=0,this._options=e,this._leakageMon=kB>0||this._options?.leakWarningThreshold?new jB(e?.onListenerError??Xz,this._options?.leakWarningThreshold??kB):void 0,this._perfMon=this._options?._profName?new OB(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??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new PB(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Xz)(n),vB.None}if(this._disposed)return vB.None;t&&(e=e.bind(t));let r=new IB(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=MB.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof IB?(this._deliveryQueue??=new RB,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=hB(()=>{i?.(),this._removeListener(r)});return n instanceof _B?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){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 t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*LB<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Xz;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof IB)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},RB=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},zB=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new X,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new X,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};zB.INSTANCE=new zB;var BB=zB;function VB(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}BB.INSTANCE.onDidChangeZoomLevel;function HB(e){return BB.INSTANCE.getZoomFactor(e)}BB.INSTANCE.onDidChangeFullscreen;var UB=typeof navigator==`object`?navigator.userAgent:``,WB=UB.indexOf(`Firefox`)>=0,GB=UB.indexOf(`AppleWebKit`)>=0,KB=UB.indexOf(`Chrome`)>=0,qB=!KB&&UB.indexOf(`Safari`)>=0;UB.indexOf(`Electron/`),UB.indexOf(`Android`);var JB=!1;if(typeof bB.matchMedia==`function`){let e=bB.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=bB.matchMedia(`(display-mode: fullscreen)`);JB=e.matches,VB(bB,e,({matches:e})=>{JB&&t.matches||(JB=e)})}function YB(){return JB}var XB=`en`,ZB=!1,QB=!1,$B=!1,eV=!1,tV=!1,nV=XB,rV,iV=globalThis,aV;typeof iV.vscode<`u`&&typeof iV.vscode.process<`u`?aV=iV.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(aV=process);var oV=typeof aV?.versions?.electron==`string`&&aV?.type===`renderer`;if(typeof aV==`object`){ZB=aV.platform===`win32`,QB=aV.platform===`darwin`,$B=aV.platform===`linux`,$B&&aV.env.SNAP&&aV.env.SNAP_REVISION,aV.env.CI||aV.env.BUILD_ARTIFACTSTAGINGDIRECTORY,nV=XB;let e=aV.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,nV=t.resolvedLanguage||XB,t.languagePack?.translationsConfigFile}catch{}eV=!0}else typeof navigator==`object`&&!oV?(rV=navigator.userAgent,ZB=rV.indexOf(`Windows`)>=0,QB=rV.indexOf(`Macintosh`)>=0,(rV.indexOf(`Macintosh`)>=0||rV.indexOf(`iPad`)>=0||rV.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,$B=rV.indexOf(`Linux`)>=0,rV?.indexOf(`Mobi`),tV=!0,nV=globalThis._VSCODE_NLS_LANGUAGE||XB,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var sV=ZB,cV=QB,lV=$B,uV=eV;tV&&typeof iV.importScripts==`function`&&iV.origin;var dV=rV,fV=nV,pV;(e=>{function t(){return fV}e.value=t;function n(){return fV.length===2?fV===`en`:fV.length>=3&&fV[0]===`e`&&fV[1]===`n`&&fV[2]===`-`}e.isDefaultVariant=n;function r(){return fV===`en`}e.isDefault=r})(pV||={});var mV=typeof iV.postMessage==`function`&&!iV.importScripts;(()=>{if(mV){let e=[];iV.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),iV.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var hV=!!(dV&&dV.indexOf(`Chrome`)>=0);dV&&dV.indexOf(`Firefox`),!hV&&dV&&dV.indexOf(`Safari`),dV&&dV.indexOf(`Edg/`),dV&&dV.indexOf(`Android`);var gV=typeof navigator==`object`?navigator:{};uV||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||gV&&gV.clipboard&&gV.clipboard.writeText,uV||gV&&gV.clipboard&&gV.clipboard.readText,uV||YB()||gV.keyboard,`ontouchstart`in bB||gV.maxTouchPoints,bB.PointerEvent&&(`ontouchstart`in bB||navigator.maxTouchPoints);var _V=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},vV=new _V,yV=new _V,bV=new _V,xV=Array(230),SV;(e=>{function t(e){return vV.keyCodeToStr(e)}e.toString=t;function n(e){return vV.strToKeyCode(e)}e.fromString=n;function r(e){return yV.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return bV.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return yV.strToKeyCode(e)||bV.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return vV.keyCodeToStr(e)}e.toElectronAccelerator=o})(SV||={});var CV=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new wV([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},wV=class{constructor(e){if(e.length===0)throw eB(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function TV(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return SV.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(WB)switch(t){case 59:return 85;case 60:if(lV)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(cV)return 57}else if(GB&&(cV&&t===93||!cV&&t===92))return 57;return xV[t]||0}var EV=cV?256:2048,DV=512,OV=1024,kV=cV?2048:256,AV=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=TV(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=EV),this.altKey&&(t|=DV),this.shiftKey&&(t|=OV),this.metaKey&&(t|=kV),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new CV(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},jV=new WeakMap;function MV(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var NV=class{static getSameOriginWindowChain(e){let t=jV.get(e);if(!t){t=[],jV.set(e,t);let n=e,r;do r=MV(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},PV=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=NV.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},FV=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(KB){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)this.deltaY=r?t.wheelDeltaY/(120*i):t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;this.deltaY=t.deltaMode===t.DOM_DELTA_LINE?WB&&!cV?-e.deltaY/3:-e.deltaY:-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)this.deltaX=qB&&sV?-(t.wheelDeltaX/120):r?t.wheelDeltaX/(120*i):t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;this.deltaX=t.deltaMode===t.DOM_DELTA_LINE?WB&&!cV?-e.deltaX/3:-e.deltaX:-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(this.deltaY=r?e.wheelDelta/(120*i):e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},IV=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),LV;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof RV?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:EB.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:IV})})(LV||={});var RV=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?IV:(this._emitter||=new X,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},zV=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new nB(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new nB(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},BV=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new nB(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=hB(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var VV;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(VV||={});var HV=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new X,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.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 EB.toPromise(this._onStateChanged.event)}while(1)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.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())}};HV.EMPTY=HV.fromArray([]);function UV(e){return WV(e,0)}function WV(e,t){switch(typeof e){case`object`:return e===null?GV(349,t):Array.isArray(e)?JV(e,t):YV(e,t);case`string`:return qV(e,t);case`boolean`:return KV(e,t);case`number`:return GV(e,t);case`undefined`:return GV(937,t);default:return GV(617,t)}}function GV(e,t){return(t<<5)-t+e|0}function KV(e,t){return GV(e?433:863,t)}function qV(e,t){t=GV(149417,t);for(let n=0,r=e.length;n<r;n++)t=GV(e.charCodeAt(n),t);return t}function JV(e,t){return t=GV(104579,t),e.reduce((e,t)=>WV(t,e),t)}function YV(e,t){return t=GV(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=qV(n,t),WV(e[n],t)),t)}var{registerWindow:XV,getWindow:ZV,getDocument:QV,getWindows:$V,getWindowsCount:eH,getWindowId:tH,getWindowById:nH,hasWindow:rH,onDidRegisterWindow:iH,onWillUnregisterWindow:aH,onDidUnregisterWindow:oH}=function(){let e=new Map,t={window:bB,disposables:new _B};e.set(bB.vscodeWindowId,t);let n=new X,r=new X,i=new X;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return vB.None;let a=new _B,o={window:t,disposables:a.add(new _B)};return e.set(t.vscodeWindowId,o),a.add(hB(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(cH(t,_H.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:bB},getDocument(e){return ZV(e).document}}}(),sH=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function cH(e,t,n,r){return new sH(e,t,n,r)}function lH(e,t){return function(n){return t(new PV(e,n))}}function uH(e){return function(t){return e(new AV(t))}}var dH=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=lH(ZV(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=uH(n)),cH(e,t,i,r)},fH,pH=class extends BV{constructor(e){super(),this.defaultTarget=e&&ZV(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},mH=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Xz(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(mH.sort),a.shift().execute();r.set(i,!1)};fH=(t,r,a=0)=>{let o=tH(t),s=new mH(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var hH=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};hH.None=new hH(0,0);function gH(e){let t=e.getBoundingClientRect(),n=ZV(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=UV(n),a=r.get(i);if(a)a.users+=1;else{let o=new X,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(hB(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var _H={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:GB?`webkitAnimationStart`:`animationstart`,ANIMATION_END:GB?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:GB?`webkitAnimationIteration`:`animationiteration`},vH=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=yH(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=yH(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=yH(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=yH(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=yH(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=yH(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=yH(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=yH(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=yH(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=yH(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=yH(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=yH(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=yH(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=yH(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function yH(e){return typeof e==`number`?`${e}px`:e}function bH(e){return new vH(e)}var xH=class{constructor(){this._hooks=new _B,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(hB(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=ZV(e)}this._hooks.add(cH(a,_H.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(cH(a,_H.POINTER_UP,e=>this.stopMonitoring(!0)))}};function SH(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var CH;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(CH||={});var wH=class e extends vB{constructor(){super(),this.dispatched=!1,this.targets=new CB,this.ignoreTargets=new CB,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(EB.runAndSubscribe(iH,({window:e,disposables:t})=>{t.add(cH(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(cH(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(cH(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:bB,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=fB(new e),hB(e.INSTANCE.targets.push(t))):vB.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=fB(new e),hB(e.INSTANCE.ignoreTargets.push(t))):vB.None}static isTouchDevice(){return`ontouchstart`in bB||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(CH.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-rB(s.rollingPageX))<30&&Math.abs(s.initialPageY-rB(s.rollingPageY))<30){let e=this.newGestureEvent(CH.Tap,s.initialTarget);e.pageX=rB(s.rollingPageX),e.pageY=rB(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-rB(s.rollingPageX))<30&&Math.abs(s.initialPageY-rB(s.rollingPageY))<30){let e=this.newGestureEvent(CH.Contextmenu,s.initialTarget);e.pageX=rB(s.rollingPageX),e.pageY=rB(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=rB(s.rollingPageX),n=rB(s.rollingPageY),i=rB(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(CH.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===CH.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===CH.Change||t.type===CH.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=fH(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(CH.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(CH.Change,i.initialTarget);a.translationX=r.pageX-rB(i.rollingPageX),a.translationY=r.pageY-rB(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};wH.SCROLL_FRICTION=-.005,wH.HOLD_DELAY=700,wH.CLEAR_TAP_COUNT_TIME=400,nz([SH],wH,`isTouchDevice`,1);var TH=wH,EH=class extends vB{onclick(e,t){this._register(cH(e,_H.CLICK,n=>t(new PV(ZV(e),n))))}onmousedown(e,t){this._register(cH(e,_H.MOUSE_DOWN,n=>t(new PV(ZV(e),n))))}onmouseover(e,t){this._register(cH(e,_H.MOUSE_OVER,n=>t(new PV(ZV(e),n))))}onmouseleave(e,t){this._register(cH(e,_H.MOUSE_LEAVE,n=>t(new PV(ZV(e),n))))}onkeydown(e,t){this._register(cH(e,_H.KEY_DOWN,e=>t(new AV(e))))}onkeyup(e,t){this._register(cH(e,_H.KEY_UP,e=>t(new AV(e))))}oninput(e,t){this._register(cH(e,_H.INPUT,t))}onblur(e,t){this._register(cH(e,_H.BLUR,t))}onfocus(e,t){this._register(cH(e,_H.FOCUS,t))}onchange(e,t){this._register(cH(e,_H.CHANGE,t))}ignoreGesture(e){return TH.ignoreTarget(e)}},DH=11,OH=class extends EH{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=DH+`px`,this.domNode.style.height=DH+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new xH),this._register(dH(this.bgDomNode,_H.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(dH(this.domNode,_H.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new pH),this._pointerdownScheduleRepeatTimer=this._register(new zV)}_arrowPointerDown(e){e.target&&e.target instanceof Element&&(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,ZV(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},kH=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}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(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,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:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},AH=class extends vB{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new kH(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new PH(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=PH.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},jH=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function MH(e,t){let n=t-e;return function(t){return e+n*IH(t)}}function NH(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var PH=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,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,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),NH(MH(e,r),MH(i,t),.33)}return MH(e,t)}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 t=(e-this.startTime)/this.duration;return t<1?new jH(this.scrollLeft(t),this.scrollTop(t),!1):new jH(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function FH(e){return e**3}function IH(e){return 1-FH(1-e)}var LH=class extends vB{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new zV)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3||this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},RH=140,zH=class extends EH{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new LH(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new xH),this._shouldRender=!0,this.domNode=bH(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(cH(this.domNode.domNode,_H.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new OH(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=bH(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(cH(this.slider.domNode,_H.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=gH(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(sV&&a>RH){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},BH=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},VH=class extends zH{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new BH(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},HH=class extends zH{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new BH(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},UH=500,WH=50,GH=!0,KH=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},qH=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,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(1);return t<=.5}acceptStandardWheelEvent(e){if(KB){let t=HB(ZV(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new KH(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=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]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};qH.INSTANCE=new qH;var JH=qH,YH=class extends EH{constructor(e,t,n){super(),this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new X),this.onWillScroll=this._onWillScroll.event,this._options=ZH(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new HH(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new VH(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=bH(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=bH(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=bH(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,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new zV),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=pB(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,cV&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new FV(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=pB(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(cH(this._listenOnDomNode,_H.MOUSE_WHEEL,e=>{this._onMouseWheel(new FV(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=JH.INSTANCE;GH&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!cV&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=WH*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=WH*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(GH&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),UH)}},XH=class extends YH{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function ZH(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,cV&&(t.className+=` mac`),t}var QH=class extends vB{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new X),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new AH({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>fH(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new XH(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(EB.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(hB(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(hB(()=>this._styleElement.remove())),this._register(EB.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
|
|
276
|
-
`)})),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(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};QH=nz([Y(2,kz),Y(3,Hz),Y(4,Az),Y(5,qz),Y(6,Fz),Y(7,Wz)],QH);var $H=class extends vB{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(hB(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};$H=nz([Y(1,kz),Y(2,Hz),Y(3,Rz),Y(4,Wz)],$H);var eU=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},tU={full:0,left:0,center:0,right:0},nU={full:0,left:0,center:0,right:0},rU={full:0,left:0,center:0,right:0},iU=class extends vB{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new eU,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(hB(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw 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 e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);nU.full=this._canvas.width,nU.left=e,nU.center=t,nU.right=e,this._refreshDrawHeightConstants(),rU.full=1,rU.left=1,rU.center=1+nU.left,rU.right=1+nU.left+nU.center}_refreshDrawHeightConstants(){tU.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);tU.left=t,tU.center=t,tU.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*tU.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*tU.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*tU.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*tU.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 e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(rU[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-tU[e.position||`full`]/2),nU[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+tU[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};iU=nz([Y(2,kz),Y(3,Rz),Y(4,Wz),Y(5,Fz),Y(6,qz),Y(7,Hz)],iU);var Z;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
|
|
277
|
-
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(Z||={});var aU;(e=>(e.PAD=``,e.HOP=``,e.BPH=``,e.NBH=``,e.IND=``,e.NEL=`
`,e.SSA=``,e.ESA=``,e.HTS=``,e.HTJ=``,e.VTS=``,e.PLD=``,e.PLU=``,e.RI=``,e.SS2=``,e.SS3=``,e.DCS=``,e.PU1=``,e.PU2=``,e.STS=``,e.CCH=``,e.MW=``,e.SPA=``,e.EPA=``,e.SOS=``,e.SGCI=``,e.SCI=``,e.CSI=``,e.ST=``,e.OSC=``,e.PM=``,e.APC=``))(aU||={});var oU;(e=>e.ST=`${Z.ESC}\\`)(oU||={});var sU=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!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 e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Z.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};sU=nz([Y(2,kz),Y(3,Fz),Y(4,jz),Y(5,Wz)],sU);var cU=0,lU=0,uU=0,dU=0,fU={css:`#00000000`,rgba:0},pU;(e=>{function t(e,t,n,r){return r===void 0?`#${vU(e)}${vU(t)}${vU(n)}`:`#${vU(e)}${vU(t)}${vU(n)}${vU(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(pU||={});var mU;(e=>{function t(e,t){if(dU=(t.rgba&255)/255,dU===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return cU=a+Math.round((n-a)*dU),lU=o+Math.round((r-o)*dU),uU=s+Math.round((i-s)*dU),{css:pU.toCss(cU,lU,uU),rgba:pU.toRgba(cU,lU,uU)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=_U.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return pU.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[cU,lU,uU]=_U.toChannels(t),{css:pU.toCss(cU,lU,uU),rgba:t}}e.opaque=i;function a(e,t){return dU=Math.round(t*255),[cU,lU,uU]=_U.toChannels(e.rgba),{css:pU.toCss(cU,lU,uU,dU),rgba:pU.toRgba(cU,lU,uU,dU)}}e.opacity=a;function o(e,t){return dU=e.rgba&255,a(e,dU*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(mU||={});var hU;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return cU=parseInt(e.slice(1,2).repeat(2),16),lU=parseInt(e.slice(2,3).repeat(2),16),uU=parseInt(e.slice(3,4).repeat(2),16),pU.toColor(cU,lU,uU);case 5:return cU=parseInt(e.slice(1,2).repeat(2),16),lU=parseInt(e.slice(2,3).repeat(2),16),uU=parseInt(e.slice(3,4).repeat(2),16),dU=parseInt(e.slice(4,5).repeat(2),16),pU.toColor(cU,lU,uU,dU);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return cU=parseInt(r[1]),lU=parseInt(r[2]),uU=parseInt(r[3]),dU=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),pU.toColor(cU,lU,uU,dU);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[cU,lU,uU,dU]=t.getImageData(0,0,1,1).data,dU!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:pU.toRgba(cU,lU,uU,dU),css:e}}e.toColor=r})(hU||={});var gU;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(gU||={});var _U;(e=>{function t(e,t){if(dU=(t&255)/255,dU===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return cU=a+Math.round((n-a)*dU),lU=o+Math.round((r-o)*dU),uU=s+Math.round((i-s)*dU),pU.toRgba(cU,lU,uU)}e.blend=t;function n(e,t,n){let a=gU.relativeLuminance(e>>8),o=gU.relativeLuminance(t>>8);if(yU(a,o)<n){if(o<a){let o=r(e,t,n),s=yU(a,gU.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>yU(a,gU.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=yU(a,gU.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>yU(a,gU.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=yU(gU.relativeLuminance2(o,s,c),gU.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=yU(gU.relativeLuminance2(o,s,c),gU.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=yU(gU.relativeLuminance2(o,s,c),gU.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=yU(gU.relativeLuminance2(o,s,c),gU.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(_U||={});function vU(e){let t=e.toString(16);return t.length<2?`0`+t:t}function yU(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var bU=class extends bz{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},xU=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Sz}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||yz.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)xU._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||yz.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};xU=nz([Y(0,kz)],xU);function SU(e){return 57508<=e&&e<=57558}function CU(e){return 9472<=e&&e<=9631}function wU(e){return SU(e)||CU(e)}function TU(){return{css:{canvas:EU(),cell:EU()},device:{canvas:EU(),cell:EU(),char:{width:0,height:0,left:0,top:0}}}}function EU(){return{width:0,height:0}}var DU=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new Sz,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,w=!1,T=0,E=0,D=[],ee=l!==-1&&u!==-1;for(let O=0;O<m;O++){e.loadCell(O,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let k=!1,A=O>=E,j=O,M=this._workCell;if(f.length>0&&O===f[0][0]&&A){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)A&&=i===this._isCellInSelection(v,t);A&&=!n||a<r[0]||a>=r[1],A?(k=!0,M=new bU(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),j=r[1]-1,m=M.getWidth()):E=r[1]}let N=this._isCellInSelection(O,t),P=n&&O===a,F=ee&&O>=l&&O<=u,I=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,e=>{I=!0});let L=M.getChars()||yz;if(L===` `&&(M.isUnderline()||M.isOverline())&&(L=`\xA0`),T=m*s-c.get(L,M.isBold(),M.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(N&&w||!N&&!w&&M.bg===y)&&(N&&w&&p.selectionForeground||M.fg===b)&&M.extended.ext===x&&F===S&&T===C&&!P&&!k&&!I&&A){M.isInvisible()?_+=yz:_+=L,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=M.bg,b=M.fg,x=M.extended.ext,S=F,C=T,w=N,k&&a>=O&&a<=j&&(a=O),!this._coreService.isCursorHidden&&P&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`)}}if(M.isBold()&&D.push(`xterm-bold`),M.isItalic()&&D.push(`xterm-italic`),M.isDim()&&D.push(`xterm-dim`),_=M.isInvisible()?yz:M.getChars()||yz,M.isUnderline()&&(D.push(`xterm-underline-${M.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!M.isUnderlineColorDefault())){if(M.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${bz.toColorRGB(M.getUnderlineColor()).join(`,`)})`;else{let e=M.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&M.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}}M.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),M.isStrikethrough()&&D.push(`xterm-strikethrough`),F&&(h.style.textDecoration=`underline`);let te=M.getFgColor(),R=M.getFgColorMode(),ne=M.getBgColor(),re=M.getBgColorMode(),z=!!M.isInverse();if(z){let e=te;te=ne,ne=e;let t=R;R=re,re=t}let B,ie,V=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,e=>{e.options.layer!==`top`&&V||(e.backgroundColorRGB&&(re=50331648,ne=e.backgroundColorRGB.rgba>>8&16777215,B=e.backgroundColorRGB),e.foregroundColorRGB&&(R=50331648,te=e.foregroundColorRGB.rgba>>8&16777215,ie=e.foregroundColorRGB),V=e.options.layer===`top`)}),!V&&N&&(B=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,ne=B.rgba>>8&16777215,re=50331648,V=!0,p.selectionForeground&&(R=50331648,te=p.selectionForeground.rgba>>8&16777215,ie=p.selectionForeground)),V&&D.push(`xterm-decoration-top`);let ae;switch(re){case 16777216:case 33554432:ae=p.ansi[ne],D.push(`xterm-bg-${ne}`);break;case 50331648:ae=pU.toColor(ne>>16,ne>>8&255,ne&255),this._addStyle(h,`background-color:#${OU((ne>>>0).toString(16),`0`,6)}`);break;default:z?(ae=p.foreground,D.push(`xterm-bg-257`)):ae=p.background}switch(B||M.isDim()&&(B=mU.multiplyOpacity(ae,.5)),R){case 16777216:case 33554432:M.isBold()&&te<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(te+=8),this._applyMinimumContrast(h,ae,p.ansi[te],M,B,void 0)||D.push(`xterm-fg-${te}`);break;case 50331648:let e=pU.toColor(te>>16&255,te>>8&255,te&255);this._applyMinimumContrast(h,ae,e,M,B,ie)||this._addStyle(h,`color:#${OU(te.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,ae,p.foreground,M,B,ie)||z&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!P&&!k&&!I&&A?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),O=j}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||wU(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=mU.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};DU=nz([Y(1,Kz),Y(2,Fz),Y(3,Hz),Y(4,jz),Y(5,Rz),Y(6,qz)],DU);function OU(e,t,n){for(;e.length<n;)e=t+e;return e}var kU=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},AU=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function jU(){return new AU}var MU=`xterm-dom-renderer-owner-`,NU=`xterm-rows`,PU=`xterm-fg-`,FU=`xterm-bg-`,IU=`xterm-focus`,LU=`xterm-selection`,RU=1,zU=class extends vB{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=RU++,this._rowElements=[],this._selectionRenderModel=jU(),this.onRequestRedraw=this._register(new X).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(NU),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(LU),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=TU(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(DU,document),this._element.classList.add(MU+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(hB(()=>{this._element.classList.remove(MU+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new kU(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${NU} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${NU} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${NU} .xterm-dim { color: ${mU.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${NU}.${IU} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${NU}.${IU} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${NU}.${IU} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${NU} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${NU} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${NU} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${NU} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${NU} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${LU} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${LU} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${LU} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${PU}${n} { color: ${r.css}; }${this._terminalSelector} .${PU}${n}.xterm-dim { color: ${mU.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${FU}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${PU}257 { color: ${mU.opaque(e.background).css}; }${this._terminalSelector} .${PU}257.xterm-dim { color: ${mU.multiplyOpacity(mU.opaque(e.background),.5).css}; }${this._terminalSelector} .${FU}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(IU),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(IU),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${MU}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};zU=nz([Y(7,Nz),Y(8,Vz),Y(9,Fz),Y(10,kz),Y(11,jz),Y(12,Hz),Y(13,qz)],zU);var BU=class extends vB{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new X),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new UU(this._optionsService))}catch{this._measureStrategy=this._register(new HU(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};BU=nz([Y(2,Fz)],BU);var VU=class extends vB{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},HU=class extends VU{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},UU=class extends VU{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},WU=class extends vB{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new GU(this._window)),this._onDprChange=this._register(new X),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new X),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(EB.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(cH(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(cH(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},GU=class extends vB{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new yB),this._onDprChange=this._register(new X),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(hB(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=cH(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)}},KU=class extends vB{constructor(){super(),this.linkProviders=[],this._register(hB(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function qU(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function JU(e,t,n,r,i,a,o,s,c){if(!a)return;let l=qU(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var YU=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return JU(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=qU(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};YU=nz([Y(0,Wz),Y(1,Vz)],YU);var XU=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},ZU={};tz(ZU,{getSafariVersion:()=>iW,isChromeOS:()=>uW,isFirefox:()=>tW,isIpad:()=>oW,isIphone:()=>sW,isLegacyEdge:()=>nW,isLinux:()=>lW,isMac:()=>aW,isNode:()=>QU,isSafari:()=>rW,isWindows:()=>cW});var QU=typeof process<`u`&&`title`in process,$U=QU?`node`:navigator.userAgent,eW=QU?`node`:navigator.platform,tW=$U.includes(`Firefox`),nW=$U.includes(`Edge`),rW=/^((?!chrome|android).)*safari/i.test($U);function iW(){if(!rW)return 0;let e=$U.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var aW=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(eW),oW=eW===`iPad`,sW=eW===`iPhone`,cW=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(eW),lW=eW.indexOf(`Linux`)>=0,uW=/\bCrOS\b/.test($U),dW=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},fW=class extends dW{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},pW=class extends dW{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},mW=!QU&&`requestIdleCallback`in window?pW:fW,hW=class{constructor(){this._queue=new mW}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},gW=class extends vB{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new yB),this._pausedResizeTask=new hW,this._observerDisposable=this._register(new yB),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 X),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new X),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new X),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new X),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new XU((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new _W(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(hB(()=>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(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.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(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=hB(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){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(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};gW=nz([Y(2,Fz),Y(3,Vz),Y(4,jz),Y(5,Rz),Y(6,kz),Y(7,Hz),Y(8,qz)],gW);var _W=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function vW(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return xW(i,a,e,t,n,r)+SW(a,t,n,r)+CW(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,AW(Math.abs(i-e),kW(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return AW(bW(a>t?e:i,n)+(s-1)*n.cols+1+yW(a>t?i:e,n),kW(o,r))}function yW(e,t){return e-1}function bW(e,t){return t.cols-e}function xW(e,t,n,r,i,a){return SW(t,r,i,a).length===0?``:AW(OW(e,t,e,t-TW(t,i),!1,i).length,kW(`D`,a))}function SW(e,t,n,r){let i=e-TW(e,n),a=t-TW(t,n);return AW(Math.abs(i-a)-wW(e,t,n),kW(DW(e,t),r))}function CW(e,t,n,r,i,a){let o;o=SW(t,r,i,a).length>0?r-TW(r,i):t;let s=r,c=EW(e,t,n,r,i,a);return AW(OW(e,o,n,s,c===`C`,i).length,kW(c,a))}function wW(e,t,n){let r=0,i=e-TW(e,n),a=t-TW(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=DW(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function TW(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function EW(e,t,n,r,i,a){let o;return o=SW(n,r,i,a).length>0?r-TW(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function DW(e,t){return e>t?`A`:`B`}function OW(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function kW(e,t){let n=t?`O`:`[`;return Z.ESC+n+e}function AW(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var jW=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function MW(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var NW=50,PW=15,FW=50,IW=500,LW=RegExp(`\xA0`,`g`),RW=class extends vB{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Sz,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new X),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new X),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new X),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new X),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new jW(this._bufferService),this._activeSelectionMode=0,this._register(hB(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(LW,` `)).join(cW?`\r
|
|
275
|
+
`))}},RB=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},zB=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},BB=0,VB=class{constructor(e){this.value=e,this.id=BB++}},HB=2,X=class{constructor(e){this._size=0,this._options=e,this._leakageMon=PB>0||this._options?.leakWarningThreshold?new IB(e?.onListenerError??tB,this._options?.leakWarningThreshold??PB):void 0,this._perfMon=this._options?._profName?new NB(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??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new zB(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||tB)(n),CB.None}if(this._disposed)return CB.None;t&&(e=e.bind(t));let r=new VB(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=LB.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof VB?(this._deliveryQueue??=new UB,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=bB(()=>{i?.(),this._removeListener(r)});return n instanceof SB?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){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 t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*HB<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||tB;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof VB)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},UB=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},WB=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new X,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new X,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};WB.INSTANCE=new WB;var GB=WB;function KB(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}GB.INSTANCE.onDidChangeZoomLevel;function qB(e){return GB.INSTANCE.getZoomFactor(e)}GB.INSTANCE.onDidChangeFullscreen;var JB=typeof navigator==`object`?navigator.userAgent:``,YB=JB.indexOf(`Firefox`)>=0,XB=JB.indexOf(`AppleWebKit`)>=0,ZB=JB.indexOf(`Chrome`)>=0,QB=!ZB&&JB.indexOf(`Safari`)>=0;JB.indexOf(`Electron/`),JB.indexOf(`Android`);var $B=!1;if(typeof TB.matchMedia==`function`){let e=TB.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=TB.matchMedia(`(display-mode: fullscreen)`);$B=e.matches,KB(TB,e,({matches:e})=>{$B&&t.matches||($B=e)})}function eV(){return $B}var tV=`en`,nV=!1,rV=!1,iV=!1,aV=!1,oV=!1,sV=tV,cV,lV=globalThis,uV;typeof lV.vscode<`u`&&typeof lV.vscode.process<`u`?uV=lV.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(uV=process);var dV=typeof uV?.versions?.electron==`string`&&uV?.type===`renderer`;if(typeof uV==`object`){nV=uV.platform===`win32`,rV=uV.platform===`darwin`,iV=uV.platform===`linux`,iV&&uV.env.SNAP&&uV.env.SNAP_REVISION,uV.env.CI||uV.env.BUILD_ARTIFACTSTAGINGDIRECTORY,sV=tV;let e=uV.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,sV=t.resolvedLanguage||tV,t.languagePack?.translationsConfigFile}catch{}aV=!0}else typeof navigator==`object`&&!dV?(cV=navigator.userAgent,nV=cV.indexOf(`Windows`)>=0,rV=cV.indexOf(`Macintosh`)>=0,(cV.indexOf(`Macintosh`)>=0||cV.indexOf(`iPad`)>=0||cV.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,iV=cV.indexOf(`Linux`)>=0,cV?.indexOf(`Mobi`),oV=!0,sV=globalThis._VSCODE_NLS_LANGUAGE||tV,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var fV=nV,pV=rV,mV=iV,hV=aV;oV&&typeof lV.importScripts==`function`&&lV.origin;var gV=cV,_V=sV,vV;(e=>{function t(){return _V}e.value=t;function n(){return _V.length===2?_V===`en`:_V.length>=3&&_V[0]===`e`&&_V[1]===`n`&&_V[2]===`-`}e.isDefaultVariant=n;function r(){return _V===`en`}e.isDefault=r})(vV||={});var yV=typeof lV.postMessage==`function`&&!lV.importScripts;(()=>{if(yV){let e=[];lV.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),lV.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var bV=!!(gV&&gV.indexOf(`Chrome`)>=0);gV&&gV.indexOf(`Firefox`),!bV&&gV&&gV.indexOf(`Safari`),gV&&gV.indexOf(`Edg/`),gV&&gV.indexOf(`Android`);var xV=typeof navigator==`object`?navigator:{};hV||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||xV&&xV.clipboard&&xV.clipboard.writeText,hV||xV&&xV.clipboard&&xV.clipboard.readText,hV||eV()||xV.keyboard,`ontouchstart`in TB||xV.maxTouchPoints,TB.PointerEvent&&(`ontouchstart`in TB||navigator.maxTouchPoints);var SV=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},CV=new SV,wV=new SV,TV=new SV,EV=Array(230),DV;(e=>{function t(e){return CV.keyCodeToStr(e)}e.toString=t;function n(e){return CV.strToKeyCode(e)}e.fromString=n;function r(e){return wV.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return TV.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return wV.strToKeyCode(e)||TV.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return CV.keyCodeToStr(e)}e.toElectronAccelerator=o})(DV||={});var OV=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new kV([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},kV=class{constructor(e){if(e.length===0)throw aB(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function AV(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return DV.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(YB)switch(t){case 59:return 85;case 60:if(mV)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(pV)return 57}else if(XB&&(pV&&t===93||!pV&&t===92))return 57;return EV[t]||0}var jV=pV?256:2048,MV=512,NV=1024,PV=pV?2048:256,FV=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=AV(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=jV),this.altKey&&(t|=MV),this.shiftKey&&(t|=NV),this.metaKey&&(t|=PV),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new OV(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},IV=new WeakMap;function LV(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var RV=class{static getSameOriginWindowChain(e){let t=IV.get(e);if(!t){t=[],IV.set(e,t);let n=e,r;do r=LV(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},zV=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=RV.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},BV=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(ZB){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)this.deltaY=r?t.wheelDeltaY/(120*i):t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;this.deltaY=t.deltaMode===t.DOM_DELTA_LINE?YB&&!pV?-e.deltaY/3:-e.deltaY:-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)this.deltaX=QB&&fV?-(t.wheelDeltaX/120):r?t.wheelDeltaX/(120*i):t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;this.deltaX=t.deltaMode===t.DOM_DELTA_LINE?YB&&!pV?-e.deltaX/3:-e.deltaX:-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(this.deltaY=r?e.wheelDelta/(120*i):e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},VV=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),HV;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof UV?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:jB.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:VV})})(HV||={});var UV=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?VV:(this._emitter||=new X,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},WV=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new sB(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new sB(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},GV=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new sB(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=bB(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var KV;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(KV||={});var qV=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new X,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.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 jB.toPromise(this._onStateChanged.event)}while(1)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.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())}};qV.EMPTY=qV.fromArray([]);function JV(e){return YV(e,0)}function YV(e,t){switch(typeof e){case`object`:return e===null?XV(349,t):Array.isArray(e)?$V(e,t):eH(e,t);case`string`:return QV(e,t);case`boolean`:return ZV(e,t);case`number`:return XV(e,t);case`undefined`:return XV(937,t);default:return XV(617,t)}}function XV(e,t){return(t<<5)-t+e|0}function ZV(e,t){return XV(e?433:863,t)}function QV(e,t){t=XV(149417,t);for(let n=0,r=e.length;n<r;n++)t=XV(e.charCodeAt(n),t);return t}function $V(e,t){return t=XV(104579,t),e.reduce((e,t)=>YV(t,e),t)}function eH(e,t){return t=XV(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=QV(n,t),YV(e[n],t)),t)}var{registerWindow:tH,getWindow:nH,getDocument:rH,getWindows:iH,getWindowsCount:aH,getWindowId:oH,getWindowById:sH,hasWindow:cH,onDidRegisterWindow:lH,onWillUnregisterWindow:uH,onDidUnregisterWindow:dH}=function(){let e=new Map,t={window:TB,disposables:new SB};e.set(TB.vscodeWindowId,t);let n=new X,r=new X,i=new X;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return CB.None;let a=new SB,o={window:t,disposables:a.add(new SB)};return e.set(t.vscodeWindowId,o),a.add(bB(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(pH(t,SH.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:TB},getDocument(e){return nH(e).document}}}(),fH=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function pH(e,t,n,r){return new fH(e,t,n,r)}function mH(e,t){return function(n){return t(new zV(e,n))}}function hH(e){return function(t){return e(new FV(t))}}var gH=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=mH(nH(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=hH(n)),pH(e,t,i,r)},_H,vH=class extends GV{constructor(e){super(),this.defaultTarget=e&&nH(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},yH=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){tB(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(yH.sort),a.shift().execute();r.set(i,!1)};_H=(t,r,a=0)=>{let o=oH(t),s=new yH(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var bH=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};bH.None=new bH(0,0);function xH(e){let t=e.getBoundingClientRect(),n=nH(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=JV(n),a=r.get(i);if(a)a.users+=1;else{let o=new X,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(bB(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var SH={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:XB?`webkitAnimationStart`:`animationstart`,ANIMATION_END:XB?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:XB?`webkitAnimationIteration`:`animationiteration`},CH=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=wH(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=wH(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=wH(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=wH(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=wH(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=wH(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=wH(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=wH(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=wH(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=wH(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=wH(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=wH(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=wH(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=wH(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function wH(e){return typeof e==`number`?`${e}px`:e}function TH(e){return new CH(e)}var EH=class{constructor(){this._hooks=new SB,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(bB(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=nH(e)}this._hooks.add(pH(a,SH.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(pH(a,SH.POINTER_UP,e=>this.stopMonitoring(!0)))}};function DH(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var OH;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(OH||={});var kH=class e extends CB{constructor(){super(),this.dispatched=!1,this.targets=new OB,this.ignoreTargets=new OB,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(jB.runAndSubscribe(lH,({window:e,disposables:t})=>{t.add(pH(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(pH(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(pH(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:TB,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=_B(new e),bB(e.INSTANCE.targets.push(t))):CB.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=_B(new e),bB(e.INSTANCE.ignoreTargets.push(t))):CB.None}static isTouchDevice(){return`ontouchstart`in TB||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(OH.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-cB(s.rollingPageX))<30&&Math.abs(s.initialPageY-cB(s.rollingPageY))<30){let e=this.newGestureEvent(OH.Tap,s.initialTarget);e.pageX=cB(s.rollingPageX),e.pageY=cB(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-cB(s.rollingPageX))<30&&Math.abs(s.initialPageY-cB(s.rollingPageY))<30){let e=this.newGestureEvent(OH.Contextmenu,s.initialTarget);e.pageX=cB(s.rollingPageX),e.pageY=cB(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=cB(s.rollingPageX),n=cB(s.rollingPageY),i=cB(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(OH.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===OH.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===OH.Change||t.type===OH.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=_H(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(OH.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(OH.Change,i.initialTarget);a.translationX=r.pageX-cB(i.rollingPageX),a.translationY=r.pageY-cB(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};kH.SCROLL_FRICTION=-.005,kH.HOLD_DELAY=700,kH.CLEAR_TAP_COUNT_TIME=400,sz([DH],kH,`isTouchDevice`,1);var AH=kH,jH=class extends CB{onclick(e,t){this._register(pH(e,SH.CLICK,n=>t(new zV(nH(e),n))))}onmousedown(e,t){this._register(pH(e,SH.MOUSE_DOWN,n=>t(new zV(nH(e),n))))}onmouseover(e,t){this._register(pH(e,SH.MOUSE_OVER,n=>t(new zV(nH(e),n))))}onmouseleave(e,t){this._register(pH(e,SH.MOUSE_LEAVE,n=>t(new zV(nH(e),n))))}onkeydown(e,t){this._register(pH(e,SH.KEY_DOWN,e=>t(new FV(e))))}onkeyup(e,t){this._register(pH(e,SH.KEY_UP,e=>t(new FV(e))))}oninput(e,t){this._register(pH(e,SH.INPUT,t))}onblur(e,t){this._register(pH(e,SH.BLUR,t))}onfocus(e,t){this._register(pH(e,SH.FOCUS,t))}onchange(e,t){this._register(pH(e,SH.CHANGE,t))}ignoreGesture(e){return AH.ignoreTarget(e)}},MH=11,NH=class extends jH{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=MH+`px`,this.domNode.style.height=MH+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new EH),this._register(gH(this.bgDomNode,SH.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(gH(this.domNode,SH.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new vH),this._pointerdownScheduleRepeatTimer=this._register(new WV)}_arrowPointerDown(e){e.target&&e.target instanceof Element&&(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,nH(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},PH=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}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(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,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:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},FH=class extends CB{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new PH(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new zH(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=zH.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},IH=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function LH(e,t){let n=t-e;return function(t){return e+n*VH(t)}}function RH(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var zH=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,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,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),RH(LH(e,r),LH(i,t),.33)}return LH(e,t)}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 t=(e-this.startTime)/this.duration;return t<1?new IH(this.scrollLeft(t),this.scrollTop(t),!1):new IH(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function BH(e){return e**3}function VH(e){return 1-BH(1-e)}var HH=class extends CB{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new WV)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3||this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},UH=140,WH=class extends jH{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new HH(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new EH),this._shouldRender=!0,this.domNode=TH(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(pH(this.domNode.domNode,SH.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new NH(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=TH(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(pH(this.slider.domNode,SH.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=xH(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(fV&&a>UH){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},GH=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},KH=class extends WH{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new GH(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},qH=class extends WH{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new GH(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},JH=500,YH=50,XH=!0,ZH=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},QH=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,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(1);return t<=.5}acceptStandardWheelEvent(e){if(ZB){let t=qB(nH(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new ZH(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=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]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};QH.INSTANCE=new QH;var $H=QH,eU=class extends jH{constructor(e,t,n){super(),this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new X),this.onWillScroll=this._onWillScroll.event,this._options=nU(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new qH(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new KH(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=TH(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=TH(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=TH(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,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new WV),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=vB(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,pV&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new BV(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=vB(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(pH(this._listenOnDomNode,SH.MOUSE_WHEEL,e=>{this._onMouseWheel(new BV(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=$H.INSTANCE;XH&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!pV&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=YH*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=YH*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(XH&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),JH)}},tU=class extends eU{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function nU(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,pV&&(t.className+=` mac`),t}var rU=class extends CB{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new X),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new FH({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>_H(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new tU(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(jB.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(bB(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(bB(()=>this._styleElement.remove())),this._register(jB.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
|
|
276
|
+
`)})),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(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};rU=sz([Y(2,Pz),Y(3,qz),Y(4,Fz),Y(5,Qz),Y(6,Bz),Y(7,Yz)],rU);var iU=class extends CB{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(bB(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};iU=sz([Y(1,Pz),Y(2,qz),Y(3,Uz),Y(4,Yz)],iU);var aU=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},oU={full:0,left:0,center:0,right:0},sU={full:0,left:0,center:0,right:0},cU={full:0,left:0,center:0,right:0},lU=class extends CB{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new aU,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(bB(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw 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 e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);sU.full=this._canvas.width,sU.left=e,sU.center=t,sU.right=e,this._refreshDrawHeightConstants(),cU.full=1,cU.left=1,cU.center=1+sU.left,cU.right=1+sU.left+sU.center}_refreshDrawHeightConstants(){oU.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);oU.left=t,oU.center=t,oU.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*oU.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*oU.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*oU.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*oU.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 e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(cU[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-oU[e.position||`full`]/2),sU[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+oU[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};lU=sz([Y(2,Pz),Y(3,Uz),Y(4,Yz),Y(5,Bz),Y(6,Qz),Y(7,qz)],lU);var Z;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
|
|
277
|
+
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(Z||={});var uU;(e=>(e.PAD=``,e.HOP=``,e.BPH=``,e.NBH=``,e.IND=``,e.NEL=`
`,e.SSA=``,e.ESA=``,e.HTS=``,e.HTJ=``,e.VTS=``,e.PLD=``,e.PLU=``,e.RI=``,e.SS2=``,e.SS3=``,e.DCS=``,e.PU1=``,e.PU2=``,e.STS=``,e.CCH=``,e.MW=``,e.SPA=``,e.EPA=``,e.SOS=``,e.SGCI=``,e.SCI=``,e.CSI=``,e.ST=``,e.OSC=``,e.PM=``,e.APC=``))(uU||={});var dU;(e=>e.ST=`${Z.ESC}\\`)(dU||={});var fU=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!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 e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Z.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};fU=sz([Y(2,Pz),Y(3,Bz),Y(4,Iz),Y(5,Yz)],fU);var pU=0,mU=0,hU=0,gU=0,_U={css:`#00000000`,rgba:0},vU;(e=>{function t(e,t,n,r){return r===void 0?`#${CU(e)}${CU(t)}${CU(n)}`:`#${CU(e)}${CU(t)}${CU(n)}${CU(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(vU||={});var yU;(e=>{function t(e,t){if(gU=(t.rgba&255)/255,gU===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return pU=a+Math.round((n-a)*gU),mU=o+Math.round((r-o)*gU),hU=s+Math.round((i-s)*gU),{css:vU.toCss(pU,mU,hU),rgba:vU.toRgba(pU,mU,hU)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=SU.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return vU.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[pU,mU,hU]=SU.toChannels(t),{css:vU.toCss(pU,mU,hU),rgba:t}}e.opaque=i;function a(e,t){return gU=Math.round(t*255),[pU,mU,hU]=SU.toChannels(e.rgba),{css:vU.toCss(pU,mU,hU,gU),rgba:vU.toRgba(pU,mU,hU,gU)}}e.opacity=a;function o(e,t){return gU=e.rgba&255,a(e,gU*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(yU||={});var bU;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return pU=parseInt(e.slice(1,2).repeat(2),16),mU=parseInt(e.slice(2,3).repeat(2),16),hU=parseInt(e.slice(3,4).repeat(2),16),vU.toColor(pU,mU,hU);case 5:return pU=parseInt(e.slice(1,2).repeat(2),16),mU=parseInt(e.slice(2,3).repeat(2),16),hU=parseInt(e.slice(3,4).repeat(2),16),gU=parseInt(e.slice(4,5).repeat(2),16),vU.toColor(pU,mU,hU,gU);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return pU=parseInt(r[1]),mU=parseInt(r[2]),hU=parseInt(r[3]),gU=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),vU.toColor(pU,mU,hU,gU);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[pU,mU,hU,gU]=t.getImageData(0,0,1,1).data,gU!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:vU.toRgba(pU,mU,hU,gU),css:e}}e.toColor=r})(bU||={});var xU;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(xU||={});var SU;(e=>{function t(e,t){if(gU=(t&255)/255,gU===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return pU=a+Math.round((n-a)*gU),mU=o+Math.round((r-o)*gU),hU=s+Math.round((i-s)*gU),vU.toRgba(pU,mU,hU)}e.blend=t;function n(e,t,n){let a=xU.relativeLuminance(e>>8),o=xU.relativeLuminance(t>>8);if(wU(a,o)<n){if(o<a){let o=r(e,t,n),s=wU(a,xU.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>wU(a,xU.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=wU(a,xU.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>wU(a,xU.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=wU(xU.relativeLuminance2(o,s,c),xU.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=wU(xU.relativeLuminance2(o,s,c),xU.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=wU(xU.relativeLuminance2(o,s,c),xU.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=wU(xU.relativeLuminance2(o,s,c),xU.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(SU||={});function CU(e){let t=e.toString(16);return t.length<2?`0`+t:t}function wU(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var TU=class extends Tz{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},EU=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Dz}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||wz.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)EU._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||wz.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};EU=sz([Y(0,Pz)],EU);function DU(e){return 57508<=e&&e<=57558}function OU(e){return 9472<=e&&e<=9631}function kU(e){return DU(e)||OU(e)}function AU(){return{css:{canvas:jU(),cell:jU()},device:{canvas:jU(),cell:jU(),char:{width:0,height:0,left:0,top:0}}}}function jU(){return{width:0,height:0}}var MU=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new Dz,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,w=!1,T=0,E=0,D=[],ee=l!==-1&&u!==-1;for(let O=0;O<m;O++){e.loadCell(O,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let k=!1,A=O>=E,j=O,M=this._workCell;if(f.length>0&&O===f[0][0]&&A){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)A&&=i===this._isCellInSelection(v,t);A&&=!n||a<r[0]||a>=r[1],A?(k=!0,M=new TU(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),j=r[1]-1,m=M.getWidth()):E=r[1]}let N=this._isCellInSelection(O,t),P=n&&O===a,F=ee&&O>=l&&O<=u,I=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,e=>{I=!0});let L=M.getChars()||wz;if(L===` `&&(M.isUnderline()||M.isOverline())&&(L=`\xA0`),T=m*s-c.get(L,M.isBold(),M.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(N&&w||!N&&!w&&M.bg===y)&&(N&&w&&p.selectionForeground||M.fg===b)&&M.extended.ext===x&&F===S&&T===C&&!P&&!k&&!I&&A){M.isInvisible()?_+=wz:_+=L,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=M.bg,b=M.fg,x=M.extended.ext,S=F,C=T,w=N,k&&a>=O&&a<=j&&(a=O),!this._coreService.isCursorHidden&&P&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`)}}if(M.isBold()&&D.push(`xterm-bold`),M.isItalic()&&D.push(`xterm-italic`),M.isDim()&&D.push(`xterm-dim`),_=M.isInvisible()?wz:M.getChars()||wz,M.isUnderline()&&(D.push(`xterm-underline-${M.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!M.isUnderlineColorDefault())){if(M.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${Tz.toColorRGB(M.getUnderlineColor()).join(`,`)})`;else{let e=M.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&M.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}}M.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),M.isStrikethrough()&&D.push(`xterm-strikethrough`),F&&(h.style.textDecoration=`underline`);let te=M.getFgColor(),R=M.getFgColorMode(),ne=M.getBgColor(),re=M.getBgColorMode(),z=!!M.isInverse();if(z){let e=te;te=ne,ne=e;let t=R;R=re,re=t}let B,ie,V=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,e=>{e.options.layer!==`top`&&V||(e.backgroundColorRGB&&(re=50331648,ne=e.backgroundColorRGB.rgba>>8&16777215,B=e.backgroundColorRGB),e.foregroundColorRGB&&(R=50331648,te=e.foregroundColorRGB.rgba>>8&16777215,ie=e.foregroundColorRGB),V=e.options.layer===`top`)}),!V&&N&&(B=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,ne=B.rgba>>8&16777215,re=50331648,V=!0,p.selectionForeground&&(R=50331648,te=p.selectionForeground.rgba>>8&16777215,ie=p.selectionForeground)),V&&D.push(`xterm-decoration-top`);let ae;switch(re){case 16777216:case 33554432:ae=p.ansi[ne],D.push(`xterm-bg-${ne}`);break;case 50331648:ae=vU.toColor(ne>>16,ne>>8&255,ne&255),this._addStyle(h,`background-color:#${NU((ne>>>0).toString(16),`0`,6)}`);break;default:z?(ae=p.foreground,D.push(`xterm-bg-257`)):ae=p.background}switch(B||M.isDim()&&(B=yU.multiplyOpacity(ae,.5)),R){case 16777216:case 33554432:M.isBold()&&te<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(te+=8),this._applyMinimumContrast(h,ae,p.ansi[te],M,B,void 0)||D.push(`xterm-fg-${te}`);break;case 50331648:let e=vU.toColor(te>>16&255,te>>8&255,te&255);this._applyMinimumContrast(h,ae,e,M,B,ie)||this._addStyle(h,`color:#${NU(te.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,ae,p.foreground,M,B,ie)||z&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!P&&!k&&!I&&A?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),O=j}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||kU(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=yU.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};MU=sz([Y(1,Zz),Y(2,Bz),Y(3,qz),Y(4,Iz),Y(5,Uz),Y(6,Qz)],MU);function NU(e,t,n){for(;e.length<n;)e=t+e;return e}var PU=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},FU=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function IU(){return new FU}var LU=`xterm-dom-renderer-owner-`,RU=`xterm-rows`,zU=`xterm-fg-`,BU=`xterm-bg-`,VU=`xterm-focus`,HU=`xterm-selection`,UU=1,WU=class extends CB{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=UU++,this._rowElements=[],this._selectionRenderModel=IU(),this.onRequestRedraw=this._register(new X).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(RU),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(HU),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=AU(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(MU,document),this._element.classList.add(LU+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(bB(()=>{this._element.classList.remove(LU+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new PU(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${RU} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${RU} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${RU} .xterm-dim { color: ${yU.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${RU}.${VU} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${RU}.${VU} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${RU}.${VU} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${RU} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${RU} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${RU} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${RU} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${RU} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${HU} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${HU} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${HU} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${zU}${n} { color: ${r.css}; }${this._terminalSelector} .${zU}${n}.xterm-dim { color: ${yU.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${BU}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${zU}257 { color: ${yU.opaque(e.background).css}; }${this._terminalSelector} .${zU}257.xterm-dim { color: ${yU.multiplyOpacity(yU.opaque(e.background),.5).css}; }${this._terminalSelector} .${BU}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(VU),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(VU),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${LU}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};WU=sz([Y(7,Rz),Y(8,Kz),Y(9,Bz),Y(10,Pz),Y(11,Iz),Y(12,qz),Y(13,Qz)],WU);var GU=class extends CB{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new X),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new JU(this._optionsService))}catch{this._measureStrategy=this._register(new qU(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};GU=sz([Y(2,Bz)],GU);var KU=class extends CB{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},qU=class extends KU{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},JU=class extends KU{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},YU=class extends CB{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new XU(this._window)),this._onDprChange=this._register(new X),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new X),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(jB.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(pH(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(pH(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},XU=class extends CB{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new wB),this._onDprChange=this._register(new X),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(bB(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=pH(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)}},ZU=class extends CB{constructor(){super(),this.linkProviders=[],this._register(bB(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function QU(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function $U(e,t,n,r,i,a,o,s,c){if(!a)return;let l=QU(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var eW=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return $U(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=QU(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};eW=sz([Y(0,Yz),Y(1,Kz)],eW);var tW=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},nW={};oz(nW,{getSafariVersion:()=>lW,isChromeOS:()=>hW,isFirefox:()=>oW,isIpad:()=>dW,isIphone:()=>fW,isLegacyEdge:()=>sW,isLinux:()=>mW,isMac:()=>uW,isNode:()=>rW,isSafari:()=>cW,isWindows:()=>pW});var rW=typeof process<`u`&&`title`in process,iW=rW?`node`:navigator.userAgent,aW=rW?`node`:navigator.platform,oW=iW.includes(`Firefox`),sW=iW.includes(`Edge`),cW=/^((?!chrome|android).)*safari/i.test(iW);function lW(){if(!cW)return 0;let e=iW.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var uW=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(aW),dW=aW===`iPad`,fW=aW===`iPhone`,pW=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(aW),mW=aW.indexOf(`Linux`)>=0,hW=/\bCrOS\b/.test(iW),gW=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},_W=class extends gW{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},vW=class extends gW{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},yW=!rW&&`requestIdleCallback`in window?vW:_W,bW=class{constructor(){this._queue=new yW}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},xW=class extends CB{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new wB),this._pausedResizeTask=new bW,this._observerDisposable=this._register(new wB),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 X),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new X),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new X),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new X),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new tW((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new SW(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(bB(()=>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(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.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(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=bB(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){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(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};xW=sz([Y(2,Bz),Y(3,Kz),Y(4,Iz),Y(5,Uz),Y(6,Pz),Y(7,qz),Y(8,Qz)],xW);var SW=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function CW(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return EW(i,a,e,t,n,r)+DW(a,t,n,r)+OW(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,FW(Math.abs(i-e),PW(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return FW(TW(a>t?e:i,n)+(s-1)*n.cols+1+wW(a>t?i:e,n),PW(o,r))}function wW(e,t){return e-1}function TW(e,t){return t.cols-e}function EW(e,t,n,r,i,a){return DW(t,r,i,a).length===0?``:FW(NW(e,t,e,t-AW(t,i),!1,i).length,PW(`D`,a))}function DW(e,t,n,r){let i=e-AW(e,n),a=t-AW(t,n);return FW(Math.abs(i-a)-kW(e,t,n),PW(MW(e,t),r))}function OW(e,t,n,r,i,a){let o;o=DW(t,r,i,a).length>0?r-AW(r,i):t;let s=r,c=jW(e,t,n,r,i,a);return FW(NW(e,o,n,s,c===`C`,i).length,PW(c,a))}function kW(e,t,n){let r=0,i=e-AW(e,n),a=t-AW(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=MW(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function AW(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function jW(e,t,n,r,i,a){let o;return o=DW(n,r,i,a).length>0?r-AW(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function MW(e,t){return e>t?`A`:`B`}function NW(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function PW(e,t){let n=t?`O`:`[`;return Z.ESC+n+e}function FW(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var IW=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function LW(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var RW=50,zW=15,BW=50,VW=500,HW=RegExp(`\xA0`,`g`),UW=class extends CB{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Dz,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new X),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new X),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new X),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new X),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new IW(this._bufferService),this._activeSelectionMode=0,this._register(bB(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(HW,` `)).join(pW?`\r
|
|
278
278
|
`:`
|
|
279
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),lW&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=MW(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=qU(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-NW),NW),t/=NW,t/Math.abs(t)+Math.round(t*(PW-1)))}shouldForceSelection(e){return aW?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),FW)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(aW&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<IW&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=vW(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(t||o.slice(s,c).trim()!==``){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=MW(n,this._bufferService.cols)}};RW=nz([Y(3,kz),Y(4,jz),Y(5,Uz),Y(6,Fz),Y(7,Wz),Y(8,Hz)],RW);var zW=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},BW=class{constructor(){this._color=new zW,this._css=new zW}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},VW=Object.freeze((()=>{let e=[hU.toColor(`#2e3436`),hU.toColor(`#cc0000`),hU.toColor(`#4e9a06`),hU.toColor(`#c4a000`),hU.toColor(`#3465a4`),hU.toColor(`#75507b`),hU.toColor(`#06989a`),hU.toColor(`#d3d7cf`),hU.toColor(`#555753`),hU.toColor(`#ef2929`),hU.toColor(`#8ae234`),hU.toColor(`#fce94f`),hU.toColor(`#729fcf`),hU.toColor(`#ad7fa8`),hU.toColor(`#34e2e2`),hU.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:pU.toCss(r,i,a),rgba:pU.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:pU.toCss(n,n,n),rgba:pU.toRgba(n,n,n)})}return e})()),HW=hU.toColor(`#ffffff`),UW=hU.toColor(`#000000`),WW=hU.toColor(`#ffffff`),GW=UW,KW={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},qW=HW,JW=class extends vB{constructor(e){super(),this._optionsService=e,this._contrastCache=new BW,this._halfContrastCache=new BW,this._onChangeColors=this._register(new X),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:HW,background:UW,cursor:WW,cursorAccent:GW,selectionForeground:void 0,selectionBackgroundTransparent:KW,selectionBackgroundOpaque:mU.blend(UW,KW),selectionInactiveBackgroundTransparent:KW,selectionInactiveBackgroundOpaque:mU.blend(UW,KW),scrollbarSliderBackground:mU.opacity(HW,.2),scrollbarSliderHoverBackground:mU.opacity(HW,.4),scrollbarSliderActiveBackground:mU.opacity(HW,.5),overviewRulerBorder:HW,ansi:VW.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=YW(e.foreground,HW),t.background=YW(e.background,UW),t.cursor=mU.blend(t.background,YW(e.cursor,WW)),t.cursorAccent=mU.blend(t.background,YW(e.cursorAccent,GW)),t.selectionBackgroundTransparent=YW(e.selectionBackground,KW),t.selectionBackgroundOpaque=mU.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=YW(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=mU.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?YW(e.selectionForeground,fU):void 0,t.selectionForeground===fU&&(t.selectionForeground=void 0),mU.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=mU.opacity(t.selectionBackgroundTransparent,.3)),mU.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=mU.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=YW(e.scrollbarSliderBackground,mU.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=YW(e.scrollbarSliderHoverBackground,mU.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=YW(e.scrollbarSliderActiveBackground,mU.opacity(t.foreground,.5)),t.overviewRulerBorder=YW(e.overviewRulerBorder,qW),t.ansi=VW.slice(),t.ansi[0]=YW(e.black,VW[0]),t.ansi[1]=YW(e.red,VW[1]),t.ansi[2]=YW(e.green,VW[2]),t.ansi[3]=YW(e.yellow,VW[3]),t.ansi[4]=YW(e.blue,VW[4]),t.ansi[5]=YW(e.magenta,VW[5]),t.ansi[6]=YW(e.cyan,VW[6]),t.ansi[7]=YW(e.white,VW[7]),t.ansi[8]=YW(e.brightBlack,VW[8]),t.ansi[9]=YW(e.brightRed,VW[9]),t.ansi[10]=YW(e.brightGreen,VW[10]),t.ansi[11]=YW(e.brightYellow,VW[11]),t.ansi[12]=YW(e.brightBlue,VW[12]),t.ansi[13]=YW(e.brightMagenta,VW[13]),t.ansi[14]=YW(e.brightCyan,VW[14]),t.ansi[15]=YW(e.brightWhite,VW[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=YW(e.extendedAnsi[r],VW[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};JW=nz([Y(0,Fz)],JW);function YW(e,t){if(e!==void 0)try{return hU.toColor(e)}catch{}return t}var XW=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},ZW=class{constructor(){this._services=new XW,this._services.set(Nz,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Ez(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},QW={trace:0,debug:1,info:2,warn:3,error:4,off:5},$W=`xterm.js: `,eG=class extends vB{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),tG=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=QW[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:$W)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};eG=nz([Y(0,Fz)],eG);var tG,nG=class extends vB{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new X),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new X),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new X),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},rG=3,iG=Object.freeze(new bz),aG=0,oG=2,sG=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*rG);let r=t||Sz.fromCharData([0,vz,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*rG+0],n=t&2097151;return[this._data[e*rG+1],t&2097152?this._combined[e]:n?mz(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*rG+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*rG+0]=e|2097152|t[2]<<22):this._data[e*rG+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*rG+0]>>22}hasWidth(e){return this._data[e*rG+0]&12582912}getFg(e){return this._data[e*rG+1]}getBg(e){return this._data[e*rG+2]}hasContent(e){return this._data[e*rG+0]&4194303}getCodePoint(e){let t=this._data[e*rG+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*rG+0]&2097152}getString(e){let t=this._data[e*rG+0];return t&2097152?this._combined[e]:t&2097151?mz(t&2097151):``}isProtected(e){return this._data[e*rG+2]&536870912}loadCell(e,t){return aG=e*rG,t.content=this._data[aG+0],t.fg=this._data[aG+1],t.bg=this._data[aG+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*rG+0]=t.content,this._data[e*rG+1]=t.fg,this._data[e*rG+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*rG+0]=t|n<<22,this._data[e*rG+1]=r.fg,this._data[e*rG+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*rG+0];r&2097152?this._combined[e]+=mz(t):r&2097151?(this._combined[e]=mz(r&2097151)+mz(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*rG+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new Sz;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new Sz;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*oG<this._data.buffer.byteLength;let n=e*rG;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*oG<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*oG<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*rG+0]&4194303)return e+(this._data[e*rG+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*rG+0]&4194303||this._data[e*rG+2]&50331648)return e+(this._data[e*rG+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<rG;e++)this._data[(n+i)*rG+e]=a[(t+i)*rG+e];a[(t+i)*rG+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<rG;e++)this._data[(n+i)*rG+e]=a[(t+i)*rG+e];a[(t+i)*rG+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*rG+0],n=e&2097151,a=e&2097152?this._combined[t]:n?mz(n):yz;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function cG(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=fG(u,d,t),p=1,m=0;for(;p<u.length;){let e=fG(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function lG(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function uG(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function dG(e,t,n){let r=[],i=e.map((n,r)=>fG(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=fG(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function fG(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var pG=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new X),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),pB(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};pG._nextId=1;var mG=pG,hG={},gG=hG.B;hG[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},hG.A={"#":`£`},hG.B=void 0,hG[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},hG.C=hG[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},hG.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},hG.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},hG.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},hG.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},hG.E=hG[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},hG.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},hG.H=hG[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},hG[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var _G=4294967295,vG=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=iG.clone(),this.savedCharset=gG,this.markers=[],this._nullCell=Sz.fromCharData([0,vz,1,0]),this._whitespaceCell=Sz.fromCharData([0,yz,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new mW,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new nG(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new xz),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new xz),this._whitespaceCell}getBlankLine(e,t){return new sG(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>_G?_G:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=iG);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new nG(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(iG),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new sG(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new sG(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=cG(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(iG),n);if(r.length>0){let n=lG(this.lines,r);uG(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(iG),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new sG(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(iG),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=dG(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(iG,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=fG(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new mG(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},yG=class extends vB{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new X),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 vG(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new vG(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},bG=2,xG=1,SG=class extends vB{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new X),this.onResize=this._onResize.event,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,bG),this.rows=Math.max(e.rawOptions.rows||0,xG),this.buffers=this._register(new yG(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};SG=nz([Y(0,Fz)],SG);var CG={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:aW,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},wG=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],TG=class extends vB{constructor(e){super(),this._onOptionChange=this._register(new X),this.onOptionChange=this._onOptionChange.event;let t={...CG};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(hB(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in CG))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in CG))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=CG[e],!EG(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=CG[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=wG.includes(t)?t:CG[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}};function EG(e){return e===`block`||e===`underline`||e===`bar`}function DG(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&DG(e[r],t-1);return n}var OG=Object.freeze({insertMode:!1}),kG=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),AG=class extends vB{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new X),this.onData=this._onData.event,this._onUserInput=this._register(new X),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new X),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new X),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=DG(OG),this.decPrivateModes=DG(kG)}reset(){this.modes=DG(OG),this.decPrivateModes=DG(kG)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};AG=nz([Y(0,kz),Y(1,Pz),Y(2,Fz)],AG);var jG={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function MG(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var NG=String.fromCharCode,PG={DEFAULT:e=>{let t=[MG(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${NG(t[0])}${NG(t[1])}${NG(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${MG(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${MG(e,!0)};${e.x};${e.y}${t}`}},FG=class extends vB{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new X),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(jG))this.addProtocol(e,jG[e]);for(let e of Object.keys(PG))this.addEncoding(e,PG[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};FG=nz([Y(0,kz),Y(1,jz),Y(2,Fz)],FG);var IG=[[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]],LG=[[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]],RG;function zG(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var BG=class{constructor(){if(this.version=`6`,!RG){RG=new Uint8Array(65536),RG.fill(1),RG[0]=0,RG.fill(0,1,32),RG.fill(0,127,160),RG.fill(2,4352,4448),RG[9001]=2,RG[9002]=2,RG.fill(2,11904,42192),RG[12351]=1,RG.fill(2,44032,55204),RG.fill(2,63744,64256),RG.fill(2,65040,65050),RG.fill(2,65072,65136),RG.fill(2,65280,65377),RG.fill(2,65504,65511);for(let e=0;e<IG.length;++e)RG.fill(0,IG[e][0],IG[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?RG[e]:zG(e,LG)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=VG.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return VG.createPropertyValue(0,n,r)}},VG=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new X,this.onChange=this._onChange.event;let e=new BG;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw 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(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},HG=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function UG(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var WG=2147483647,GG=256,KG=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>GG)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}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 Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>WG?WG:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>WG?WG:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,WG):e}},qG=[],JG=class{constructor(){this._state=0,this._active=qG,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=qG}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=qG,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||qG,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,hz(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3){if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}}this._active=qG,this._id=-1,this._state=0}}},YG=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=hz(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},XG=[],ZG=class{constructor(){this._handlers=Object.create(null),this._active=XG,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=XG}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=XG,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||XG,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,hz(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=XG,this._ident=0}},QG=new KG;QG.addParam(0);var $G=class{constructor(e){this._handler=e,this._data=``,this._params=QG,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():QG,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=hz(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=QG,this._data=``,this._hitLimit=!1,e));return this._params=QG,this._data=``,this._hitLimit=!1,t}},eK=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},tK=160,nK=function(){let e=new eK(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(tK,0,2,0),e.add(tK,8,5,8),e.add(tK,6,0,6),e.add(tK,11,0,11),e.add(tK,13,13,13),e}(),rK=class extends vB{constructor(e=nK){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new KG,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},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(hB(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new JG),this._dcsParser=this._register(new ZG),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:tK)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<tK){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<tK){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<tK){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<tK){this._printHandler(e,n,i),n=i-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:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<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(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<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 i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<tK){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<tK){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=i&15}}},iK=/^([\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})$/,aK=/^[\da-f]+$/;function oK(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=iK.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),aK.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function sK(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function cK(e,t=16){let[n,r,i]=e;return`rgb:${sK(n,t)}/${sK(r,t)}/${sK(i,t)}`}var lK={"(":0,")":1,"*":2,"+":3,"-":1,".":2},uK=131072,dK=10;function fK(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var pK=5e3,mK=0,hK=class extends vB{constructor(e,t,n,r,i,a,o,s,c=new rK){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new gz,this._utf8Decoder=new _z,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=iG.clone(),this._eraseAttrDataInternal=iG.clone(),this._onRequestBell=this._register(new X),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new X),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new X),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new X),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new X),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new X),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new X),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new X),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new X),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new X),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new X),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new X),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 gK(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(Z.BEL,()=>this.bell()),this._parser.setExecuteHandler(Z.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Z.BS,()=>this.backspace()),this._parser.setExecuteHandler(Z.HT,()=>this.tab()),this._parser.setExecuteHandler(Z.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Z.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(aU.IND,()=>this.index()),this._parser.setExecuteHandler(aU.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(aU.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new YG(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new YG(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new YG(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new YG(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new YG(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new YG(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new YG(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new YG(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new YG(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new YG(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new YG(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new YG(e=>this.restoreCursorColor(e))),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 e in hG)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new $G((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),pK))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${pK} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>uK&&(a=this._parseStack.position+uK)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<uK&&(this._parseBuffer=new Uint32Array(Math.min(e.length,uK))),o||this._dirtyRowTracker.clearRange(),e.length>uK)for(let t=a;t<e.length;t+=uK){let a=t+uK<e.length?t+uK:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=VG.extractWidth(t);let n=VG.extractShouldJoin(t),m=n?VG.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(mz(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof sG&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!fK(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new $G(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new YG(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){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 e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(iG));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=VG.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(Z.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(Z.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(Z.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(Z.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(Z.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,gG),this._charsetService.setgCharset(1,gG),this._charsetService.setgCharset(2,gG),this._charsetService.setgCharset(3,gG);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}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${Z.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=bz.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=iG.fg,e.bg=iG.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=iG.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=iG.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=iG.fg&16777215,r.bg&=-67108864,r.bg|=iG.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Z.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=iG.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!fK(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Z.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>dK&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>dK&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(_K(n)){if(r===`?`)t.push({type:0,index:n});else{let e=oK(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=oK(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);_K(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,gG),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(lK[e[0]],hG[e[1]]||gG),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=iG.clone(),this._eraseAttrDataInternal=iG.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Sz;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${Z.ESC}${e}${Z.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},gK=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(mK=e,e=t,t=mK),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};gK=nz([Y(0,kz)],gK);function _K(e){return 0<=e&&e<256}var vK=5e7,yK=12,bK=50,xK=class extends vB{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new X),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>vK)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=yK?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=yK)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>bK&&(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()}},SK=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};SK=nz([Y(0,kz)],SK);var CK=!1,wK=class extends vB{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new yB),this._onBinary=this._register(new X),this.onBinary=this._onBinary.event,this._onData=this._register(new X),this.onData=this._onData.event,this._onLineFeed=this._register(new X),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new X),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new X),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new X),this._instantiationService=new ZW,this.optionsService=this._register(new TG(e)),this._instantiationService.setService(Fz,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(SG)),this._instantiationService.setService(kz,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(eG)),this._instantiationService.setService(Pz,this._logService),this.coreService=this._register(this._instantiationService.createInstance(AG)),this._instantiationService.setService(jz,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(FG)),this._instantiationService.setService(Az,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(VG)),this._instantiationService.setService(Lz,this.unicodeService),this._charsetService=this._instantiationService.createInstance(HG),this._instantiationService.setService(Mz,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(SK),this._instantiationService.setService(Iz,this._oscLinkService),this._inputHandler=this._register(new hK(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(EB.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(EB.forward(this._bufferService.onResize,this._onResize)),this._register(EB.forward(this.coreService.onData,this._onData)),this._register(EB.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 xK((e,t)=>this._inputHandler.parse(e,t))),this._register(EB.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new X),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!CK&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),CK=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,bG),t=Math.max(t,xG),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(UG.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(UG(this._bufferService),!1))),this._windowsWrappingHeuristics.value=hB(()=>{for(let t of e)t.dispose()})}}},TK={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 EK(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=+!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?Z.ESC+`OA`:Z.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?Z.ESC+`OD`:Z.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?Z.ESC+`OC`:Z.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?Z.ESC+`OB`:Z.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:Z.DEL,e.altKey&&(i.key=Z.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Z.ESC+`[Z`;break}i.key=Z.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Z.ESC+Z.CR:Z.CR,i.cancel=!0;break;case 27:i.key=Z.ESC,e.altKey&&(i.key=Z.ESC+Z.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`D`:t?Z.ESC+`OD`:Z.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`C`:t?Z.ESC+`OC`:Z.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`A`:t?Z.ESC+`OA`:Z.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`B`:t?Z.ESC+`OB`:Z.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Z.ESC+`[2~`);break;case 46:i.key=a?Z.ESC+`[3;`+(a+1)+`~`:Z.ESC+`[3~`;break;case 36:i.key=a?Z.ESC+`[1;`+(a+1)+`H`:t?Z.ESC+`OH`:Z.ESC+`[H`;break;case 35:i.key=a?Z.ESC+`[1;`+(a+1)+`F`:t?Z.ESC+`OF`:Z.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?Z.ESC+`[5;`+(a+1)+`~`:Z.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?Z.ESC+`[6;`+(a+1)+`~`:Z.ESC+`[6~`;break;case 112:i.key=a?Z.ESC+`[1;`+(a+1)+`P`:Z.ESC+`OP`;break;case 113:i.key=a?Z.ESC+`[1;`+(a+1)+`Q`:Z.ESC+`OQ`;break;case 114:i.key=a?Z.ESC+`[1;`+(a+1)+`R`:Z.ESC+`OR`;break;case 115:i.key=a?Z.ESC+`[1;`+(a+1)+`S`:Z.ESC+`OS`;break;case 116:i.key=a?Z.ESC+`[15;`+(a+1)+`~`:Z.ESC+`[15~`;break;case 117:i.key=a?Z.ESC+`[17;`+(a+1)+`~`:Z.ESC+`[17~`;break;case 118:i.key=a?Z.ESC+`[18;`+(a+1)+`~`:Z.ESC+`[18~`;break;case 119:i.key=a?Z.ESC+`[19;`+(a+1)+`~`:Z.ESC+`[19~`;break;case 120:i.key=a?Z.ESC+`[20;`+(a+1)+`~`:Z.ESC+`[20~`;break;case 121:i.key=a?Z.ESC+`[21;`+(a+1)+`~`:Z.ESC+`[21~`;break;case 122:i.key=a?Z.ESC+`[23;`+(a+1)+`~`:Z.ESC+`[23~`;break;case 123:i.key=a?Z.ESC+`[24;`+(a+1)+`~`:Z.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Z.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Z.DEL:e.keyCode===219?i.key=Z.ESC:e.keyCode===220?i.key=Z.FS:e.keyCode===221&&(i.key=Z.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=TK[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=Z.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=Z.ESC+n}else if(e.keyCode===32)i.key=Z.ESC+(e.ctrlKey?Z.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=Z.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=Z.US),e.key===`@`&&(i.key=Z.NUL))}return i}var DK=0,OK=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new mW,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new mW,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(DK=this._search(t),DK===-1)||this._getKey(this._array[DK])!==t)return!1;do if(this._array[DK]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(DK),!0;while(++DK<this._array.length&&this._getKey(this._array[DK])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(DK=this._search(e),!(DK<0||DK>=this._array.length)&&this._getKey(this._array[DK])===e))do yield this._array[DK];while(++DK<this._array.length&&this._getKey(this._array[DK])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(DK=this._search(e),!(DK<0||DK>=this._array.length)&&this._getKey(this._array[DK])===e))do t(this._array[DK]);while(++DK<this._array.length&&this._getKey(this._array[DK])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},kK=0,AK=0,jK=class extends vB{constructor(){super(),this._decorations=new OK(e=>e?.marker.line),this._onDecorationRegistered=this._register(new X),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new X),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(hB(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new MK(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{kK=t.options.x??0,AK=kK+(t.options.width??1),e>=kK&&e<AK&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},MK=class extends _B{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new X),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new X),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this._cachedBg=this.options.backgroundColor?hU.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?hU.toColor(this.options.foregroundColor):void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},NK=1e3,PK=class{constructor(e,t=NK){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},FK=20,IK=class extends vB{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new PK(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
280
|
-
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(
|
|
281
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===FK+1&&(this._liveRegion.textContent+=oz.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){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>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};IK=nz([Y(1,Nz),Y(2,Hz),Y(3,Wz)],IK);var LK=class extends vB{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new X),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new X),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(hB(()=>{pB(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(cH(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(cH(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(cH(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(cH(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&RK(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,pB(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};LK=nz([Y(1,Uz),Y(2,Wz),Y(3,kz),Y(4,Jz)],LK);function RK(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var zK=class extends wK{constructor(e={}){super(e),this._linkifier=this._register(new yB),this.browser=ZU,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new yB),this._onCursorMove=this._register(new X),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new X),this.onKey=this._onKey.event,this._onRender=this._register(new X),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new X),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new X),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new X),this.onBell=this._onBell.event,this._onFocus=this._register(new X),this._onBlur=this._register(new X),this._onA11yCharEmitter=this._register(new X),this._onA11yTabEmitter=this._register(new X),this._onWillOpen=this._register(new X),this._setup(),this._decorationService=this._instantiationService.createInstance(jK),this._instantiationService.setService(Rz,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(KU),this._instantiationService.setService(Jz,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(zz)),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(EB.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(EB.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(EB.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(EB.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(hB(()=>{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(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=mU.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${Z.ESC}]${n};${cK(r)}${oU.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=pU.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=pU.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(IK,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.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(Z.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(cH(this.element,`copy`,e=>{this.hasSelection()&&lz(e,this._selectionService)}));let e=e=>uz(e,this.textarea,this.coreService,this.optionsService);this._register(cH(this.textarea,`paste`,e)),this._register(cH(this.element,`paste`,e)),tW?this._register(cH(this.element,`mousedown`,e=>{e.button===2&&pz(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(cH(this.element,`contextmenu`,e=>{pz(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),lW&&this._register(cH(this.element,`auxclick`,e=>{e.button===1&&fz(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(cH(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(cH(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(cH(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(cH(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(cH(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(cH(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(cH(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(cH(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,iz.get()),uW||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(WU,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(Hz,this._coreBrowserService),this._register(cH(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(cH(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(BU,this._document,this._helperContainer),this._instantiationService.setService(Vz,this._charSizeService),this._themeService=this._instantiationService.createInstance(JW),this._instantiationService.setService(qz,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(xU),this._instantiationService.setService(Kz,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(gW,this.rows,this.screenElement)),this._instantiationService.setService(Wz,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(sU,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(YU),this._instantiationService.setService(Uz,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(LK,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(QH,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(RW,this.element,this.screenElement,r)),this._instantiationService.setService(Gz,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(EB.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance($H,this.screenElement)),this._register(cH(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),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(IK,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(iU,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(iU,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(zU,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),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()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(cH(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(cH(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=Z.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){dz(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=EK(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===Z.ETX||n.key===Z.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(BK(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(iG));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 e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(Z.ESC+`[I`):this.coreService.triggerDataEvent(Z.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}};function BK(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var VK=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},HK=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Sz)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},UK=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new HK(t)}getNullCell(){return new Sz}},WK=class extends vB{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new X),this.onBufferChange=this._onBufferChange.event,this._normal=new UK(this._core.buffers.normal,`normal`),this._alternate=new UK(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 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)}},GK=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},KK=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},qK=[`cols`,`rows`],JK=0,YK=class extends vB{constructor(e){super(),this._core=this._register(new zK(e)),this._addonManager=this._register(new VK),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(qK.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw 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||=new GK(this._core),this._parser}get unicode(){return this._checkProposedApi(),new KK(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._register(new WK(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
282
|
-
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return iz.get()},set promptLabel(e){iz.set(e)},get tooMuchOutput(){return oz.get()},set tooMuchOutput(e){oz.set(e)}}}_verifyIntegers(...e){for(JK of e)if(JK===1/0||isNaN(JK)||JK%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(JK of e)if(JK&&(JK===1/0||isNaN(JK)||JK%1!=0||JK<0))throw Error(`This API only accepts positive integers`)}},XK=2,ZK=1,QK=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(XK,Math.floor(u/e.css.cell.width)),rows:Math.max(ZK,Math.floor(l/e.css.cell.height))}}},$K={key:0,class:`pty-context-bar`},eq=ze(z({__name:`PtyContextBar`,setup(e){let{attachedContexts:t,removeAttachedContext:n}=Ut();return(e,i)=>r(t).length>0?(B(),N(`div`,$K,[(B(!0),N(V,null,P(r(t),(e,t)=>(B(),W(KR,{key:t,icon:e.icon,label:e.label,text:e.text,removable:``,onRemove:e=>r(n)(t)},null,8,[`icon`,`label`,`text`,`onRemove`]))),128))])):G(``,!0)}}),[[`__scopeId`,`data-v-cfcb3a01`]]);function tq(e,t){let n=e.textarea;if(!n)return()=>{};let r=!1,i=!1,a=e=>{r=e.keyCode===229||e.key===`Process`},o=()=>{i=!0},s=()=>{setTimeout(()=>{i=!1},0)},c=e=>{let a=e;r&&!i&&a.inputType===`insertText`&&a.data&&!a.isComposing?(r=!1,n.value=``,t(a.data)):a.inputType===`insertText`&&(r=!1)};return n.addEventListener(`keydown`,a,!0),n.addEventListener(`compositionstart`,o,!0),n.addEventListener(`compositionend`,s,!0),n.addEventListener(`input`,c,!0),()=>{n.removeEventListener(`keydown`,a,!0),n.removeEventListener(`compositionstart`,o,!0),n.removeEventListener(`compositionend`,s,!0),n.removeEventListener(`input`,c,!0)}}function nq(e,t,n){let[r,i]=t.row>e.row||t.row===e.row&&t.col>=e.col?[e,t]:[t,e];return{column:r.col,row:r.row,length:(i.row-r.row)*n+i.col-r.col+1}}var rq=450;async function iq(e){if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(e);return}let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),t.remove()}function aq(e,t){let n=null,r=0,i=0,a=`none`,o=0,s=0,c=0,l=null,u=null,d=!1,f={col:0,row:0},p=document.createElement(`button`);p.type=`button`,p.className=`terminal-touch-copy`,Object.assign(p.style,{position:`absolute`,top:`8px`,right:`8px`,zIndex:`5`,display:`none`,padding:`6px 12px`,border:`0`,borderRadius:`6px`,font:`inherit`,fontSize:`14px`,background:`var(--r-primary)`,color:`var(--r-primary-contrast)`}),getComputedStyle(t).position===`static`&&(t.style.position=`relative`),t.appendChild(p);function m(){p.style.display=`none`}p.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation();let n=e.getSelection();m(),e.clearSelection(),n&&iq(n).catch(()=>{})}),p.addEventListener(`touchstart`,e=>e.stopPropagation(),{passive:!0});function h(){u!==null&&(clearTimeout(u),u=null)}function g(t,n){return x(t,n),{col:y-1,row:e.buffer.active.viewportY+b-1}}function _(t){let n=nq(f,t,e.cols);e.select(n.column,n.row,n.length)}let v=()=>{let n=e.rows||24,r=t.querySelector(`.xterm-viewport`)?.clientHeight??t.clientHeight;return r>0?r/n:17},y=1,b=1;function x(n,r){let i=t.querySelector(`.xterm-screen`);if(!i)return;let a=i.getBoundingClientRect();if(a.width<=0||a.height<=0)return;let o=Math.floor((n-a.left)/a.width*e.cols)+1,s=Math.floor((r-a.top)/a.height*e.rows)+1;y=Math.min(Math.max(o,1),e.cols),b=Math.min(Math.max(s,1),e.rows)}function S(t){let n=t>0,r=Math.min(Math.abs(t),12),i=e.modes.mouseTrackingMode===`none`?`\x1b${e.modes.applicationCursorKeysMode?`O`:`[`}${n?`B`:`A`}`:`\x1b[<${n?65:64};${y};${b}M`;for(let t=0;t<r;t+=1)e.input(i,!0)}function C(){l!==null&&(cancelAnimationFrame(l),l=null)}function w(){if(e.buffer.active.type===`alternate`||Math.abs(s)<.004)return;let t=performance.now(),n=r=>{let i=r-t;t=r,o+=s*i;let a=Math.trunc(o);a!==0&&(o-=a,e.scrollLines(a)),s*=Math.exp(-.005*i),l=Math.abs(s)<.002?null:requestAnimationFrame(n)};l=requestAnimationFrame(n)}let T=t=>{if(C(),h(),d=!1,m(),t.touches.length!==1){n=null;return}n=t.touches[0].clientY,r=t.touches[0].clientX,x(r,n),i=n,a=`none`,o=0,s=0,c=performance.now(),e.hasSelection()&&e.clearSelection();let l=r,p=i;u=setTimeout(()=>{u=null,a===`none`&&(d=!0,f=g(l,p),_(f),navigator.vibrate?.(10))},rq)},E=t=>{if(d&&t.touches.length===1){_(g(t.touches[0].clientX,t.touches[0].clientY)),t.preventDefault();return}if(n===null||t.touches.length!==1)return;let l=t.touches[0].clientY;if(a===`none`){let e=Math.abs(t.touches[0].clientX-r),o=Math.abs(l-i);if(Math.max(e,o)<8)return;if(h(),e>o){n=null;return}a=`vertical`}let u=n-l;n=l;let f=u/v(),p=performance.now(),m=p-c;c=p,m>0&&m<100&&(s=s*.7+f/m*.3),o+=f;let y=Math.trunc(o);y!==0&&(o-=y,e.buffer.active.type===`alternate`?S(y):e.scrollLines(y)),t.preventDefault()},D=t=>{if(h(),d){d=!1,t.cancelable&&t.preventDefault(),e.hasSelection()&&(p.textContent=rt.global.t(`terminal.copySelection`),p.style.display=``),n=null;return}a===`vertical`&&w(),n=null,a=`none`};t.addEventListener(`touchstart`,T,{passive:!0}),t.addEventListener(`touchmove`,E,{passive:!1}),t.addEventListener(`touchend`,D,{passive:!1}),t.addEventListener(`touchcancel`,D,{passive:!0});let ee=t=>{(d||e.hasSelection())&&t.preventDefault()};return t.addEventListener(`contextmenu`,ee),()=>{C(),h(),p.remove(),t.removeEventListener(`contextmenu`,ee),t.removeEventListener(`touchstart`,T),t.removeEventListener(`touchmove`,E),t.removeEventListener(`touchend`,D),t.removeEventListener(`touchcancel`,D)}}function oq(e,t){let n=e+(t>0?-1:1);return Math.min(Math.max(n,8),32)}function sq(e,t){try{let t=Number(localStorage.getItem(e));if(Number.isFinite(t)&&t>=8&&t<=32)return t}catch{}return t}function cq(e){let{terminal:t,container:n,storageKey:r,onResize:i}=e,a=e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault(),e.stopPropagation();let n=oq(t.options.fontSize??14,e.deltaY);if(n!==t.options.fontSize){t.options.fontSize=n;try{localStorage.setItem(r,String(n))}catch{}i()}};return n.addEventListener(`wheel`,a,{capture:!0,passive:!1}),()=>n.removeEventListener(`wheel`,a,{capture:!0})}function lq(e,t={}){let n=t.schedule??requestAnimationFrame,r=t.cancel??cancelAnimationFrame,i=[],a=null,o=!0;function s(){if(a!==null&&(r(a),a=null),i.length===0)return;let t=i.join(``);i=[],o?(o=!1,e.write(t,()=>e.scrollToBottom())):e.write(t)}return{write(e){i.push(e),a===null&&(a=n(s))},dispose(){a!==null&&(r(a),a=null),i=[]}}}var uq=150,dq=1.01,fq=i(!1),pq=0,mq=0;function hq(){let e=document.activeElement;return e?e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable:!1}var gq=0,_q=null;function vq(){return typeof window>`u`?!1:window.matchMedia?.(`(pointer: coarse)`).matches?!0:(navigator.maxTouchPoints??0)>0}function yq(e){return!e.editing||e.scale>dq?{visible:!1}:{visible:Math.max(e.maxHeight-e.innerHeight,e.innerHeight-e.viewportHeight)>=uq}}function bq(e=!1){let t=window.visualViewport;if(!t){fq.value=!1;return}let n=hq();(window.innerWidth!==mq||e&&!n)&&(mq=window.innerWidth,pq=0),pq=Math.max(pq,window.innerHeight),fq.value=yq({innerHeight:window.innerHeight,viewportHeight:t.height,maxHeight:pq,scale:t.scale,editing:n}).visible}function xq(){if(!vq()||(gq+=1,_q))return;let e=window.visualViewport;if(!e)return;let t=()=>bq(!0),n=()=>bq(!1);e.addEventListener(`resize`,t),e.addEventListener(`scroll`,n),window.addEventListener(`resize`,t),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),_q=()=>{e.removeEventListener(`resize`,t),e.removeEventListener(`scroll`,n),window.removeEventListener(`resize`,t),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)},bq()}function Sq(){gq=Math.max(0,gq-1),!(gq>0||!_q)&&(_q(),_q=null,fq.value=!1)}function Cq(){return F(xq),te(Sq),{keyboardVisible:l(fq)}}var wq=`\x1B`,Tq={up:`A`,down:`B`,right:`C`,left:`D`};function Eq(e,t){switch(e){case`up`:case`down`:case`left`:case`right`:return`${wq}${t?`O`:`[`}${Tq[e]}`;case`esc`:return wq;case`tab`:return` `;case`enter`:return`\r`;case`ctrl-c`:return``}}var Dq=[`aria-label`],Oq=[`title`,`aria-label`,`onPointerdown`],kq={class:`terminal-key-bar__cap`},Aq=ze(z({__name:`TerminalKeyBar`,props:{terminal:{}},setup(e){let t=e,{t:n}=He(),{keyboardVisible:a}=Cq(),o=vq(),s=i(!1);function c(){let e=t.terminal?.element;s.value=e!=null&&e.contains(document.activeElement)}F(()=>{document.addEventListener(`focusin`,c),document.addEventListener(`focusout`,c),c()}),te(()=>{document.removeEventListener(`focusin`,c),document.removeEventListener(`focusout`,c)});let l=R(()=>o&&a.value&&s.value);function u(e){return Eq(e,t.terminal?.modes.applicationCursorKeysMode===!0)}let d=R(()=>[{id:`up`,label:`↑`,title:n(`terminal.keyBar.up`)},{id:`down`,label:`↓`,title:n(`terminal.keyBar.down`)},{id:`left`,label:`←`,title:n(`terminal.keyBar.left`)},{id:`right`,label:`→`,title:n(`terminal.keyBar.right`)},{id:`esc`,label:`Esc`,title:n(`terminal.keyBar.escape`),wide:!0},{id:`tab`,label:`⇥`,title:n(`terminal.keyBar.tab`)},{id:`enter`,label:`⏎`,title:n(`terminal.keyBar.enter`)},{id:`ctrl-c`,label:`^C`,title:n(`terminal.keyBar.interrupt`),wide:!0}]);function f(e,n){n.preventDefault(),t.terminal?.input(u(e.id),!0),t.terminal?.focus()}return(e,t)=>(B(),W(ue,{to:`body`},[l.value?(B(),N(`div`,{key:0,class:`terminal-key-bar`,role:`toolbar`,"aria-label":r(n)(`terminal.keyBar.label`)},[(B(!0),N(V,null,P(d.value,e=>(B(),N(`button`,{key:e.id,type:`button`,class:I([`terminal-key-bar__key`,{"terminal-key-bar__key--wide":e.wide}]),title:e.title,"aria-label":e.title,onPointerdown:t=>f(e,t)},[M(`kbd`,kq,U(e.label),1)],42,Oq))),128))],8,Dq)):G(``,!0)]))}}),[[`__scopeId`,`data-v-4528940d`]]),jq={key:0,class:`claude-terminal__error`},Mq=`runeya:ai-terminal-font-size`,Nq=ze(z({__name:`ClaudeTerminal`,props:{sessionId:{},resume:{type:Boolean},model:{},cwd:{},agentId:{},runner:{},attachSpawnId:{}},setup(e){let t=e,n=i(null),r=i(!1),a=i(null),o=null,c=s(null),l=null,u=null,d=null,f=null,p=null,m=null,h=null,g=null,_=null,v=null,y=null,S=-1,w=!1,T=null,E=null,D=!1;function ee(e){if(!p||!f)return;let t=p,n=f,r=`\x1b[200~${e}\x1b[201~`;yt.chat.pty.write.mutate({agentId:t,spawnId:n,data:r}).then(()=>{setTimeout(()=>{yt.chat.pty.write.mutate({agentId:t,spawnId:n,data:`\r`}).catch(()=>{})},200)}).catch(e=>console.warn(`[ClaudeTerminal] auto-submit failed:`,e))}function O(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`FileReader error`)),r.onload=()=>{let e=r.result,n=e.indexOf(`,`);t(n>=0?e.slice(n+1):e)},r.readAsDataURL(e)})}async function k(e,t){if(p&&f)try{let n=await O(e),r=await yt.chat.pty.pasteImage.mutate({agentId:p,sessionId:t,mimeType:e.type||`image/png`,base64:n});r.clipboardMethod?await yt.chat.pty.write.mutate({agentId:p,spawnId:f,data:``}):await yt.chat.pty.write.mutate({agentId:p,spawnId:f,data:`@${r.tmpPath} `})}catch(e){console.error(`[ClaudeTerminal] image paste failed:`,e)}}let{attachedContexts:A,clearAttachedContexts:j,contextServiceId:P,pendingDiffContext:L,pendingContext:R,pendingPopulateContext:ne,autoSendPending:re,setDiffContext:z}=Ut(),ie=Xt(),V=Dt(),ae=tt();function H(){let e=[];if(P.value){let t=ie.getById(P.value);t&&e.push({label:`Service: ${t.name}`,icon:`ti-server`,text:`Service attached: ${t.name}\nID: ${t.id}\nCommand: ${t.command??`(none)`}\nCwd: ${t.cwd??`(none)`}`})}L.value&&e.push({label:`Diff`,icon:`ti-code`,text:L.value}),R.value&&e.push(R.value);for(let t of A.value)e.push(t);return e}function oe(){l?.fit(),p&&f&&o&&yt.chat.pty.resize.mutate({agentId:p,spawnId:f,cols:o.cols,rows:o.rows}).catch(()=>{})}async function se(){if(!n.value)return;if(await le(),a.value=null,o=new YK({cursorBlink:!0,fontFamily:`monospace`,fontSize:sq(Mq,13),theme:{background:`#1a1b1e`,foreground:`#d4d4d4`,cursor:`#d4d4d4`},allowProposedApi:!1}),l=new QK,o.loadAddon(l),o.open(n.value),c.value=o,y=lq(o),_=aq(o,n.value),v=cq({terminal:o,container:n.value,storageKey:Mq,onResize:()=>oe()}),o.attachCustomKeyEventHandler(e=>{if(e.type!==`keydown`||e.altKey||!(e.ctrlKey||e.metaKey))return!0;let t=e.key.toLowerCase();if(t===`v`)return!1;if(e.shiftKey&&t===`c`){e.preventDefault();let t=o?.getSelection();return t&&navigator.clipboard.writeText(t).catch(()=>{}),!1}return!0}),await new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(()=>e()))),l.fit(),t.attachSpawnId&&t.agentId)f=t.attachSpawnId,p=t.agentId;else try{let e=H().map(e=>({label:e.label,text:e.text})),n=await yt.chat.pty.start.mutate({agentId:t.agentId,sessionId:t.sessionId,runner:t.runner??`claude-code`,resume:t.resume??!1,model:t.model,cwd:t.cwd,...ae.activeProjectId?{projectId:ae.activeProjectId,orgId:ae.activeOrgId}:{},cols:o.cols,rows:o.rows,enableMcp:!0,environmentId:V.currentProject?.activeEnvironmentId,attachedContexts:e.length>0?e:void 0});f=n.spawnId,p=n.agentId,!n.reattached&&re.value&&ne.value&&(E=ne.value,D=!0,re.value=!1,ne.value=null),e.length>0&&(j(),z(null),R.value=null)}catch(e){w=!0,a.value=e.message,o.dispose(),o=null,c.value=null;return}d=yt.chat.pty.stream.subscribe({agentId:p,spawnId:f,fromOffset:0},{onData(e){if(e.offset<=S)return;S=e.offset;let{chunk:n}=e;if(n.type===`pty-data`){if(y?.write(n.data),D&&E){D=!1;let e=E;E=null,setTimeout(()=>ee(e),1e3)}}else n.type===`exit`&&y?.write(`\r\n\x1b[90m[${t.runner===`codex`?`codex`:`claude`} exited with code ${n.code??0}]\x1b[0m\r\n`)},onError(e){w=!0,a.value=e.message}});let e=e=>{p&&f&&yt.chat.pty.write.mutate({agentId:p,spawnId:f,data:e}).catch(()=>{})};o.onData(e),g=tq(o,e),u=new ResizeObserver(()=>oe()),u.observe(n.value),h=o.textarea??null,h&&(m=e=>{let n=e.clipboardData?.items;if(n){for(let r of n)if(r.kind===`file`&&r.type.startsWith(`image/`)){let n=r.getAsFile();if(n){e.preventDefault(),e.stopPropagation(),k(n,t.sessionId);return}}}},h.addEventListener(`paste`,m,!0)),r.value=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>o?.focus())})}function ce(){o?.focus()}async function le(){u?.disconnect(),u=null,g?.(),g=null,_?.(),_=null,v?.(),v=null,y?.dispose(),y=null,h&&m&&h.removeEventListener(`paste`,m,!0),h=null,m=null,d?.unsubscribe(),d=null,S=-1,w=!1,p=null,f=null,D=!1,E=null,o?.dispose(),o=null,c.value=null,l=null,r.value=!1}return C(()=>[t.sessionId,t.resume,t.model,t.cwd,t.agentId,t.runner],()=>{se()}),F(()=>{se(),T=_t(()=>{a.value=null,w&&se()})}),te(()=>{T?.(),T=null,le()}),(e,t)=>(B(),N(`div`,{class:`claude-terminal`,onClick:ce},[b(eq),b(Aq,{terminal:c.value},null,8,[`terminal`]),a.value?(B(),N(`div`,jq,[t[0]||=M(`i`,{class:`ti ti-alert-triangle`},null,-1),x(` `+U(a.value),1)])):G(``,!0),M(`div`,{ref_key:`terminalEl`,ref:n,class:I([`claude-terminal__xterm`,{"claude-terminal__xterm--hidden":!r.value}])},null,2)]))}}),[[`__scopeId`,`data-v-f97e250f`]]);function Pq(e){return p()?(u(e),!0):!1}function Fq(e){return typeof e==`function`?e():r(e)}var Iq=typeof window<`u`&&typeof document<`u`,Lq=e=>e!==void 0,Rq=Object.prototype.toString,zq=e=>Rq.call(e)===`[object Object]`,Bq=()=>{};function Vq(e,t){function n(...n){return new Promise((r,i)=>{Promise.resolve(e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})).then(r).catch(i)})}return n}var Hq=e=>e();function Uq(e=Hq){let t=i(!0);function n(){t.value=!1}function r(){t.value=!0}return{isActive:l(t),pause:n,resume:r,eventFilter:(...n)=>{t.value&&e(...n)}}}function Wq(e,t=!1,n=`Timeout`){return new Promise((r,i)=>{setTimeout(t?()=>i(n):r,e)})}function Gq(e,t,n={}){let{eventFilter:r=Hq,...i}=n;return C(e,Vq(r,t),i)}function Kq(e,t,n={}){let{eventFilter:r,...i}=n,{eventFilter:a,pause:o,resume:s,isActive:c}=Uq(r);return{stop:Gq(e,t,{...i,eventFilter:a}),pause:o,resume:s,isActive:c}}function qq(e,t={}){if(!m(e))return c(e);let n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(let r in e.value)n[r]=h(()=>({get(){return e.value[r]},set(n){if(Fq(t.replaceRef)??!0){if(Array.isArray(e.value)){let t=[...e.value];t[r]=n,e.value=t}else{let t={...e.value,[r]:n};Object.setPrototypeOf(t,Object.getPrototypeOf(e.value)),e.value=t}}else e.value[r]=n}}));return n}function Jq(e,t=!1){function n(n,{flush:r=`sync`,deep:i=!1,timeout:a,throwOnTimeout:o}={}){let s=null,c=[new Promise(a=>{s=C(e,e=>{n(e)!==t&&(s?.(),a(e))},{flush:r,deep:i,immediate:!0})})];return a!=null&&c.push(Wq(a,o).then(()=>Fq(e)).finally(()=>s?.())),Promise.race(c)}function r(r,i){if(!m(r))return n(e=>e===r,i);let{flush:a=`sync`,deep:o=!1,timeout:s,throwOnTimeout:c}=i??{},l=null,u=[new Promise(n=>{l=C([e,r],([e,r])=>{t!==(e===r)&&(l?.(),n(e))},{flush:a,deep:o,immediate:!0})})];return s!=null&&u.push(Wq(s,c).then(()=>Fq(e)).finally(()=>(l?.(),Fq(e)))),Promise.race(u)}function i(e){return n(e=>!!e,e)}function a(e){return r(null,e)}function o(e){return r(void 0,e)}function s(e){return n(Number.isNaN,e)}function c(e,t){return n(t=>{let n=Array.from(t);return n.includes(e)||n.includes(Fq(e))},t)}function l(e){return u(1,e)}function u(e=1,t){let r=-1;return n(()=>(r+=1,r>=e),t)}return Array.isArray(Fq(e))?{toMatch:n,toContains:c,changed:l,changedTimes:u,get not(){return Jq(e,!t)}}:{toMatch:n,toBe:r,toBeTruthy:i,toBeNull:a,toBeNaN:s,toBeUndefined:o,changed:l,changedTimes:u,get not(){return Jq(e,!t)}}}function Yq(e){return Jq(e)}function Xq(e){let t=Fq(e);return t?.$el??t}var Zq=Iq?window:void 0;function Qq(...e){let t,n,r,i;if(typeof e[0]==`string`||Array.isArray(e[0])?([n,r,i]=e,t=Zq):[t,n,r,i]=e,!t)return Bq;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);let a=[],o=()=>{a.forEach(e=>e()),a.length=0},s=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)),c=C(()=>[Xq(t),Fq(i)],([e,t])=>{if(o(),!e)return;let i=zq(t)?{...t}:t;a.push(...n.flatMap(t=>r.map(n=>s(e,t,n,i))))},{immediate:!0,flush:`post`}),l=()=>{c(),o()};return Pq(l),l}function $q(e){return typeof e==`function`?e:typeof e==`string`?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function eJ(...e){let t,n,r={};e.length===3?(t=e[0],n=e[1],r=e[2]):e.length===2?typeof e[1]==`object`?(t=!0,n=e[0],r=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);let{target:i=Zq,eventName:a=`keydown`,passive:o=!1,dedupe:s=!1}=r,c=$q(t);return Qq(i,a,e=>{e.repeat&&Fq(s)||c(e)&&n(e)},o)}function tJ(e){return JSON.parse(JSON.stringify(e))}function nJ(e,t,n,r={}){let{clone:a=!1,passive:o=!1,eventName:s,deep:c=!1,defaultValue:l,shouldEmit:u}=r,d=T(),f=n||d?.emit||(d?.$emit)?.bind(d)||(d?.proxy?.$emit)?.bind(d?.proxy),p=s;t||=`modelValue`,p||=`update:${t.toString()}`;let m=e=>a?typeof a==`function`?a(e):tJ(e):e,h=()=>Lq(e[t])?m(e[t]):l,g=e=>{u?u(e)&&f(p,e):f(p,e)};if(o){let n=h(),r=i(n),a=!1;return C(()=>e[t],e=>{a||(a=!0,r.value=m(e),le(()=>a=!1))}),C(r,n=>{!a&&(n!==e[t]||c)&&g(n)},{deep:c}),r}return R({get(){return h()},set(e){g(e)}})}var rJ={value:()=>{}};function iJ(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new aJ(n)}function aJ(e){this._=e}function oJ(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}aJ.prototype=iJ.prototype={constructor:aJ,on:function(e,t){var n=this._,r=oJ(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=sJ(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=cJ(n[i],e.name,t);else if(t==null)for(i in n)n[i]=cJ(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new aJ(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function sJ(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function cJ(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=rJ,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var lJ=`http://www.w3.org/1999/xhtml`,uJ={svg:`http://www.w3.org/2000/svg`,xhtml:lJ,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function dJ(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),uJ.hasOwnProperty(t)?{space:uJ[t],local:e}:e}function fJ(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===lJ&&t.documentElement.namespaceURI===lJ?t.createElement(e):t.createElementNS(n,e)}}function pJ(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function mJ(e){var t=dJ(e);return(t.local?pJ:fJ)(t)}function hJ(){}function gJ(e){return e==null?hJ:function(){return this.querySelector(e)}}function _J(e){typeof e!=`function`&&(e=gJ(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new aX(r,this._parents)}function vJ(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function yJ(){return[]}function bJ(e){return e==null?yJ:function(){return this.querySelectorAll(e)}}function xJ(e){return function(){return vJ(e.apply(this,arguments))}}function SJ(e){e=typeof e==`function`?xJ(e):bJ(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new aX(r,i)}function CJ(e){return function(){return this.matches(e)}}function wJ(e){return function(t){return t.matches(e)}}var TJ=Array.prototype.find;function EJ(e){return function(){return TJ.call(this.children,e)}}function DJ(){return this.firstElementChild}function OJ(e){return this.select(e==null?DJ:EJ(typeof e==`function`?e:wJ(e)))}var kJ=Array.prototype.filter;function AJ(){return Array.from(this.children)}function jJ(e){return function(){return kJ.call(this.children,e)}}function MJ(e){return this.selectAll(e==null?AJ:jJ(typeof e==`function`?e:wJ(e)))}function NJ(e){typeof e!=`function`&&(e=CJ(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new aX(r,this._parents)}function PJ(e){return Array(e.length)}function FJ(){return new aX(this._enter||this._groups.map(PJ),this._parents)}function IJ(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}IJ.prototype={constructor:IJ,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function LJ(e){return function(){return e}}function RJ(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new IJ(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function zJ(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new IJ(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function BJ(e){return e.__data__}function VJ(e,t){if(!arguments.length)return Array.from(this,BJ);var n=t?zJ:RJ,r=this._parents,i=this._groups;typeof e!=`function`&&(e=LJ(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=HJ(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new aX(o,r),o._enter=s,o._exit=c,o}function HJ(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function UJ(){return new aX(this._exit||this._groups.map(PJ),this._parents)}function WJ(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function GJ(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new aX(s,this._parents)}function KJ(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function qJ(e){e||=JJ;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new aX(i,this._parents).order()}function JJ(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function YJ(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function XJ(){return Array.from(this)}function ZJ(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function QJ(){let e=0;for(let t of this)++e;return e}function $J(){return!this.node()}function eY(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function tY(e){return function(){this.removeAttribute(e)}}function nY(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rY(e,t){return function(){this.setAttribute(e,t)}}function iY(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function aY(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function oY(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function sY(e,t){var n=dJ(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?nY:tY:typeof t==`function`?n.local?oY:aY:n.local?iY:rY)(n,t))}function cY(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function lY(e){return function(){this.style.removeProperty(e)}}function uY(e,t,n){return function(){this.style.setProperty(e,t,n)}}function dY(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function fY(e,t,n){return arguments.length>1?this.each((t==null?lY:typeof t==`function`?dY:uY)(e,t,n??``)):pY(this.node(),e)}function pY(e,t){return e.style.getPropertyValue(t)||cY(e).getComputedStyle(e,null).getPropertyValue(t)}function mY(e){return function(){delete this[e]}}function hY(e,t){return function(){this[e]=t}}function gY(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function _Y(e,t){return arguments.length>1?this.each((t==null?mY:typeof t==`function`?gY:hY)(e,t)):this.node()[e]}function vY(e){return e.trim().split(/^|\s+/)}function yY(e){return e.classList||new bY(e)}function bY(e){this._node=e,this._names=vY(e.getAttribute(`class`)||``)}bY.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function xY(e,t){for(var n=yY(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function SY(e,t){for(var n=yY(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function CY(e){return function(){xY(this,e)}}function wY(e){return function(){SY(this,e)}}function TY(e,t){return function(){(t.apply(this,arguments)?xY:SY)(this,e)}}function EY(e,t){var n=vY(e+``);if(arguments.length<2){for(var r=yY(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?TY:t?CY:wY)(n,t))}function DY(){this.textContent=``}function OY(e){return function(){this.textContent=e}}function kY(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function AY(e){return arguments.length?this.each(e==null?DY:(typeof e==`function`?kY:OY)(e)):this.node().textContent}function jY(){this.innerHTML=``}function MY(e){return function(){this.innerHTML=e}}function NY(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function PY(e){return arguments.length?this.each(e==null?jY:(typeof e==`function`?NY:MY)(e)):this.node().innerHTML}function FY(){this.nextSibling&&this.parentNode.appendChild(this)}function IY(){return this.each(FY)}function LY(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function RY(){return this.each(LY)}function zY(e){var t=typeof e==`function`?e:mJ(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function BY(){return null}function VY(e,t){var n=typeof e==`function`?e:mJ(e),r=t==null?BY:typeof t==`function`?t:gJ(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function HY(){var e=this.parentNode;e&&e.removeChild(this)}function UY(){return this.each(HY)}function WY(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function GY(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function KY(e){return this.select(e?GY:WY)}function qY(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function JY(e){return function(t){e.call(this,t,this.__data__)}}function YY(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function XY(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function ZY(e,t,n){return function(){var r=this.__on,i,a=JY(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function QY(e,t,n){var r=YY(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?ZY:XY,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function $Y(e,t,n){var r=cY(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function eX(e,t){return function(){return $Y(this,e,t)}}function tX(e,t){return function(){return $Y(this,e,t.apply(this,arguments))}}function nX(e,t){return this.each((typeof t==`function`?tX:eX)(e,t))}function*rX(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var iX=[null];function aX(e,t){this._groups=e,this._parents=t}function oX(){return new aX([[document.documentElement]],iX)}function sX(){return this}aX.prototype=oX.prototype={constructor:aX,select:_J,selectAll:SJ,selectChild:OJ,selectChildren:MJ,filter:NJ,data:VJ,enter:FJ,exit:UJ,join:WJ,merge:GJ,selection:sX,order:KJ,sort:qJ,call:YJ,nodes:XJ,node:ZJ,size:QJ,empty:$J,each:eY,attr:sY,style:fY,property:_Y,classed:EY,text:AY,html:PY,raise:IY,lower:RY,append:zY,insert:VY,remove:UY,clone:KY,datum:qY,on:QY,dispatch:nX,[Symbol.iterator]:rX};function cX(e){return typeof e==`string`?new aX([[document.querySelector(e)]],[document.documentElement]):new aX([[e]],iX)}function lX(e){let t;for(;t=e.sourceEvent;)e=t;return e}function uX(e,t){if(e=lX(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var dX={passive:!1},fX={capture:!0,passive:!1};function pX(e){e.stopImmediatePropagation()}function mX(e){e.preventDefault(),e.stopImmediatePropagation()}function hX(e){var t=e.document.documentElement,n=cX(e).on(`dragstart.drag`,mX,fX);`onselectstart`in t?n.on(`selectstart.drag`,mX,fX):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function gX(e,t){var n=e.document.documentElement,r=cX(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,mX,fX),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var _X=e=>()=>e;function vX(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}vX.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function yX(e){return!e.ctrlKey&&!e.button}function bX(){return this.parentNode}function xX(e,t){return t??{x:e.x,y:e.y}}function SX(){return navigator.maxTouchPoints||`ontouchstart`in this}function CX(){var e=yX,t=bX,n=xX,r=SX,i={},a=iJ(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,dX).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!u&&e.call(this,n,r)){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(cX(n.view).on(`mousemove.drag`,m,fX).on(`mouseup.drag`,h,fX),hX(n.view),pX(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(mX(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){cX(e.view).on(`mousemove.drag mouseup.drag`,null),gX(e.view,l),mX(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r))for(var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s=0,c;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(pX(n),c(`start`,n,i[s]))}function _(e){for(var t=e.changedTouches,n=t.length,r=0,a;r<n;++r)(a=i[t[r].identifier])&&(mX(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(pX(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=uX(l||r,t),p,m,h;if((h=n.call(e,new vX(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=uX(l||a,t),_=o}u.call(r,e,new vX(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:_X(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:_X(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:_X(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:_X(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function wX(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function TX(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function EX(){}var DX=.7,OX=1/DX,kX=`\\s*([+-]?\\d+)\\s*`,AX=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,jX=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,MX=/^#([0-9a-f]{3,8})$/,NX=RegExp(`^rgb\\(${kX},${kX},${kX}\\)$`),PX=RegExp(`^rgb\\(${jX},${jX},${jX}\\)$`),FX=RegExp(`^rgba\\(${kX},${kX},${kX},${AX}\\)$`),IX=RegExp(`^rgba\\(${jX},${jX},${jX},${AX}\\)$`),LX=RegExp(`^hsl\\(${AX},${jX},${jX}\\)$`),RX=RegExp(`^hsla\\(${AX},${jX},${jX},${AX}\\)$`),zX={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};wX(EX,WX,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:BX,formatHex:BX,formatHex8:VX,formatHsl:HX,formatRgb:UX,toString:UX});function BX(){return this.rgb().formatHex()}function VX(){return this.rgb().formatHex8()}function HX(){return rZ(this).formatHsl()}function UX(){return this.rgb().formatRgb()}function WX(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=MX.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?GX(t):n===3?new YX(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?KX(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?KX(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=NX.exec(e))?new YX(t[1],t[2],t[3],1):(t=PX.exec(e))?new YX(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=FX.exec(e))?KX(t[1],t[2],t[3],t[4]):(t=IX.exec(e))?KX(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=LX.exec(e))?nZ(t[1],t[2]/100,t[3]/100,1):(t=RX.exec(e))?nZ(t[1],t[2]/100,t[3]/100,t[4]):zX.hasOwnProperty(e)?GX(zX[e]):e===`transparent`?new YX(NaN,NaN,NaN,0):null}function GX(e){return new YX(e>>16&255,e>>8&255,e&255,1)}function KX(e,t,n,r){return r<=0&&(e=t=n=NaN),new YX(e,t,n,r)}function qX(e){return e instanceof EX||(e=WX(e)),e?(e=e.rgb(),new YX(e.r,e.g,e.b,e.opacity)):new YX}function JX(e,t,n,r){return arguments.length===1?qX(e):new YX(e,t,n,r??1)}function YX(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}wX(YX,JX,TX(EX,{brighter(e){return e=e==null?OX:OX**+e,new YX(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?DX:DX**+e,new YX(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new YX(eZ(this.r),eZ(this.g),eZ(this.b),$X(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:XX,formatHex:XX,formatHex8:ZX,formatRgb:QX,toString:QX}));function XX(){return`#${tZ(this.r)}${tZ(this.g)}${tZ(this.b)}`}function ZX(){return`#${tZ(this.r)}${tZ(this.g)}${tZ(this.b)}${tZ((isNaN(this.opacity)?1:this.opacity)*255)}`}function QX(){let e=$X(this.opacity);return`${e===1?`rgb(`:`rgba(`}${eZ(this.r)}, ${eZ(this.g)}, ${eZ(this.b)}${e===1?`)`:`, ${e})`}`}function $X(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function eZ(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function tZ(e){return e=eZ(e),(e<16?`0`:``)+e.toString(16)}function nZ(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new aZ(e,t,n,r)}function rZ(e){if(e instanceof aZ)return new aZ(e.h,e.s,e.l,e.opacity);if(e instanceof EX||(e=WX(e)),!e)return new aZ;if(e instanceof aZ)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new aZ(o,s,c,e.opacity)}function iZ(e,t,n,r){return arguments.length===1?rZ(e):new aZ(e,t,n,r??1)}function aZ(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}wX(aZ,iZ,TX(EX,{brighter(e){return e=e==null?OX:OX**+e,new aZ(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?DX:DX**+e,new aZ(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new YX(cZ(e>=240?e-240:e+120,i,r),cZ(e,i,r),cZ(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new aZ(oZ(this.h),sZ(this.s),sZ(this.l),$X(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=$X(this.opacity);return`${e===1?`hsl(`:`hsla(`}${oZ(this.h)}, ${sZ(this.s)*100}%, ${sZ(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function oZ(e){return e=(e||0)%360,e<0?e+360:e}function sZ(e){return Math.max(0,Math.min(1,e||0))}function cZ(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var lZ=e=>()=>e;function uZ(e,t){return function(n){return e+n*t}}function dZ(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function fZ(e){return(e=+e)==1?pZ:function(t,n){return n-t?dZ(t,n,e):lZ(isNaN(t)?n:t)}}function pZ(e,t){var n=t-e;return n?uZ(e,n):lZ(isNaN(e)?t:e)}var mZ=function e(t){var n=fZ(t);function r(e,t){var r=n((e=JX(e)).r,(t=JX(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=pZ(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r}(1);function hZ(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function gZ(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function _Z(e,t){for(var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o=0;o<r;++o)i[o]=EZ(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function vZ(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function yZ(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function bZ(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=EZ(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var xZ=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,SZ=new RegExp(xZ.source,`g`);function CZ(e){return function(){return e}}function wZ(e){return function(t){return e(t)+``}}function TZ(e,t){var n=xZ.lastIndex=SZ.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=xZ.exec(e))&&(i=SZ.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:yZ(r,i)})),n=SZ.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?wZ(c[0].x):CZ(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function EZ(e,t){var n=typeof t,r;return t==null||n===`boolean`?lZ(t):(n===`number`?yZ:n===`string`?(r=WX(t))?(t=r,mZ):TZ:t instanceof WX?mZ:t instanceof Date?vZ:gZ(t)?hZ:Array.isArray(t)?_Z:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?bZ:yZ)(e,t)}var DZ=180/Math.PI,OZ={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function kZ(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*DZ,skewX:Math.atan(c)*DZ,scaleX:o,scaleY:s}}var AZ;function jZ(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?OZ:kZ(t.a,t.b,t.c,t.d,t.e,t.f)}function MZ(e){return e==null||(AZ||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),AZ.setAttribute(`transform`,e),!(e=AZ.transform.baseVal.consolidate()))?OZ:(e=e.matrix,kZ(e.a,e.b,e.c,e.d,e.e,e.f))}function NZ(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:yZ(e,i)},{i:c-2,x:yZ(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:yZ(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:yZ(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:yZ(e,n)},{i:s-2,x:yZ(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var PZ=NZ(jZ,`px, `,`px)`,`deg)`),FZ=NZ(MZ,`, `,`)`,`)`),IZ=1e-12;function LZ(e){return((e=Math.exp(e))+1/e)/2}function RZ(e){return((e=Math.exp(e))-1/e)/2}function zZ(e){return((e=Math.exp(2*e))-1)/(e+1)}var BZ=function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<IZ)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=LZ(y),c=s/(n*g)*(i*zZ(t*r+y)-RZ(y));return[a+c*d,o+c*f,s*i/LZ(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i}(Math.SQRT2,2,4),VZ=0,HZ=0,UZ=0,WZ=1e3,GZ,KZ,qZ=0,JZ=0,YZ=0,XZ=typeof performance==`object`&&performance.now?performance:Date,ZZ=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function QZ(){return JZ||=(ZZ($Z),XZ.now()+YZ)}function $Z(){JZ=0}function eQ(){this._call=this._time=this._next=null}eQ.prototype=tQ.prototype={constructor:eQ,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?QZ():+n)+(t==null?0:+t),!this._next&&KZ!==this&&(KZ?KZ._next=this:GZ=this,KZ=this),this._call=e,this._time=n,oQ()},stop:function(){this._call&&(this._call=null,this._time=1/0,oQ())}};function tQ(e,t,n){var r=new eQ;return r.restart(e,t,n),r}function nQ(){QZ(),++VZ;for(var e=GZ,t;e;)(t=JZ-e._time)>=0&&e._call.call(void 0,t),e=e._next;--VZ}function rQ(){JZ=(qZ=XZ.now())+YZ,VZ=HZ=0;try{nQ()}finally{VZ=0,aQ(),JZ=0}}function iQ(){var e=XZ.now(),t=e-qZ;t>WZ&&(YZ-=t,qZ=e)}function aQ(){for(var e,t=GZ,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:GZ=n);KZ=e,oQ(r)}function oQ(e){VZ||(HZ&&=clearTimeout(HZ),e-JZ>24?(e<1/0&&(HZ=setTimeout(rQ,e-XZ.now()-YZ)),UZ&&=clearInterval(UZ)):(UZ||=(qZ=XZ.now(),setInterval(iQ,WZ)),VZ=1,ZZ(rQ)))}function sQ(e,t,n){var r=new eQ;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var cQ=iJ(`start`,`end`,`cancel`,`interrupt`),lQ=[],uQ=0,dQ=1,fQ=2,pQ=3,mQ=4,hQ=5,gQ=6;function _Q(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;xQ(e,n,{name:t,index:r,group:i,on:cQ,tween:lQ,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:uQ})}function vQ(e,t){var n=bQ(e,t);if(n.state>uQ)throw Error(`too late; already scheduled`);return n}function yQ(e,t){var n=bQ(e,t);if(n.state>pQ)throw Error(`too late; already running`);return n}function bQ(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function xQ(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=tQ(a,0,n.time);function a(e){n.state=dQ,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==dQ)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===pQ)return sQ(o);f.state===mQ?(f.state=gQ,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=gQ,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(sQ(function(){n.state===pQ&&(n.state=mQ,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=fQ,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===fQ){for(n.state=pQ,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=hQ,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===hQ&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=gQ,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function SQ(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>fQ&&r.state<hQ,r.state=gQ,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function CQ(e){return this.each(function(){SQ(this,e)})}function wQ(e,t){var n,r;return function(){var i=yQ(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function TQ(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=yQ(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function EQ(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=bQ(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?wQ:TQ)(n,e,t))}function DQ(e,t,n){var r=e._id;return e.each(function(){var e=yQ(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return bQ(e,r).value[t]}}function OQ(e,t){var n;return(typeof t==`number`?yZ:t instanceof WX?mZ:(n=WX(t))?(t=n,mZ):TZ)(e,t)}function kQ(e){return function(){this.removeAttribute(e)}}function AQ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function jQ(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function MQ(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function NQ(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function PQ(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function FQ(e,t){var n=dJ(e),r=n===`transform`?FZ:OQ;return this.attrTween(e,typeof t==`function`?(n.local?PQ:NQ)(n,r,DQ(this,`attr.`+e,t)):t==null?(n.local?AQ:kQ)(n):(n.local?MQ:jQ)(n,r,t))}function IQ(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function LQ(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function RQ(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&LQ(e,i)),n}return i._value=t,i}function zQ(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&IQ(e,i)),n}return i._value=t,i}function BQ(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=dJ(e);return this.tween(n,(r.local?RQ:zQ)(r,t))}function VQ(e,t){return function(){vQ(this,e).delay=+t.apply(this,arguments)}}function HQ(e,t){return t=+t,function(){vQ(this,e).delay=t}}function UQ(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?VQ:HQ)(t,e)):bQ(this.node(),t).delay}function WQ(e,t){return function(){yQ(this,e).duration=+t.apply(this,arguments)}}function GQ(e,t){return t=+t,function(){yQ(this,e).duration=t}}function KQ(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?WQ:GQ)(t,e)):bQ(this.node(),t).duration}function qQ(e,t){if(typeof t!=`function`)throw Error();return function(){yQ(this,e).ease=t}}function JQ(e){var t=this._id;return arguments.length?this.each(qQ(t,e)):bQ(this.node(),t).ease}function YQ(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();yQ(this,e).ease=n}}function XQ(e){if(typeof e!=`function`)throw Error();return this.each(YQ(this._id,e))}function ZQ(e){typeof e!=`function`&&(e=CJ(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new E$(r,this._parents,this._name,this._id)}function QQ(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new E$(o,this._parents,this._name,this._id)}function $Q(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function e$(e,t,n){var r,i,a=$Q(t)?vQ:yQ;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function t$(e,t){var n=this._id;return arguments.length<2?bQ(this.node(),n).on.on(e):this.each(e$(n,e,t))}function n$(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function r$(){return this.on(`end.remove`,n$(this._id))}function i$(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=gJ(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,_Q(l[f],t,n,f,l,bQ(u,n)));return new E$(a,this._parents,t,n)}function a$(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=bJ(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=bQ(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&_Q(p,t,n,h,f,m);a.push(f),o.push(u)}return new E$(a,o,t,n)}var o$=oX.prototype.constructor;function s$(){return new o$(this._groups,this._parents)}function c$(e,t){var n,r,i;return function(){var a=pY(this,e),o=(this.style.removeProperty(e),pY(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function l$(e){return function(){this.style.removeProperty(e)}}function u$(e,t,n){var r,i=n+``,a;return function(){var o=pY(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function d$(e,t,n){var r,i,a;return function(){var o=pY(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),pY(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function f$(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=yQ(this,e),l=c.on,u=c.value[a]==null?s||=l$(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function p$(e,t,n){var r=(e+=``)==`transform`?PZ:OQ;return t==null?this.styleTween(e,c$(e,r)).on(`end.style.`+e,l$(e)):typeof t==`function`?this.styleTween(e,d$(e,r,DQ(this,`style.`+e,t))).each(f$(this._id,e)):this.styleTween(e,u$(e,r,t),n).on(`end.style.`+e,null)}function m$(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function h$(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&m$(e,a,n)),r}return a._value=t,a}function g$(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,h$(e,t,n??``))}function _$(e){return function(){this.textContent=e}}function v$(e){return function(){var t=e(this);this.textContent=t??``}}function y$(e){return this.tween(`text`,typeof e==`function`?v$(DQ(this,`text`,e)):_$(e==null?``:e+``))}function b$(e){return function(t){this.textContent=e.call(this,t)}}function x$(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&b$(r)),t}return r._value=e,r}function S$(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,x$(e))}function C$(){for(var e=this._name,t=this._id,n=D$(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=bQ(c,t);_Q(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new E$(r,this._parents,e,n)}function w$(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=yQ(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var T$=0;function E$(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function D$(){return++T$}var O$=oX.prototype;E$.prototype={constructor:E$,select:i$,selectAll:a$,selectChild:O$.selectChild,selectChildren:O$.selectChildren,filter:ZQ,merge:QQ,selection:s$,transition:C$,call:O$.call,nodes:O$.nodes,node:O$.node,size:O$.size,empty:O$.empty,each:O$.each,on:t$,attr:FQ,attrTween:BQ,style:p$,styleTween:g$,text:y$,textTween:S$,remove:r$,tween:EQ,delay:UQ,duration:KQ,ease:JQ,easeVarying:XQ,end:w$,[Symbol.iterator]:O$[Symbol.iterator]};function k$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var A$={time:null,delay:0,duration:250,ease:k$};function j$(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function M$(e){var t,n;e instanceof E$?(t=e._id,e=e._name):(t=D$(),(n=A$).time=QZ(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&_Q(c,e,t,l,o,n||j$(c,t));return new E$(r,this._parents,e,t)}oX.prototype.interrupt=CQ,oX.prototype.transition=M$;var N$=e=>()=>e;function P$(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function F$(e,t,n){this.k=e,this.x=t,this.y=n}F$.prototype={constructor:F$,scale:function(e){return e===1?this:new F$(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new F$(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var I$=new F$(1,0,0);F$.prototype;function L$(e){e.stopImmediatePropagation()}function R$(e){e.preventDefault(),e.stopImmediatePropagation()}function z$(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function B$(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function V$(){return this.__zoom||I$}function H$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function U$(){return navigator.maxTouchPoints||`ontouchstart`in this}function W$(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function G$(){var e=z$,t=B$,n=W$,r=H$,i=U$,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=BZ,l=iJ(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,V$).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,ee).on(`touchend.zoom touchcancel.zoom`,O).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,V$),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(I$.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new F$(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new F$(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new F$(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=cX(this.that).datum();l.call(e,this.that,new P$(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=uX(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],SQ(this),s.start();R$(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=cX(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=uX(t,i),l=t.clientX,u=t.clientY;hX(t.view),L$(t),a.mouse=[c,this.__zoom.invert(c)],SQ(this),a.start();function d(e){if(R$(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=uX(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),gX(e.view,a.moved),R$(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=uX(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);R$(r),s>0?cX(this).transition().duration(s).call(x,d,c,r):cX(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(L$(t),s=0;s<i;++s)c=r[s],l=uX(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),SQ(this),a.start())}}function ee(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(R$(e),s=0;s<a;++s)c=i[s],l=uX(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function O(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(L$(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=uX(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=cX(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:N$(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:N$(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:N$(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:N$([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var Q=(e=>(e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`,e))(Q||{}),K$=(e=>(e.Partial=`partial`,e.Full=`full`,e))(K$||{}),q$=(e=>(e.Bezier=`default`,e.SimpleBezier=`simple-bezier`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e))(q$||{}),J$=(e=>(e.Strict=`strict`,e.Loose=`loose`,e))(J$||{}),Y$=(e=>(e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`,e))(Y$||{}),X$=(e=>(e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`,e))(X$||{}),Z$=(e=>(e.TopLeft=`top-left`,e.TopCenter=`top-center`,e.TopRight=`top-right`,e.BottomLeft=`bottom-left`,e.BottomCenter=`bottom-center`,e.BottomRight=`bottom-right`,e))(Z$||{}),Q$=[`INPUT`,`SELECT`,`TEXTAREA`],$$=typeof document<`u`?document:null;function e1(e){let t=e.composedPath?.call(e)?.[0]||e.target,n=typeof t?.hasAttribute==`function`&&t.hasAttribute(`contenteditable`),r=typeof t?.closest==`function`?t.closest(`.nokey`):null;return Q$.includes(t?.nodeName)||n||!!r}function t1(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function n1(e,t,n,r){let i=t.replace(`+`,`
|
|
279
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),mW&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=LW(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=QU(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-RW),RW),t/=RW,t/Math.abs(t)+Math.round(t*(zW-1)))}shouldForceSelection(e){return uW?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),BW)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(uW&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<VW&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=CW(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(t||o.slice(s,c).trim()!==``){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=LW(n,this._bufferService.cols)}};UW=sz([Y(3,Pz),Y(4,Iz),Y(5,Jz),Y(6,Bz),Y(7,Yz),Y(8,qz)],UW);var WW=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},GW=class{constructor(){this._color=new WW,this._css=new WW}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},KW=Object.freeze((()=>{let e=[bU.toColor(`#2e3436`),bU.toColor(`#cc0000`),bU.toColor(`#4e9a06`),bU.toColor(`#c4a000`),bU.toColor(`#3465a4`),bU.toColor(`#75507b`),bU.toColor(`#06989a`),bU.toColor(`#d3d7cf`),bU.toColor(`#555753`),bU.toColor(`#ef2929`),bU.toColor(`#8ae234`),bU.toColor(`#fce94f`),bU.toColor(`#729fcf`),bU.toColor(`#ad7fa8`),bU.toColor(`#34e2e2`),bU.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:vU.toCss(r,i,a),rgba:vU.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:vU.toCss(n,n,n),rgba:vU.toRgba(n,n,n)})}return e})()),qW=bU.toColor(`#ffffff`),JW=bU.toColor(`#000000`),YW=bU.toColor(`#ffffff`),XW=JW,ZW={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},QW=qW,$W=class extends CB{constructor(e){super(),this._optionsService=e,this._contrastCache=new GW,this._halfContrastCache=new GW,this._onChangeColors=this._register(new X),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:qW,background:JW,cursor:YW,cursorAccent:XW,selectionForeground:void 0,selectionBackgroundTransparent:ZW,selectionBackgroundOpaque:yU.blend(JW,ZW),selectionInactiveBackgroundTransparent:ZW,selectionInactiveBackgroundOpaque:yU.blend(JW,ZW),scrollbarSliderBackground:yU.opacity(qW,.2),scrollbarSliderHoverBackground:yU.opacity(qW,.4),scrollbarSliderActiveBackground:yU.opacity(qW,.5),overviewRulerBorder:qW,ansi:KW.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=eG(e.foreground,qW),t.background=eG(e.background,JW),t.cursor=yU.blend(t.background,eG(e.cursor,YW)),t.cursorAccent=yU.blend(t.background,eG(e.cursorAccent,XW)),t.selectionBackgroundTransparent=eG(e.selectionBackground,ZW),t.selectionBackgroundOpaque=yU.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=eG(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=yU.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?eG(e.selectionForeground,_U):void 0,t.selectionForeground===_U&&(t.selectionForeground=void 0),yU.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=yU.opacity(t.selectionBackgroundTransparent,.3)),yU.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=yU.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=eG(e.scrollbarSliderBackground,yU.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=eG(e.scrollbarSliderHoverBackground,yU.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=eG(e.scrollbarSliderActiveBackground,yU.opacity(t.foreground,.5)),t.overviewRulerBorder=eG(e.overviewRulerBorder,QW),t.ansi=KW.slice(),t.ansi[0]=eG(e.black,KW[0]),t.ansi[1]=eG(e.red,KW[1]),t.ansi[2]=eG(e.green,KW[2]),t.ansi[3]=eG(e.yellow,KW[3]),t.ansi[4]=eG(e.blue,KW[4]),t.ansi[5]=eG(e.magenta,KW[5]),t.ansi[6]=eG(e.cyan,KW[6]),t.ansi[7]=eG(e.white,KW[7]),t.ansi[8]=eG(e.brightBlack,KW[8]),t.ansi[9]=eG(e.brightRed,KW[9]),t.ansi[10]=eG(e.brightGreen,KW[10]),t.ansi[11]=eG(e.brightYellow,KW[11]),t.ansi[12]=eG(e.brightBlue,KW[12]),t.ansi[13]=eG(e.brightMagenta,KW[13]),t.ansi[14]=eG(e.brightCyan,KW[14]),t.ansi[15]=eG(e.brightWhite,KW[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=eG(e.extendedAnsi[r],KW[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};$W=sz([Y(0,Bz)],$W);function eG(e,t){if(e!==void 0)try{return bU.toColor(e)}catch{}return t}var tG=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},nG=class{constructor(){this._services=new tG,this._services.set(Rz,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=jz(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},rG={trace:0,debug:1,info:2,warn:3,error:4,off:5},iG=`xterm.js: `,aG=class extends CB{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),oG=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=rG[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:iG)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};aG=sz([Y(0,Bz)],aG);var oG,sG=class extends CB{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new X),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new X),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new X),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},cG=3,lG=Object.freeze(new Tz),uG=0,dG=2,fG=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*cG);let r=t||Dz.fromCharData([0,Cz,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*cG+0],n=t&2097151;return[this._data[e*cG+1],t&2097152?this._combined[e]:n?yz(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*cG+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*cG+0]=e|2097152|t[2]<<22):this._data[e*cG+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*cG+0]>>22}hasWidth(e){return this._data[e*cG+0]&12582912}getFg(e){return this._data[e*cG+1]}getBg(e){return this._data[e*cG+2]}hasContent(e){return this._data[e*cG+0]&4194303}getCodePoint(e){let t=this._data[e*cG+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*cG+0]&2097152}getString(e){let t=this._data[e*cG+0];return t&2097152?this._combined[e]:t&2097151?yz(t&2097151):``}isProtected(e){return this._data[e*cG+2]&536870912}loadCell(e,t){return uG=e*cG,t.content=this._data[uG+0],t.fg=this._data[uG+1],t.bg=this._data[uG+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*cG+0]=t.content,this._data[e*cG+1]=t.fg,this._data[e*cG+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*cG+0]=t|n<<22,this._data[e*cG+1]=r.fg,this._data[e*cG+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*cG+0];r&2097152?this._combined[e]+=yz(t):r&2097151?(this._combined[e]=yz(r&2097151)+yz(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*cG+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new Dz;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new Dz;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*dG<this._data.buffer.byteLength;let n=e*cG;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*dG<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*dG<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*cG+0]&4194303)return e+(this._data[e*cG+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*cG+0]&4194303||this._data[e*cG+2]&50331648)return e+(this._data[e*cG+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<cG;e++)this._data[(n+i)*cG+e]=a[(t+i)*cG+e];a[(t+i)*cG+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<cG;e++)this._data[(n+i)*cG+e]=a[(t+i)*cG+e];a[(t+i)*cG+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*cG+0],n=e&2097151,a=e&2097152?this._combined[t]:n?yz(n):wz;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function pG(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=_G(u,d,t),p=1,m=0;for(;p<u.length;){let e=_G(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function mG(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function hG(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function gG(e,t,n){let r=[],i=e.map((n,r)=>_G(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=_G(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function _G(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var vG=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new X),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),vB(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};vG._nextId=1;var yG=vG,bG={},xG=bG.B;bG[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},bG.A={"#":`£`},bG.B=void 0,bG[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},bG.C=bG[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},bG.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},bG.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},bG.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},bG.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},bG.E=bG[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},bG.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},bG.H=bG[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},bG[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var SG=4294967295,CG=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=lG.clone(),this.savedCharset=xG,this.markers=[],this._nullCell=Dz.fromCharData([0,Cz,1,0]),this._whitespaceCell=Dz.fromCharData([0,wz,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new yW,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new sG(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Ez),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Ez),this._whitespaceCell}getBlankLine(e,t){return new fG(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>SG?SG:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=lG);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new sG(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(lG),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new fG(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new fG(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=pG(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(lG),n);if(r.length>0){let n=mG(this.lines,r);hG(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(lG),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new fG(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(lG),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=gG(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(lG,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=_G(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new yG(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},wG=class extends CB{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new X),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 CG(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new CG(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},TG=2,EG=1,DG=class extends CB{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new X),this.onResize=this._onResize.event,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,TG),this.rows=Math.max(e.rawOptions.rows||0,EG),this.buffers=this._register(new wG(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};DG=sz([Y(0,Bz)],DG);var OG={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:uW,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},kG=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],AG=class extends CB{constructor(e){super(),this._onOptionChange=this._register(new X),this.onOptionChange=this._onOptionChange.event;let t={...OG};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(bB(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in OG))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in OG))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=OG[e],!jG(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=OG[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=kG.includes(t)?t:OG[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}};function jG(e){return e===`block`||e===`underline`||e===`bar`}function MG(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&MG(e[r],t-1);return n}var NG=Object.freeze({insertMode:!1}),PG=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),FG=class extends CB{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new X),this.onData=this._onData.event,this._onUserInput=this._register(new X),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new X),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new X),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=MG(NG),this.decPrivateModes=MG(PG)}reset(){this.modes=MG(NG),this.decPrivateModes=MG(PG)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};FG=sz([Y(0,Pz),Y(1,zz),Y(2,Bz)],FG);var IG={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function LG(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var RG=String.fromCharCode,zG={DEFAULT:e=>{let t=[LG(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${RG(t[0])}${RG(t[1])}${RG(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${LG(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${LG(e,!0)};${e.x};${e.y}${t}`}},BG=class extends CB{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new X),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(IG))this.addProtocol(e,IG[e]);for(let e of Object.keys(zG))this.addEncoding(e,zG[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};BG=sz([Y(0,Pz),Y(1,Iz),Y(2,Bz)],BG);var VG=[[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]],HG=[[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]],UG;function WG(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var GG=class{constructor(){if(this.version=`6`,!UG){UG=new Uint8Array(65536),UG.fill(1),UG[0]=0,UG.fill(0,1,32),UG.fill(0,127,160),UG.fill(2,4352,4448),UG[9001]=2,UG[9002]=2,UG.fill(2,11904,42192),UG[12351]=1,UG.fill(2,44032,55204),UG.fill(2,63744,64256),UG.fill(2,65040,65050),UG.fill(2,65072,65136),UG.fill(2,65280,65377),UG.fill(2,65504,65511);for(let e=0;e<VG.length;++e)UG.fill(0,VG[e][0],VG[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?UG[e]:WG(e,HG)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=KG.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return KG.createPropertyValue(0,n,r)}},KG=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new X,this.onChange=this._onChange.event;let e=new GG;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw 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(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},qG=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function JG(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var YG=2147483647,XG=256,ZG=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>XG)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}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 Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>YG?YG:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>YG?YG:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,YG):e}},QG=[],$G=class{constructor(){this._state=0,this._active=QG,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=QG}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=QG,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||QG,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,bz(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3){if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}}this._active=QG,this._id=-1,this._state=0}}},eK=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=bz(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},tK=[],nK=class{constructor(){this._handlers=Object.create(null),this._active=tK,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=tK}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=tK,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||tK,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,bz(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=tK,this._ident=0}},rK=new ZG;rK.addParam(0);var iK=class{constructor(e){this._handler=e,this._data=``,this._params=rK,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():rK,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=bz(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=rK,this._data=``,this._hitLimit=!1,e));return this._params=rK,this._data=``,this._hitLimit=!1,t}},aK=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},oK=160,sK=function(){let e=new aK(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(oK,0,2,0),e.add(oK,8,5,8),e.add(oK,6,0,6),e.add(oK,11,0,11),e.add(oK,13,13,13),e}(),cK=class extends CB{constructor(e=sK){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new ZG,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},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(bB(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new $G),this._dcsParser=this._register(new nK),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:oK)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<oK){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<oK){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<oK){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<oK){this._printHandler(e,n,i),n=i-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:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<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(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<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 i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<oK){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<oK){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=i&15}}},lK=/^([\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})$/,uK=/^[\da-f]+$/;function dK(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=lK.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),uK.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function fK(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function pK(e,t=16){let[n,r,i]=e;return`rgb:${fK(n,t)}/${fK(r,t)}/${fK(i,t)}`}var mK={"(":0,")":1,"*":2,"+":3,"-":1,".":2},hK=131072,gK=10;function _K(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var vK=5e3,yK=0,bK=class extends CB{constructor(e,t,n,r,i,a,o,s,c=new cK){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new xz,this._utf8Decoder=new Sz,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=lG.clone(),this._eraseAttrDataInternal=lG.clone(),this._onRequestBell=this._register(new X),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new X),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new X),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new X),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new X),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new X),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new X),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new X),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new X),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new X),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new X),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new X),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 xK(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(Z.BEL,()=>this.bell()),this._parser.setExecuteHandler(Z.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Z.BS,()=>this.backspace()),this._parser.setExecuteHandler(Z.HT,()=>this.tab()),this._parser.setExecuteHandler(Z.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Z.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(uU.IND,()=>this.index()),this._parser.setExecuteHandler(uU.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(uU.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new eK(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new eK(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new eK(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new eK(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new eK(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new eK(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new eK(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new eK(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new eK(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new eK(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new eK(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new eK(e=>this.restoreCursorColor(e))),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 e in bG)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new iK((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),vK))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${vK} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>hK&&(a=this._parseStack.position+hK)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<hK&&(this._parseBuffer=new Uint32Array(Math.min(e.length,hK))),o||this._dirtyRowTracker.clearRange(),e.length>hK)for(let t=a;t<e.length;t+=hK){let a=t+hK<e.length?t+hK:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=KG.extractWidth(t);let n=KG.extractShouldJoin(t),m=n?KG.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(yz(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof fG&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!_K(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new iK(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new eK(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){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 e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(lG));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=KG.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(Z.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(Z.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(Z.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(Z.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(Z.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,xG),this._charsetService.setgCharset(1,xG),this._charsetService.setgCharset(2,xG),this._charsetService.setgCharset(3,xG);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}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${Z.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=Tz.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=lG.fg,e.bg=lG.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=lG.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=lG.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=lG.fg&16777215,r.bg&=-67108864,r.bg|=lG.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Z.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=lG.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!_K(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Z.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>gK&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>gK&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(SK(n)){if(r===`?`)t.push({type:0,index:n});else{let e=dK(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=dK(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);SK(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,xG),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(mK[e[0]],bG[e[1]]||xG),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=lG.clone(),this._eraseAttrDataInternal=lG.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Dz;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${Z.ESC}${e}${Z.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},xK=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(yK=e,e=t,t=yK),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};xK=sz([Y(0,Pz)],xK);function SK(e){return 0<=e&&e<256}var CK=5e7,wK=12,TK=50,EK=class extends CB{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new X),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>CK)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=wK?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=wK)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>TK&&(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()}},DK=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};DK=sz([Y(0,Pz)],DK);var OK=!1,kK=class extends CB{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new wB),this._onBinary=this._register(new X),this.onBinary=this._onBinary.event,this._onData=this._register(new X),this.onData=this._onData.event,this._onLineFeed=this._register(new X),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new X),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new X),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new X),this._instantiationService=new nG,this.optionsService=this._register(new AG(e)),this._instantiationService.setService(Bz,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(DG)),this._instantiationService.setService(Pz,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(aG)),this._instantiationService.setService(zz,this._logService),this.coreService=this._register(this._instantiationService.createInstance(FG)),this._instantiationService.setService(Iz,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(BG)),this._instantiationService.setService(Fz,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(KG)),this._instantiationService.setService(Hz,this.unicodeService),this._charsetService=this._instantiationService.createInstance(qG),this._instantiationService.setService(Lz,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(DK),this._instantiationService.setService(Vz,this._oscLinkService),this._inputHandler=this._register(new bK(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(jB.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(jB.forward(this._bufferService.onResize,this._onResize)),this._register(jB.forward(this.coreService.onData,this._onData)),this._register(jB.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 EK((e,t)=>this._inputHandler.parse(e,t))),this._register(jB.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new X),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!OK&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),OK=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,TG),t=Math.max(t,EG),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(JG.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(JG(this._bufferService),!1))),this._windowsWrappingHeuristics.value=bB(()=>{for(let t of e)t.dispose()})}}},AK={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 jK(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=+!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?Z.ESC+`OA`:Z.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?Z.ESC+`OD`:Z.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?Z.ESC+`OC`:Z.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?Z.ESC+`OB`:Z.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:Z.DEL,e.altKey&&(i.key=Z.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Z.ESC+`[Z`;break}i.key=Z.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Z.ESC+Z.CR:Z.CR,i.cancel=!0;break;case 27:i.key=Z.ESC,e.altKey&&(i.key=Z.ESC+Z.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`D`:t?Z.ESC+`OD`:Z.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`C`:t?Z.ESC+`OC`:Z.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`A`:t?Z.ESC+`OA`:Z.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`B`:t?Z.ESC+`OB`:Z.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Z.ESC+`[2~`);break;case 46:i.key=a?Z.ESC+`[3;`+(a+1)+`~`:Z.ESC+`[3~`;break;case 36:i.key=a?Z.ESC+`[1;`+(a+1)+`H`:t?Z.ESC+`OH`:Z.ESC+`[H`;break;case 35:i.key=a?Z.ESC+`[1;`+(a+1)+`F`:t?Z.ESC+`OF`:Z.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?Z.ESC+`[5;`+(a+1)+`~`:Z.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?Z.ESC+`[6;`+(a+1)+`~`:Z.ESC+`[6~`;break;case 112:i.key=a?Z.ESC+`[1;`+(a+1)+`P`:Z.ESC+`OP`;break;case 113:i.key=a?Z.ESC+`[1;`+(a+1)+`Q`:Z.ESC+`OQ`;break;case 114:i.key=a?Z.ESC+`[1;`+(a+1)+`R`:Z.ESC+`OR`;break;case 115:i.key=a?Z.ESC+`[1;`+(a+1)+`S`:Z.ESC+`OS`;break;case 116:i.key=a?Z.ESC+`[15;`+(a+1)+`~`:Z.ESC+`[15~`;break;case 117:i.key=a?Z.ESC+`[17;`+(a+1)+`~`:Z.ESC+`[17~`;break;case 118:i.key=a?Z.ESC+`[18;`+(a+1)+`~`:Z.ESC+`[18~`;break;case 119:i.key=a?Z.ESC+`[19;`+(a+1)+`~`:Z.ESC+`[19~`;break;case 120:i.key=a?Z.ESC+`[20;`+(a+1)+`~`:Z.ESC+`[20~`;break;case 121:i.key=a?Z.ESC+`[21;`+(a+1)+`~`:Z.ESC+`[21~`;break;case 122:i.key=a?Z.ESC+`[23;`+(a+1)+`~`:Z.ESC+`[23~`;break;case 123:i.key=a?Z.ESC+`[24;`+(a+1)+`~`:Z.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Z.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Z.DEL:e.keyCode===219?i.key=Z.ESC:e.keyCode===220?i.key=Z.FS:e.keyCode===221&&(i.key=Z.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=AK[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=Z.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=Z.ESC+n}else if(e.keyCode===32)i.key=Z.ESC+(e.ctrlKey?Z.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=Z.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=Z.US),e.key===`@`&&(i.key=Z.NUL))}return i}var MK=0,NK=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new yW,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new yW,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(MK=this._search(t),MK===-1)||this._getKey(this._array[MK])!==t)return!1;do if(this._array[MK]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(MK),!0;while(++MK<this._array.length&&this._getKey(this._array[MK])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(MK=this._search(e),!(MK<0||MK>=this._array.length)&&this._getKey(this._array[MK])===e))do yield this._array[MK];while(++MK<this._array.length&&this._getKey(this._array[MK])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(MK=this._search(e),!(MK<0||MK>=this._array.length)&&this._getKey(this._array[MK])===e))do t(this._array[MK]);while(++MK<this._array.length&&this._getKey(this._array[MK])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},PK=0,FK=0,IK=class extends CB{constructor(){super(),this._decorations=new NK(e=>e?.marker.line),this._onDecorationRegistered=this._register(new X),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new X),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(bB(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new LK(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{PK=t.options.x??0,FK=PK+(t.options.width??1),e>=PK&&e<FK&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},LK=class extends SB{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new X),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new X),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this._cachedBg=this.options.backgroundColor?bU.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?bU.toColor(this.options.foregroundColor):void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},RK=1e3,zK=class{constructor(e,t=RK){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},BK=20,VK=class extends CB{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new zK(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
280
|
+
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(pH(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(bB(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<BK+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
281
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===BK+1&&(this._liveRegion.textContent+=dz.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){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>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};VK=sz([Y(1,Rz),Y(2,qz),Y(3,Yz)],VK);var HK=class extends CB{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new X),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new X),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(bB(()=>{vB(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(pH(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(pH(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(pH(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(pH(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&UK(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,vB(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};HK=sz([Y(1,Jz),Y(2,Yz),Y(3,Pz),Y(4,$z)],HK);function UK(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var WK=class extends kK{constructor(e={}){super(e),this._linkifier=this._register(new wB),this.browser=nW,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new wB),this._onCursorMove=this._register(new X),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new X),this.onKey=this._onKey.event,this._onRender=this._register(new X),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new X),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new X),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new X),this.onBell=this._onBell.event,this._onFocus=this._register(new X),this._onBlur=this._register(new X),this._onA11yCharEmitter=this._register(new X),this._onA11yTabEmitter=this._register(new X),this._onWillOpen=this._register(new X),this._setup(),this._decorationService=this._instantiationService.createInstance(IK),this._instantiationService.setService(Uz,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ZU),this._instantiationService.setService($z,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Wz)),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(jB.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(jB.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(jB.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(jB.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(bB(()=>{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(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=yU.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${Z.ESC}]${n};${pK(r)}${dU.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=vU.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=vU.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(VK,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.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(Z.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(pH(this.element,`copy`,e=>{this.hasSelection()&&mz(e,this._selectionService)}));let e=e=>hz(e,this.textarea,this.coreService,this.optionsService);this._register(pH(this.textarea,`paste`,e)),this._register(pH(this.element,`paste`,e)),oW?this._register(pH(this.element,`mousedown`,e=>{e.button===2&&vz(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(pH(this.element,`contextmenu`,e=>{vz(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),mW&&this._register(pH(this.element,`auxclick`,e=>{e.button===1&&_z(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(pH(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(pH(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(pH(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(pH(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(pH(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(pH(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(pH(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(pH(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,lz.get()),hW||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(YU,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(qz,this._coreBrowserService),this._register(pH(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(pH(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(GU,this._document,this._helperContainer),this._instantiationService.setService(Kz,this._charSizeService),this._themeService=this._instantiationService.createInstance($W),this._instantiationService.setService(Qz,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(EU),this._instantiationService.setService(Zz,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(xW,this.rows,this.screenElement)),this._instantiationService.setService(Yz,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(fU,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(eW),this._instantiationService.setService(Jz,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(HK,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(rU,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(UW,this.element,this.screenElement,r)),this._instantiationService.setService(Xz,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(jB.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(iU,this.screenElement)),this._register(pH(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),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(VK,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(lU,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(lU,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(WU,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),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()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(pH(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(pH(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=Z.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){gz(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=jK(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===Z.ETX||n.key===Z.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(GK(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(lG));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 e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(Z.ESC+`[I`):this.coreService.triggerDataEvent(Z.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}};function GK(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var KK=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},qK=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Dz)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},JK=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new qK(t)}getNullCell(){return new Dz}},YK=class extends CB{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new X),this.onBufferChange=this._onBufferChange.event,this._normal=new JK(this._core.buffers.normal,`normal`),this._alternate=new JK(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 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)}},XK=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},ZK=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},QK=[`cols`,`rows`],$K=0,eq=class extends CB{constructor(e){super(),this._core=this._register(new WK(e)),this._addonManager=this._register(new KK),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(QK.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw 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||=new XK(this._core),this._parser}get unicode(){return this._checkProposedApi(),new ZK(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._register(new YK(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
282
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return lz.get()},set promptLabel(e){lz.set(e)},get tooMuchOutput(){return dz.get()},set tooMuchOutput(e){dz.set(e)}}}_verifyIntegers(...e){for($K of e)if($K===1/0||isNaN($K)||$K%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for($K of e)if($K&&($K===1/0||isNaN($K)||$K%1!=0||$K<0))throw Error(`This API only accepts positive integers`)}},tq=2,nq=1,rq=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(tq,Math.floor(u/e.css.cell.width)),rows:Math.max(nq,Math.floor(l/e.css.cell.height))}}},iq={key:0,class:`pty-context-bar`},aq=ze(z({__name:`PtyContextBar`,setup(e){let{attachedContexts:t,removeAttachedContext:n}=Ut();return(e,i)=>r(t).length>0?(B(),N(`div`,iq,[(B(!0),N(V,null,P(r(t),(e,t)=>(B(),W(ZR,{key:t,icon:e.icon,label:e.label,text:e.text,removable:``,onRemove:e=>r(n)(t)},null,8,[`icon`,`label`,`text`,`onRemove`]))),128))])):G(``,!0)}}),[[`__scopeId`,`data-v-cfcb3a01`]]);function oq(e,t){let n=e.textarea;if(!n)return()=>{};let r=!1,i=!1,a=e=>{r=e.keyCode===229||e.key===`Process`},o=()=>{i=!0},s=()=>{setTimeout(()=>{i=!1},0)},c=e=>{let a=e;r&&!i&&a.inputType===`insertText`&&a.data&&!a.isComposing?(r=!1,n.value=``,t(a.data)):a.inputType===`insertText`&&(r=!1)};return n.addEventListener(`keydown`,a,!0),n.addEventListener(`compositionstart`,o,!0),n.addEventListener(`compositionend`,s,!0),n.addEventListener(`input`,c,!0),()=>{n.removeEventListener(`keydown`,a,!0),n.removeEventListener(`compositionstart`,o,!0),n.removeEventListener(`compositionend`,s,!0),n.removeEventListener(`input`,c,!0)}}function sq(e,t,n){let[r,i]=t.row>e.row||t.row===e.row&&t.col>=e.col?[e,t]:[t,e];return{column:r.col,row:r.row,length:(i.row-r.row)*n+i.col-r.col+1}}var cq=450;async function lq(e){if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(e);return}let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),t.remove()}function uq(e,t){let n=null,r=0,i=0,a=`none`,o=0,s=0,c=0,l=null,u=null,d=!1,f={col:0,row:0},p=document.createElement(`button`);p.type=`button`,p.className=`terminal-touch-copy`,Object.assign(p.style,{position:`absolute`,top:`8px`,right:`8px`,zIndex:`5`,display:`none`,padding:`6px 12px`,border:`0`,borderRadius:`6px`,font:`inherit`,fontSize:`14px`,background:`var(--r-primary)`,color:`var(--r-primary-contrast)`}),getComputedStyle(t).position===`static`&&(t.style.position=`relative`),t.appendChild(p);function m(){p.style.display=`none`}p.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation();let n=e.getSelection();m(),e.clearSelection(),n&&lq(n).catch(()=>{})}),p.addEventListener(`touchstart`,e=>e.stopPropagation(),{passive:!0});function h(){u!==null&&(clearTimeout(u),u=null)}function g(t,n){return x(t,n),{col:y-1,row:e.buffer.active.viewportY+b-1}}function _(t){let n=sq(f,t,e.cols);e.select(n.column,n.row,n.length)}let v=()=>{let n=e.rows||24,r=t.querySelector(`.xterm-viewport`)?.clientHeight??t.clientHeight;return r>0?r/n:17},y=1,b=1;function x(n,r){let i=t.querySelector(`.xterm-screen`);if(!i)return;let a=i.getBoundingClientRect();if(a.width<=0||a.height<=0)return;let o=Math.floor((n-a.left)/a.width*e.cols)+1,s=Math.floor((r-a.top)/a.height*e.rows)+1;y=Math.min(Math.max(o,1),e.cols),b=Math.min(Math.max(s,1),e.rows)}function S(t){let n=t>0,r=Math.min(Math.abs(t),12),i=e.modes.mouseTrackingMode===`none`?`\x1b${e.modes.applicationCursorKeysMode?`O`:`[`}${n?`B`:`A`}`:`\x1b[<${n?65:64};${y};${b}M`;for(let t=0;t<r;t+=1)e.input(i,!0)}function C(){l!==null&&(cancelAnimationFrame(l),l=null)}function w(){if(e.buffer.active.type===`alternate`||Math.abs(s)<.004)return;let t=performance.now(),n=r=>{let i=r-t;t=r,o+=s*i;let a=Math.trunc(o);a!==0&&(o-=a,e.scrollLines(a)),s*=Math.exp(-.005*i),l=Math.abs(s)<.002?null:requestAnimationFrame(n)};l=requestAnimationFrame(n)}let T=t=>{if(C(),h(),d=!1,m(),t.touches.length!==1){n=null;return}n=t.touches[0].clientY,r=t.touches[0].clientX,x(r,n),i=n,a=`none`,o=0,s=0,c=performance.now(),e.hasSelection()&&e.clearSelection();let l=r,p=i;u=setTimeout(()=>{u=null,a===`none`&&(d=!0,f=g(l,p),_(f),navigator.vibrate?.(10))},cq)},E=t=>{if(d&&t.touches.length===1){_(g(t.touches[0].clientX,t.touches[0].clientY)),t.preventDefault();return}if(n===null||t.touches.length!==1)return;let l=t.touches[0].clientY;if(a===`none`){let e=Math.abs(t.touches[0].clientX-r),o=Math.abs(l-i);if(Math.max(e,o)<8)return;if(h(),e>o){n=null;return}a=`vertical`}let u=n-l;n=l;let f=u/v(),p=performance.now(),m=p-c;c=p,m>0&&m<100&&(s=s*.7+f/m*.3),o+=f;let y=Math.trunc(o);y!==0&&(o-=y,e.buffer.active.type===`alternate`?S(y):e.scrollLines(y)),t.preventDefault()},D=t=>{if(h(),d){d=!1,t.cancelable&&t.preventDefault(),e.hasSelection()&&(p.textContent=rt.global.t(`terminal.copySelection`),p.style.display=``),n=null;return}a===`vertical`&&w(),n=null,a=`none`};t.addEventListener(`touchstart`,T,{passive:!0}),t.addEventListener(`touchmove`,E,{passive:!1}),t.addEventListener(`touchend`,D,{passive:!1}),t.addEventListener(`touchcancel`,D,{passive:!0});let ee=t=>{(d||e.hasSelection())&&t.preventDefault()};return t.addEventListener(`contextmenu`,ee),()=>{C(),h(),p.remove(),t.removeEventListener(`contextmenu`,ee),t.removeEventListener(`touchstart`,T),t.removeEventListener(`touchmove`,E),t.removeEventListener(`touchend`,D),t.removeEventListener(`touchcancel`,D)}}function dq(e,t){let n=e+(t>0?-1:1);return Math.min(Math.max(n,8),32)}function fq(e,t){try{let t=Number(localStorage.getItem(e));if(Number.isFinite(t)&&t>=8&&t<=32)return t}catch{}return t}function pq(e){let{terminal:t,container:n,storageKey:r,onResize:i}=e,a=e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault(),e.stopPropagation();let n=dq(t.options.fontSize??14,e.deltaY);if(n!==t.options.fontSize){t.options.fontSize=n;try{localStorage.setItem(r,String(n))}catch{}i()}};return n.addEventListener(`wheel`,a,{capture:!0,passive:!1}),()=>n.removeEventListener(`wheel`,a,{capture:!0})}function mq(e,t={}){let n=t.schedule??requestAnimationFrame,r=t.cancel??cancelAnimationFrame,i=[],a=null,o=!0;function s(){if(a!==null&&(r(a),a=null),i.length===0)return;let t=i.join(``);i=[],o?(o=!1,e.write(t,()=>e.scrollToBottom())):e.write(t)}return{write(e){i.push(e),a===null&&(a=n(s))},dispose(){a!==null&&(r(a),a=null),i=[]}}}var hq=150,gq=1.01,_q=i(!1),vq=0,yq=0;function bq(){let e=document.activeElement;return e?e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable:!1}var xq=0,Sq=null;function Cq(){return typeof window>`u`?!1:window.matchMedia?.(`(pointer: coarse)`).matches?!0:(navigator.maxTouchPoints??0)>0}function wq(e){return!e.editing||e.scale>gq?{visible:!1}:{visible:Math.max(e.maxHeight-e.innerHeight,e.innerHeight-e.viewportHeight)>=hq}}function Tq(e=!1){let t=window.visualViewport;if(!t){_q.value=!1;return}let n=bq();(window.innerWidth!==yq||e&&!n)&&(yq=window.innerWidth,vq=0),vq=Math.max(vq,window.innerHeight),_q.value=wq({innerHeight:window.innerHeight,viewportHeight:t.height,maxHeight:vq,scale:t.scale,editing:n}).visible}function Eq(){if(!Cq()||(xq+=1,Sq))return;let e=window.visualViewport;if(!e)return;let t=()=>Tq(!0),n=()=>Tq(!1);e.addEventListener(`resize`,t),e.addEventListener(`scroll`,n),window.addEventListener(`resize`,t),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),Sq=()=>{e.removeEventListener(`resize`,t),e.removeEventListener(`scroll`,n),window.removeEventListener(`resize`,t),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)},Tq()}function Dq(){xq=Math.max(0,xq-1),!(xq>0||!Sq)&&(Sq(),Sq=null,_q.value=!1)}function Oq(){return F(Eq),te(Dq),{keyboardVisible:l(_q)}}var kq=`\x1B`,Aq={up:`A`,down:`B`,right:`C`,left:`D`};function jq(e,t){switch(e){case`up`:case`down`:case`left`:case`right`:return`${kq}${t?`O`:`[`}${Aq[e]}`;case`esc`:return kq;case`tab`:return` `;case`enter`:return`\r`;case`ctrl-c`:return``}}var Mq=[`aria-label`],Nq=[`title`,`aria-label`,`onPointerdown`],Pq={class:`terminal-key-bar__cap`},Fq=ze(z({__name:`TerminalKeyBar`,props:{terminal:{}},setup(e){let t=e,{t:n}=He(),{keyboardVisible:a}=Oq(),o=Cq(),s=i(!1);function c(){let e=t.terminal?.element;s.value=e!=null&&e.contains(document.activeElement)}F(()=>{document.addEventListener(`focusin`,c),document.addEventListener(`focusout`,c),c()}),te(()=>{document.removeEventListener(`focusin`,c),document.removeEventListener(`focusout`,c)});let l=R(()=>o&&a.value&&s.value);function u(e){return jq(e,t.terminal?.modes.applicationCursorKeysMode===!0)}let d=R(()=>[{id:`up`,label:`↑`,title:n(`terminal.keyBar.up`)},{id:`down`,label:`↓`,title:n(`terminal.keyBar.down`)},{id:`left`,label:`←`,title:n(`terminal.keyBar.left`)},{id:`right`,label:`→`,title:n(`terminal.keyBar.right`)},{id:`esc`,label:`Esc`,title:n(`terminal.keyBar.escape`),wide:!0},{id:`tab`,label:`⇥`,title:n(`terminal.keyBar.tab`)},{id:`enter`,label:`⏎`,title:n(`terminal.keyBar.enter`)},{id:`ctrl-c`,label:`^C`,title:n(`terminal.keyBar.interrupt`),wide:!0}]);function f(e,n){n.preventDefault(),t.terminal?.input(u(e.id),!0),t.terminal?.focus()}return(e,t)=>(B(),W(ue,{to:`body`},[l.value?(B(),N(`div`,{key:0,class:`terminal-key-bar`,role:`toolbar`,"aria-label":r(n)(`terminal.keyBar.label`)},[(B(!0),N(V,null,P(d.value,e=>(B(),N(`button`,{key:e.id,type:`button`,class:I([`terminal-key-bar__key`,{"terminal-key-bar__key--wide":e.wide}]),title:e.title,"aria-label":e.title,onPointerdown:t=>f(e,t)},[M(`kbd`,Pq,U(e.label),1)],42,Nq))),128))],8,Mq)):G(``,!0)]))}}),[[`__scopeId`,`data-v-4528940d`]]),Iq={key:0,class:`claude-terminal__error`},Lq=`runeya:ai-terminal-font-size`,Rq=ze(z({__name:`ClaudeTerminal`,props:{sessionId:{},resume:{type:Boolean},model:{},cwd:{},agentId:{},runner:{},attachSpawnId:{}},setup(e){let t=e,n=i(null),r=i(!1),a=i(null),o=null,c=s(null),l=null,u=null,d=null,f=null,p=null,m=null,h=null,g=null,_=null,v=null,y=null,S=-1,w=!1,T=null,E=null,D=!1;function ee(e){if(!p||!f)return;let t=p,n=f,r=`\x1b[200~${e}\x1b[201~`;yt.chat.pty.write.mutate({agentId:t,spawnId:n,data:r}).then(()=>{setTimeout(()=>{yt.chat.pty.write.mutate({agentId:t,spawnId:n,data:`\r`}).catch(()=>{})},200)}).catch(e=>console.warn(`[ClaudeTerminal] auto-submit failed:`,e))}function O(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`FileReader error`)),r.onload=()=>{let e=r.result,n=e.indexOf(`,`);t(n>=0?e.slice(n+1):e)},r.readAsDataURL(e)})}async function k(e,t){if(p&&f)try{let n=await O(e),r=await yt.chat.pty.pasteImage.mutate({agentId:p,sessionId:t,mimeType:e.type||`image/png`,base64:n});r.clipboardMethod?await yt.chat.pty.write.mutate({agentId:p,spawnId:f,data:``}):await yt.chat.pty.write.mutate({agentId:p,spawnId:f,data:`@${r.tmpPath} `})}catch(e){console.error(`[ClaudeTerminal] image paste failed:`,e)}}let{attachedContexts:A,clearAttachedContexts:j,contextServiceId:P,pendingDiffContext:L,pendingContext:R,pendingPopulateContext:ne,autoSendPending:re,setDiffContext:z}=Ut(),ie=Xt(),V=Dt(),ae=tt();function H(){let e=[];if(P.value){let t=ie.getById(P.value);t&&e.push({label:`Service: ${t.name}`,icon:`ti-server`,text:`Service attached: ${t.name}\nID: ${t.id}\nCommand: ${t.command??`(none)`}\nCwd: ${t.cwd??`(none)`}`})}L.value&&e.push({label:`Diff`,icon:`ti-code`,text:L.value}),R.value&&e.push(R.value);for(let t of A.value)e.push(t);return e}function oe(){l?.fit(),p&&f&&o&&yt.chat.pty.resize.mutate({agentId:p,spawnId:f,cols:o.cols,rows:o.rows}).catch(()=>{})}async function se(){if(!n.value)return;if(await le(),a.value=null,o=new eq({cursorBlink:!0,fontFamily:`monospace`,fontSize:fq(Lq,13),theme:{background:`#1a1b1e`,foreground:`#d4d4d4`,cursor:`#d4d4d4`},allowProposedApi:!1}),l=new rq,o.loadAddon(l),o.open(n.value),c.value=o,y=mq(o),_=uq(o,n.value),v=pq({terminal:o,container:n.value,storageKey:Lq,onResize:()=>oe()}),o.attachCustomKeyEventHandler(e=>{if(e.type!==`keydown`||e.altKey||!(e.ctrlKey||e.metaKey))return!0;let t=e.key.toLowerCase();if(t===`v`)return!1;if(e.shiftKey&&t===`c`){e.preventDefault();let t=o?.getSelection();return t&&navigator.clipboard.writeText(t).catch(()=>{}),!1}return!0}),await new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(()=>e()))),l.fit(),t.attachSpawnId&&t.agentId)f=t.attachSpawnId,p=t.agentId;else try{let e=H().map(e=>({label:e.label,text:e.text})),n=await yt.chat.pty.start.mutate({agentId:t.agentId,sessionId:t.sessionId,runner:t.runner??`claude-code`,resume:t.resume??!1,model:t.model,cwd:t.cwd,...ae.activeProjectId?{projectId:ae.activeProjectId,orgId:ae.activeOrgId}:{},cols:o.cols,rows:o.rows,enableMcp:!0,environmentId:V.currentProject?.activeEnvironmentId,attachedContexts:e.length>0?e:void 0});f=n.spawnId,p=n.agentId,!n.reattached&&re.value&&ne.value&&(E=ne.value,D=!0,re.value=!1,ne.value=null),e.length>0&&(j(),z(null),R.value=null)}catch(e){w=!0,a.value=e.message,o.dispose(),o=null,c.value=null;return}d=yt.chat.pty.stream.subscribe({agentId:p,spawnId:f,fromOffset:0},{onData(e){if(e.offset<=S)return;S=e.offset;let{chunk:n}=e;if(n.type===`pty-data`){if(y?.write(n.data),D&&E){D=!1;let e=E;E=null,setTimeout(()=>ee(e),1e3)}}else n.type===`exit`&&y?.write(`\r\n\x1b[90m[${t.runner===`codex`?`codex`:`claude`} exited with code ${n.code??0}]\x1b[0m\r\n`)},onError(e){w=!0,a.value=e.message}});let e=e=>{p&&f&&yt.chat.pty.write.mutate({agentId:p,spawnId:f,data:e}).catch(()=>{})};o.onData(e),g=oq(o,e),u=new ResizeObserver(()=>oe()),u.observe(n.value),h=o.textarea??null,h&&(m=e=>{let n=e.clipboardData?.items;if(n){for(let r of n)if(r.kind===`file`&&r.type.startsWith(`image/`)){let n=r.getAsFile();if(n){e.preventDefault(),e.stopPropagation(),k(n,t.sessionId);return}}}},h.addEventListener(`paste`,m,!0)),r.value=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>o?.focus())})}function ce(){o?.focus()}async function le(){u?.disconnect(),u=null,g?.(),g=null,_?.(),_=null,v?.(),v=null,y?.dispose(),y=null,h&&m&&h.removeEventListener(`paste`,m,!0),h=null,m=null,d?.unsubscribe(),d=null,S=-1,w=!1,p=null,f=null,D=!1,E=null,o?.dispose(),o=null,c.value=null,l=null,r.value=!1}return C(()=>[t.sessionId,t.resume,t.model,t.cwd,t.agentId,t.runner],()=>{se()}),F(()=>{se(),T=_t(()=>{a.value=null,w&&se()})}),te(()=>{T?.(),T=null,le()}),(e,t)=>(B(),N(`div`,{class:`claude-terminal`,onClick:ce},[b(aq),b(Fq,{terminal:c.value},null,8,[`terminal`]),a.value?(B(),N(`div`,Iq,[t[0]||=M(`i`,{class:`ti ti-alert-triangle`},null,-1),x(` `+U(a.value),1)])):G(``,!0),M(`div`,{ref_key:`terminalEl`,ref:n,class:I([`claude-terminal__xterm`,{"claude-terminal__xterm--hidden":!r.value}])},null,2)]))}}),[[`__scopeId`,`data-v-f97e250f`]]);function zq(e){return p()?(u(e),!0):!1}function Bq(e){return typeof e==`function`?e():r(e)}var Vq=typeof window<`u`&&typeof document<`u`,Hq=e=>e!==void 0,Uq=Object.prototype.toString,Wq=e=>Uq.call(e)===`[object Object]`,Gq=()=>{};function Kq(e,t){function n(...n){return new Promise((r,i)=>{Promise.resolve(e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})).then(r).catch(i)})}return n}var qq=e=>e();function Jq(e=qq){let t=i(!0);function n(){t.value=!1}function r(){t.value=!0}return{isActive:l(t),pause:n,resume:r,eventFilter:(...n)=>{t.value&&e(...n)}}}function Yq(e,t=!1,n=`Timeout`){return new Promise((r,i)=>{setTimeout(t?()=>i(n):r,e)})}function Xq(e,t,n={}){let{eventFilter:r=qq,...i}=n;return C(e,Kq(r,t),i)}function Zq(e,t,n={}){let{eventFilter:r,...i}=n,{eventFilter:a,pause:o,resume:s,isActive:c}=Jq(r);return{stop:Xq(e,t,{...i,eventFilter:a}),pause:o,resume:s,isActive:c}}function Qq(e,t={}){if(!m(e))return c(e);let n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(let r in e.value)n[r]=h(()=>({get(){return e.value[r]},set(n){if(Bq(t.replaceRef)??!0){if(Array.isArray(e.value)){let t=[...e.value];t[r]=n,e.value=t}else{let t={...e.value,[r]:n};Object.setPrototypeOf(t,Object.getPrototypeOf(e.value)),e.value=t}}else e.value[r]=n}}));return n}function $q(e,t=!1){function n(n,{flush:r=`sync`,deep:i=!1,timeout:a,throwOnTimeout:o}={}){let s=null,c=[new Promise(a=>{s=C(e,e=>{n(e)!==t&&(s?.(),a(e))},{flush:r,deep:i,immediate:!0})})];return a!=null&&c.push(Yq(a,o).then(()=>Bq(e)).finally(()=>s?.())),Promise.race(c)}function r(r,i){if(!m(r))return n(e=>e===r,i);let{flush:a=`sync`,deep:o=!1,timeout:s,throwOnTimeout:c}=i??{},l=null,u=[new Promise(n=>{l=C([e,r],([e,r])=>{t!==(e===r)&&(l?.(),n(e))},{flush:a,deep:o,immediate:!0})})];return s!=null&&u.push(Yq(s,c).then(()=>Bq(e)).finally(()=>(l?.(),Bq(e)))),Promise.race(u)}function i(e){return n(e=>!!e,e)}function a(e){return r(null,e)}function o(e){return r(void 0,e)}function s(e){return n(Number.isNaN,e)}function c(e,t){return n(t=>{let n=Array.from(t);return n.includes(e)||n.includes(Bq(e))},t)}function l(e){return u(1,e)}function u(e=1,t){let r=-1;return n(()=>(r+=1,r>=e),t)}return Array.isArray(Bq(e))?{toMatch:n,toContains:c,changed:l,changedTimes:u,get not(){return $q(e,!t)}}:{toMatch:n,toBe:r,toBeTruthy:i,toBeNull:a,toBeNaN:s,toBeUndefined:o,changed:l,changedTimes:u,get not(){return $q(e,!t)}}}function eJ(e){return $q(e)}function tJ(e){let t=Bq(e);return t?.$el??t}var nJ=Vq?window:void 0;function rJ(...e){let t,n,r,i;if(typeof e[0]==`string`||Array.isArray(e[0])?([n,r,i]=e,t=nJ):[t,n,r,i]=e,!t)return Gq;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);let a=[],o=()=>{a.forEach(e=>e()),a.length=0},s=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)),c=C(()=>[tJ(t),Bq(i)],([e,t])=>{if(o(),!e)return;let i=Wq(t)?{...t}:t;a.push(...n.flatMap(t=>r.map(n=>s(e,t,n,i))))},{immediate:!0,flush:`post`}),l=()=>{c(),o()};return zq(l),l}function iJ(e){return typeof e==`function`?e:typeof e==`string`?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function aJ(...e){let t,n,r={};e.length===3?(t=e[0],n=e[1],r=e[2]):e.length===2?typeof e[1]==`object`?(t=!0,n=e[0],r=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);let{target:i=nJ,eventName:a=`keydown`,passive:o=!1,dedupe:s=!1}=r,c=iJ(t);return rJ(i,a,e=>{e.repeat&&Bq(s)||c(e)&&n(e)},o)}function oJ(e){return JSON.parse(JSON.stringify(e))}function sJ(e,t,n,r={}){let{clone:a=!1,passive:o=!1,eventName:s,deep:c=!1,defaultValue:l,shouldEmit:u}=r,d=T(),f=n||d?.emit||(d?.$emit)?.bind(d)||(d?.proxy?.$emit)?.bind(d?.proxy),p=s;t||=`modelValue`,p||=`update:${t.toString()}`;let m=e=>a?typeof a==`function`?a(e):oJ(e):e,h=()=>Hq(e[t])?m(e[t]):l,g=e=>{u?u(e)&&f(p,e):f(p,e)};if(o){let n=h(),r=i(n),a=!1;return C(()=>e[t],e=>{a||(a=!0,r.value=m(e),le(()=>a=!1))}),C(r,n=>{!a&&(n!==e[t]||c)&&g(n)},{deep:c}),r}return R({get(){return h()},set(e){g(e)}})}var cJ={value:()=>{}};function lJ(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new uJ(n)}function uJ(e){this._=e}function dJ(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}uJ.prototype=lJ.prototype={constructor:uJ,on:function(e,t){var n=this._,r=dJ(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=fJ(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=pJ(n[i],e.name,t);else if(t==null)for(i in n)n[i]=pJ(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new uJ(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function fJ(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function pJ(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=cJ,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var mJ=`http://www.w3.org/1999/xhtml`,hJ={svg:`http://www.w3.org/2000/svg`,xhtml:mJ,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function gJ(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),hJ.hasOwnProperty(t)?{space:hJ[t],local:e}:e}function _J(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===mJ&&t.documentElement.namespaceURI===mJ?t.createElement(e):t.createElementNS(n,e)}}function vJ(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function yJ(e){var t=gJ(e);return(t.local?vJ:_J)(t)}function bJ(){}function xJ(e){return e==null?bJ:function(){return this.querySelector(e)}}function SJ(e){typeof e!=`function`&&(e=xJ(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new uX(r,this._parents)}function CJ(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function wJ(){return[]}function TJ(e){return e==null?wJ:function(){return this.querySelectorAll(e)}}function EJ(e){return function(){return CJ(e.apply(this,arguments))}}function DJ(e){e=typeof e==`function`?EJ(e):TJ(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new uX(r,i)}function OJ(e){return function(){return this.matches(e)}}function kJ(e){return function(t){return t.matches(e)}}var AJ=Array.prototype.find;function jJ(e){return function(){return AJ.call(this.children,e)}}function MJ(){return this.firstElementChild}function NJ(e){return this.select(e==null?MJ:jJ(typeof e==`function`?e:kJ(e)))}var PJ=Array.prototype.filter;function FJ(){return Array.from(this.children)}function IJ(e){return function(){return PJ.call(this.children,e)}}function LJ(e){return this.selectAll(e==null?FJ:IJ(typeof e==`function`?e:kJ(e)))}function RJ(e){typeof e!=`function`&&(e=OJ(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new uX(r,this._parents)}function zJ(e){return Array(e.length)}function BJ(){return new uX(this._enter||this._groups.map(zJ),this._parents)}function VJ(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}VJ.prototype={constructor:VJ,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function HJ(e){return function(){return e}}function UJ(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new VJ(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function WJ(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new VJ(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function GJ(e){return e.__data__}function KJ(e,t){if(!arguments.length)return Array.from(this,GJ);var n=t?WJ:UJ,r=this._parents,i=this._groups;typeof e!=`function`&&(e=HJ(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=qJ(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new uX(o,r),o._enter=s,o._exit=c,o}function qJ(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function JJ(){return new uX(this._exit||this._groups.map(zJ),this._parents)}function YJ(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function XJ(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new uX(s,this._parents)}function ZJ(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function QJ(e){e||=$J;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new uX(i,this._parents).order()}function $J(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function eY(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function tY(){return Array.from(this)}function nY(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function rY(){let e=0;for(let t of this)++e;return e}function iY(){return!this.node()}function aY(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function oY(e){return function(){this.removeAttribute(e)}}function sY(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cY(e,t){return function(){this.setAttribute(e,t)}}function lY(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function uY(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function dY(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function fY(e,t){var n=gJ(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?sY:oY:typeof t==`function`?n.local?dY:uY:n.local?lY:cY)(n,t))}function pY(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function mY(e){return function(){this.style.removeProperty(e)}}function hY(e,t,n){return function(){this.style.setProperty(e,t,n)}}function gY(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function _Y(e,t,n){return arguments.length>1?this.each((t==null?mY:typeof t==`function`?gY:hY)(e,t,n??``)):vY(this.node(),e)}function vY(e,t){return e.style.getPropertyValue(t)||pY(e).getComputedStyle(e,null).getPropertyValue(t)}function yY(e){return function(){delete this[e]}}function bY(e,t){return function(){this[e]=t}}function xY(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function SY(e,t){return arguments.length>1?this.each((t==null?yY:typeof t==`function`?xY:bY)(e,t)):this.node()[e]}function CY(e){return e.trim().split(/^|\s+/)}function wY(e){return e.classList||new TY(e)}function TY(e){this._node=e,this._names=CY(e.getAttribute(`class`)||``)}TY.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function EY(e,t){for(var n=wY(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function DY(e,t){for(var n=wY(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function OY(e){return function(){EY(this,e)}}function kY(e){return function(){DY(this,e)}}function AY(e,t){return function(){(t.apply(this,arguments)?EY:DY)(this,e)}}function jY(e,t){var n=CY(e+``);if(arguments.length<2){for(var r=wY(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?AY:t?OY:kY)(n,t))}function MY(){this.textContent=``}function NY(e){return function(){this.textContent=e}}function PY(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function FY(e){return arguments.length?this.each(e==null?MY:(typeof e==`function`?PY:NY)(e)):this.node().textContent}function IY(){this.innerHTML=``}function LY(e){return function(){this.innerHTML=e}}function RY(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function zY(e){return arguments.length?this.each(e==null?IY:(typeof e==`function`?RY:LY)(e)):this.node().innerHTML}function BY(){this.nextSibling&&this.parentNode.appendChild(this)}function VY(){return this.each(BY)}function HY(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function UY(){return this.each(HY)}function WY(e){var t=typeof e==`function`?e:yJ(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function GY(){return null}function KY(e,t){var n=typeof e==`function`?e:yJ(e),r=t==null?GY:typeof t==`function`?t:xJ(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function qY(){var e=this.parentNode;e&&e.removeChild(this)}function JY(){return this.each(qY)}function YY(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function XY(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ZY(e){return this.select(e?XY:YY)}function QY(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function $Y(e){return function(t){e.call(this,t,this.__data__)}}function eX(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function tX(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function nX(e,t,n){return function(){var r=this.__on,i,a=$Y(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function rX(e,t,n){var r=eX(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?nX:tX,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function iX(e,t,n){var r=pY(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function aX(e,t){return function(){return iX(this,e,t)}}function oX(e,t){return function(){return iX(this,e,t.apply(this,arguments))}}function sX(e,t){return this.each((typeof t==`function`?oX:aX)(e,t))}function*cX(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var lX=[null];function uX(e,t){this._groups=e,this._parents=t}function dX(){return new uX([[document.documentElement]],lX)}function fX(){return this}uX.prototype=dX.prototype={constructor:uX,select:SJ,selectAll:DJ,selectChild:NJ,selectChildren:LJ,filter:RJ,data:KJ,enter:BJ,exit:JJ,join:YJ,merge:XJ,selection:fX,order:ZJ,sort:QJ,call:eY,nodes:tY,node:nY,size:rY,empty:iY,each:aY,attr:fY,style:_Y,property:SY,classed:jY,text:FY,html:zY,raise:VY,lower:UY,append:WY,insert:KY,remove:JY,clone:ZY,datum:QY,on:rX,dispatch:sX,[Symbol.iterator]:cX};function pX(e){return typeof e==`string`?new uX([[document.querySelector(e)]],[document.documentElement]):new uX([[e]],lX)}function mX(e){let t;for(;t=e.sourceEvent;)e=t;return e}function hX(e,t){if(e=mX(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var gX={passive:!1},_X={capture:!0,passive:!1};function vX(e){e.stopImmediatePropagation()}function yX(e){e.preventDefault(),e.stopImmediatePropagation()}function bX(e){var t=e.document.documentElement,n=pX(e).on(`dragstart.drag`,yX,_X);`onselectstart`in t?n.on(`selectstart.drag`,yX,_X):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function xX(e,t){var n=e.document.documentElement,r=pX(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,yX,_X),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var SX=e=>()=>e;function CX(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}CX.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function wX(e){return!e.ctrlKey&&!e.button}function TX(){return this.parentNode}function EX(e,t){return t??{x:e.x,y:e.y}}function DX(){return navigator.maxTouchPoints||`ontouchstart`in this}function OX(){var e=wX,t=TX,n=EX,r=DX,i={},a=lJ(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,gX).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!u&&e.call(this,n,r)){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(pX(n.view).on(`mousemove.drag`,m,_X).on(`mouseup.drag`,h,_X),bX(n.view),vX(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(yX(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){pX(e.view).on(`mousemove.drag mouseup.drag`,null),xX(e.view,l),yX(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r))for(var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s=0,c;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(vX(n),c(`start`,n,i[s]))}function _(e){for(var t=e.changedTouches,n=t.length,r=0,a;r<n;++r)(a=i[t[r].identifier])&&(yX(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(vX(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=hX(l||r,t),p,m,h;if((h=n.call(e,new CX(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=hX(l||a,t),_=o}u.call(r,e,new CX(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:SX(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:SX(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:SX(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:SX(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function kX(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function AX(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function jX(){}var MX=.7,NX=1/MX,PX=`\\s*([+-]?\\d+)\\s*`,FX=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,IX=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,LX=/^#([0-9a-f]{3,8})$/,RX=RegExp(`^rgb\\(${PX},${PX},${PX}\\)$`),zX=RegExp(`^rgb\\(${IX},${IX},${IX}\\)$`),BX=RegExp(`^rgba\\(${PX},${PX},${PX},${FX}\\)$`),VX=RegExp(`^rgba\\(${IX},${IX},${IX},${FX}\\)$`),HX=RegExp(`^hsl\\(${FX},${IX},${IX}\\)$`),UX=RegExp(`^hsla\\(${FX},${IX},${IX},${FX}\\)$`),WX={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};kX(jX,YX,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:GX,formatHex:GX,formatHex8:KX,formatHsl:qX,formatRgb:JX,toString:JX});function GX(){return this.rgb().formatHex()}function KX(){return this.rgb().formatHex8()}function qX(){return cZ(this).formatHsl()}function JX(){return this.rgb().formatRgb()}function YX(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=LX.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?XX(t):n===3?new eZ(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ZX(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ZX(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=RX.exec(e))?new eZ(t[1],t[2],t[3],1):(t=zX.exec(e))?new eZ(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=BX.exec(e))?ZX(t[1],t[2],t[3],t[4]):(t=VX.exec(e))?ZX(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=HX.exec(e))?sZ(t[1],t[2]/100,t[3]/100,1):(t=UX.exec(e))?sZ(t[1],t[2]/100,t[3]/100,t[4]):WX.hasOwnProperty(e)?XX(WX[e]):e===`transparent`?new eZ(NaN,NaN,NaN,0):null}function XX(e){return new eZ(e>>16&255,e>>8&255,e&255,1)}function ZX(e,t,n,r){return r<=0&&(e=t=n=NaN),new eZ(e,t,n,r)}function QX(e){return e instanceof jX||(e=YX(e)),e?(e=e.rgb(),new eZ(e.r,e.g,e.b,e.opacity)):new eZ}function $X(e,t,n,r){return arguments.length===1?QX(e):new eZ(e,t,n,r??1)}function eZ(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}kX(eZ,$X,AX(jX,{brighter(e){return e=e==null?NX:NX**+e,new eZ(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?MX:MX**+e,new eZ(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new eZ(aZ(this.r),aZ(this.g),aZ(this.b),iZ(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:tZ,formatHex:tZ,formatHex8:nZ,formatRgb:rZ,toString:rZ}));function tZ(){return`#${oZ(this.r)}${oZ(this.g)}${oZ(this.b)}`}function nZ(){return`#${oZ(this.r)}${oZ(this.g)}${oZ(this.b)}${oZ((isNaN(this.opacity)?1:this.opacity)*255)}`}function rZ(){let e=iZ(this.opacity);return`${e===1?`rgb(`:`rgba(`}${aZ(this.r)}, ${aZ(this.g)}, ${aZ(this.b)}${e===1?`)`:`, ${e})`}`}function iZ(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function aZ(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function oZ(e){return e=aZ(e),(e<16?`0`:``)+e.toString(16)}function sZ(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new uZ(e,t,n,r)}function cZ(e){if(e instanceof uZ)return new uZ(e.h,e.s,e.l,e.opacity);if(e instanceof jX||(e=YX(e)),!e)return new uZ;if(e instanceof uZ)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new uZ(o,s,c,e.opacity)}function lZ(e,t,n,r){return arguments.length===1?cZ(e):new uZ(e,t,n,r??1)}function uZ(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}kX(uZ,lZ,AX(jX,{brighter(e){return e=e==null?NX:NX**+e,new uZ(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?MX:MX**+e,new uZ(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new eZ(pZ(e>=240?e-240:e+120,i,r),pZ(e,i,r),pZ(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new uZ(dZ(this.h),fZ(this.s),fZ(this.l),iZ(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=iZ(this.opacity);return`${e===1?`hsl(`:`hsla(`}${dZ(this.h)}, ${fZ(this.s)*100}%, ${fZ(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function dZ(e){return e=(e||0)%360,e<0?e+360:e}function fZ(e){return Math.max(0,Math.min(1,e||0))}function pZ(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var mZ=e=>()=>e;function hZ(e,t){return function(n){return e+n*t}}function gZ(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function _Z(e){return(e=+e)==1?vZ:function(t,n){return n-t?gZ(t,n,e):mZ(isNaN(t)?n:t)}}function vZ(e,t){var n=t-e;return n?hZ(e,n):mZ(isNaN(e)?t:e)}var yZ=function e(t){var n=_Z(t);function r(e,t){var r=n((e=$X(e)).r,(t=$X(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=vZ(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r}(1);function bZ(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function xZ(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function SZ(e,t){for(var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o=0;o<r;++o)i[o]=jZ(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function CZ(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function wZ(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function TZ(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=jZ(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var EZ=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,DZ=new RegExp(EZ.source,`g`);function OZ(e){return function(){return e}}function kZ(e){return function(t){return e(t)+``}}function AZ(e,t){var n=EZ.lastIndex=DZ.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=EZ.exec(e))&&(i=DZ.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:wZ(r,i)})),n=DZ.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?kZ(c[0].x):OZ(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function jZ(e,t){var n=typeof t,r;return t==null||n===`boolean`?mZ(t):(n===`number`?wZ:n===`string`?(r=YX(t))?(t=r,yZ):AZ:t instanceof YX?yZ:t instanceof Date?CZ:xZ(t)?bZ:Array.isArray(t)?SZ:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?TZ:wZ)(e,t)}var MZ=180/Math.PI,NZ={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function PZ(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*MZ,skewX:Math.atan(c)*MZ,scaleX:o,scaleY:s}}var FZ;function IZ(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?NZ:PZ(t.a,t.b,t.c,t.d,t.e,t.f)}function LZ(e){return e==null||(FZ||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),FZ.setAttribute(`transform`,e),!(e=FZ.transform.baseVal.consolidate()))?NZ:(e=e.matrix,PZ(e.a,e.b,e.c,e.d,e.e,e.f))}function RZ(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:wZ(e,i)},{i:c-2,x:wZ(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:wZ(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:wZ(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:wZ(e,n)},{i:s-2,x:wZ(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var zZ=RZ(IZ,`px, `,`px)`,`deg)`),BZ=RZ(LZ,`, `,`)`,`)`),VZ=1e-12;function HZ(e){return((e=Math.exp(e))+1/e)/2}function UZ(e){return((e=Math.exp(e))-1/e)/2}function WZ(e){return((e=Math.exp(2*e))-1)/(e+1)}var GZ=function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<VZ)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=HZ(y),c=s/(n*g)*(i*WZ(t*r+y)-UZ(y));return[a+c*d,o+c*f,s*i/HZ(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i}(Math.SQRT2,2,4),KZ=0,qZ=0,JZ=0,YZ=1e3,XZ,ZZ,QZ=0,$Z=0,eQ=0,tQ=typeof performance==`object`&&performance.now?performance:Date,nQ=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function rQ(){return $Z||=(nQ(iQ),tQ.now()+eQ)}function iQ(){$Z=0}function aQ(){this._call=this._time=this._next=null}aQ.prototype=oQ.prototype={constructor:aQ,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?rQ():+n)+(t==null?0:+t),!this._next&&ZZ!==this&&(ZZ?ZZ._next=this:XZ=this,ZZ=this),this._call=e,this._time=n,dQ()},stop:function(){this._call&&(this._call=null,this._time=1/0,dQ())}};function oQ(e,t,n){var r=new aQ;return r.restart(e,t,n),r}function sQ(){rQ(),++KZ;for(var e=XZ,t;e;)(t=$Z-e._time)>=0&&e._call.call(void 0,t),e=e._next;--KZ}function cQ(){$Z=(QZ=tQ.now())+eQ,KZ=qZ=0;try{sQ()}finally{KZ=0,uQ(),$Z=0}}function lQ(){var e=tQ.now(),t=e-QZ;t>YZ&&(eQ-=t,QZ=e)}function uQ(){for(var e,t=XZ,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:XZ=n);ZZ=e,dQ(r)}function dQ(e){KZ||(qZ&&=clearTimeout(qZ),e-$Z>24?(e<1/0&&(qZ=setTimeout(cQ,e-tQ.now()-eQ)),JZ&&=clearInterval(JZ)):(JZ||=(QZ=tQ.now(),setInterval(lQ,YZ)),KZ=1,nQ(cQ)))}function fQ(e,t,n){var r=new aQ;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var pQ=lJ(`start`,`end`,`cancel`,`interrupt`),mQ=[],hQ=0,gQ=1,_Q=2,vQ=3,yQ=4,bQ=5,xQ=6;function SQ(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;EQ(e,n,{name:t,index:r,group:i,on:pQ,tween:mQ,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:hQ})}function CQ(e,t){var n=TQ(e,t);if(n.state>hQ)throw Error(`too late; already scheduled`);return n}function wQ(e,t){var n=TQ(e,t);if(n.state>vQ)throw Error(`too late; already running`);return n}function TQ(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function EQ(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=oQ(a,0,n.time);function a(e){n.state=gQ,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==gQ)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===vQ)return fQ(o);f.state===yQ?(f.state=xQ,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=xQ,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(fQ(function(){n.state===vQ&&(n.state=yQ,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=_Q,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===_Q){for(n.state=vQ,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=bQ,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===bQ&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=xQ,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function DQ(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>_Q&&r.state<bQ,r.state=xQ,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function OQ(e){return this.each(function(){DQ(this,e)})}function kQ(e,t){var n,r;return function(){var i=wQ(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function AQ(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=wQ(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function jQ(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=TQ(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?kQ:AQ)(n,e,t))}function MQ(e,t,n){var r=e._id;return e.each(function(){var e=wQ(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return TQ(e,r).value[t]}}function NQ(e,t){var n;return(typeof t==`number`?wZ:t instanceof YX?yZ:(n=YX(t))?(t=n,yZ):AZ)(e,t)}function PQ(e){return function(){this.removeAttribute(e)}}function FQ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function IQ(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function LQ(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function RQ(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function zQ(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function BQ(e,t){var n=gJ(e),r=n===`transform`?BZ:NQ;return this.attrTween(e,typeof t==`function`?(n.local?zQ:RQ)(n,r,MQ(this,`attr.`+e,t)):t==null?(n.local?FQ:PQ)(n):(n.local?LQ:IQ)(n,r,t))}function VQ(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function HQ(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function UQ(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&HQ(e,i)),n}return i._value=t,i}function WQ(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&VQ(e,i)),n}return i._value=t,i}function GQ(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=gJ(e);return this.tween(n,(r.local?UQ:WQ)(r,t))}function KQ(e,t){return function(){CQ(this,e).delay=+t.apply(this,arguments)}}function qQ(e,t){return t=+t,function(){CQ(this,e).delay=t}}function JQ(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?KQ:qQ)(t,e)):TQ(this.node(),t).delay}function YQ(e,t){return function(){wQ(this,e).duration=+t.apply(this,arguments)}}function XQ(e,t){return t=+t,function(){wQ(this,e).duration=t}}function ZQ(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?YQ:XQ)(t,e)):TQ(this.node(),t).duration}function QQ(e,t){if(typeof t!=`function`)throw Error();return function(){wQ(this,e).ease=t}}function $Q(e){var t=this._id;return arguments.length?this.each(QQ(t,e)):TQ(this.node(),t).ease}function e$(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();wQ(this,e).ease=n}}function t$(e){if(typeof e!=`function`)throw Error();return this.each(e$(this._id,e))}function n$(e){typeof e!=`function`&&(e=OJ(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new j$(r,this._parents,this._name,this._id)}function r$(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new j$(o,this._parents,this._name,this._id)}function i$(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function a$(e,t,n){var r,i,a=i$(t)?CQ:wQ;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function o$(e,t){var n=this._id;return arguments.length<2?TQ(this.node(),n).on.on(e):this.each(a$(n,e,t))}function s$(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function c$(){return this.on(`end.remove`,s$(this._id))}function l$(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=xJ(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,SQ(l[f],t,n,f,l,TQ(u,n)));return new j$(a,this._parents,t,n)}function u$(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=TJ(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=TQ(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&SQ(p,t,n,h,f,m);a.push(f),o.push(u)}return new j$(a,o,t,n)}var d$=dX.prototype.constructor;function f$(){return new d$(this._groups,this._parents)}function p$(e,t){var n,r,i;return function(){var a=vY(this,e),o=(this.style.removeProperty(e),vY(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function m$(e){return function(){this.style.removeProperty(e)}}function h$(e,t,n){var r,i=n+``,a;return function(){var o=vY(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function g$(e,t,n){var r,i,a;return function(){var o=vY(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),vY(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function _$(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=wQ(this,e),l=c.on,u=c.value[a]==null?s||=m$(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function v$(e,t,n){var r=(e+=``)==`transform`?zZ:NQ;return t==null?this.styleTween(e,p$(e,r)).on(`end.style.`+e,m$(e)):typeof t==`function`?this.styleTween(e,g$(e,r,MQ(this,`style.`+e,t))).each(_$(this._id,e)):this.styleTween(e,h$(e,r,t),n).on(`end.style.`+e,null)}function y$(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function b$(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&y$(e,a,n)),r}return a._value=t,a}function x$(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,b$(e,t,n??``))}function S$(e){return function(){this.textContent=e}}function C$(e){return function(){var t=e(this);this.textContent=t??``}}function w$(e){return this.tween(`text`,typeof e==`function`?C$(MQ(this,`text`,e)):S$(e==null?``:e+``))}function T$(e){return function(t){this.textContent=e.call(this,t)}}function E$(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&T$(r)),t}return r._value=e,r}function D$(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,E$(e))}function O$(){for(var e=this._name,t=this._id,n=M$(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=TQ(c,t);SQ(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new j$(r,this._parents,e,n)}function k$(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=wQ(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var A$=0;function j$(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function M$(){return++A$}var N$=dX.prototype;j$.prototype={constructor:j$,select:l$,selectAll:u$,selectChild:N$.selectChild,selectChildren:N$.selectChildren,filter:n$,merge:r$,selection:f$,transition:O$,call:N$.call,nodes:N$.nodes,node:N$.node,size:N$.size,empty:N$.empty,each:N$.each,on:o$,attr:BQ,attrTween:GQ,style:v$,styleTween:x$,text:w$,textTween:D$,remove:c$,tween:jQ,delay:JQ,duration:ZQ,ease:$Q,easeVarying:t$,end:k$,[Symbol.iterator]:N$[Symbol.iterator]};function P$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var F$={time:null,delay:0,duration:250,ease:P$};function I$(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function L$(e){var t,n;e instanceof j$?(t=e._id,e=e._name):(t=M$(),(n=F$).time=rQ(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&SQ(c,e,t,l,o,n||I$(c,t));return new j$(r,this._parents,e,t)}dX.prototype.interrupt=OQ,dX.prototype.transition=L$;var R$=e=>()=>e;function z$(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function B$(e,t,n){this.k=e,this.x=t,this.y=n}B$.prototype={constructor:B$,scale:function(e){return e===1?this:new B$(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new B$(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var V$=new B$(1,0,0);B$.prototype;function H$(e){e.stopImmediatePropagation()}function U$(e){e.preventDefault(),e.stopImmediatePropagation()}function W$(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function G$(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function K$(){return this.__zoom||V$}function q$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function J$(){return navigator.maxTouchPoints||`ontouchstart`in this}function Y$(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function X$(){var e=W$,t=G$,n=Y$,r=q$,i=J$,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=GZ,l=lJ(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,K$).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,ee).on(`touchend.zoom touchcancel.zoom`,O).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,K$),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(V$.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new B$(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new B$(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new B$(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=pX(this.that).datum();l.call(e,this.that,new z$(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=hX(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],DQ(this),s.start();U$(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=pX(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=hX(t,i),l=t.clientX,u=t.clientY;bX(t.view),H$(t),a.mouse=[c,this.__zoom.invert(c)],DQ(this),a.start();function d(e){if(U$(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=hX(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),xX(e.view,a.moved),U$(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=hX(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);U$(r),s>0?pX(this).transition().duration(s).call(x,d,c,r):pX(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(H$(t),s=0;s<i;++s)c=r[s],l=hX(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),DQ(this),a.start())}}function ee(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(U$(e),s=0;s<a;++s)c=i[s],l=hX(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function O(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(H$(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=hX(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=pX(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:R$(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:R$(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:R$(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:R$([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var Q=(e=>(e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`,e))(Q||{}),Z$=(e=>(e.Partial=`partial`,e.Full=`full`,e))(Z$||{}),Q$=(e=>(e.Bezier=`default`,e.SimpleBezier=`simple-bezier`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e))(Q$||{}),$$=(e=>(e.Strict=`strict`,e.Loose=`loose`,e))($$||{}),e1=(e=>(e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`,e))(e1||{}),t1=(e=>(e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`,e))(t1||{}),n1=(e=>(e.TopLeft=`top-left`,e.TopCenter=`top-center`,e.TopRight=`top-right`,e.BottomLeft=`bottom-left`,e.BottomCenter=`bottom-center`,e.BottomRight=`bottom-right`,e))(n1||{}),r1=[`INPUT`,`SELECT`,`TEXTAREA`],i1=typeof document<`u`?document:null;function a1(e){let t=e.composedPath?.call(e)?.[0]||e.target,n=typeof t?.hasAttribute==`function`&&t.hasAttribute(`contenteditable`),r=typeof t?.closest==`function`?t.closest(`.nokey`):null;return r1.includes(t?.nodeName)||n||!!r}function o1(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function s1(e,t,n,r){let i=t.replace(`+`,`
|
|
283
283
|
`).replace(`
|
|
284
284
|
|
|
285
285
|
`,`
|
|
286
286
|
+`).split(`
|
|
287
|
-
`).map(e=>e.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();r||n.add(e.toLowerCase());let a=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return r&&n.delete(e.toLowerCase()),a}function r1(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=i1(n.code,e);return Array.isArray(e)?e.some(e=>n1(n[r],e,t,n.type===`keyup`)):n1(n[r],e,t,n.type===`keyup`)}}function i1(e,t){return t.includes(e)?`code`:`key`}function a1(e,t){let n=R(()=>a(t?.target)??$$),r=s(a(e)===!0),i=!1,o=new Set,c=u(a(e));C(()=>a(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&l(),c=u(e)},{immediate:!0}),Qq([`blur`,`contextmenu`],l),eJ((...e)=>c(...e),e=>{let n=a(t?.actInsideInputWithModifier)??!0,o=a(t?.preventDefault)??!1;if(i=t1(e),(!i||i&&!n)&&e1(e))return;let s=e.composedPath?.call(e)?.[0]||e.target,c=s?.nodeName===`BUTTON`||s?.nodeName===`A`;!o&&(i||!c)&&e.preventDefault(),r.value=!0},{eventName:`keydown`,target:n}),eJ((...e)=>c(...e),e=>{let n=a(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&e1(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function l(){i=!1,o.clear(),r.value=a(e)===!0}function u(e){return e===null?(l(),()=>!1):typeof e==`boolean`?(l(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?r1(e,o):e}return r}var o1=`vue-flow__node-desc`,s1=`vue-flow__edge-desc`,c1=`vue-flow__aria-live`,l1=[`Enter`,` `,`Escape`],u1={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function d1(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function f1(e,t){let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)}function p1(e){return{width:e.offsetWidth,height:e.offsetHeight}}function m1(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function h1(e,t){return{x:m1(e.x,t[0][0],t[1][0]),y:m1(e.y,t[0][1],t[1][1])}}function g1(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function _1(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function v1(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!_1(e)}function y1(e){return v1(e)&&`computedPosition`in e}function b1(e){return!Number.isNaN(e)&&Number.isFinite(e)}function x1(e){return b1(e.width)&&b1(e.height)&&b1(e.x)&&b1(e.y)}function S1(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:f({width:0,height:0}),computedPosition:f({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:z0(e.data)?e.data:{},events:f(z0(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function C1(e,t,n){let r={id:e.id.toString(),type:e.type??t?.type??`default`,source:e.source.toString(),target:e.target.toString(),sourceHandle:e.sourceHandle?.toString(),targetHandle:e.targetHandle?.toString(),updatable:e.updatable??n?.updatable,selectable:e.selectable??n?.selectable,focusable:e.focusable??n?.focusable,data:z0(e.data)?e.data:{},events:f(z0(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function w1(e,t,n,r){let i=typeof e==`string`?e:e.id,a=new Set,o=r===`source`?`target`:`source`;for(let e of n)e[o]===i&&a.add(e[r]);return t.filter(e=>a.has(e.id))}function T1(...e){if(e.length===3){let[t,n,r]=e;return w1(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>_1(e)&&e.source===r).map(e=>n.find(t=>v1(t)&&t.id===e.target))}function E1(...e){if(e.length===3){let[t,n,r]=e;return w1(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>_1(e)&&e.target===r).map(e=>n.find(t=>v1(t)&&t.id===e.source))}function D1({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function O1(e,t){return t.some(t=>_1(t)&&t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle))}function k1({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function A1({x:e,y:t},{x:n,y:r,zoom:i},a=!1,o=[1,1]){let s={x:(e-n)/i,y:(t-r)/i};return a?S0(s,o):s}function j1(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function M1({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function N1({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function P1(e,t){return N1(j1(M1(e),M1(t)))}function F1(e){let t={x:1/0,y:1/0,x2:-1/0,y2:-1/0};for(let n=0;n<e.length;n++){let r=e[n];t=j1(t,M1({...r.computedPosition,...r.dimensions}))}return N1(t)}function I1(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...A1(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n=!0,hidden:s=!1}=t,c=e.width??t.width??null,l=e.height??t.height??null;if(i&&!n||s)continue;let u=f1(a,d1(t)),d=c===null||l===null,f=r&&u>0,p=(c??0)*(l??0);(d||f||u>=p||t.dragging)&&o.push(t)}return o}function L1(e,t){let n=new Set;if(typeof e==`string`)n.add(e);else if(e.length>=1)for(let t of e)n.add(t.id);return t.filter(e=>n.has(e.source)||n.has(e.target))}function R1(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=Number.parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=Number.parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return F0(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function z1(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=R1(e,n),i=R1(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=R1(e.top??e.y??0,n),i=R1(e.bottom??e.y??0,n),a=R1(e.left??e.x??0,t),o=R1(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function B1(e,t,n,r,i,a){let{x:o,y:s}=k1(e,{x:t,y:n,zoom:r}),{x:c,y:l}=k1({x:e.x+e.width,y:e.y+e.height},{x:t,y:n,zoom:r}),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}function V1(e,t,n,r,i,a=.1){let o=z1(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=m1(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=B1(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}}function H1(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function U1(e,t){if(!e.parentNode)return!1;let n=t.get(e.parentNode);return n?n.selected?!0:U1(n,t):!1}function W1(e,t){return e===void 0?``:typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`}function G1(e){let t=e.ctrlKey&&b0()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function K1(e,t,n){return e<t?m1(Math.abs(e-t),1,t)/t:e>n?-m1(Math.abs(e-n),1,t)/t:0}function q1(e,t,n=15,r=40){return[K1(e.x,r,t.width-r)*n,K1(e.y,r,t.height-r)*n]}function J1(e,t){if(t){let n=e.position.x+e.dimensions.width-t.dimensions.width,r=e.position.y+e.dimensions.height-t.dimensions.height;if(n>0||r>0||e.position.x<0||e.position.y<0){let i={};if(typeof t.style==`function`?i={...t.style(t)}:t.style&&(i={...t.style}),i.width=i.width??`${t.dimensions.width}px`,i.height=i.height??`${t.dimensions.height}px`,n>0){if(typeof i.width==`string`){let e=Number(i.width.replace(`px`,``));i.width=`${e+n}px`}else i.width+=n}if(r>0){if(typeof i.height==`string`){let e=Number(i.height.replace(`px`,``));i.height=`${e+r}px`}else i.height+=r}if(e.position.x<0){let n=Math.abs(e.position.x);if(t.position.x=t.position.x-n,typeof i.width==`string`){let e=Number(i.width.replace(`px`,``));i.width=`${e+n}px`}else i.width+=n;e.position.x=0}if(e.position.y<0){let n=Math.abs(e.position.y);if(t.position.y=t.position.y-n,typeof i.height==`string`){let e=Number(i.height.replace(`px`,``));i.height=`${e+n}px`}else i.height+=n;e.position.y=0}t.dimensions.width=Number(i.width.toString().replace(`px`,``)),t.dimensions.height=Number(i.height.toString().replace(`px`,``)),t.style=typeof t.style==`function`?e=>{let n=t.style;return{...n(e),...i}}:{...t.style,...i}}}}function Y1(e,t){let n=e.filter(e=>e.type===`add`||e.type===`remove`);for(let e of n)if(e.type===`add`)t.findIndex(t=>t.id===e.item.id)===-1&&t.push(e.item);else if(e.type===`remove`){let n=t.findIndex(t=>t.id===e.id);n!==-1&&t.splice(n,1)}let r=t.map(e=>e.id);for(let n of t)for(let i of e)if(i.id===n.id)switch(i.type){case`select`:n.selected=i.selected;break;case`position`:if(y1(n)&&(i.position!==void 0&&(n.position=i.position),i.dragging!==void 0&&(n.dragging=i.dragging),n.expandParent&&n.parentNode)){let e=t[r.indexOf(n.parentNode)];e&&y1(e)&&J1(n,e)}break;case`dimensions`:if(y1(n)&&(i.dimensions!==void 0&&(n.dimensions=i.dimensions),i.updateStyle!==void 0&&i.updateStyle&&(n.style={...n.style||{},width:`${i.dimensions?.width}px`,height:`${i.dimensions?.height}px`}),i.resizing!==void 0&&(n.resizing=i.resizing),n.expandParent&&n.parentNode)){let e=t[r.indexOf(n.parentNode)];e&&y1(e)&&(e.dimensions.width&&e.dimensions.height?J1(n,e):le(()=>{J1(n,e)}))}}return t}function X1(e,t){return{id:e,type:`select`,selected:t}}function Z1(e){return{item:e,type:`add`}}function Q1(e){return{id:e,type:`remove`}}function $1(e,t,n,r,i){return{id:e,source:t,target:n,sourceHandle:r||null,targetHandle:i||null,type:`remove`}}function e0(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);(a.selected!==void 0||e)&&a.selected!==e&&(n&&(a.selected=e),r.push(X1(a.id,e)))}return r}var t0=()=>{};function $(e){let t=new Set,n=t0,r=()=>!1,i=()=>t.size>0||r(),a=e=>{n=e},o=()=>{n=t0},s=e=>{r=e},c=()=>{r=()=>!1},l=e=>{t.delete(e)};return{on:e=>{t.add(e);let n=()=>l(e);return Pq(n),{off:n}},off:l,trigger:r=>{let a=[n];return i()?a.push(...t):e&&a.push(e),Promise.allSettled(a.map(e=>e(r)))},hasListeners:i,listeners:t,setEmitter:a,removeEmitter:o,setHasEmitListeners:s,removeHasEmitListeners:c}}function n0(e,t,n){let r=e;do{if(r&&r.matches(t))return!0;if(r===n)return!1;r=r.parentElement}while(r);return!1}function r0(e,t,n,r){let i=new Map;for(let[a,o]of e)(o.selected||o.id===r)&&(!o.parentNode||!U1(o,e))&&(o.draggable||t&&o.draggable===void 0)&&e.get(a)&&i.set(a,{id:o.id,position:o.position||{x:0,y:0},distance:{x:n.x-o.computedPosition?.x||0,y:n.y-o.computedPosition?.y||0},from:{x:o.computedPosition.x,y:o.computedPosition.y},extent:o.extent,parentNode:o.parentNode,dimensions:{...o.dimensions},expandParent:o.expandParent});return Array.from(i.values())}function i0({id:e,dragItems:t,findNode:n}){let r=[];for(let e of t){let t=n(e.id);t&&r.push(t)}return[e?r.find(t=>t.id===e):r[0],r]}function a0(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function o0(e,t,n){let[r,i,a,o]=typeof e==`string`?[0,0,0,0]:a0(e.padding);return n&&n.computedPosition.x!==void 0&&n.computedPosition.y!==void 0&&n.dimensions.width!==void 0&&n.dimensions.height!==void 0?[[n.computedPosition.x+o,n.computedPosition.y+r],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-a]]:!1}function s0(e,t,n,r){let i=e.extent||n;if((i===`parent`||!Array.isArray(i)&&i?.range===`parent`)&&!e.expandParent){if(e.parentNode&&r&&e.dimensions.width&&e.dimensions.height){let t=o0(i,e,r);t&&(i=t)}else t(new g0(m0.NODE_EXTENT_INVALID,e.id)),i=n}else if(Array.isArray(i)){let e=r?.computedPosition.x||0,t=r?.computedPosition.y||0;i=[[i[0][0]+e,i[0][1]+t],[i[1][0]+e,i[1][1]+t]]}else if(i!==`parent`&&i?.range&&Array.isArray(i.range)){let[e,t,n,a]=a0(i.padding),o=r?.computedPosition.x||0,s=r?.computedPosition.y||0;i=[[i.range[0][0]+o+a,i.range[0][1]+s+e],[i.range[1][0]+o-t,i.range[1][1]+s-n]]}return i===`parent`?[[-1/0,-1/0],[1/0,1/0]]:i}function c0({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function l0(e,t,n,r,i){let a=h1(t,c0(e.dimensions,s0(e,n,r,i)));return{position:{x:a.x-(i?.computedPosition.x||0),y:a.y-(i?.computedPosition.y||0)},computedPosition:a}}function u0(e,t,n=Q.Left,r=!1){let i=(t?.x??0)+e.computedPosition.x,a=(t?.y??0)+e.computedPosition.y,{width:o,height:s}=t??x0(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case Q.Top:return{x:i+o/2,y:a};case Q.Right:return{x:i+o,y:a+s/2};case Q.Bottom:return{x:i+o/2,y:a+s};case Q.Left:return{x:i,y:a+s/2}}}function d0(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function f0({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:a,width:o,height:s,viewport:c}){let l={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+a)};l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);let u=M1({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:o/c.zoom,height:s/c.zoom}),d=Math.max(0,Math.min(u.x2,l.x2)-Math.max(u.x,l.x)),f=Math.max(0,Math.min(u.y2,l.y2)-Math.max(u.y,l.y));return Math.ceil(d*f)>0}function p0(e,t,n=!1){let r=typeof e.zIndex==`number`,i=r?e.zIndex:0,a=t(e.source),o=t(e.target);return!a||!o?0:(n&&(i=r?e.zIndex:Math.max(a.computedPosition.z||0,o.computedPosition.z||0)),i)}var m0=(e=>(e.MISSING_STYLES=`MISSING_STYLES`,e.MISSING_VIEWPORT_DIMENSIONS=`MISSING_VIEWPORT_DIMENSIONS`,e.NODE_INVALID=`NODE_INVALID`,e.NODE_NOT_FOUND=`NODE_NOT_FOUND`,e.NODE_MISSING_PARENT=`NODE_MISSING_PARENT`,e.NODE_TYPE_MISSING=`NODE_TYPE_MISSING`,e.NODE_EXTENT_INVALID=`NODE_EXTENT_INVALID`,e.EDGE_INVALID=`EDGE_INVALID`,e.EDGE_NOT_FOUND=`EDGE_NOT_FOUND`,e.EDGE_SOURCE_MISSING=`EDGE_SOURCE_MISSING`,e.EDGE_TARGET_MISSING=`EDGE_TARGET_MISSING`,e.EDGE_TYPE_MISSING=`EDGE_TYPE_MISSING`,e.EDGE_SOURCE_TARGET_SAME=`EDGE_SOURCE_TARGET_SAME`,e.EDGE_SOURCE_TARGET_MISSING=`EDGE_SOURCE_TARGET_MISSING`,e.EDGE_ORPHANED=`EDGE_ORPHANED`,e.USEVUEFLOW_OPTIONS=`USEVUEFLOW_OPTIONS`,e))(m0||{}),h0={MISSING_STYLES:()=>`It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly`,MISSING_VIEWPORT_DIMENSIONS:()=>`The Vue Flow parent container needs a width and a height to render the graph`,NODE_INVALID:e=>`Node is invalid
|
|
287
|
+
`).map(e=>e.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();r||n.add(e.toLowerCase());let a=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return r&&n.delete(e.toLowerCase()),a}function c1(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=l1(n.code,e);return Array.isArray(e)?e.some(e=>s1(n[r],e,t,n.type===`keyup`)):s1(n[r],e,t,n.type===`keyup`)}}function l1(e,t){return t.includes(e)?`code`:`key`}function u1(e,t){let n=R(()=>a(t?.target)??i1),r=s(a(e)===!0),i=!1,o=new Set,c=u(a(e));C(()=>a(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&l(),c=u(e)},{immediate:!0}),rJ([`blur`,`contextmenu`],l),aJ((...e)=>c(...e),e=>{let n=a(t?.actInsideInputWithModifier)??!0,o=a(t?.preventDefault)??!1;if(i=o1(e),(!i||i&&!n)&&a1(e))return;let s=e.composedPath?.call(e)?.[0]||e.target,c=s?.nodeName===`BUTTON`||s?.nodeName===`A`;!o&&(i||!c)&&e.preventDefault(),r.value=!0},{eventName:`keydown`,target:n}),aJ((...e)=>c(...e),e=>{let n=a(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&a1(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function l(){i=!1,o.clear(),r.value=a(e)===!0}function u(e){return e===null?(l(),()=>!1):typeof e==`boolean`?(l(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?c1(e,o):e}return r}var d1=`vue-flow__node-desc`,f1=`vue-flow__edge-desc`,p1=`vue-flow__aria-live`,m1=[`Enter`,` `,`Escape`],h1={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function g1(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function _1(e,t){let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)}function v1(e){return{width:e.offsetWidth,height:e.offsetHeight}}function y1(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function b1(e,t){return{x:y1(e.x,t[0][0],t[1][0]),y:y1(e.y,t[0][1],t[1][1])}}function x1(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function S1(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function C1(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!S1(e)}function w1(e){return C1(e)&&`computedPosition`in e}function T1(e){return!Number.isNaN(e)&&Number.isFinite(e)}function E1(e){return T1(e.width)&&T1(e.height)&&T1(e.x)&&T1(e.y)}function D1(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:f({width:0,height:0}),computedPosition:f({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:W0(e.data)?e.data:{},events:f(W0(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function O1(e,t,n){let r={id:e.id.toString(),type:e.type??t?.type??`default`,source:e.source.toString(),target:e.target.toString(),sourceHandle:e.sourceHandle?.toString(),targetHandle:e.targetHandle?.toString(),updatable:e.updatable??n?.updatable,selectable:e.selectable??n?.selectable,focusable:e.focusable??n?.focusable,data:W0(e.data)?e.data:{},events:f(W0(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function k1(e,t,n,r){let i=typeof e==`string`?e:e.id,a=new Set,o=r===`source`?`target`:`source`;for(let e of n)e[o]===i&&a.add(e[r]);return t.filter(e=>a.has(e.id))}function A1(...e){if(e.length===3){let[t,n,r]=e;return k1(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>S1(e)&&e.source===r).map(e=>n.find(t=>C1(t)&&t.id===e.target))}function j1(...e){if(e.length===3){let[t,n,r]=e;return k1(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>S1(e)&&e.target===r).map(e=>n.find(t=>C1(t)&&t.id===e.source))}function M1({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function N1(e,t){return t.some(t=>S1(t)&&t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle))}function P1({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function F1({x:e,y:t},{x:n,y:r,zoom:i},a=!1,o=[1,1]){let s={x:(e-n)/i,y:(t-r)/i};return a?D0(s,o):s}function I1(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function L1({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function R1({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function z1(e,t){return R1(I1(L1(e),L1(t)))}function B1(e){let t={x:1/0,y:1/0,x2:-1/0,y2:-1/0};for(let n=0;n<e.length;n++){let r=e[n];t=I1(t,L1({...r.computedPosition,...r.dimensions}))}return R1(t)}function V1(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...F1(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n=!0,hidden:s=!1}=t,c=e.width??t.width??null,l=e.height??t.height??null;if(i&&!n||s)continue;let u=_1(a,g1(t)),d=c===null||l===null,f=r&&u>0,p=(c??0)*(l??0);(d||f||u>=p||t.dragging)&&o.push(t)}return o}function H1(e,t){let n=new Set;if(typeof e==`string`)n.add(e);else if(e.length>=1)for(let t of e)n.add(t.id);return t.filter(e=>n.has(e.source)||n.has(e.target))}function U1(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=Number.parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=Number.parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return B0(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function W1(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=U1(e,n),i=U1(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=U1(e.top??e.y??0,n),i=U1(e.bottom??e.y??0,n),a=U1(e.left??e.x??0,t),o=U1(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function G1(e,t,n,r,i,a){let{x:o,y:s}=P1(e,{x:t,y:n,zoom:r}),{x:c,y:l}=P1({x:e.x+e.width,y:e.y+e.height},{x:t,y:n,zoom:r}),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}function K1(e,t,n,r,i,a=.1){let o=W1(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=y1(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=G1(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}}function q1(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function J1(e,t){if(!e.parentNode)return!1;let n=t.get(e.parentNode);return n?n.selected?!0:J1(n,t):!1}function Y1(e,t){return e===void 0?``:typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`}function X1(e){let t=e.ctrlKey&&T0()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function Z1(e,t,n){return e<t?y1(Math.abs(e-t),1,t)/t:e>n?-y1(Math.abs(e-n),1,t)/t:0}function Q1(e,t,n=15,r=40){return[Z1(e.x,r,t.width-r)*n,Z1(e.y,r,t.height-r)*n]}function $1(e,t){if(t){let n=e.position.x+e.dimensions.width-t.dimensions.width,r=e.position.y+e.dimensions.height-t.dimensions.height;if(n>0||r>0||e.position.x<0||e.position.y<0){let i={};if(typeof t.style==`function`?i={...t.style(t)}:t.style&&(i={...t.style}),i.width=i.width??`${t.dimensions.width}px`,i.height=i.height??`${t.dimensions.height}px`,n>0){if(typeof i.width==`string`){let e=Number(i.width.replace(`px`,``));i.width=`${e+n}px`}else i.width+=n}if(r>0){if(typeof i.height==`string`){let e=Number(i.height.replace(`px`,``));i.height=`${e+r}px`}else i.height+=r}if(e.position.x<0){let n=Math.abs(e.position.x);if(t.position.x=t.position.x-n,typeof i.width==`string`){let e=Number(i.width.replace(`px`,``));i.width=`${e+n}px`}else i.width+=n;e.position.x=0}if(e.position.y<0){let n=Math.abs(e.position.y);if(t.position.y=t.position.y-n,typeof i.height==`string`){let e=Number(i.height.replace(`px`,``));i.height=`${e+n}px`}else i.height+=n;e.position.y=0}t.dimensions.width=Number(i.width.toString().replace(`px`,``)),t.dimensions.height=Number(i.height.toString().replace(`px`,``)),t.style=typeof t.style==`function`?e=>{let n=t.style;return{...n(e),...i}}:{...t.style,...i}}}}function e0(e,t){let n=e.filter(e=>e.type===`add`||e.type===`remove`);for(let e of n)if(e.type===`add`)t.findIndex(t=>t.id===e.item.id)===-1&&t.push(e.item);else if(e.type===`remove`){let n=t.findIndex(t=>t.id===e.id);n!==-1&&t.splice(n,1)}let r=t.map(e=>e.id);for(let n of t)for(let i of e)if(i.id===n.id)switch(i.type){case`select`:n.selected=i.selected;break;case`position`:if(w1(n)&&(i.position!==void 0&&(n.position=i.position),i.dragging!==void 0&&(n.dragging=i.dragging),n.expandParent&&n.parentNode)){let e=t[r.indexOf(n.parentNode)];e&&w1(e)&&$1(n,e)}break;case`dimensions`:if(w1(n)&&(i.dimensions!==void 0&&(n.dimensions=i.dimensions),i.updateStyle!==void 0&&i.updateStyle&&(n.style={...n.style||{},width:`${i.dimensions?.width}px`,height:`${i.dimensions?.height}px`}),i.resizing!==void 0&&(n.resizing=i.resizing),n.expandParent&&n.parentNode)){let e=t[r.indexOf(n.parentNode)];e&&w1(e)&&(e.dimensions.width&&e.dimensions.height?$1(n,e):le(()=>{$1(n,e)}))}}return t}function t0(e,t){return{id:e,type:`select`,selected:t}}function n0(e){return{item:e,type:`add`}}function r0(e){return{id:e,type:`remove`}}function i0(e,t,n,r,i){return{id:e,source:t,target:n,sourceHandle:r||null,targetHandle:i||null,type:`remove`}}function a0(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);(a.selected!==void 0||e)&&a.selected!==e&&(n&&(a.selected=e),r.push(t0(a.id,e)))}return r}var o0=()=>{};function $(e){let t=new Set,n=o0,r=()=>!1,i=()=>t.size>0||r(),a=e=>{n=e},o=()=>{n=o0},s=e=>{r=e},c=()=>{r=()=>!1},l=e=>{t.delete(e)};return{on:e=>{t.add(e);let n=()=>l(e);return zq(n),{off:n}},off:l,trigger:r=>{let a=[n];return i()?a.push(...t):e&&a.push(e),Promise.allSettled(a.map(e=>e(r)))},hasListeners:i,listeners:t,setEmitter:a,removeEmitter:o,setHasEmitListeners:s,removeHasEmitListeners:c}}function s0(e,t,n){let r=e;do{if(r&&r.matches(t))return!0;if(r===n)return!1;r=r.parentElement}while(r);return!1}function c0(e,t,n,r){let i=new Map;for(let[a,o]of e)(o.selected||o.id===r)&&(!o.parentNode||!J1(o,e))&&(o.draggable||t&&o.draggable===void 0)&&e.get(a)&&i.set(a,{id:o.id,position:o.position||{x:0,y:0},distance:{x:n.x-o.computedPosition?.x||0,y:n.y-o.computedPosition?.y||0},from:{x:o.computedPosition.x,y:o.computedPosition.y},extent:o.extent,parentNode:o.parentNode,dimensions:{...o.dimensions},expandParent:o.expandParent});return Array.from(i.values())}function l0({id:e,dragItems:t,findNode:n}){let r=[];for(let e of t){let t=n(e.id);t&&r.push(t)}return[e?r.find(t=>t.id===e):r[0],r]}function u0(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function d0(e,t,n){let[r,i,a,o]=typeof e==`string`?[0,0,0,0]:u0(e.padding);return n&&n.computedPosition.x!==void 0&&n.computedPosition.y!==void 0&&n.dimensions.width!==void 0&&n.dimensions.height!==void 0?[[n.computedPosition.x+o,n.computedPosition.y+r],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-a]]:!1}function f0(e,t,n,r){let i=e.extent||n;if((i===`parent`||!Array.isArray(i)&&i?.range===`parent`)&&!e.expandParent){if(e.parentNode&&r&&e.dimensions.width&&e.dimensions.height){let t=d0(i,e,r);t&&(i=t)}else t(new x0(y0.NODE_EXTENT_INVALID,e.id)),i=n}else if(Array.isArray(i)){let e=r?.computedPosition.x||0,t=r?.computedPosition.y||0;i=[[i[0][0]+e,i[0][1]+t],[i[1][0]+e,i[1][1]+t]]}else if(i!==`parent`&&i?.range&&Array.isArray(i.range)){let[e,t,n,a]=u0(i.padding),o=r?.computedPosition.x||0,s=r?.computedPosition.y||0;i=[[i.range[0][0]+o+a,i.range[0][1]+s+e],[i.range[1][0]+o-t,i.range[1][1]+s-n]]}return i===`parent`?[[-1/0,-1/0],[1/0,1/0]]:i}function p0({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function m0(e,t,n,r,i){let a=b1(t,p0(e.dimensions,f0(e,n,r,i)));return{position:{x:a.x-(i?.computedPosition.x||0),y:a.y-(i?.computedPosition.y||0)},computedPosition:a}}function h0(e,t,n=Q.Left,r=!1){let i=(t?.x??0)+e.computedPosition.x,a=(t?.y??0)+e.computedPosition.y,{width:o,height:s}=t??E0(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case Q.Top:return{x:i+o/2,y:a};case Q.Right:return{x:i+o,y:a+s/2};case Q.Bottom:return{x:i+o/2,y:a+s};case Q.Left:return{x:i,y:a+s/2}}}function g0(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function _0({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:a,width:o,height:s,viewport:c}){let l={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+a)};l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);let u=L1({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:o/c.zoom,height:s/c.zoom}),d=Math.max(0,Math.min(u.x2,l.x2)-Math.max(u.x,l.x)),f=Math.max(0,Math.min(u.y2,l.y2)-Math.max(u.y,l.y));return Math.ceil(d*f)>0}function v0(e,t,n=!1){let r=typeof e.zIndex==`number`,i=r?e.zIndex:0,a=t(e.source),o=t(e.target);return!a||!o?0:(n&&(i=r?e.zIndex:Math.max(a.computedPosition.z||0,o.computedPosition.z||0)),i)}var y0=(e=>(e.MISSING_STYLES=`MISSING_STYLES`,e.MISSING_VIEWPORT_DIMENSIONS=`MISSING_VIEWPORT_DIMENSIONS`,e.NODE_INVALID=`NODE_INVALID`,e.NODE_NOT_FOUND=`NODE_NOT_FOUND`,e.NODE_MISSING_PARENT=`NODE_MISSING_PARENT`,e.NODE_TYPE_MISSING=`NODE_TYPE_MISSING`,e.NODE_EXTENT_INVALID=`NODE_EXTENT_INVALID`,e.EDGE_INVALID=`EDGE_INVALID`,e.EDGE_NOT_FOUND=`EDGE_NOT_FOUND`,e.EDGE_SOURCE_MISSING=`EDGE_SOURCE_MISSING`,e.EDGE_TARGET_MISSING=`EDGE_TARGET_MISSING`,e.EDGE_TYPE_MISSING=`EDGE_TYPE_MISSING`,e.EDGE_SOURCE_TARGET_SAME=`EDGE_SOURCE_TARGET_SAME`,e.EDGE_SOURCE_TARGET_MISSING=`EDGE_SOURCE_TARGET_MISSING`,e.EDGE_ORPHANED=`EDGE_ORPHANED`,e.USEVUEFLOW_OPTIONS=`USEVUEFLOW_OPTIONS`,e))(y0||{}),b0={MISSING_STYLES:()=>`It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly`,MISSING_VIEWPORT_DIMENSIONS:()=>`The Vue Flow parent container needs a width and a height to render the graph`,NODE_INVALID:e=>`Node is invalid
|
|
288
288
|
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
|
|
289
289
|
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
|
|
290
290
|
Node: ${e}
|
|
@@ -304,6 +304,6 @@ Edge: ${e}
|
|
|
304
304
|
Source: ${t}
|
|
305
305
|
Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
|
|
306
306
|
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
|
|
307
|
-
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},g0=class extends Error{constructor(e,...t){super(h0[e]?.call(h0,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function _0(e){return`clientX`in e}function v0(e){return`sourceEvent`in e}function y0(e,t){let n=_0(e),r,i;return n?(r=e.clientX,i=e.clientY):`touches`in e&&e.touches.length>0?(r=e.touches[0].clientX,i=e.touches[0].clientY):`changedTouches`in e&&e.changedTouches.length>0?(r=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(r=0,i=0),{x:r-(t?.left??0),y:i-(t?.top??0)}}var b0=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function x0(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function S0(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var C0=()=>!0;function w0(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function T0(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())f1(i,d1(e))>0&&r.push(e);return r}var E0=250;function D0(e,t,n,r){let i=[],a=1/0,o=T0(e,n,t+E0);for(let n of o){let o=[...n.handleBounds?.source??[],...n.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=u0(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function O0(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=C0},u,d,f,p){let m=a===`target`,h=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:_}=y0(e),v=o.elementFromPoint(g,_),y=v?.classList.contains(`${s}-flow__handle`)?v:h,b={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){let e=k0(void 0,y),t=y.getAttribute(`data-nodeid`),a=y.getAttribute(`data-handleid`),o=y.classList.contains(`connectable`),s=y.classList.contains(`connectableend`);if(!t||!e)return b;let c={source:m?t:r,sourceHandle:m?a:i,target:m?r:t,targetHandle:m?i:a};b.connection=c,b.isValid=o&&s&&(n===J$.Strict?m&&e===`source`||!m&&e===`target`:t!==r||a!==i)&&l(c,{nodes:d,edges:u,sourceNode:f(c.source),targetNode:f(c.target)}),b.toHandle=M0(t,e,a,p,n,!0)}return b}function k0(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function A0(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function j0(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function M0(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===J$.Strict?o.handleBounds?.[t]:[...o.handleBounds?.source??[],...o.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...u0(o,c,c.position,!0)}:c}var N0={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top},P0=[`production`,`prod`];function F0(e,...t){I0()&&console.warn(`[Vue Flow]: ${e}`,...t)}function I0(){return!P0.includes(`production`)}function L0(e,t,n,r,i){let a=t.querySelectorAll(`.vue-flow__handle.${e}`);return a?.length?Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...p1(t)}}):null}function R0(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),le(()=>{o.blur()})):n([e])}function z0(e){return r(e)!==void 0}function B0(e,t,n,r){if(!e||!e.source||!e.target)return n(new g0(m0.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=_1(e)?e:{...e,id:D1(e)},i=C1(i,void 0,r),!O1(i,t)&&i}function V0(e,t,n,r,i){if(!t.source||!t.target)return i(new g0(m0.EDGE_INVALID,e.id)),!1;if(!n)return i(new g0(m0.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?D1(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function H0(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!v1(o)){n(new g0(m0.NODE_INVALID,o?.id));continue}let s=S1(o,t(o.id),o.parentNode);o.parentNode&&(r[o.parentNode]=!0),i[a]=s}for(let e of i){let a=t(e.parentNode)||i.find(t=>t.id===e.parentNode);e.parentNode&&!a&&n(new g0(m0.NODE_MISSING_PARENT,e.id,e.parentNode)),(e.parentNode||r[e.id])&&(r[e.id]&&(e.isParent=!0),a&&(a.isParent=!0))}return i}function U0(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function W0(e,t,n){e.clear();for(let t of n){let{source:n,target:r,sourceHandle:i=null,targetHandle:a=null}=t,o={edgeId:t.id,source:n,target:r,sourceHandle:i,targetHandle:a},s=`${n}-${i}--${r}-${a}`;U0(`source`,o,`${r}-${a}--${n}-${i}`,e,n,i),U0(`target`,o,s,e,r,a)}}function G0(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function K0(e,t,n,r,i,a,o,s){let c=[];for(let l of e){let e=_1(l)?l:B0(l,s,i,a);if(!e)continue;let u=n(e.source),d=n(e.target);if(!u||!d){i(new g0(m0.EDGE_SOURCE_TARGET_MISSING,e.id,e.source,e.target));continue}if(!u){i(new g0(m0.EDGE_SOURCE_MISSING,e.id,e.source));continue}if(!d){i(new g0(m0.EDGE_TARGET_MISSING,e.id,e.target));continue}if(t&&!t(e,{edges:s,nodes:o,sourceNode:u,targetNode:d})){i(new g0(m0.EDGE_INVALID,e.id));continue}let f=r(e.id);c.push({...C1(e,f,a),sourceNode:u,targetNode:d})}return c}var q0=Symbol(`vueFlow`),J0=Symbol(`nodeId`),Y0=Symbol(`nodeRef`),X0=Symbol(`edgeId`),Z0=Symbol(`edgeRef`),Q0=Symbol(`slots`);function $0(e){let{vueFlowRef:t,snapToGrid:n,snapGrid:r,noDragClassName:i,nodeLookup:o,nodeExtent:c,nodeDragThreshold:l,viewport:u,autoPanOnNodeDrag:d,autoPanSpeed:f,nodesDraggable:p,panBy:m,findNode:h,multiSelectionActive:g,nodesSelectionActive:_,selectNodesOnDrag:v,removeSelectedElements:y,addSelectedNodes:b,updateNodePositions:x,emits:S}=s4(),{onStart:w,onDrag:T,onStop:E,onClick:D,el:ee,disabled:O,id:k,selectable:A,dragHandle:j}=e,M=s(!1),N=[],P,F=null,I={x:void 0,y:void 0},L={x:0,y:0},te=null,R=!1,ne=!1,re=0,z=!1,B=n2(),ie=({x:e,y:t})=>{I={x:e,y:t};let i=!1;if(N=N.map(a=>{let o={x:e-a.distance.x,y:t-a.distance.y},{computedPosition:s}=l0(a,n.value?S0(o,r.value):o,S.error,c.value,a.parentNode?h(a.parentNode):void 0);return i=i||a.position.x!==s.x||a.position.y!==s.y,a.position=s,a}),ne||=i,i&&(x(N,!0,!0),M.value=!0,te)){let[e,t]=i0({id:k,dragItems:N,findNode:h});T({event:te,node:e,nodes:t})}},V=()=>{if(!F)return;let[e,t]=q1(L,F,f.value);if(e!==0||t!==0){let n={x:(I.x??0)-e/u.value.zoom,y:(I.y??0)-t/u.value.zoom};m({x:e,y:t})&&ie(n)}re=requestAnimationFrame(V)},ae=(e,t)=>{R=!0;let n=h(k);!v.value&&!g.value&&n&&(n.selected||y()),n&&a(A)&&v.value&&R0(n,g.value,b,y,_,!1,t);let r=B(e.sourceEvent);if(I=r,N=r0(o.value,p.value,r,k),N.length){let[t,n]=i0({id:k,dragItems:N,findNode:h});w({event:e.sourceEvent,node:t,nodes:n})}},H=(e,n)=>{e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||(ne=!1,l.value===0&&ae(e,n),I=B(e.sourceEvent),F=t.value?.getBoundingClientRect()||null,L=y0(e.sourceEvent,F))},U=(e,t)=>{let n=B(e.sourceEvent);if(!z&&R&&d.value&&(z=!0,V()),!R){let r=n.xSnapped-(I.x??0),i=n.ySnapped-(I.y??0);Math.sqrt(r*r+i*i)>l.value&&ae(e,t)}(I.x!==n.xSnapped||I.y!==n.ySnapped)&&N.length&&R&&(te=e.sourceEvent,L=y0(e.sourceEvent,F),ie(n))},oe=e=>{let t=!1;if(!R&&!M.value&&!g.value){let n=e.sourceEvent,r=B(n),i=r.xSnapped-(I.x??0),a=r.ySnapped-(I.y??0),o=Math.sqrt(i*i+a*a);o!==0&&o<=l.value&&(D?.(n),t=!0)}if(N.length&&!t){ne&&=(x(N,!1,!1),!1);let[t,n]=i0({id:k,dragItems:N,findNode:h});E({event:e.sourceEvent,node:t,nodes:n})}N=[],M.value=!1,z=!1,R=!1,I={x:void 0,y:void 0},cancelAnimationFrame(re)};return C([()=>a(O),ee],([e,t],n,r)=>{if(t){let n=cX(t);e||(P=CX().on(`start`,e=>H(e,t)).on(`drag`,e=>U(e,t)).on(`end`,e=>oe(e)).filter(e=>{let n=e.target,r=a(j);return!e.button&&(!i.value||!n0(n,`.${i.value}`,t)&&(!r||n0(n,r,t)))}),n.call(P)),r(()=>{n.on(`.drag`,null),P&&(P.on(`start`,null),P.on(`drag`,null),P.on(`end`,null))})}}),M}function e2(){return{doubleClick:$(),click:$(),mouseEnter:$(),mouseMove:$(),mouseLeave:$(),contextMenu:$(),updateStart:$(),update:$(),updateEnd:$()}}function t2(e,t){let n=e2();return n.doubleClick.on(n=>{var r,i;t.edgeDoubleClick(n),(i=(r=e.events)?.doubleClick)==null||i.call(r,n)}),n.click.on(n=>{var r,i;t.edgeClick(n),(i=(r=e.events)?.click)==null||i.call(r,n)}),n.mouseEnter.on(n=>{var r,i;t.edgeMouseEnter(n),(i=(r=e.events)?.mouseEnter)==null||i.call(r,n)}),n.mouseMove.on(n=>{var r,i;t.edgeMouseMove(n),(i=(r=e.events)?.mouseMove)==null||i.call(r,n)}),n.mouseLeave.on(n=>{var r,i;t.edgeMouseLeave(n),(i=(r=e.events)?.mouseLeave)==null||i.call(r,n)}),n.contextMenu.on(n=>{var r,i;t.edgeContextMenu(n),(i=(r=e.events)?.contextMenu)==null||i.call(r,n)}),n.updateStart.on(n=>{var r,i;t.edgeUpdateStart(n),(i=(r=e.events)?.updateStart)==null||i.call(r,n)}),n.update.on(n=>{var r,i;t.edgeUpdate(n),(i=(r=e.events)?.update)==null||i.call(r,n)}),n.updateEnd.on(n=>{var r,i;t.edgeUpdateEnd(n),(i=(r=e.events)?.updateEnd)==null||i.call(r,n)}),Object.entries(n).reduce((e,[t,n])=>(e.emit[t]=n.trigger,e.on[t]=n.on,e),{emit:{},on:{}})}function n2(){let{viewport:e,snapGrid:t,snapToGrid:n,vueFlowRef:r}=s4();return i=>{let a=r.value?.getBoundingClientRect()??{left:0,top:0},{x:o,y:s}=y0(v0(i)?i.sourceEvent:i,a),c=A1({x:o,y:s},e.value),{x:l,y:u}=n.value?S0(c,t.value):c;return{xSnapped:l,ySnapped:u,...c}}}function r2(){return!0}function i2({handleId:e,nodeId:t,type:n,isValidConnection:r,edgeUpdaterType:i,onEdgeUpdate:o,onEdgeUpdateEnd:s}){let{id:c,vueFlowRef:l,connectionMode:u,connectionRadius:d,connectOnClick:f,connectionClickStartHandle:p,nodesConnectable:m,autoPanOnConnect:h,autoPanSpeed:g,findNode:_,panBy:v,startConnection:y,updateConnection:b,endConnection:x,emits:S,viewport:C,edges:w,nodes:T,isValidConnection:E,nodeLookup:D}=s4(),ee=null,O=!1,k=null;function A(f){let p=a(n)===`target`,m=_0(f),A=g1(f.target),j=f.currentTarget;if(j&&(m&&f.button===0||!m)){let n=function(n){z=y0(n,R),P=D0(A1(z,C.value,!1,[1,1]),d.value,D.value,V),B||=(ie(),!0);let r=O0(n,{handle:P,connectionMode:u.value,fromNodeId:a(t),fromHandleId:a(e),fromType:p?`target`:`source`,isValidConnection:N,doc:A,lib:`vue`,flowId:c,nodeLookup:D.value},w.value,T.value,_,D.value);k=r.handleDomNode,ee=r.connection,O=j0(!!P,r.isValid);let i={...U,isValid:O,to:r.toHandle&&O?k1({x:r.toHandle.x,y:r.toHandle.y},C.value):z,toHandle:r.toHandle,toPosition:O&&r.toHandle?r.toHandle.position:N0[V.position],toNode:r.toHandle?D.value.get(r.toHandle.nodeId):null};if(O&&P&&U?.toHandle&&i.toHandle&&U.toHandle.type===i.toHandle.type&&U.toHandle.nodeId===i.toHandle.nodeId&&U.toHandle.id===i.toHandle.id&&U.to.x===i.to.x&&U.to.y===i.to.y)return;let o=P??r.toHandle;if(b(o&&O?k1({x:o.x,y:o.y},C.value):z,o,A0(!!o,O)),U=i,!P&&!O&&!k)return w0(re);ee&&ee.source!==ee.target&&k&&(w0(re),re=k,k.classList.add(`connecting`,`vue-flow__handle-connecting`),k.classList.toggle(`valid`,!!O),k.classList.toggle(`vue-flow__handle-valid`,!!O))},m=function(e){`touches`in e&&e.touches.length>0||((P||k)&&ee&&O&&(o?o(e,ee):S.connect(ee)),S.connectEnd(e),i&&s?.(e),w0(re),cancelAnimationFrame(F),x(e),B=!1,O=!1,ee=null,k=null,A.removeEventListener(`mousemove`,n),A.removeEventListener(`mouseup`,m),A.removeEventListener(`touchmove`,n),A.removeEventListener(`touchend`,m))},M=_(a(t)),N=a(r)||E.value||r2;!N&&M&&(N=(p?M.isValidSourcePos:M.isValidTargetPos)||r2);let P,F=0,{x:I,y:L}=y0(f),te=k0(a(i),j),R=l.value?.getBoundingClientRect();if(!R||!te)return;let ne=M0(a(t),te,a(e),D.value,u.value);if(!ne)return;let re,z=y0(f,R),B=!1,ie=()=>{if(!h.value)return;let[e,t]=q1(z,R,g.value);v({x:e,y:t}),F=requestAnimationFrame(ie)},V={...ne,nodeId:a(t),type:te,position:ne.position},ae=D.value.get(a(t)),H={inProgress:!0,isValid:null,from:u0(ae,V,Q.Left,!0),fromHandle:V,fromPosition:V.position,fromNode:ae,to:z,toHandle:null,toPosition:N0[V.position],toNode:null};y({nodeId:a(t),id:a(e),type:te,position:j?.getAttribute(`data-handlepos`)||Q.Top,...z},{x:I-R.left,y:L-R.top}),S.connectStart({event:f,nodeId:a(t),handleId:a(e),handleType:te});let U=H;A.addEventListener(`mousemove`,n),A.addEventListener(`mouseup`,m),A.addEventListener(`touchmove`,n),A.addEventListener(`touchend`,m)}}function j(i){if(!f.value)return;let o=a(n)===`target`;if(!p.value){S.clickConnectStart({event:i,nodeId:a(t),handleId:a(e)}),y({nodeId:a(t),type:a(n),id:a(e),position:Q.Top,...y0(i)},void 0,!0);return}let s=a(r)||E.value||r2,l=_(a(t));if(!s&&l&&(s=(o?l.isValidSourcePos:l.isValidTargetPos)||r2),l&&(l.connectable===void 0?m.value:l.connectable)===!1)return;let d=g1(i.target),h=O0(i,{handle:{nodeId:a(t),id:a(e),type:a(n),position:Q.Top,...y0(i)},connectionMode:u.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:s,doc:d,lib:`vue`,flowId:c,nodeLookup:D.value},w.value,T.value,_,D.value),g=h.connection?.source===h.connection?.target;h.isValid&&h.connection&&!g&&S.connect(h.connection),S.clickConnectEnd(i),x(i,!0)}return{handlePointerDown:A,handleClick:j}}function a2(){return w(J0,``)}function o2(e){let t=e??a2()??``,n=w(Y0,i(null)),{findNode:r,edges:a,emits:o}=s4(),s=r(t);return s||o.error(new g0(m0.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:s,parentNode:R(()=>r(s.parentNode)),connectedEdges:R(()=>L1([s],a.value))}}function s2(){return{doubleClick:$(),click:$(),mouseEnter:$(),mouseMove:$(),mouseLeave:$(),contextMenu:$(),dragStart:$(),drag:$(),dragStop:$()}}function c2(e,t){let n=s2();return n.doubleClick.on(n=>{var r,i;t.nodeDoubleClick(n),(i=(r=e.events)?.doubleClick)==null||i.call(r,n)}),n.click.on(n=>{var r,i;t.nodeClick(n),(i=(r=e.events)?.click)==null||i.call(r,n)}),n.mouseEnter.on(n=>{var r,i;t.nodeMouseEnter(n),(i=(r=e.events)?.mouseEnter)==null||i.call(r,n)}),n.mouseMove.on(n=>{var r,i;t.nodeMouseMove(n),(i=(r=e.events)?.mouseMove)==null||i.call(r,n)}),n.mouseLeave.on(n=>{var r,i;t.nodeMouseLeave(n),(i=(r=e.events)?.mouseLeave)==null||i.call(r,n)}),n.contextMenu.on(n=>{var r,i;t.nodeContextMenu(n),(i=(r=e.events)?.contextMenu)==null||i.call(r,n)}),n.dragStart.on(n=>{var r,i;t.nodeDragStart(n),(i=(r=e.events)?.dragStart)==null||i.call(r,n)}),n.drag.on(n=>{var r,i;t.nodeDrag(n),(i=(r=e.events)?.drag)==null||i.call(r,n)}),n.dragStop.on(n=>{var r,i;t.nodeDragStop(n),(i=(r=e.events)?.dragStop)==null||i.call(r,n)}),Object.entries(n).reduce((e,[t,n])=>(e.emit[t]=n.trigger,e.on[t]=n.on,e),{emit:{},on:{}})}function l2(){let{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:r,snapGrid:i,snapToGrid:a,nodesDraggable:o,emits:s}=s4();return(c,l=!1)=>{let u=a.value?i.value[0]:5,d=a.value?i.value[1]:5,f=l?4:1,p=c.x*u*f,m=c.y*d*f,h=[];for(let n of e.value)if(n.draggable||o&&n.draggable===void 0){let{position:e}=l0(n,{x:n.computedPosition.x+p,y:n.computedPosition.y+m},s.error,t.value,n.parentNode?r(n.parentNode):void 0);h.push({id:n.id,position:e,from:n.position,distance:{x:c.x,y:c.y},dimensions:n.dimensions})}n(h,!0,!1)}}var u2=.1,d2=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function f2(){return F0(`Viewport not initialized yet.`),Promise.resolve(!1)}var p2={zoomIn:f2,zoomOut:f2,zoomTo:f2,fitView:f2,setCenter:f2,fitBounds:f2,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:f2,setTransform:f2,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function m2(e){function t(t,n){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(n?.interpolate===`linear`?EZ:BZ).scaleBy(h2(e.d3Selection,n?.duration,n?.ease,()=>{r(!0)}),t):r(!1)})}function n(t,n,r,i){return new Promise(a=>{var o;let{x:s,y:c}=h1({x:-t,y:-n},e.translateExtent),l=I$.translate(-s,-c).scale(r);e.d3Selection&&e.d3Zoom?(o=e.d3Zoom)==null||o.interpolate(i?.interpolate===`linear`?EZ:BZ).transform(h2(e.d3Selection,i?.duration,i?.ease,()=>{a(!0)}),l):a(!1)})}return R(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:e=>t(1.2,e),zoomOut:e=>t(1/1.2,e),zoomTo:(t,n)=>new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(n?.interpolate===`linear`?EZ:BZ).scaleTo(h2(e.d3Selection,n?.duration,n?.ease,()=>{r(!0)}),t):r(!1)}),setViewport:(e,t)=>n(e.x,e.y,e.zoom,t),setTransform:(e,t)=>n(e.x,e.y,e.zoom,t),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(t={padding:u2,includeHiddenNodes:!1,duration:0})=>{let r=[];for(let n of e.nodes)n.dimensions.width&&n.dimensions.height&&(t?.includeHiddenNodes||!n.hidden)&&(!t.nodes?.length||t.nodes?.length&&t.nodes.includes(n.id))&&r.push(n);if(!r.length)return Promise.resolve(!1);let{x:i,y:a,zoom:o}=V1(F1(r),e.dimensions.width,e.dimensions.height,t.minZoom??e.minZoom,t.maxZoom??e.maxZoom,t.padding??u2);return n(i,a,o,t)},setCenter:(t,r,i)=>{let a=i?.zoom===void 0?e.maxZoom:i.zoom;return n(e.dimensions.width/2-t*a,e.dimensions.height/2-r*a,a,i)},fitBounds:(t,r={padding:u2})=>{let{x:i,y:a,zoom:o}=V1(t,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??u2);return n(i,a,o,r)},project:t=>A1(t,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:t=>{if(e.vueFlowRef){let{x:n,y:r}=e.vueFlowRef.getBoundingClientRect();return A1({x:t.x-n,y:t.y-r},e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:t=>{if(e.vueFlowRef){let{x:n,y:r}=e.vueFlowRef.getBoundingClientRect();return k1({x:t.x+n,y:t.y+r},e.viewport)}return{x:0,y:0}}}:p2)}function h2(e,t=0,n=d2,r=()=>{}){let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e}function g2(e,t,n){let r=d(!0);return r.run(()=>{r.run(()=>{let t,r,i=!!(n.nodes.value.length||n.edges.value.length);t=Kq([e.modelValue,()=>e.modelValue?.value?.length],([e])=>{e&&Array.isArray(e)&&(r?.pause(),n.setElements(e),!r&&!i&&e.length?i=!0:r?.resume())}),r=Kq([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([n,r])=>{e.modelValue?.value&&Array.isArray(e.modelValue.value)&&(t?.pause(),e.modelValue.value=[...n,...r],le(()=>{t?.resume()}))},{immediate:i}),u(()=>{t?.stop(),r?.stop()})}),r.run(()=>{let t,r,i=!!n.nodes.value.length;t=Kq([e.nodes,()=>e.nodes?.value?.length],([e])=>{e&&Array.isArray(e)&&(r?.pause(),n.setNodes(e),!r&&!i&&e.length?i=!0:r?.resume())}),r=Kq([n.nodes,()=>n.nodes.value.length],([n])=>{e.nodes?.value&&Array.isArray(e.nodes.value)&&(t?.pause(),e.nodes.value=[...n],le(()=>{t?.resume()}))},{immediate:i}),u(()=>{t?.stop(),r?.stop()})}),r.run(()=>{let t,r,i=!!n.edges.value.length;t=Kq([e.edges,()=>e.edges?.value?.length],([e])=>{e&&Array.isArray(e)&&(r?.pause(),n.setEdges(e),!r&&!i&&e.length?i=!0:r?.resume())}),r=Kq([n.edges,()=>n.edges.value.length],([n])=>{e.edges?.value&&Array.isArray(e.edges.value)&&(t?.pause(),e.edges.value=[...n],le(()=>{t?.resume()}))},{immediate:i}),u(()=>{t?.stop(),r?.stop()})}),r.run(()=>{C(()=>t.minZoom,()=>{t.minZoom&&z0(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})}),r.run(()=>{C(()=>t.maxZoom,()=>{t.maxZoom&&z0(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})}),r.run(()=>{C(()=>t.translateExtent,()=>{t.translateExtent&&z0(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})}),r.run(()=>{C(()=>t.nodeExtent,()=>{t.nodeExtent&&z0(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})}),r.run(()=>{C(()=>t.applyDefault,()=>{z0(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})}),r.run(()=>{let e=async e=>{let r=e;typeof t.autoConnect==`function`&&(r=await t.autoConnect(e)),r!==!1&&n.addEdges([r])};C(()=>t.autoConnect,()=>{z0(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),C(n.autoConnect,(t,r,i)=>{t?n.onConnect(e):n.hooks.value.connect.off(e),i(()=>{n.hooks.value.connect.off(e)})},{immediate:!0})}),(()=>{let e=[`id`,`modelValue`,`translateExtent`,`nodeExtent`,`edges`,`nodes`,`maxZoom`,`minZoom`,`applyDefault`,`autoConnect`];for(let i of Object.keys(t)){let a=i;if(!e.includes(a)){let e=o(()=>t[a]),i=n[a];m(i)&&r.run(()=>{C(e,e=>{z0(e)&&(i.value=e)},{immediate:!0})})}}})()}),()=>r.stop()}function _2(){return{edgesChange:$(),nodesChange:$(),nodeDoubleClick:$(),nodeClick:$(),nodeMouseEnter:$(),nodeMouseMove:$(),nodeMouseLeave:$(),nodeContextMenu:$(),nodeDragStart:$(),nodeDrag:$(),nodeDragStop:$(),nodesInitialized:$(),miniMapNodeClick:$(),miniMapNodeDoubleClick:$(),miniMapNodeMouseEnter:$(),miniMapNodeMouseMove:$(),miniMapNodeMouseLeave:$(),connect:$(),connectStart:$(),connectEnd:$(),clickConnectStart:$(),clickConnectEnd:$(),paneReady:$(),init:$(),move:$(),moveStart:$(),moveEnd:$(),selectionDragStart:$(),selectionDrag:$(),selectionDragStop:$(),selectionContextMenu:$(),selectionStart:$(),selectionEnd:$(),viewportChangeStart:$(),viewportChange:$(),viewportChangeEnd:$(),paneScroll:$(),paneClick:$(),paneContextMenu:$(),paneMouseEnter:$(),paneMouseMove:$(),paneMouseLeave:$(),edgeContextMenu:$(),edgeMouseEnter:$(),edgeMouseMove:$(),edgeMouseLeave:$(),edgeDoubleClick:$(),edgeClick:$(),edgeUpdateStart:$(),edgeUpdate:$(),edgeUpdateEnd:$(),updateNodeInternals:$(),error:$(e=>F0(e.message))}}function v2(e,t){let n=T();oe(()=>{for(let[n,i]of Object.entries(t.value))i.setEmitter(t=>{e(n,t)}),Pq(i.removeEmitter),i.setHasEmitListeners(()=>r(n)),Pq(i.removeHasEmitListeners)});function r(e){let t=y2(e);return!!n?.vnode.props?.[t]}}function y2(e){let[t,...n]=e.split(`:`);return`on${t.replace(/(?:^|-)(\w)/g,(e,t)=>t.toUpperCase())}${n.length?`:${n.join(`:`)}`:``}`}function b2(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[-1/0,-1/0],[1/0,1/0]],nodeExtent:[[-1/0,-1/0],[1/0,1/0]],selectionMode:K$.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:X$.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:`#b1b1b7`,connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:q$.Bezier,style:{}},connectionMode:J$.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:NaN,y:NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:`Shift`,multiSelectionKeyCode:b0()?`Meta`:`Control`,zoomActivationKeyCode:b0()?`Meta`:`Control`,deleteKeyCode:`Backspace`,panActivationKeyCode:`Space`,hooks:_2(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:`nodrag`,noWheelClassName:`nowheel`,noPanClassName:`nopan`,defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:``}}var x2=[`id`,`vueFlowRef`,`viewportRef`,`initialized`,`modelValue`,`nodes`,`edges`,`maxZoom`,`minZoom`,`translateExtent`,`hooks`,`defaultEdgeOptions`];function S2(e,t,n){let r=m2(e),i=t=>{let n=t??[];e.hooks.updateNodeInternals.trigger(n)},a=t=>E1(t,e.nodes,e.edges),o=t=>T1(t,e.nodes,e.edges),s=t=>L1(t,e.edges),c=({id:t,type:n,nodeId:r})=>{let i=t?`-${n}-${t}`:`-${n}`;return Array.from(e.connectionLookup.get(`${r}${i}`)?.values()??[])},l=e=>{if(e)return t.value.get(e)},u=e=>{if(e)return n.value.get(e)},d=(t,n,r)=>{let i=[];for(let e of t){let t={id:e.id,type:`position`,dragging:r,from:e.from};if(n&&(t.position=e.position,e.parentNode)){let n=l(e.parentNode);t.position={x:t.position.x-(n?.computedPosition?.x??0),y:t.position.y-(n?.computedPosition?.y??0)}}i.push(t)}i?.length&&e.hooks.nodesChange.trigger(i)},f=t=>{if(!e.vueFlowRef)return;let n=e.vueFlowRef.querySelector(`.vue-flow__transformationpane`);if(!n)return;let i=window.getComputedStyle(n),{m22:a}=new window.DOMMatrixReadOnly(i.transform),o=[];for(let e of t){let t=e,n=l(t.id);if(n){let e=p1(t.nodeElement);if(e.width&&e.height&&(n.dimensions.width!==e.width||n.dimensions.height!==e.height||t.forceUpdate)){let r=t.nodeElement.getBoundingClientRect();n.dimensions=e,n.handleBounds.source=L0(`source`,t.nodeElement,r,a,n.id),n.handleBounds.target=L0(`target`,t.nodeElement,r,a,n.id),o.push({id:n.id,type:`dimensions`,dimensions:e})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&r.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),o.length&&e.hooks.nodesChange.trigger(o)},p=(r,i)=>{let a=new Set,o=new Set;for(let e of r)v1(e)?a.add(e.id):_1(e)&&o.add(e.id);let s=e0(t.value,a,!0),c=e0(n.value,o);if(e.multiSelectionActive){for(let e of a)s.push(X1(e,i));for(let e of o)c.push(X1(e,i))}s.length&&e.hooks.nodesChange.trigger(s),c.length&&e.hooks.edgesChange.trigger(c)},m=r=>{if(e.multiSelectionActive){let t=r.map(e=>X1(e.id,!0));e.hooks.nodesChange.trigger(t);return}e.hooks.nodesChange.trigger(e0(t.value,new Set(r.map(e=>e.id)),!0)),e.hooks.edgesChange.trigger(e0(n.value))},h=r=>{if(e.multiSelectionActive){let t=r.map(e=>X1(e.id,!0));e.hooks.edgesChange.trigger(t);return}e.hooks.edgesChange.trigger(e0(n.value,new Set(r.map(e=>e.id)))),e.hooks.nodesChange.trigger(e0(t.value,new Set,!0))},g=e=>{p(e,!0)},_=t=>{let n=(t||e.nodes).map(e=>(e.selected=!1,X1(e.id,!1)));e.hooks.nodesChange.trigger(n)},v=t=>{let n=(t||e.edges).map(e=>(e.selected=!1,X1(e.id,!1)));e.hooks.edgesChange.trigger(n)},y=t=>{if(!t||!t.length)return p([],!1);let n=t.reduce((e,t)=>{let n=X1(t.id,!1);return v1(t)?e.nodes.push(n):e.edges.push(n),e},{nodes:[],edges:[]});n.nodes.length&&e.hooks.nodesChange.trigger(n.nodes),n.edges.length&&e.hooks.edgesChange.trigger(n.edges)},b=t=>{var n;(n=e.d3Zoom)==null||n.scaleExtent([t,e.maxZoom]),e.minZoom=t},x=t=>{var n;(n=e.d3Zoom)==null||n.scaleExtent([e.minZoom,t]),e.maxZoom=t},S=t=>{var n;(n=e.d3Zoom)==null||n.translateExtent(t),e.translateExtent=t},C=t=>{e.nodeExtent=t,i()},w=t=>{var n;(n=e.d3Zoom)==null||n.clickDistance(t)},T=t=>{e.nodesDraggable=t,e.nodesConnectable=t,e.elementsSelectable=t},E=t=>{let n=t instanceof Function?t(e.nodes):t;(e.initialized||n.length)&&(e.nodes=H0(n,l,e.hooks.error.trigger))},D=t=>{let r=t instanceof Function?t(e.edges):t;if(!e.initialized&&!r.length)return;let i=K0(r,e.isValidConnection,l,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);W0(e.connectionLookup,n.value,i),e.edges=i},ee=t=>{let n=t instanceof Function?t([...e.nodes,...e.edges]):t;(e.initialized||n.length)&&(E(n.filter(v1)),D(n.filter(_1)))},O=t=>{let n=t instanceof Function?t(e.nodes):t;n=Array.isArray(n)?n:[n];let r=H0(n,l,e.hooks.error.trigger),i=[];for(let e of r)i.push(Z1(e));i.length&&e.hooks.nodesChange.trigger(i)},k=t=>{let n=t instanceof Function?t(e.edges):t;n=Array.isArray(n)?n:[n];let r=K0(n,e.isValidConnection,l,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),i=[];for(let e of r)i.push(Z1(e));i.length&&e.hooks.edgesChange.trigger(i)},A=(t,n=!0,r=!1)=>{let i=t instanceof Function?t(e.nodes):t,a=Array.isArray(i)?i:[i],o=[],c=[];function u(e){let t=s(e);for(let e of t)(!z0(e.deletable)||e.deletable)&&c.push($1(e.id,e.source,e.target,e.sourceHandle,e.targetHandle))}function d(t){let r=[];for(let n of e.nodes)n.parentNode===t&&r.push(n);if(r.length){for(let e of r)o.push(Q1(e.id));n&&u(r);for(let e of r)d(e.id)}}for(let e of a){let t=typeof e==`string`?l(e):e;t&&(!z0(t.deletable)||t.deletable)&&(o.push(Q1(t.id)),n&&u([t]),r&&d(t.id))}c.length&&e.hooks.edgesChange.trigger(c),o.length&&e.hooks.nodesChange.trigger(o)},j=t=>{let n=t instanceof Function?t(e.edges):t,r=Array.isArray(n)?n:[n],i=[];for(let e of r){let t=typeof e==`string`?u(e):e;t&&(!z0(t.deletable)||t.deletable)&&i.push($1(typeof e==`string`?e:e.id,t.source,t.target,t.sourceHandle,t.targetHandle))}e.hooks.edgesChange.trigger(i)},M=(t,r,i=!0)=>{let a=u(t.id);if(!a)return!1;let o=e.edges.indexOf(a),s=V0(t,r,a,i,e.hooks.error.trigger);if(s){let[t]=K0([s],e.isValidConnection,l,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((e,n)=>n===o?t:e),W0(e.connectionLookup,n.value,[t]),t}return!1},N=(e,t,n={replace:!1})=>{let r=u(e);if(!r)return;let i=typeof t==`function`?t(r):t;r.data=n.replace?i:{...r.data,...i}},P=t=>Y1(t,e.nodes),F=t=>{let r=Y1(t,e.edges);return W0(e.connectionLookup,n.value,r),r},I=(t,n,r={replace:!1})=>{let i=l(t);if(!i)return;let a=typeof n==`function`?n(i):n;r.replace?e.nodes.splice(e.nodes.indexOf(i),1,a):Object.assign(i,a)},L=(e,t,n={replace:!1})=>{let r=l(e);if(!r)return;let i=typeof t==`function`?t(r):t;r.data=n.replace?i:{...r.data,...i}},te=(t,n,r=!1)=>{r?e.connectionClickStartHandle=t:e.connectionStartHandle=t,e.connectionEndHandle=null,e.connectionStatus=null,n&&(e.connectionPosition=n)},R=(t,n=null,r=null)=>{e.connectionStartHandle&&(e.connectionPosition=t,e.connectionEndHandle=n,e.connectionStatus=r)},ne=(t,n)=>{e.connectionPosition={x:NaN,y:NaN},e.connectionEndHandle=null,e.connectionStatus=null,n?e.connectionClickStartHandle=null:e.connectionStartHandle=null},re=e=>{let t=x1(e),n=t?null:y1(e)?e:l(e.id);return!t&&!n?[null,null,t]:[t?e:d1(n),n,t]},z=(t,n=!0,r=e.nodes)=>{let[i,a,o]=re(t);if(!i)return[];let s=[];for(let t of r||e.nodes){if(!o&&(t.id===a.id||!t.computedPosition))continue;let e=d1(t),r=f1(e,i);(n&&r>0||r>=e.width*e.height||r>=Number(i.width)*Number(i.height))&&s.push(t)}return s},B=(e,t,n=!0)=>{let[r]=re(e);if(!r)return!1;let i=f1(r,t);return n&&i>0||i>=Number(r.width)*Number(r.height)},ie=t=>{let{viewport:n,dimensions:r,d3Zoom:i,d3Selection:a,translateExtent:o}=e;if(!i||!a||!t.x&&!t.y)return!1;let s=I$.translate(n.x+t.x,n.y+t.y).scale(n.zoom),c=[[0,0],[r.width,r.height]],l=i.constrain()(s,c,o),u=e.viewport.x!==l.x||e.viewport.y!==l.y||e.viewport.zoom!==l.k;return i.transform(a,l),u},V=t=>{let n=t instanceof Function?t(e):t,r=[`d3Zoom`,`d3Selection`,`d3ZoomHandler`,`viewportRef`,`vueFlowRef`,`dimensions`,`hooks`];z0(n.defaultEdgeOptions)&&(e.defaultEdgeOptions=n.defaultEdgeOptions);let i=n.modelValue||n.nodes||n.edges?[]:void 0;i&&(n.modelValue&&i.push(...n.modelValue),n.nodes&&i.push(...n.nodes),n.edges&&i.push(...n.edges),ee(i));let a=()=>{z0(n.maxZoom)&&x(n.maxZoom),z0(n.minZoom)&&b(n.minZoom),z0(n.translateExtent)&&S(n.translateExtent)};for(let t of Object.keys(n)){let i=t,a=n[i];![...x2,...r].includes(i)&&z0(a)&&(e[i]=a)}Yq(()=>e.d3Zoom).not.toBeNull().then(a),e.initialized||=!0};return{updateNodePositions:d,updateNodeDimensions:f,setElements:ee,setNodes:E,setEdges:D,addNodes:O,addEdges:k,removeNodes:A,removeEdges:j,findNode:l,findEdge:u,updateEdge:M,updateEdgeData:N,updateNode:I,updateNodeData:L,applyEdgeChanges:F,applyNodeChanges:P,addSelectedElements:g,addSelectedNodes:m,addSelectedEdges:h,setMinZoom:b,setMaxZoom:x,setTranslateExtent:S,setNodeExtent:C,setPaneClickDistance:w,removeSelectedElements:y,removeSelectedNodes:_,removeSelectedEdges:v,startConnection:te,updateConnection:R,endConnection:ne,setInteractive:T,setState:V,getIntersectingNodes:z,getIncomers:a,getOutgoers:o,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:B,panBy:ie,fitView:e=>r.value.fitView(e),zoomIn:e=>r.value.zoomIn(e),zoomOut:e=>r.value.zoomOut(e),zoomTo:(e,t)=>r.value.zoomTo(e,t),setViewport:(e,t)=>r.value.setViewport(e,t),setTransform:(e,t)=>r.value.setTransform(e,t),getViewport:()=>r.value.getViewport(),getTransform:()=>r.value.getTransform(),setCenter:(e,t,n)=>r.value.setCenter(e,t,n),fitBounds:(e,t)=>r.value.fitBounds(e,t),project:e=>r.value.project(e),screenToFlowCoordinate:e=>r.value.screenToFlowCoordinate(e),flowToScreenCoordinate:e=>r.value.flowToScreenCoordinate(e),toObject:()=>{let t=[],n=[];for(let n of e.nodes){let{computedPosition:e,handleBounds:r,selected:i,dimensions:a,isParent:o,resizing:s,dragging:c,events:l,...u}=n;t.push(u)}for(let t of e.edges){let{selected:e,sourceNode:r,targetNode:i,events:a,...o}=t;n.push(o)}return JSON.parse(JSON.stringify({nodes:t,edges:n,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:t=>new Promise(n=>{let{nodes:i,edges:a,position:o,zoom:s,viewport:c}=t;i&&E(i),a&&D(a);let[l,u]=c?.x&&c?.y?[c.x,c.y]:o??[null,null];if(l&&u){let t=c?.zoom||s||e.viewport.zoom;return Yq(()=>r.value.viewportInitialized).toBe(!0).then(()=>{r.value.setViewport({x:l,y:u,zoom:t}).then(()=>{n(!0)})})}n(!0)}),updateNodeInternals:i,viewportHelper:r,$reset:()=>{let t=b2();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){let n=I$.translate(t.defaultViewport.x??0,t.defaultViewport.y??0).scale(m1(t.defaultViewport.zoom??1,t.minZoom,t.maxZoom)),r=e.viewportRef.getBoundingClientRect(),i=[[0,0],[r.width,r.height]],a=e.d3Zoom.constrain()(n,i,t.translateExtent);e.d3Zoom.transform(e.d3Selection,a)}V(t)},$destroy:()=>{}}}var C2=[`data-id`,`data-handleid`,`data-nodeid`,`data-handlepos`],w2=z({name:`Handle`,compatConfig:{MODE:3},props:{id:{default:null},type:{},position:{default:()=>Q.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){let n=ee(e,[`position`,`connectable`,`connectableStart`,`connectableEnd`,`id`]),a=o(()=>n.type??`source`),s=o(()=>n.isValidConnection??null),{id:c,connectionStartHandle:l,connectionClickStartHandle:u,connectionEndHandle:d,vueFlowRef:f,nodesConnectable:p,noDragClassName:m,noPanClassName:h}=s4(),{id:g,node:_,nodeEl:v,connectedEdges:y}=o2(),b=i(),x=o(()=>e.connectableStart===void 0||e.connectableStart),S=o(()=>e.connectableEnd===void 0||e.connectableEnd),C=o(()=>l.value?.nodeId===g&&l.value?.id===e.id&&l.value?.type===a.value||d.value?.nodeId===g&&d.value?.id===e.id&&d.value?.type===a.value),w=o(()=>u.value?.nodeId===g&&u.value?.id===e.id&&u.value?.type===a.value),{handlePointerDown:T,handleClick:E}=i2({nodeId:g,handleId:e.id,isValidConnection:s,type:a}),D=R(()=>typeof e.connectable==`string`&&e.connectable===`single`?!y.value.some(t=>{let n=t[`${a.value}Handle`];return t[a.value]===g?!n||n===e.id:!1}):typeof e.connectable==`number`?y.value.filter(t=>{let n=t[`${a.value}Handle`];return t[a.value]===g?!n||n===e.id:!1}).length<e.connectable:typeof e.connectable==`function`?e.connectable(_,y.value):z0(e.connectable)?e.connectable:p.value);F(()=>{if(!_.dimensions.width||!_.dimensions.height)return;let t=_.handleBounds[a.value]?.find(t=>t.id===e.id);if(!f.value||t)return;let n=f.value.querySelector(`.vue-flow__transformationpane`);if(!v.value||!b.value||!n||!e.id)return;let r=v.value.getBoundingClientRect(),i=b.value.getBoundingClientRect(),o=window.getComputedStyle(n),{m22:s}=new window.DOMMatrixReadOnly(o.transform),c={id:e.id,position:e.position,x:(i.left-r.left)/s,y:(i.top-r.top)/s,type:a.value,nodeId:g,...p1(b.value)};_.handleBounds[a.value]=[..._.handleBounds[a.value]??[],c]});function O(e){let t=_0(e);D.value&&x.value&&(t&&e.button===0||!t)&&T(e)}function k(e){g&&(u.value||x.value)&&D.value&&E(e)}return t({handleClick:E,handlePointerDown:T,onClick:k,onPointerDown:O}),(t,n)=>(B(),N(`div`,{ref_key:`handle`,ref:b,"data-id":`${r(c)}-${r(g)}-${e.id}-${a.value}`,"data-handleid":e.id,"data-nodeid":r(g),"data-handlepos":t.position,class:I([`vue-flow__handle`,[`vue-flow__handle-${t.position}`,`vue-flow__handle-${e.id}`,r(m),r(h),a.value,{connectable:D.value,connecting:w.value,connectablestart:x.value,connectableend:S.value,connectionindicator:D.value&&(x.value&&!C.value||S.value&&C.value)}]]),onMousedown:O,onTouchstartPassive:O,onClick:k},[fe(t.$slots,`default`,{id:t.id})],42,C2))}}),T2=function({sourcePosition:e=Q.Bottom,targetPosition:t=Q.Top,label:n,connectable:r=!0,isValidTargetPos:i,isValidSourcePos:a,data:o}){let s=o.label??n;return[v(w2,{type:`target`,position:t,connectable:r,isValidConnection:i}),typeof s!=`string`&&s?v(s):v(V,[s]),v(w2,{type:`source`,position:e,connectable:r,isValidConnection:a})]};T2.props=[`sourcePosition`,`targetPosition`,`label`,`isValidTargetPos`,`isValidSourcePos`,`connectable`,`data`],T2.inheritAttrs=!1,T2.compatConfig={MODE:3};var E2=T2,D2=function({targetPosition:e=Q.Top,label:t,connectable:n=!0,isValidTargetPos:r,data:i}){let a=i.label??t;return[v(w2,{type:`target`,position:e,connectable:n,isValidConnection:r}),typeof a!=`string`&&a?v(a):v(V,[a])]};D2.props=[`targetPosition`,`label`,`isValidTargetPos`,`connectable`,`data`],D2.inheritAttrs=!1,D2.compatConfig={MODE:3};var O2=D2,k2=function({sourcePosition:e=Q.Bottom,label:t,connectable:n=!0,isValidSourcePos:r,data:i}){let a=i.label??t;return[typeof a!=`string`&&a?v(a):v(V,[a]),v(w2,{type:`source`,position:e,connectable:n,isValidConnection:r})]};k2.props=[`sourcePosition`,`label`,`isValidSourcePos`,`connectable`,`data`],k2.inheritAttrs=!1,k2.compatConfig={MODE:3};var A2=k2,j2=[`transform`],M2=[`width`,`height`,`x`,`y`,`rx`,`ry`],N2=[`y`],P2=z({name:`EdgeText`,compatConfig:{MODE:3},props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){let t=i({x:0,y:0,width:0,height:0}),n=i(null),r=R(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);F(a),C([()=>e.x,()=>e.y,n,()=>e.label],a);function a(){if(!n.value)return;let e=n.value.getBBox();(e.width!==t.value.width||e.height!==t.value.height)&&(t.value=e)}return(e,i)=>(B(),N(`g`,{transform:r.value,class:`vue-flow__edge-textwrapper`},[e.labelShowBg?(B(),N(`rect`,{key:0,class:`vue-flow__edge-textbg`,width:`${t.value.width+2*e.labelBgPadding[0]}px`,height:`${t.value.height+2*e.labelBgPadding[1]}px`,x:-e.labelBgPadding[0],y:-e.labelBgPadding[1],style:ie(e.labelBgStyle),rx:e.labelBgBorderRadius,ry:e.labelBgBorderRadius},null,12,M2)):G(``,!0),M(`text`,L(e.$attrs,{ref_key:`el`,ref:n,class:`vue-flow__edge-text`,y:t.value.height/2,dy:`0.3em`,style:e.labelStyle}),[fe(e.$slots,`default`,{},()=>[typeof e.label==`string`?(B(),N(V,{key:1},[x(U(e.label),1)],64)):(B(),W(de(e.label),{key:0}))])],16,N2)],8,j2))}}),F2=[`id`,`d`,`marker-end`,`marker-start`],I2=[`d`,`stroke-width`],L2=z({name:`BaseEdge`,inheritAttrs:!1,compatConfig:{MODE:3},props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){let n=i(null),a=i(null),o=i(null),s=D();return t({pathEl:n,interactionEl:a,labelEl:o}),(e,t)=>(B(),N(V,null,[M(`path`,L(r(s),{id:e.id,ref_key:`pathEl`,ref:n,d:e.path,class:`vue-flow__edge-path`,"marker-end":e.markerEnd,"marker-start":e.markerStart}),null,16,F2),e.interactionWidth?(B(),N(`path`,{key:0,ref_key:`interactionEl`,ref:a,fill:`none`,d:e.path,"stroke-width":e.interactionWidth,"stroke-opacity":0,class:`vue-flow__edge-interaction`},null,8,I2)):G(``,!0),e.label&&e.labelX&&e.labelY?(B(),W(P2,{key:1,ref_key:`labelEl`,ref:o,x:e.labelX,y:e.labelY,label:e.label,"label-show-bg":e.labelShowBg,"label-bg-style":e.labelBgStyle,"label-bg-padding":e.labelBgPadding,"label-bg-border-radius":e.labelBgBorderRadius,"label-style":e.labelStyle},null,8,[`x`,`y`,`label`,`label-show-bg`,`label-bg-style`,`label-bg-padding`,`label-bg-border-radius`,`label-style`])):G(``,!0)],64))}});function R2({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function z2({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function B2(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function V2({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){let o,s;switch(e){case Q.Left:o=t-B2(t-r,a),s=n;break;case Q.Right:o=t+B2(r-t,a),s=n;break;case Q.Top:o=t,s=n-B2(n-i,a);break;case Q.Bottom:o=t,s=n+B2(i-n,a)}return[o,s]}function H2(e){let{sourceX:t,sourceY:n,sourcePosition:r=Q.Bottom,targetX:i,targetY:a,targetPosition:o=Q.Top,curvature:s=.25}=e,[c,l]=V2({pos:r,x1:t,y1:n,x2:i,y2:a,c:s}),[u,d]=V2({pos:o,x1:i,y1:a,x2:t,y2:n,c:s}),[f,p,m,h]=z2({sourceX:t,sourceY:n,targetX:i,targetY:a,sourceControlX:c,sourceControlY:l,targetControlX:u,targetControlY:d});return[`M${t},${n} C${c},${l} ${u},${d} ${i},${a}`,f,p,m,h]}function U2({pos:e,x1:t,y1:n,x2:r,y2:i}){let a,o;switch(e){case Q.Left:case Q.Right:a=.5*(t+r),o=n;break;case Q.Top:case Q.Bottom:a=t,o=.5*(n+i)}return[a,o]}function W2(e){let{sourceX:t,sourceY:n,sourcePosition:r=Q.Bottom,targetX:i,targetY:a,targetPosition:o=Q.Top}=e,[s,c]=U2({pos:r,x1:t,y1:n,x2:i,y2:a}),[l,u]=U2({pos:o,x1:i,y1:a,x2:t,y2:n}),[d,f,p,m]=z2({sourceX:t,sourceY:n,targetX:i,targetY:a,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${t},${n} C${s},${c} ${l},${u} ${i},${a}`,d,f,p,m]}var G2={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}};function K2({source:e,sourcePosition:t=Q.Bottom,target:n}){return t===Q.Left||t===Q.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1}}function q2(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function J2({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a}){let o=G2[t],s=G2[r],c={x:e.x+o.x*a,y:e.y+o.y*a},l={x:n.x+s.x*a,y:n.y+s.y*a},u=K2({source:c,sourcePosition:t,target:l}),d=u.x===0?`y`:`x`,f=u[d],p,m,h,g={x:0,y:0},_={x:0,y:0},[v,y,b,x]=R2({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[d]*s[d]===-1){m=i.x??v,h=i.y??y;let e=[{x:m,y:c.y},{x:m,y:l.y}],t=[{x:c.x,y:h},{x:l.x,y:h}];p=o[d]===f?d===`x`?e:t:d===`x`?t:e}else{let i=[{x:c.x,y:l.y}],u=[{x:l.x,y:c.y}];if(p=d===`x`?o.x===f?u:i:o.y===f?i:u,t===r){let t=Math.abs(e[d]-n[d]);if(t<=a){let r=Math.min(a-1,a-t);o[d]===f?g[d]=(c[d]>e[d]?-1:1)*r:_[d]=(l[d]>n[d]?-1:1)*r}}if(t!==r){let e=d===`x`?`y`:`x`,t=o[d]===s[e],n=c[e]>l[e],r=c[e]<l[e];(o[d]===1&&(!t&&n||t&&r)||o[d]!==1&&(!t&&r||t&&n))&&(p=d===`x`?i:u)}let v={x:c.x+g.x,y:c.y+g.y},y={x:l.x+_.x,y:l.y+_.y};Math.max(Math.abs(v.x-p[0].x),Math.abs(y.x-p[0].x))>=Math.max(Math.abs(v.y-p[0].y),Math.abs(y.y-p[0].y))?(m=(v.x+y.x)/2,h=p[0].y):(m=p[0].x,h=(v.y+y.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...p,{x:l.x+_.x,y:l.y+_.y},n],m,h,b,x]}function Y2(e,t,n,r){let i=Math.min(q2(e,t)/2,q2(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function X2(e){let{sourceX:t,sourceY:n,sourcePosition:r=Q.Bottom,targetX:i,targetY:a,targetPosition:o=Q.Top,borderRadius:s=5,centerX:c,centerY:l,offset:u=20}=e,[d,f,p,m,h]=J2({source:{x:t,y:n},sourcePosition:r,target:{x:i,y:a},targetPosition:o,center:{x:c,y:l},offset:u});return[d.reduce((e,t,n)=>{let r;return r=n>0&&n<d.length-1?Y2(d[n-1],t,d[n+1],s):`${n===0?`M`:`L`}${t.x} ${t.y}`,e+=r,e},``),f,p,m,h]}function Z2(e){let{sourceX:t,sourceY:n,targetX:r,targetY:i}=e,[a,o,s,c]=R2({sourceX:t,sourceY:n,targetX:r,targetY:i});return[`M ${t},${n}L ${r},${i}`,a,o,s,c]}var Q2=z({name:`StraightEdge`,props:[`label`,`labelStyle`,`labelShowBg`,`labelBgStyle`,`labelBgPadding`,`labelBgBorderRadius`,`sourceY`,`sourceX`,`targetX`,`targetY`,`markerEnd`,`markerStart`,`interactionWidth`],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{let[n,r,i]=Z2(e);return v(L2,{path:n,labelX:r,labelY:i,...t,...e})}}}),$2=z({name:`SmoothStepEdge`,props:[`sourcePosition`,`targetPosition`,`label`,`labelStyle`,`labelShowBg`,`labelBgStyle`,`labelBgPadding`,`labelBgBorderRadius`,`sourceY`,`sourceX`,`targetX`,`targetY`,`borderRadius`,`markerEnd`,`markerStart`,`interactionWidth`,`offset`],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{let[n,r,i]=X2({...e,sourcePosition:e.sourcePosition??Q.Bottom,targetPosition:e.targetPosition??Q.Top});return v(L2,{path:n,labelX:r,labelY:i,...t,...e})}}}),e4=z({name:`StepEdge`,props:[`sourcePosition`,`targetPosition`,`label`,`labelStyle`,`labelShowBg`,`labelBgStyle`,`labelBgPadding`,`labelBgBorderRadius`,`sourceY`,`sourceX`,`targetX`,`targetY`,`markerEnd`,`markerStart`,`interactionWidth`],setup(e,{attrs:t}){return()=>v($2,{...e,...t,borderRadius:0})}}),t4=z({name:`BezierEdge`,props:[`sourcePosition`,`targetPosition`,`label`,`labelStyle`,`labelShowBg`,`labelBgStyle`,`labelBgPadding`,`labelBgBorderRadius`,`sourceY`,`sourceX`,`targetX`,`targetY`,`curvature`,`markerEnd`,`markerStart`,`interactionWidth`],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{let[n,r,i]=H2({...e,sourcePosition:e.sourcePosition??Q.Bottom,targetPosition:e.targetPosition??Q.Top});return v(L2,{path:n,labelX:r,labelY:i,...t,...e})}}}),n4=z({name:`SimpleBezierEdge`,props:[`sourcePosition`,`targetPosition`,`label`,`labelStyle`,`labelShowBg`,`labelBgStyle`,`labelBgPadding`,`labelBgBorderRadius`,`sourceY`,`sourceX`,`targetX`,`targetY`,`markerEnd`,`markerStart`,`interactionWidth`],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{let[n,r,i]=W2({...e,sourcePosition:e.sourcePosition??Q.Bottom,targetPosition:e.targetPosition??Q.Top});return v(L2,{path:n,labelX:r,labelY:i,...t,...e})}}}),r4={input:A2,default:E2,output:O2},i4={default:t4,straight:Q2,step:e4,smoothstep:$2,simplebezier:n4};function a4(e,t,n){let r=R(()=>e=>t.value.get(e)),i=R(()=>e=>n.value.get(e)),a=R(()=>{let t={...i4,...e.edgeTypes},n=Object.keys(t);for(let r of e.edges)r.type&&!n.includes(r.type)&&(t[r.type]=r.type);return t}),o=R(()=>{let t={...r4,...e.nodeTypes},n=Object.keys(t);for(let r of e.nodes)r.type&&!n.includes(r.type)&&(t[r.type]=r.type);return t}),s=R(()=>e.onlyRenderVisibleElements?I1(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=R(()=>{if(e.onlyRenderVisibleElements){let n=[];for(let r of e.edges){let i=t.value.get(r.source),a=t.value.get(r.target);f0({sourcePos:i.computedPosition||{x:0,y:0},targetPos:a.computedPosition||{x:0,y:0},sourceWidth:i.dimensions.width,sourceHeight:i.dimensions.height,targetWidth:a.dimensions.width,targetHeight:a.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&n.push(r)}return n}return e.edges}),l=R(()=>[...s.value,...c.value]),u=R(()=>{let t=[];for(let n of e.nodes)n.selected&&t.push(n);return t}),d=R(()=>{let t=[];for(let n of e.edges)n.selected&&t.push(n);return t}),f=R(()=>[...u.value,...d.value]),p=R(()=>{let t=[];for(let n of e.nodes)n.dimensions.width&&n.dimensions.height&&n.handleBounds!==void 0&&t.push(n);return t});return{getNode:r,getEdge:i,getElements:l,getEdgeTypes:a,getNodeTypes:o,getEdges:c,getNodes:s,getSelectedElements:f,getSelectedNodes:u,getSelectedEdges:d,getNodesInitialized:p,areNodesInitialized:R(()=>s.value.length>0&&p.value.length===s.value.length)}}var o4=class e{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){let t=T()?.appContext.app,n=t?.config.globalProperties.$vueFlowStorage??e.instance;return e.instance=n??new e,t&&(t.config.globalProperties.$vueFlowStorage=e.instance),e.instance}set(e,t){return this.flows.set(e,t)}get(e){return this.flows.get(e)}remove(e){return this.flows.delete(e)}create(e,t){let n=b2(),r=g(n),i={};for(let[e,t]of Object.entries(r.hooks)){let n=`on${e.charAt(0).toUpperCase()+e.slice(1)}`;i[n]=t.on}let a={};for(let[e,t]of Object.entries(r.hooks))a[e]=t.trigger;let o=R(()=>{let e=new Map;for(let t of r.nodes)e.set(t.id,t);return e}),s=R(()=>{let e=new Map;for(let t of r.edges)e.set(t.id,t);return e}),c=a4(r,o,s),l=S2(r,o,s);l.setState({...r,...t});let u={...i,...c,...l,...qq(r),nodeLookup:o,edgeLookup:s,emits:a,id:e,vueFlowVersion:`1.48.2`,$destroy:()=>{this.remove(e)}};return this.set(e,u),u}getId(){return`vue-flow-${this.currentId++}`}};function s4(e){let t=o4.getInstance(),n=p(),r=typeof e==`object`,i=r?e:{id:e},a=i.id,o=a??n?.vueFlowId,s;if(n){let e=w(q0,null);e!=null&&(!o||e.id===o)&&(s=e)}if(s||o&&(s=t.get(o)),!s||o&&s.id!==o){let e=a??t.getId(),r=t.create(e,i);s=r,(n??d(!0)).run(()=>{C(r.applyDefault,(e,t,n)=>{let i=e=>{r.applyNodeChanges(e)},a=e=>{r.applyEdgeChanges(e)};e?(r.onNodesChange(i),r.onEdgesChange(a)):(r.hooks.value.nodesChange.off(i),r.hooks.value.edgesChange.off(a)),n(()=>{r.hooks.value.nodesChange.off(i),r.hooks.value.edgesChange.off(a)})},{immediate:!0}),Pq(()=>{if(s){let e=t.get(s.id);e?e.$destroy():F0(`No store instance found for id ${s.id} in storage.`)}})})}else r&&s.setState(i);return n&&(ne(q0,s),n.vueFlowId=s.id),r&&T()?.type.name!==`VueFlow`&&s.emits.error(new g0(m0.USEVUEFLOW_OPTIONS)),s}function c4(e){let{emits:t,dimensions:n}=s4(),r;F(()=>{let i=()=>{var r;if(!e.value||!((r=e.value).checkVisibility?.call(r)??!0))return;let i=p1(e.value);(i.width===0||i.height===0)&&t.error(new g0(m0.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:i.width||500,height:i.height||500}};i(),window.addEventListener(`resize`,i),e.value&&(r=new ResizeObserver(()=>i()),r.observe(e.value)),re(()=>{window.removeEventListener(`resize`,i),r&&e.value&&r.unobserve(e.value)})})}var l4=z({name:`UserSelection`,compatConfig:{MODE:3},props:{userSelectionRect:{}},setup(e){return(e,t)=>(B(),N(`div`,{class:`vue-flow__selection vue-flow__container`,style:ie({width:`${e.userSelectionRect.width}px`,height:`${e.userSelectionRect.height}px`,transform:`translate(${e.userSelectionRect.x}px, ${e.userSelectionRect.y}px)`})},null,4))}}),u4=[`tabIndex`],d4=z({name:`NodesSelection`,compatConfig:{MODE:3},setup(e){let{emits:t,viewport:n,getSelectedNodes:a,noPanClassName:o,disableKeyboardA11y:s,userSelectionActive:c}=s4(),l=l2(),u=i(null),d=$0({el:u,onStart(e){t.selectionDragStart(e),t.nodeDragStart(e)},onDrag(e){t.selectionDrag(e),t.nodeDrag(e)},onStop(e){t.selectionDragStop(e),t.nodeDragStop(e)}});F(()=>{var e;s.value||(e=u.value)==null||e.focus({preventScroll:!0})});let f=R(()=>F1(a.value)),p=R(()=>({width:`${f.value.width}px`,height:`${f.value.height}px`,top:`${f.value.y}px`,left:`${f.value.x}px`}));function m(e){t.selectionContextMenu({event:e,nodes:a.value})}function h(e){s.value||u1[e.key]&&(e.preventDefault(),l({x:u1[e.key].x,y:u1[e.key].y},e.shiftKey))}return(e,t)=>!r(c)&&f.value.width&&f.value.height?(B(),N(`div`,{key:0,class:I([`vue-flow__nodesselection vue-flow__container`,r(o)]),style:ie({transform:`translate(${r(n).x}px,${r(n).y}px) scale(${r(n).zoom})`})},[M(`div`,{ref_key:`el`,ref:u,class:I([{dragging:r(d)},`vue-flow__nodesselection-rect`]),style:ie(p.value),tabIndex:r(s)?void 0:-1,onContextmenu:m,onKeydown:h},null,46,u4)],6)):G(``,!0)}});function f4(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}var p4=z({name:`Pane`,compatConfig:{MODE:3},props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){let{vueFlowRef:t,nodes:n,viewport:i,emits:a,userSelectionActive:c,removeSelectedElements:l,userSelectionRect:u,elementsSelectable:d,nodesSelectionActive:f,getSelectedEdges:p,getSelectedNodes:m,removeNodes:h,removeEdges:g,selectionMode:_,deleteKeyCode:v,multiSelectionKeyCode:y,multiSelectionActive:b,edgeLookup:x,nodeLookup:S,connectionLookup:w,defaultEdgeOptions:T,connectionStartHandle:E,panOnDrag:D}=s4(),ee=s(null),O=s(new Set),k=s(new Set),A=s(null),j=o(()=>d.value&&(e.isSelecting||c.value)),M=o(()=>E.value!==null),P=!1,F=!1,L=a1(v,{actInsideInputWithModifier:!1}),te=a1(y);C(L,e=>{e&&(h(m.value),g(p.value),f.value=!1)}),C(te,e=>{b.value=e});function R(e,t){return n=>{n.target===t&&e?.(n)}}function ne(e){if(P||M.value){P=!1;return}a.paneClick(e),l(),f.value=!1}function re(e){if(Array.isArray(D.value)&&D.value?.includes(2)){e.preventDefault();return}a.paneContextMenu(e)}function z(e){a.paneScroll(e)}function ie(n){var r,i;if(A.value=t.value?.getBoundingClientRect()??null,!d.value||!e.isSelecting||n.button!==0||n.target!==ee.value||!A.value)return;(i=(r=n.target)?.setPointerCapture)==null||i.call(r,n.pointerId);let{x:o,y:s}=f4(n,A.value);F=!0,P=!1,l(),u.value={width:0,height:0,startX:o,startY:s,x:o,y:s},a.selectionStart(n)}function V(e){if(!A.value||!u.value)return;P=!0;let{x:t,y:r}=y0(e,A.value),{startX:o=0,startY:s=0}=u.value,l={startX:o,startY:s,x:t<o?t:o,y:r<s?r:s,width:Math.abs(t-o),height:Math.abs(r-s)},d=O.value,p=k.value;O.value=new Set(I1(n.value,l,i.value,_.value===K$.Partial,!0).map(e=>e.id)),k.value=new Set;let m=T.value?.selectable??!0;for(let e of O.value){let t=w.value.get(e);if(t)for(let{edgeId:e}of t.values()){let t=x.value.get(e);t&&(t.selectable??m)&&k.value.add(e)}}if(!G0(d,O.value)){let e=e0(S.value,O.value,!0);a.nodesChange(e)}if(!G0(p,k.value)){let e=e0(x.value,k.value);a.edgesChange(e)}u.value=l,c.value=!0,f.value=!1}function ae(t){var n;t.button===0&&F&&((n=t.target)==null||n.releasePointerCapture(t.pointerId),!c.value&&u.value&&t.target===ee.value&&ne(t),c.value=!1,u.value=null,f.value=O.value.size>0,a.selectionEnd(t),e.selectionKeyPressed&&(P=!1),F=!1)}return(e,t)=>(B(),N(`div`,{ref_key:`container`,ref:ee,class:I([`vue-flow__pane vue-flow__container`,{selection:e.isSelecting}]),onClick:t[0]||=e=>j.value?void 0:R(ne,ee.value)(e),onContextmenu:t[1]||=e=>R(re,ee.value)(e),onWheelPassive:t[2]||=e=>R(z,ee.value)(e),onPointerenter:t[3]||=e=>j.value?void 0:r(a).paneMouseEnter(e),onPointerdown:t[4]||=e=>j.value?ie(e):r(a).paneMouseMove(e),onPointermove:t[5]||=e=>j.value?V(e):r(a).paneMouseMove(e),onPointerup:t[6]||=e=>j.value?ae(e):void 0,onPointerleave:t[7]||=e=>r(a).paneMouseLeave(e)},[fe(e.$slots,`default`),r(c)&&r(u)?(B(),W(l4,{key:0,"user-selection-rect":r(u)},null,8,[`user-selection-rect`])):G(``,!0),r(f)&&r(m).length?(B(),W(d4,{key:1})):G(``,!0)],34))}}),m4=z({name:`Transform`,compatConfig:{MODE:3},setup(e){let{viewport:t,fitViewOnInit:n,fitViewOnInitDone:r}=s4(),i=R(()=>n.value?!r.value:!1),a=R(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(e,t)=>(B(),N(`div`,{class:`vue-flow__transformationpane vue-flow__container`,style:ie({transform:a.value,opacity:i.value?0:void 0})},[fe(e.$slots,`default`)],4))}}),h4=z({name:`Viewport`,compatConfig:{MODE:3},setup(e){let{minZoom:t,maxZoom:n,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:c,selectionKeyCode:l,panActivationKeyCode:u,panOnScroll:d,panOnScrollMode:f,panOnScrollSpeed:p,panOnDrag:m,zoomOnDoubleClick:h,zoomOnPinch:g,zoomOnScroll:_,preventScrolling:v,noWheelClassName:y,noPanClassName:x,emits:S,connectionStartHandle:w,userSelectionActive:T,paneDragging:E,d3Zoom:D,d3Selection:ee,d3ZoomHandler:O,viewport:k,viewportRef:A,paneClickDistance:j}=s4();c4(A);let M=s(!1),P=s(!1),L=null,te=!1,R=0,ne={x:0,y:0,zoom:0},re=a1(u),z=a1(l),ie=a1(c),V=o(()=>(!z.value||z.value&&l.value===!0)&&(re.value||m.value)),ae=o(()=>re.value||d.value),U=o(()=>l.value===!0&&V.value!==!0),oe=o(()=>z.value&&l.value!==!0||T.value||U.value),se=o(()=>w.value!==null);F(()=>{if(!A.value){F0(`Viewport element is missing`);return}let e=A.value,r=e.getBoundingClientRect(),o=G$().clickDistance(j.value).scaleExtent([t.value,n.value]).translateExtent(a.value),s=cX(e).call(o),c=s.on(`wheel.zoom`),u=I$.translate(i.value.x??0,i.value.y??0).scale(m1(i.value.zoom??1,t.value,n.value)),b=[[0,0],[r.width,r.height]],w=o.constrain()(u,b,a.value);o.transform(s,w),o.wheelDelta(G1),D.value=o,ee.value=s,O.value=c,k.value={x:w.x,y:w.y,zoom:w.k},o.on(`start`,e=>{if(!e.sourceEvent)return null;R=e.sourceEvent.button,M.value=!0;let t=ue(e.transform);e.sourceEvent?.type===`mousedown`&&(E.value=!0),ne=t,S.viewportChangeStart(t),S.moveStart({event:e,flowTransform:t})}),o.on(`end`,e=>{if(!e.sourceEvent)return null;if(M.value=!1,E.value=!1,ce(V.value,R??0)&&!te&&S.paneContextMenu(e.sourceEvent),te=!1,le(ne,e.transform)){let t=ue(e.transform);ne=t,S.viewportChangeEnd(t),S.moveEnd({event:e,flowTransform:t})}}),o.filter(e=>{let t=ie.value||_.value,n=g.value&&e.ctrlKey,r=e.button,i=e.type===`wheel`;if(r===1&&e.type===`mousedown`&&(W(e,`vue-flow__node`)||W(e,`vue-flow__edge`)))return!0;if(!V.value&&!t&&!ae.value&&!h.value&&!g.value||T.value||se.value&&!i||!h.value&&e.type===`dblclick`||W(e,y.value)&&i||W(e,x.value)&&(!i||ae.value&&i&&!ie.value)||!g.value&&e.ctrlKey&&i||!t&&!ae.value&&!n&&i)return!1;if(!g&&e.type===`touchstart`&&e.touches?.length>1)return e.preventDefault(),!1;if(!V.value&&(e.type===`mousedown`||e.type===`touchstart`)||U.value&&Array.isArray(m.value)&&m.value.includes(0)&&r===0||Array.isArray(m.value)&&!m.value.includes(r)&&(e.type===`mousedown`||e.type===`touchstart`))return!1;let a=Array.isArray(m.value)&&m.value.includes(r)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!r||r<=1;return(!e.ctrlKey||re.value||i)&&a}),C([T,V],()=>{T.value&&!M.value?o.on(`zoom`,null):T.value||o.on(`zoom`,e=>{k.value={x:e.transform.x,y:e.transform.y,zoom:e.transform.k};let t=ue(e.transform);te=ce(V.value,R??0),S.viewportChange(t),S.move({event:e,flowTransform:t})})},{immediate:!0}),C([T,ae,f,ie,g,v,y],()=>{ae.value&&!ie.value&&!T.value?s.on(`wheel.zoom`,e=>{if(W(e,y.value))return!1;let t=ie.value||_.value,n=g.value&&e.ctrlKey;if(!(!v.value||ae.value||t||n))return!1;e.preventDefault(),e.stopImmediatePropagation();let r=s.property(`__zoom`).k||1,i=b0();if(!re.value&&e.ctrlKey&&g.value&&i){let t=uX(e),n=r*2**G1(e);o.scaleTo(s,n,t,e);return}let a=e.deltaMode===1?20:1,c=f.value===X$.Vertical?0:e.deltaX*a,l=f.value===X$.Horizontal?0:e.deltaY*a;!i&&e.shiftKey&&f.value!==X$.Vertical&&!c&&l&&(c=l,l=0),o.translateBy(s,-(c/r)*p.value,-(l/r)*p.value);let u=ue(s.property(`__zoom`));L&&clearTimeout(L),P.value?(S.move({event:e,flowTransform:u}),S.viewportChange(u),L=setTimeout(()=>{S.moveEnd({event:e,flowTransform:u}),S.viewportChangeEnd(u),P.value=!1},150)):(P.value=!0,S.moveStart({event:e,flowTransform:u}),S.viewportChangeStart(u))},{passive:!1}):c!==void 0&&s.on(`wheel.zoom`,function(e,t){let n=!v.value&&e.type===`wheel`&&!e.ctrlKey,r=ie.value||_.value,i=g.value&&e.ctrlKey;if(!r&&!d.value&&!i&&e.type===`wheel`||n||W(e,y.value))return null;e.preventDefault(),c.call(this,e,t)},{passive:!1})},{immediate:!0})});function ce(e,t){return t===2&&Array.isArray(e)&&e.includes(2)}function le(e,t){return e.x!==t.x&&!Number.isNaN(t.x)||e.y!==t.y&&!Number.isNaN(t.y)||e.zoom!==t.k&&!Number.isNaN(t.k)}function ue(e){return{x:e.x,y:e.y,zoom:e.k}}function W(e,t){return e.target.closest(`.${t}`)}return(e,t)=>(B(),N(`div`,{ref_key:`viewportRef`,ref:A,class:`vue-flow__viewport vue-flow__container`},[b(p4,{"is-selecting":oe.value,"selection-key-pressed":r(z),class:I({connecting:se.value,dragging:r(E),draggable:r(m)===!0||Array.isArray(r(m))&&r(m).includes(0)})},{default:H(()=>[b(m4,null,{default:H(()=>[fe(e.$slots,`default`)]),_:3})]),_:3},8,[`is-selecting`,`selection-key-pressed`,`class`])],512))}}),g4=[`id`],_4=[`id`],v4=[`id`],y4=z({name:`A11yDescriptions`,compatConfig:{MODE:3},setup(e){let{id:t,disableKeyboardA11y:n,ariaLiveMessage:i}=s4();return(e,a)=>(B(),N(V,null,[M(`div`,{id:`${r(o1)}-${r(t)}`,style:{display:`none`}},` Press enter or space to select a node. `+U(r(n)?``:`You can then use the arrow keys to move the node around.`)+` You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. `,9,g4),M(`div`,{id:`${r(s1)}-${r(t)}`,style:{display:`none`}},` Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. `,8,_4),r(n)?G(``,!0):(B(),N(`div`,{key:0,id:`${r(c1)}-${r(t)}`,"aria-live":`assertive`,"aria-atomic":`true`,style:{position:`absolute`,width:`1px`,height:`1px`,margin:`-1px`,border:`0`,padding:`0`,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,"clip-path":`inset(100%)`}},U(r(i)),9,v4))],64))}});function b4(){let e=s4();C(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function x4(e,t,n){return n===Q.Left?e-t:n===Q.Right?e+t:e}function S4(e,t,n){return n===Q.Top?e-t:n===Q.Bottom?e+t:e}var C4=function({radius:e=10,centerX:t=0,centerY:n=0,position:r=Q.Top,type:i}){return v(`circle`,{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:x4(t,e,r),cy:S4(n,e,r),r:e,stroke:`transparent`,fill:`transparent`})};C4.props=[`radius`,`centerX`,`centerY`,`position`,`type`],C4.compatConfig={MODE:3};var w4=C4,T4=z({name:`Edge`,compatConfig:{MODE:3},props:[`id`],setup(e){let{id:t,addSelectedEdges:n,connectionMode:r,edgeUpdaterRadius:a,emits:s,nodesSelectionActive:c,noPanClassName:l,getEdgeTypes:u,removeSelectedEdges:d,findEdge:f,findNode:p,isValidConnection:m,multiSelectionActive:h,disableKeyboardA11y:g,elementsSelectable:_,edgesUpdatable:y,edgesFocusable:b,hooks:x}=s4(),S=R(()=>f(e.id)),{emit:C,on:E}=t2(S.value,s),D=w(Q0),ee=T(),k=i(!1),A=i(!1),j=i(``),M=i(null),N=i(`source`),P=i(null),F=o(()=>S.value.selectable===void 0?_.value:S.value.selectable),I=o(()=>S.value.updatable===void 0?y.value:S.value.updatable),L=o(()=>S.value.focusable===void 0?b.value:S.value.focusable);ne(X0,e.id),ne(Z0,P);let te=R(()=>S.value.class instanceof Function?S.value.class(S.value):S.value.class),re=R(()=>S.value.style instanceof Function?S.value.style(S.value):S.value.style),z=R(()=>{let e=S.value.type||`default`,t=D?.[`edge-${e}`];if(t)return t;let n=S.value.template??u.value[e];if(typeof n==`string`&&ee){let t=Object.keys(ee.appContext.components);t&&t.includes(e)&&(n=O(e,!1))}return n&&typeof n!=`string`?n:(s.error(new g0(m0.EDGE_TYPE_MISSING,n)),!1)}),{handlePointerDown:B}=i2({nodeId:j,handleId:M,type:N,isValidConnection:m,edgeUpdaterType:N,onEdgeUpdate:ae,onEdgeUpdateEnd:H});return()=>{let n=p(S.value.source),i=p(S.value.target),o=`pathOptions`in S.value?S.value.pathOptions:{};if(!n&&!i)return s.error(new g0(m0.EDGE_SOURCE_TARGET_MISSING,S.value.id,S.value.source,S.value.target)),null;if(!n)return s.error(new g0(m0.EDGE_SOURCE_MISSING,S.value.id,S.value.source)),null;if(!i)return s.error(new g0(m0.EDGE_TARGET_MISSING,S.value.id,S.value.target)),null;if(!S.value||S.value.hidden||n.hidden||i.hidden)return null;let c;c=r.value===J$.Strict?n.handleBounds.source:[...n.handleBounds.source||[],...n.handleBounds.target||[]];let d=d0(c,S.value.sourceHandle),f;f=r.value===J$.Strict?i.handleBounds.target:[...i.handleBounds.target||[],...i.handleBounds.source||[]];let m=d0(f,S.value.targetHandle),h=d?.position||Q.Bottom,g=m?.position||Q.Top,{x:_,y}=u0(n,d,h),{x:b,y:C}=u0(i,m,g);return S.value.sourceX=_,S.value.sourceY=y,S.value.targetX=b,S.value.targetY=C,v(`g`,{ref:P,key:e.id,"data-id":e.id,class:[`vue-flow__edge`,`vue-flow__edge-${z.value===!1?`default`:S.value.type||`default`}`,l.value,te.value,{updating:k.value,selected:S.value.selected,animated:S.value.animated,inactive:!F.value&&!x.value.edgeClick.hasListeners()}],tabIndex:L.value?0:void 0,"aria-label":S.value.ariaLabel===null?void 0:S.value.ariaLabel??`Edge from ${S.value.source} to ${S.value.target}`,"aria-describedby":L.value?`${s1}-${t}`:void 0,"aria-roledescription":`edge`,role:L.value?`group`:`img`,...S.value.domAttributes,onClick:oe,onContextmenu:se,onDblclick:ce,onMouseenter:le,onMousemove:ue,onMouseleave:W,onKeyDown:L.value?G:void 0},[A.value?null:v(z.value===!1?u.value.default:z.value,{id:e.id,sourceNode:n,targetNode:i,source:S.value.source,target:S.value.target,type:S.value.type,updatable:I.value,selected:S.value.selected,animated:S.value.animated,label:S.value.label,labelStyle:S.value.labelStyle,labelShowBg:S.value.labelShowBg,labelBgStyle:S.value.labelBgStyle,labelBgPadding:S.value.labelBgPadding,labelBgBorderRadius:S.value.labelBgBorderRadius,data:S.value.data,events:{...S.value.events,...E},style:re.value,markerStart:`url('#${W1(S.value.markerStart,t)}')`,markerEnd:`url('#${W1(S.value.markerEnd,t)}')`,sourcePosition:h,targetPosition:g,sourceX:_,sourceY:y,targetX:b,targetY:C,sourceHandleId:S.value.sourceHandle,targetHandleId:S.value.targetHandle,interactionWidth:S.value.interactionWidth,...o}),[I.value===`source`||I.value===!0?[v(`g`,{onMousedown:de,onMouseenter:ie,onMouseout:V},v(w4,{position:h,centerX:_,centerY:y,radius:a.value,type:`source`,"data-type":`source`}))]:null,I.value===`target`||I.value===!0?[v(`g`,{onMousedown:fe,onMouseenter:ie,onMouseout:V},v(w4,{position:g,centerX:b,centerY:C,radius:a.value,type:`target`,"data-type":`target`}))]:null]])};function ie(){k.value=!0}function V(){k.value=!1}function ae(e,t){C.update({event:e,edge:S.value,connection:t})}function H(e){C.updateEnd({event:e,edge:S.value}),A.value=!1}function U(e,t){e.button===0&&(A.value=!0,j.value=t?S.value.target:S.value.source,M.value=(t?S.value.targetHandle:S.value.sourceHandle)??null,N.value=t?`target`:`source`,C.updateStart({event:e,edge:S.value}),B(e))}function oe(e){var t;let r={event:e,edge:S.value};F.value&&(c.value=!1,S.value.selected&&h.value?(d([S.value]),(t=P.value)==null||t.blur()):n([S.value])),C.click(r)}function se(e){C.contextMenu({event:e,edge:S.value})}function ce(e){C.doubleClick({event:e,edge:S.value})}function le(e){C.mouseEnter({event:e,edge:S.value})}function ue(e){C.mouseMove({event:e,edge:S.value})}function W(e){C.mouseLeave({event:e,edge:S.value})}function de(e){U(e,!0)}function fe(e){U(e,!1)}function G(t){var r;!g.value&&l1.includes(t.key)&&F.value&&(t.key===`Escape`?((r=P.value)==null||r.blur(),d([f(e.id)])):n([f(e.id)]))}}}),E4=z({name:`ConnectionLine`,compatConfig:{MODE:3},setup(){let{id:e,connectionMode:t,connectionStartHandle:n,connectionEndHandle:r,connectionPosition:i,connectionLineType:a,connectionLineStyle:o,connectionLineOptions:s,connectionStatus:c,viewport:l,findNode:u}=s4(),d=w(Q0)?.[`connection-line`],f=R(()=>u(n.value?.nodeId)),p=R(()=>u(r.value?.nodeId)??null),m=R(()=>({x:(i.value.x-l.value.x)/l.value.zoom,y:(i.value.y-l.value.y)/l.value.zoom})),h=R(()=>s.value.markerStart?`url(#${W1(s.value.markerStart,e)})`:``),g=R(()=>s.value.markerEnd?`url(#${W1(s.value.markerEnd,e)})`:``);return()=>{if(!f.value||!n.value)return null;let e=n.value.id,i=n.value.type,l=f.value.handleBounds,u=l?.[i]??[];if(t.value===J$.Loose){let e=l?.[i===`source`?`target`:`source`]??[];u=[...u,...e]}if(!u)return null;let _=(e?u.find(t=>t.id===e):u[0])??null,y=_?.position??Q.Top,{x:b,y:x}=u0(f.value,_,y),S=null;p.value&&(S=t.value===J$.Strict?p.value.handleBounds[i===`source`?`target`:`source`]?.find(e=>e.id===r.value?.id)||null:[...p.value.handleBounds.source??[],...p.value.handleBounds.target??[]].find(e=>e.id===r.value?.id)||null);let C=r.value?.position??(y?N0[y]:null);if(!y||!C)return null;let w=a.value??s.value.type??q$.Bezier,T=``,E={sourceX:b,sourceY:x,sourcePosition:y,targetX:m.value.x,targetY:m.value.y,targetPosition:C};return w===q$.Bezier?[T]=H2(E):w===q$.Step?[T]=X2({...E,borderRadius:0}):w===q$.SmoothStep?[T]=X2(E):w===q$.SimpleBezier?[T]=W2(E):T=`M${b},${x} ${m.value.x},${m.value.y}`,v(`svg`,{class:`vue-flow__edges vue-flow__connectionline vue-flow__container`},v(`g`,{class:`vue-flow__connection`},d?v(d,{sourceX:b,sourceY:x,sourcePosition:y,targetX:m.value.x,targetY:m.value.y,targetPosition:C,sourceNode:f.value,sourceHandle:_,targetNode:p.value,targetHandle:S,markerEnd:g.value,markerStart:h.value,connectionStatus:c.value}):v(`path`,{d:T,class:[s.value.class,c.value,`vue-flow__connection-path`],style:{...o.value,...s.value.style},"marker-end":g.value,"marker-start":h.value})))}}}),D4=[`id`,`markerWidth`,`markerHeight`,`markerUnits`,`orient`],O4=z({name:`MarkerType`,compatConfig:{MODE:3},props:{id:{},type:{},color:{default:`none`},width:{default:12.5},height:{default:12.5},markerUnits:{default:`strokeWidth`},orient:{default:`auto-start-reverse`},strokeWidth:{default:1}},setup(e){return(e,t)=>(B(),N(`marker`,{id:e.id,class:`vue-flow__arrowhead`,viewBox:`-10 -10 20 20`,refX:`0`,refY:`0`,markerWidth:`${e.width}`,markerHeight:`${e.height}`,markerUnits:e.markerUnits,orient:e.orient},[e.type===r(Y$).ArrowClosed?(B(),N(`polyline`,{key:0,style:ie({stroke:e.color,fill:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":`round`,"stroke-linejoin":`round`,points:`-5,-4 0,0 -5,4 -5,-4`},null,4)):G(``,!0),e.type===r(Y$).Arrow?(B(),N(`polyline`,{key:1,style:ie({stroke:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":`round`,"stroke-linejoin":`round`,fill:`none`,points:`-5,-4 0,0 -5,4`},null,4)):G(``,!0)],8,D4))}}),k4={class:`vue-flow__marker vue-flow__container`,"aria-hidden":`true`},A4=z({name:`MarkerDefinitions`,compatConfig:{MODE:3},setup(e){let{id:t,edges:n,connectionLineOptions:r,defaultMarkerColor:i}=s4(),a=R(()=>{let e=new Set,a=[],o=n=>{if(n){let r=W1(n,t);e.has(r)||(typeof n==`object`?a.push({...n,id:r,color:n.color||i.value}):a.push({id:r,color:i.value,type:n}),e.add(r))}};for(let e of[r.value.markerEnd,r.value.markerStart])o(e);for(let e of n.value)for(let t of[e.markerStart,e.markerEnd])o(t);return a.sort((e,t)=>e.id.localeCompare(t.id))});return(e,t)=>(B(),N(`svg`,k4,[M(`defs`,null,[(B(!0),N(V,null,P(a.value,e=>(B(),W(O4,{id:e.id,key:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,"stroke-width":e.strokeWidth,orient:e.orient},null,8,[`id`,`type`,`color`,`width`,`height`,`markerUnits`,`stroke-width`,`orient`]))),128))])]))}}),j4=z({name:`Edges`,compatConfig:{MODE:3},setup(e){let{findNode:t,getEdges:n,elevateEdgesOnSelect:i}=s4();return(e,a)=>(B(),N(V,null,[b(A4),(B(!0),N(V,null,P(r(n),e=>(B(),N(`svg`,{key:e.id,class:`vue-flow__edges vue-flow__container`,style:ie({zIndex:r(p0)(e,r(t),r(i))})},[b(r(T4),{id:e.id},null,8,[`id`])],4))),128)),b(r(E4))],64))}}),M4=z({name:`Node`,compatConfig:{MODE:3},props:[`id`,`resizeObserver`],setup(e){let{id:t,noPanClassName:n,selectNodesOnDrag:r,nodesSelectionActive:a,multiSelectionActive:s,emits:c,removeSelectedNodes:l,addSelectedNodes:u,updateNodeDimensions:d,onUpdateNodeInternals:f,getNodeTypes:p,nodeExtent:m,elevateNodesOnSelect:h,disableKeyboardA11y:g,ariaLiveMessage:_,snapToGrid:y,snapGrid:b,nodeDragThreshold:x,nodesDraggable:S,elementsSelectable:E,nodesConnectable:D,nodesFocusable:ee,hooks:k}=s4(),A=i(null);ne(Y0,A),ne(J0,e.id);let j=w(Q0),M=T(),N=l2(),{node:P,parentNode:I}=o2(e.id),{emit:L,on:te}=c2(P,c),re=o(()=>P.draggable===void 0?S.value:P.draggable),z=o(()=>P.selectable===void 0?E.value:P.selectable),B=o(()=>P.connectable===void 0?D.value:P.connectable),ie=o(()=>P.focusable===void 0?ee.value:P.focusable),V=R(()=>z.value||re.value||k.value.nodeClick.hasListeners()||k.value.nodeDoubleClick.hasListeners()||k.value.nodeMouseEnter.hasListeners()||k.value.nodeMouseMove.hasListeners()||k.value.nodeMouseLeave.hasListeners()),ae=o(()=>!!P.dimensions.width&&!!P.dimensions.height),H=R(()=>{let e=P.type||`default`,t=j?.[`node-${e}`];if(t)return t;let n=P.template||p.value[e];if(typeof n==`string`&&M){let t=Object.keys(M.appContext.components);t&&t.includes(e)&&(n=O(e,!1))}return n&&typeof n!=`string`?n:(c.error(new g0(m0.NODE_TYPE_MISSING,n)),!1)}),U=$0({id:e.id,el:A,disabled:()=>!re.value,selectable:z,dragHandle:()=>P.dragHandle,onStart(e){L.dragStart(e)},onDrag(e){L.drag(e)},onStop(e){L.dragStop(e)},onClick(e){he(e)}}),oe=R(()=>P.class instanceof Function?P.class(P):P.class),se=R(()=>{let e=(P.style instanceof Function?P.style(P):P.style)||{},t=P.width instanceof Function?P.width(P):P.width,n=P.height instanceof Function?P.height(P):P.height;return!e.width&&t&&(e.width=typeof t==`string`?t:`${t}px`),!e.height&&n&&(e.height=typeof n==`string`?n:`${n}px`),e}),ce=o(()=>Number(P.zIndex??se.value.zIndex??0));return f(t=>{(t.includes(e.id)||!t.length)&&W()}),F(()=>{C(()=>P.hidden,(t=!1,n,r)=>{!t&&A.value&&(e.resizeObserver.observe(A.value),r(()=>{A.value&&e.resizeObserver.unobserve(A.value)}))},{immediate:!0,flush:`post`})}),C([()=>P.type,()=>P.sourcePosition,()=>P.targetPosition],()=>{le(()=>{d([{id:e.id,nodeElement:A.value,forceUpdate:!0}])})}),C([()=>P.position.x,()=>P.position.y,()=>I.value?.computedPosition.x,()=>I.value?.computedPosition.y,()=>I.value?.computedPosition.z,ce,()=>P.selected,()=>P.dimensions.height,()=>P.dimensions.width,()=>I.value?.dimensions.height,()=>I.value?.dimensions.width],([e,t,n,r,i,a])=>{let o={x:e,y:t,z:a+(h.value&&P.selected?1e3:0)};n!==void 0&&r!==void 0?P.computedPosition=H1({x:n,y:r,z:i},o):P.computedPosition=o},{flush:`post`,immediate:!0}),C([()=>P.extent,m],([e,t],[n,r])=>{(e!==n||t!==r)&&ue()}),P.extent===`parent`||typeof P.extent==`object`&&`range`in P.extent&&P.extent.range===`parent`?Yq(()=>ae).toBe(!0).then(ue):ue(),()=>P.hidden?null:v(`div`,{ref:A,"data-id":P.id,class:[`vue-flow__node`,`vue-flow__node-${H.value===!1?`default`:P.type||`default`}`,{[n.value]:re.value,dragging:U?.value,draggable:re.value,selected:P.selected,selectable:z.value,parent:P.isParent},oe.value],style:{visibility:ae.value?`visible`:`hidden`,zIndex:P.computedPosition.z??ce.value,transform:`translate(${P.computedPosition.x}px,${P.computedPosition.y}px)`,pointerEvents:V.value?`all`:`none`,...se.value},tabIndex:ie.value?0:void 0,role:ie.value?`group`:void 0,"aria-describedby":g.value?void 0:`${o1}-${t}`,"aria-label":P.ariaLabel,"aria-roledescription":`node`,...P.domAttributes,onMouseenter:de,onMousemove:fe,onMouseleave:G,onContextmenu:pe,onClick:he,onDblclick:me,onKeydown:ge},[v(H.value===!1?p.value.default:H.value,{id:P.id,type:P.type,data:P.data,events:{...P.events,...te},selected:P.selected,resizing:P.resizing,dragging:U.value,connectable:B.value,position:P.computedPosition,dimensions:P.dimensions,isValidTargetPos:P.isValidTargetPos,isValidSourcePos:P.isValidSourcePos,parent:P.parentNode,parentNodeId:P.parentNode,zIndex:P.computedPosition.z??ce.value,targetPosition:P.targetPosition,sourcePosition:P.sourcePosition,label:P.label,dragHandle:P.dragHandle,onUpdateNodeInternals:W})]);function ue(){let e=P.computedPosition,{computedPosition:t,position:n}=l0(P,y.value?S0(e,b.value):e,c.error,m.value,I.value);(P.computedPosition.x!==t.x||P.computedPosition.y!==t.y)&&(P.computedPosition={...P.computedPosition,...t}),(P.position.x!==n.x||P.position.y!==n.y)&&(P.position=n)}function W(){A.value&&d([{id:e.id,nodeElement:A.value,forceUpdate:!0}])}function de(e){U?.value||L.mouseEnter({event:e,node:P})}function fe(e){U?.value||L.mouseMove({event:e,node:P})}function G(e){U?.value||L.mouseLeave({event:e,node:P})}function pe(e){return L.contextMenu({event:e,node:P})}function me(e){return L.doubleClick({event:e,node:P})}function he(e){z.value&&(!r.value||!re.value||x.value>0)&&R0(P,s.value,u,l,a,!1,A.value),L.click({event:e,node:P})}function ge(e){if(!(e1(e)||g.value)){if(l1.includes(e.key)&&z.value){let t=e.key===`Escape`;R0(P,s.value,u,l,a,t,A.value)}else re.value&&P.selected&&u1[e.key]&&(e.preventDefault(),_.value=`Moved selected node ${e.key.replace(`Arrow`,``).toLowerCase()}. New position, x: ${~~P.position.x}, y: ${~~P.position.y}`,N({x:u1[e.key].x,y:u1[e.key].y},e.shiftKey))}}}});function N4(e={includeHiddenNodes:!1}){let{nodes:t}=s4();return R(()=>{if(t.value.length===0)return!1;for(let n of t.value)if((e.includeHiddenNodes||!n.hidden)&&(n?.handleBounds===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}var P4={class:`vue-flow__nodes vue-flow__container`},F4=z({name:`Nodes`,compatConfig:{MODE:3},setup(e){let{getNodes:t,updateNodeDimensions:n,emits:a}=s4(),o=N4(),s=i();return C(o,e=>{e&&le(()=>{a.nodesInitialized(t.value)})},{immediate:!0}),F(()=>{s.value=new ResizeObserver(e=>{let t=e.map(e=>({id:e.target.getAttribute(`data-id`),nodeElement:e.target,forceUpdate:!0}));le(()=>n(t))})}),re(()=>s.value?.disconnect()),(e,n)=>(B(),N(`div`,P4,[s.value?(B(!0),N(V,{key:0},P(r(t),(e,t,n,i)=>{let a=[e.id];if(i&&i.key===e.id&&A(i,a))return i;let o=(B(),W(r(M4),{id:e.id,key:e.id,"resize-observer":s.value},null,8,[`id`,`resize-observer`]));return o.memo=a,o},n,0),128)):G(``,!0)]))}});function I4(){let{emits:e}=s4();F(()=>{if(I0()){let t=document.querySelector(`.vue-flow__pane`);t&&window.getComputedStyle(t).zIndex!==`1`&&e.error(new g0(m0.MISSING_STYLES))}})}var L4=M(`div`,{class:`vue-flow__edge-labels`},null,-1),R4=z({name:`VueFlow`,compatConfig:{MODE:3},props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:`nodesChange.edgesChange.nodesInitialized.paneReady.init.updateNodeInternals.error.connect.connectStart.connectEnd.clickConnectStart.clickConnectEnd.moveStart.move.moveEnd.selectionDragStart.selectionDrag.selectionDragStop.selectionContextMenu.selectionStart.selectionEnd.viewportChangeStart.viewportChange.viewportChangeEnd.paneScroll.paneClick.paneContextMenu.paneMouseEnter.paneMouseMove.paneMouseLeave.edgeUpdate.edgeContextMenu.edgeMouseEnter.edgeMouseMove.edgeMouseLeave.edgeDoubleClick.edgeClick.edgeUpdateStart.edgeUpdateEnd.nodeContextMenu.nodeMouseEnter.nodeMouseMove.nodeMouseLeave.nodeDoubleClick.nodeClick.nodeDragStart.nodeDrag.nodeDragStop.miniMapNodeClick.miniMapNodeDoubleClick.miniMapNodeMouseEnter.miniMapNodeMouseMove.miniMapNodeMouseLeave.update:modelValue.update:nodes.update:edges`.split(`.`),setup(e,{expose:t,emit:n}){let i=e,a=E(),o=nJ(i,`modelValue`,n),s=nJ(i,`nodes`,n),c=nJ(i,`edges`,n),l=s4(i),u=g2({modelValue:o,nodes:s,edges:c},i,l);return v2(n,l.hooks),b4(),I4(),ne(Q0,a),te(u),t(l),(e,t)=>(B(),N(`div`,{ref:r(l).vueFlowRef,class:`vue-flow`},[b(h4,null,{default:H(()=>[b(j4),L4,b(F4),fe(e.$slots,`zoom-pane`)]),_:3}),fe(e.$slots,`default`),b(y4)],512))}}),z4=z({name:`Panel`,compatConfig:{MODE:3},props:{position:{}},setup(e){let t=e,{userSelectionActive:n}=s4(),i=R(()=>`${t.position}`.split(`-`));return(e,t)=>(B(),N(`div`,{class:I([`vue-flow__panel`,i.value]),style:ie({pointerEvents:r(n)?`none`:`all`})},[fe(e.$slots,`default`)],6))}}),B4=`#818cf8`,V4=ze(z({inheritAttrs:!1,__name:`ScenarioGroupNode`,props:{id:{},data:{},selected:{type:Boolean},readonly:{type:Boolean}},emits:[`updateLabel`,`updateNodeInternals`,`remove`],setup(e,{emit:t}){let n=e,a=t,o=i(!1),s=i(``);function c(e){e.stopPropagation(),s.value=n.data.label,o.value=!0}function l(){o.value=!1,a(`updateLabel`,n.id,s.value)}function u(e){e.key===`Enter`&&l(),e.key===`Escape`&&(o.value=!1)}C(()=>n.data.label,e=>{o.value||(s.value=e)});let d=R(()=>n.data.color??B4),f=R(()=>n.selected?d.value:`${d.value}90`),p=R(()=>n.selected?`color-mix(in srgb, ${d.value} 28%, transparent)`:`color-mix(in srgb, ${d.value} 14%, transparent)`),m=R(()=>n.selected?d.value:`${d.value}cc`),h=R(()=>`${d.value}55`),g=R(()=>({borderColor:f.value,background:p.value,boxShadow:n.selected?`0 0 0 1px ${f.value}, 0 0 28px ${h.value}`:`0 0 0 0 transparent`})),_=R(()=>({color:m.value}));return R(()=>({borderColor:d.value})),(t,n)=>(B(),N(`div`,{class:`group-node`,style:ie(g.value)},[M(`div`,{class:`group-node__header`,onDblclick:n[3]||=t=>!e.readonly&&c(t)},[o.value?(B(),W(r(Ce),{key:0,modelValue:s.value,"onUpdate:modelValue":n[0]||=e=>s.value=e,class:`group-node__label-input`,style:ie({color:d.value,outlineColor:d.value}),autofocus:``,onBlur:l,onKeydown:u,onClick:n[1]||=he(()=>{},[`stop`])},null,8,[`modelValue`,`style`])):(B(),N(`span`,{key:1,class:`group-node__label`,style:ie(_.value)},U(e.data.label||`Team`),5)),e.selected&&!e.readonly?(B(),W(r(Le),{key:2,icon:`ti ti-trash`,variant:`text`,rounded:``,size:`small`,severity:`danger`,class:`group-node__remove`,onClick:n[2]||=he(t=>a(`remove`,e.id),[`stop`])})):G(``,!0)],32)],4))}}),[[`__scopeId`,`data-v-81199534`]]),H4={class:`efn__inner`},U4={class:`efn__icon-wrap`},W4={class:`efn__content`},G4={class:`efn__label`},K4={class:`efn__meta`},q4={key:1,class:`efn__spinner`},J4={key:2,class:`efn__spinner efn__spinner--waiting-input`},Y4={key:3,class:`efn__spinner efn__spinner--waiting`},X4=ze(z({inheritAttrs:!1,__name:`ScenarioFlowNode`,props:{id:{},data:{},selected:{type:Boolean}},emits:[`updateNodeInternals`],setup(e){let t=e,{updateNodeInternals:n}=s4();F(()=>n(t.id));let a=w(`efn-selected-node-id`,i(void 0)),o=w(`efn-node-states`,i({})),s=R(()=>o.value[t.id]??t.data.state??`idle`),c=R(()=>t.selected||a.value===t.id),l=R(()=>t.data.label||t.id),u=R(()=>t.data.isLeader??!1),d=R(()=>u.value?`ti ti-crown`:t.data.type===`ask`?`ti ti-message`:`ti ti-brain`),f=R(()=>(t.data.aiCli??`claude-code`)===`codex`?`Codex`:`Claude`),p=R(()=>t.data.model?.trim()||``),m=R(()=>{let e=p.value?`${f.value} · ${p.value}`:f.value;return t.data.roleName?`${t.data.roleName} · ${e}`:e}),h=w(`efn-open-pty-debug`,null),g=R(()=>!h||t.data.type===`ask`||(t.data.aiCli??`claude-code`)!==`claude-code`?!1:s.value===`done`||s.value===`synthesized`);function _(e){e.stopPropagation(),h?.(t.id)}return(t,n)=>(B(),N(V,null,[b(r(w2),{type:`target`,position:r(Q).Left,class:`efn-handle efn-handle--target`},null,8,[`position`]),M(`div`,{class:I([`efn`,u.value?`efn--leader`:`efn--node`,c.value&&`efn--selected`,s.value!==`idle`&&`efn--${s.value}`])},[n[6]||=M(`div`,{class:`efn__border`},null,-1),M(`div`,H4,[M(`div`,U4,[M(`i`,{class:I([d.value,`efn__icon`])},null,2)]),M(`div`,W4,[M(`span`,G4,U(l.value),1),M(`span`,K4,U(m.value),1)])]),g.value?(B(),N(`button`,{key:0,class:`efn__badge efn__badge--debug`,title:`Reprendre dans un terminal Claude (--resume)`,onClick:_,onMousedown:n[0]||=he(()=>{},[`stop`]),onPointerdown:n[1]||=he(()=>{},[`stop`])},[...n[2]||=[M(`i`,{class:`ti ti-device-desktop`},null,-1)]],32)):G(``,!0),s.value===`running`?(B(),N(`div`,q4,[...n[3]||=[M(`i`,{class:`ti ti-spin ti-loader-2`},null,-1)]])):s.value===`waiting_input`?(B(),N(`div`,J4,[...n[4]||=[M(`i`,{class:`ti ti-help-circle`},null,-1)]])):s.value===`waiting`?(B(),N(`div`,Y4,[...n[5]||=[M(`i`,{class:`ti ti-clock`},null,-1)]])):G(``,!0)],2),e.data.showBottomHandle===!1?G(``,!0):(B(),W(r(w2),{key:0,id:`source-bottom`,type:`source`,position:r(Q).Bottom,class:`efn-handle efn-handle--source efn-handle--source-bottom`,style:{left:`10px`}},null,8,[`position`])),e.data.showTopHandle?(B(),W(r(w2),{key:1,id:`source-top`,type:`source`,position:r(Q).Top,class:`efn-handle efn-handle--source efn-handle--source-top`,style:{left:`10px`}},null,8,[`position`])):G(``,!0)],64))}}),[[`__scopeId`,`data-v-feea8c6d`]]),Z4={class:`scenario-run-view`},Q4={key:0,class:`scenario-run-view__loading`},$4=`scenario-run-view`,e3=ze(z({__name:`ScenarioRunView`,props:{scenario:{},nodeStates:{},selectedNodeId:{},preset:{}},emits:[`node-click`],setup(e,{emit:t}){let n=e,i=t;ne(`efn-selected-node-id`,o(n,`selectedNodeId`)),ne(`efn-node-states`,o(n,`nodeStates`));let{updateEdge:a,getEdges:s}=s4($4),c=R(()=>n.scenario),l=R(()=>{if(!c.value)return[];let e=(c.value.groups??[]).map(e=>({id:e.id,type:`group`,position:{...e.position},style:{width:`${e.width}px`,height:`${e.height}px`},data:{label:e.name,color:e.color??void 0},draggable:!1,selectable:!1})),t=c.value.nodes.map(e=>({id:e.id,position:{...e.position},label:e.label,data:{label:e.label,isLeader:e.id===c.value.leaderId,type:e.type,aiCli:e.aiCli,model:e.model,roleName:n.preset?.roles.find(t=>t.id===e.role)?.name},...e.groupId?{parentNode:e.groupId,extent:`parent`}:{}}));return[...e,...t]}),u=R(()=>{if(!c.value)return[];let e=[];for(let t of c.value.nodes)for(let n of t.parentIds??[])e.push({id:`e-${n}-${t.id}`,source:n,target:t.id,type:`step`,animated:!1,zIndex:1500,style:{stroke:`rgba(99,102,241,0.55)`,strokeWidth:2.5}});return e});return C(()=>n.nodeStates,e=>{let t=Object.values(e).some(e=>e===`running`);for(let e of s.value)a(e.id,{animated:t})},{deep:!0}),(e,t)=>(B(),N(`div`,Z4,[c.value?(B(),W(r(R4),{key:1,id:$4,nodes:l.value,edges:u.value,"nodes-draggable":!0,"nodes-connectable":!1,"elements-selectable":!1,"fit-view-on-init":``,class:`scenario-run-view__flow scenario-flow-canvas`,onNodeClick:t[0]||=e=>i(`node-click`,e.node.id)},{"node-default":H(e=>[b(X4,ce(pe(e)),null,16)]),"node-group":H(e=>[b(V4,L(e,{readonly:!0}),null,16)]),_:1},8,[`nodes`,`edges`])):(B(),N(`div`,Q4,[...t[1]||=[M(`i`,{class:`ti ti-spin ti-loader-2`},null,-1)]]))]))}}),[[`__scopeId`,`data-v-d046446e`]]),t3={class:`ai-chat-scenario-view`},n3={class:`ai-chat-scenario-view__graph`},r3={key:0,class:`ai-chat-scenario-view__synthesis-banner`},i3={class:`ai-chat-scenario-view__detail`},a3={key:0,class:`ai-chat-scenario-view__stop-bar`},o3={key:1,class:`ai-chat-scenario-view__stop-bar`},s3={style:{"font-size":`0.875rem`}},c3={class:`ai-chat-scenario-view__input-request-header`},l3={class:`ai-chat-scenario-view__input-request-name`},u3={class:`ai-chat-scenario-view__input-request-question`},d3={class:`ai-chat-scenario-view__input-request-form`},f3={class:`ai-chat-scenario-view__tabs`},p3={key:0,class:`ai-chat-scenario-view__tab-dot`},m3={key:0,class:I([`ai-chat-scenario-view__tab`,`ai-chat-scenario-view__tab--active`])},h3={key:0,class:`ai-chat-scenario-view__hint`},g3={key:1,class:`ai-chat-scenario-view__accordion`},_3={key:0,class:`ai-chat-scenario-view__accordion-item`},v3=[`innerHTML`],y3={key:1,class:`ai-chat-scenario-view__accordion-item`},b3=[`innerHTML`],x3={key:2,class:`ai-chat-scenario-view__cursor`},S3={key:0,class:`ai-chat-scenario-view__node-meta`},C3={class:`ai-chat-scenario-view__chip`},w3={key:0,class:`ai-chat-scenario-view__chip ai-chat-scenario-view__chip--model`},T3={key:1,class:`ai-chat-scenario-view__node-status`},E3={key:2,class:`ai-chat-scenario-view__thinking-block`},D3={key:0,class:`ai-chat-scenario-view__thinking-content`},O3={key:3,class:`ai-chat-scenario-view__tool-events`},k3={class:`ai-chat-scenario-view__tool-event-name`},A3={key:0,class:`ai-chat-scenario-view__tool-event-args ai-chat-scenario-view__tool-event-args--streaming`},j3={key:1,class:`ai-chat-scenario-view__tool-event-args`},M3={key:2,class:`ai-chat-scenario-view__tool-event-result`},N3=[`innerHTML`],P3={key:5,class:`ai-chat-scenario-view__node-empty`},F3={key:6,class:`ai-chat-scenario-view__node-duration`},I3={key:0,style:{padding:`1rem`,color:`#d4d4d4`}},L3={key:1,style:{padding:`1rem`,color:`#f87171`}},R3=ze(z({__name:`AiChatScenarioView`,props:{availablePresets:{}},emits:[`click-resume`],setup(e,{expose:t,emit:n}){let a=e,o=n,{t:s}=He(),c=De(),l=lt(),u=dt(),{activeConversation:d}=$e(l),f=i(null);t({messagesEl:f,resetNodeSelection:Ce,syncScenarioAccordionState:de});let p=i(null),m=i(!0),h=i(!1),g=i(null),_=i(null),v=i(!1),y=i(null);ne(`efn-open-pty-debug`,e=>{S(e)});async function S(e){let t=d.value;if(t){g.value=e,_.value=null,y.value=null,v.value=!0;try{let n=await yt.scenario.getNodeSession.query({conversationId:t.id,nodeId:e});n?_.value=n:y.value=`Ce nœud n'a pas encore de session Claude (jamais exécuté ?).`}catch(e){y.value=e.message}finally{v.value=!1}}}let C=/##\s*(?:✅\s*)?FINAL REPORT/i,w=R(()=>d.value?.scenarioNodeStates??{}),T=R(()=>d.value?.scenarioNodeOutputs??{}),E=R(()=>d.value?.scenarioRunning??!1),D=R(()=>d.value?.scenarioSynthesisRunning??!1),ee=R(()=>{let e=d.value;if(!e||e.workflowType!==`scenario`||E.value)return!1;let t=e.scenarioNodeStates??{};return Object.keys(t).length>0&&Object.values(t).some(e=>e!==`done`&&e!==`synthesized`)}),O=R(()=>d.value?.scenarioReadme??``),k=R(()=>{let e=O.value??``,t=C.exec(e);if(!t)return{runLog:e,finalReport:``};let n=t.index??0;return{runLog:e.slice(0,n).trim(),finalReport:e.slice(n).trim()}}),A=R(()=>{let e=d.value;return!e||e.workflowType!==`scenario`?null:e.scenarioSnapshot??u.scenarios.find(t=>t.id===e.workflowId)??null}),j=R(()=>a.availablePresets.find(e=>e.id===A.value?.presetId)),F=R(()=>!p.value||!A.value?null:A.value.nodes.find(e=>e.id===p.value)??null),L=R(()=>(F.value?.aiCli??`claude-code`)===`codex`?`Codex`:`Claude Code`),te=R(()=>{let e=F.value;return e&&e.model?.trim()||``}),re=R(()=>d.value?.scenarioWaitingInputs??{}),z=R(()=>d.value?.scenarioNodeStatuses??{}),ie=R(()=>d.value?.scenarioNodeThinking??{}),ae=R(()=>d.value?.scenarioNodeToolEvents??{}),oe=R(()=>d.value?.scenarioNodeDurations??{}),se=i(new Set),ce=R(()=>p.value),le=i({});async function ue(e){let t=d.value;if(!t)return;let n=le.value[e]?.trim();if(n)try{await l.sendNodeInput(t.id,e,n);let{[e]:r,...i}=le.value;le.value=i}catch(e){c.add({severity:`error`,summary:s(`common.error`),detail:e.message,life:4e3})}}function de(){let e=k.value.finalReport.length>0;m.value=!e,h.value=e}function fe(e){if(e===`run`){let e=!m.value;m.value=e,e&&(h.value=!1);return}let t=!h.value;h.value=t,t&&(m.value=!1)}let pe=new Map;function ge(e){return e.replace(/<pass\s+branch="(\d+)"\s*\/>/g,(e,t)=>`<span class="scenario-flag scenario-flag--pass">PASS ${t}</span>`).replace(/<pass\s*\/>/g,`<span class="scenario-flag scenario-flag--pass">PASS</span>`).replace(/<error>([\s\S]*?)<\/error>/g,(e,t)=>`<span class="scenario-flag scenario-flag--error">ERROR: ${t.trim()}</span>`).replace(/<ask_user>([\s\S]*?)<\/ask_user>/g,(e,t)=>`<span class="scenario-flag scenario-flag--ask">${t.trim()}</span>`).replace(/<kanban_move\s+column="([^"]*?)"\s*\/>/g,(e,t)=>`<span class="scenario-flag scenario-flag--kanban">📋 Move → ${t}</span>`).replace(/<kanban_comment>([\s\S]*?)<\/kanban_comment>/g,(e,t)=>`<span class="scenario-flag scenario-flag--kanban-comment">💬 ${t.trim()}</span>`).replace(/<kanban_add_card\s+column="([^"]*?)"\s+title="([^"]*?)">([\s\S]*?)<\/kanban_add_card>/g,(e,t,n)=>`<span class="scenario-flag scenario-flag--kanban">➕ Card "${n}" → ${t}</span>`).replace(/<next_person\s+name="([^"]*?)"\s*\/>/g,(e,t)=>`<span class="scenario-flag scenario-flag--delegate">🔀 ${t}</span>`).replace(/<next_person\s+name="([^"]*?)">([\s\S]*?)<\/next_person>/g,(e,t,n)=>`<span class="scenario-flag scenario-flag--delegate">🔀 <strong>${t}</strong> — ${n.trim()}</span>`).replace(/<hire_person\s+label="([^"]*?)"\s+role="([^"]*?)">([\s\S]*?)<\/hire_person>/g,(e,t,n)=>`<span class="scenario-flag scenario-flag--hire">🧑💼 Hire ${t} (${n})</span>`)}function _e(e){let t=pe.get(e);return t===void 0&&(t=nR.sanitize(NI.parse(ge(e),{async:!1})),pe.set(e,t)),t}function ve(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function ye(e){return e.name===`command_execution`&&typeof e.input?.command==`string`}function be(e){return ye(e)?`shell`:e.name}function xe(e){return!e.input||Object.keys(e.input).length===0?``:ye(e)?String(e.input.command??``):Object.entries(e.input).map(([e,t])=>`${e}=${t}`).join(`, `)}function Se(e,t){let n;if(typeof e==`string`)n=e;else try{n=JSON.stringify(e,null,2)}catch{n=`[unserializable result]`}return n.split(`
|
|
307
|
+
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},x0=class extends Error{constructor(e,...t){super(b0[e]?.call(b0,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function S0(e){return`clientX`in e}function C0(e){return`sourceEvent`in e}function w0(e,t){let n=S0(e),r,i;return n?(r=e.clientX,i=e.clientY):`touches`in e&&e.touches.length>0?(r=e.touches[0].clientX,i=e.touches[0].clientY):`changedTouches`in e&&e.changedTouches.length>0?(r=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(r=0,i=0),{x:r-(t?.left??0),y:i-(t?.top??0)}}var T0=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function E0(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function D0(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var O0=()=>!0;function k0(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function A0(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())_1(i,g1(e))>0&&r.push(e);return r}var j0=250;function M0(e,t,n,r){let i=[],a=1/0,o=A0(e,n,t+j0);for(let n of o){let o=[...n.handleBounds?.source??[],...n.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=h0(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function N0(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=O0},u,d,f,p){let m=a===`target`,h=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:_}=w0(e),v=o.elementFromPoint(g,_),y=v?.classList.contains(`${s}-flow__handle`)?v:h,b={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){let e=P0(void 0,y),t=y.getAttribute(`data-nodeid`),a=y.getAttribute(`data-handleid`),o=y.classList.contains(`connectable`),s=y.classList.contains(`connectableend`);if(!t||!e)return b;let c={source:m?t:r,sourceHandle:m?a:i,target:m?r:t,targetHandle:m?i:a};b.connection=c,b.isValid=o&&s&&(n===$$.Strict?m&&e===`source`||!m&&e===`target`:t!==r||a!==i)&&l(c,{nodes:d,edges:u,sourceNode:f(c.source),targetNode:f(c.target)}),b.toHandle=L0(t,e,a,p,n,!0)}return b}function P0(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function F0(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function I0(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function L0(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===$$.Strict?o.handleBounds?.[t]:[...o.handleBounds?.source??[],...o.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...h0(o,c,c.position,!0)}:c}var R0={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top},z0=[`production`,`prod`];function B0(e,...t){V0()&&console.warn(`[Vue Flow]: ${e}`,...t)}function V0(){return!z0.includes(`production`)}function H0(e,t,n,r,i){let a=t.querySelectorAll(`.vue-flow__handle.${e}`);return a?.length?Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...v1(t)}}):null}function U0(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),le(()=>{o.blur()})):n([e])}function W0(e){return r(e)!==void 0}function G0(e,t,n,r){if(!e||!e.source||!e.target)return n(new x0(y0.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=S1(e)?e:{...e,id:M1(e)},i=O1(i,void 0,r),!N1(i,t)&&i}function K0(e,t,n,r,i){if(!t.source||!t.target)return i(new x0(y0.EDGE_INVALID,e.id)),!1;if(!n)return i(new x0(y0.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?M1(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function q0(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!C1(o)){n(new x0(y0.NODE_INVALID,o?.id));continue}let s=D1(o,t(o.id),o.parentNode);o.parentNode&&(r[o.parentNode]=!0),i[a]=s}for(let e of i){let a=t(e.parentNode)||i.find(t=>t.id===e.parentNode);e.parentNode&&!a&&n(new x0(y0.NODE_MISSING_PARENT,e.id,e.parentNode)),(e.parentNode||r[e.id])&&(r[e.id]&&(e.isParent=!0),a&&(a.isParent=!0))}return i}function J0(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function Y0(e,t,n){e.clear();for(let t of n){let{source:n,target:r,sourceHandle:i=null,targetHandle:a=null}=t,o={edgeId:t.id,source:n,target:r,sourceHandle:i,targetHandle:a},s=`${n}-${i}--${r}-${a}`;J0(`source`,o,`${r}-${a}--${n}-${i}`,e,n,i),J0(`target`,o,s,e,r,a)}}function X0(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Z0(e,t,n,r,i,a,o,s){let c=[];for(let l of e){let e=S1(l)?l:G0(l,s,i,a);if(!e)continue;let u=n(e.source),d=n(e.target);if(!u||!d){i(new x0(y0.EDGE_SOURCE_TARGET_MISSING,e.id,e.source,e.target));continue}if(!u){i(new x0(y0.EDGE_SOURCE_MISSING,e.id,e.source));continue}if(!d){i(new x0(y0.EDGE_TARGET_MISSING,e.id,e.target));continue}if(t&&!t(e,{edges:s,nodes:o,sourceNode:u,targetNode:d})){i(new x0(y0.EDGE_INVALID,e.id));continue}let f=r(e.id);c.push({...O1(e,f,a),sourceNode:u,targetNode:d})}return c}var Q0=Symbol(`vueFlow`),$0=Symbol(`nodeId`),e2=Symbol(`nodeRef`),t2=Symbol(`edgeId`),n2=Symbol(`edgeRef`),r2=Symbol(`slots`);function i2(e){let{vueFlowRef:t,snapToGrid:n,snapGrid:r,noDragClassName:i,nodeLookup:o,nodeExtent:c,nodeDragThreshold:l,viewport:u,autoPanOnNodeDrag:d,autoPanSpeed:f,nodesDraggable:p,panBy:m,findNode:h,multiSelectionActive:g,nodesSelectionActive:_,selectNodesOnDrag:v,removeSelectedElements:y,addSelectedNodes:b,updateNodePositions:x,emits:S}=f4(),{onStart:w,onDrag:T,onStop:E,onClick:D,el:ee,disabled:O,id:k,selectable:A,dragHandle:j}=e,M=s(!1),N=[],P,F=null,I={x:void 0,y:void 0},L={x:0,y:0},te=null,R=!1,ne=!1,re=0,z=!1,B=s2(),ie=({x:e,y:t})=>{I={x:e,y:t};let i=!1;if(N=N.map(a=>{let o={x:e-a.distance.x,y:t-a.distance.y},{computedPosition:s}=m0(a,n.value?D0(o,r.value):o,S.error,c.value,a.parentNode?h(a.parentNode):void 0);return i=i||a.position.x!==s.x||a.position.y!==s.y,a.position=s,a}),ne||=i,i&&(x(N,!0,!0),M.value=!0,te)){let[e,t]=l0({id:k,dragItems:N,findNode:h});T({event:te,node:e,nodes:t})}},V=()=>{if(!F)return;let[e,t]=Q1(L,F,f.value);if(e!==0||t!==0){let n={x:(I.x??0)-e/u.value.zoom,y:(I.y??0)-t/u.value.zoom};m({x:e,y:t})&&ie(n)}re=requestAnimationFrame(V)},ae=(e,t)=>{R=!0;let n=h(k);!v.value&&!g.value&&n&&(n.selected||y()),n&&a(A)&&v.value&&U0(n,g.value,b,y,_,!1,t);let r=B(e.sourceEvent);if(I=r,N=c0(o.value,p.value,r,k),N.length){let[t,n]=l0({id:k,dragItems:N,findNode:h});w({event:e.sourceEvent,node:t,nodes:n})}},H=(e,n)=>{e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||(ne=!1,l.value===0&&ae(e,n),I=B(e.sourceEvent),F=t.value?.getBoundingClientRect()||null,L=w0(e.sourceEvent,F))},U=(e,t)=>{let n=B(e.sourceEvent);if(!z&&R&&d.value&&(z=!0,V()),!R){let r=n.xSnapped-(I.x??0),i=n.ySnapped-(I.y??0);Math.sqrt(r*r+i*i)>l.value&&ae(e,t)}(I.x!==n.xSnapped||I.y!==n.ySnapped)&&N.length&&R&&(te=e.sourceEvent,L=w0(e.sourceEvent,F),ie(n))},oe=e=>{let t=!1;if(!R&&!M.value&&!g.value){let n=e.sourceEvent,r=B(n),i=r.xSnapped-(I.x??0),a=r.ySnapped-(I.y??0),o=Math.sqrt(i*i+a*a);o!==0&&o<=l.value&&(D?.(n),t=!0)}if(N.length&&!t){ne&&=(x(N,!1,!1),!1);let[t,n]=l0({id:k,dragItems:N,findNode:h});E({event:e.sourceEvent,node:t,nodes:n})}N=[],M.value=!1,z=!1,R=!1,I={x:void 0,y:void 0},cancelAnimationFrame(re)};return C([()=>a(O),ee],([e,t],n,r)=>{if(t){let n=pX(t);e||(P=OX().on(`start`,e=>H(e,t)).on(`drag`,e=>U(e,t)).on(`end`,e=>oe(e)).filter(e=>{let n=e.target,r=a(j);return!e.button&&(!i.value||!s0(n,`.${i.value}`,t)&&(!r||s0(n,r,t)))}),n.call(P)),r(()=>{n.on(`.drag`,null),P&&(P.on(`start`,null),P.on(`drag`,null),P.on(`end`,null))})}}),M}function a2(){return{doubleClick:$(),click:$(),mouseEnter:$(),mouseMove:$(),mouseLeave:$(),contextMenu:$(),updateStart:$(),update:$(),updateEnd:$()}}function o2(e,t){let n=a2();return n.doubleClick.on(n=>{var r,i;t.edgeDoubleClick(n),(i=(r=e.events)?.doubleClick)==null||i.call(r,n)}),n.click.on(n=>{var r,i;t.edgeClick(n),(i=(r=e.events)?.click)==null||i.call(r,n)}),n.mouseEnter.on(n=>{var r,i;t.edgeMouseEnter(n),(i=(r=e.events)?.mouseEnter)==null||i.call(r,n)}),n.mouseMove.on(n=>{var r,i;t.edgeMouseMove(n),(i=(r=e.events)?.mouseMove)==null||i.call(r,n)}),n.mouseLeave.on(n=>{var r,i;t.edgeMouseLeave(n),(i=(r=e.events)?.mouseLeave)==null||i.call(r,n)}),n.contextMenu.on(n=>{var r,i;t.edgeContextMenu(n),(i=(r=e.events)?.contextMenu)==null||i.call(r,n)}),n.updateStart.on(n=>{var r,i;t.edgeUpdateStart(n),(i=(r=e.events)?.updateStart)==null||i.call(r,n)}),n.update.on(n=>{var r,i;t.edgeUpdate(n),(i=(r=e.events)?.update)==null||i.call(r,n)}),n.updateEnd.on(n=>{var r,i;t.edgeUpdateEnd(n),(i=(r=e.events)?.updateEnd)==null||i.call(r,n)}),Object.entries(n).reduce((e,[t,n])=>(e.emit[t]=n.trigger,e.on[t]=n.on,e),{emit:{},on:{}})}function s2(){let{viewport:e,snapGrid:t,snapToGrid:n,vueFlowRef:r}=f4();return i=>{let a=r.value?.getBoundingClientRect()??{left:0,top:0},{x:o,y:s}=w0(C0(i)?i.sourceEvent:i,a),c=F1({x:o,y:s},e.value),{x:l,y:u}=n.value?D0(c,t.value):c;return{xSnapped:l,ySnapped:u,...c}}}function c2(){return!0}function l2({handleId:e,nodeId:t,type:n,isValidConnection:r,edgeUpdaterType:i,onEdgeUpdate:o,onEdgeUpdateEnd:s}){let{id:c,vueFlowRef:l,connectionMode:u,connectionRadius:d,connectOnClick:f,connectionClickStartHandle:p,nodesConnectable:m,autoPanOnConnect:h,autoPanSpeed:g,findNode:_,panBy:v,startConnection:y,updateConnection:b,endConnection:x,emits:S,viewport:C,edges:w,nodes:T,isValidConnection:E,nodeLookup:D}=f4(),ee=null,O=!1,k=null;function A(f){let p=a(n)===`target`,m=S0(f),A=x1(f.target),j=f.currentTarget;if(j&&(m&&f.button===0||!m)){let n=function(n){z=w0(n,R),P=M0(F1(z,C.value,!1,[1,1]),d.value,D.value,V),B||=(ie(),!0);let r=N0(n,{handle:P,connectionMode:u.value,fromNodeId:a(t),fromHandleId:a(e),fromType:p?`target`:`source`,isValidConnection:N,doc:A,lib:`vue`,flowId:c,nodeLookup:D.value},w.value,T.value,_,D.value);k=r.handleDomNode,ee=r.connection,O=I0(!!P,r.isValid);let i={...U,isValid:O,to:r.toHandle&&O?P1({x:r.toHandle.x,y:r.toHandle.y},C.value):z,toHandle:r.toHandle,toPosition:O&&r.toHandle?r.toHandle.position:R0[V.position],toNode:r.toHandle?D.value.get(r.toHandle.nodeId):null};if(O&&P&&U?.toHandle&&i.toHandle&&U.toHandle.type===i.toHandle.type&&U.toHandle.nodeId===i.toHandle.nodeId&&U.toHandle.id===i.toHandle.id&&U.to.x===i.to.x&&U.to.y===i.to.y)return;let o=P??r.toHandle;if(b(o&&O?P1({x:o.x,y:o.y},C.value):z,o,F0(!!o,O)),U=i,!P&&!O&&!k)return k0(re);ee&&ee.source!==ee.target&&k&&(k0(re),re=k,k.classList.add(`connecting`,`vue-flow__handle-connecting`),k.classList.toggle(`valid`,!!O),k.classList.toggle(`vue-flow__handle-valid`,!!O))},m=function(e){`touches`in e&&e.touches.length>0||((P||k)&&ee&&O&&(o?o(e,ee):S.connect(ee)),S.connectEnd(e),i&&s?.(e),k0(re),cancelAnimationFrame(F),x(e),B=!1,O=!1,ee=null,k=null,A.removeEventListener(`mousemove`,n),A.removeEventListener(`mouseup`,m),A.removeEventListener(`touchmove`,n),A.removeEventListener(`touchend`,m))},M=_(a(t)),N=a(r)||E.value||c2;!N&&M&&(N=(p?M.isValidSourcePos:M.isValidTargetPos)||c2);let P,F=0,{x:I,y:L}=w0(f),te=P0(a(i),j),R=l.value?.getBoundingClientRect();if(!R||!te)return;let ne=L0(a(t),te,a(e),D.value,u.value);if(!ne)return;let re,z=w0(f,R),B=!1,ie=()=>{if(!h.value)return;let[e,t]=Q1(z,R,g.value);v({x:e,y:t}),F=requestAnimationFrame(ie)},V={...ne,nodeId:a(t),type:te,position:ne.position},ae=D.value.get(a(t)),H={inProgress:!0,isValid:null,from:h0(ae,V,Q.Left,!0),fromHandle:V,fromPosition:V.position,fromNode:ae,to:z,toHandle:null,toPosition:R0[V.position],toNode:null};y({nodeId:a(t),id:a(e),type:te,position:j?.getAttribute(`data-handlepos`)||Q.Top,...z},{x:I-R.left,y:L-R.top}),S.connectStart({event:f,nodeId:a(t),handleId:a(e),handleType:te});let U=H;A.addEventListener(`mousemove`,n),A.addEventListener(`mouseup`,m),A.addEventListener(`touchmove`,n),A.addEventListener(`touchend`,m)}}function j(i){if(!f.value)return;let o=a(n)===`target`;if(!p.value){S.clickConnectStart({event:i,nodeId:a(t),handleId:a(e)}),y({nodeId:a(t),type:a(n),id:a(e),position:Q.Top,...w0(i)},void 0,!0);return}let s=a(r)||E.value||c2,l=_(a(t));if(!s&&l&&(s=(o?l.isValidSourcePos:l.isValidTargetPos)||c2),l&&(l.connectable===void 0?m.value:l.connectable)===!1)return;let d=x1(i.target),h=N0(i,{handle:{nodeId:a(t),id:a(e),type:a(n),position:Q.Top,...w0(i)},connectionMode:u.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:s,doc:d,lib:`vue`,flowId:c,nodeLookup:D.value},w.value,T.value,_,D.value),g=h.connection?.source===h.connection?.target;h.isValid&&h.connection&&!g&&S.connect(h.connection),S.clickConnectEnd(i),x(i,!0)}return{handlePointerDown:A,handleClick:j}}function u2(){return w($0,``)}function d2(e){let t=e??u2()??``,n=w(e2,i(null)),{findNode:r,edges:a,emits:o}=f4(),s=r(t);return s||o.error(new x0(y0.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:s,parentNode:R(()=>r(s.parentNode)),connectedEdges:R(()=>H1([s],a.value))}}function f2(){return{doubleClick:$(),click:$(),mouseEnter:$(),mouseMove:$(),mouseLeave:$(),contextMenu:$(),dragStart:$(),drag:$(),dragStop:$()}}function p2(e,t){let n=f2();return n.doubleClick.on(n=>{var r,i;t.nodeDoubleClick(n),(i=(r=e.events)?.doubleClick)==null||i.call(r,n)}),n.click.on(n=>{var r,i;t.nodeClick(n),(i=(r=e.events)?.click)==null||i.call(r,n)}),n.mouseEnter.on(n=>{var r,i;t.nodeMouseEnter(n),(i=(r=e.events)?.mouseEnter)==null||i.call(r,n)}),n.mouseMove.on(n=>{var r,i;t.nodeMouseMove(n),(i=(r=e.events)?.mouseMove)==null||i.call(r,n)}),n.mouseLeave.on(n=>{var r,i;t.nodeMouseLeave(n),(i=(r=e.events)?.mouseLeave)==null||i.call(r,n)}),n.contextMenu.on(n=>{var r,i;t.nodeContextMenu(n),(i=(r=e.events)?.contextMenu)==null||i.call(r,n)}),n.dragStart.on(n=>{var r,i;t.nodeDragStart(n),(i=(r=e.events)?.dragStart)==null||i.call(r,n)}),n.drag.on(n=>{var r,i;t.nodeDrag(n),(i=(r=e.events)?.drag)==null||i.call(r,n)}),n.dragStop.on(n=>{var r,i;t.nodeDragStop(n),(i=(r=e.events)?.dragStop)==null||i.call(r,n)}),Object.entries(n).reduce((e,[t,n])=>(e.emit[t]=n.trigger,e.on[t]=n.on,e),{emit:{},on:{}})}function m2(){let{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:r,snapGrid:i,snapToGrid:a,nodesDraggable:o,emits:s}=f4();return(c,l=!1)=>{let u=a.value?i.value[0]:5,d=a.value?i.value[1]:5,f=l?4:1,p=c.x*u*f,m=c.y*d*f,h=[];for(let n of e.value)if(n.draggable||o&&n.draggable===void 0){let{position:e}=m0(n,{x:n.computedPosition.x+p,y:n.computedPosition.y+m},s.error,t.value,n.parentNode?r(n.parentNode):void 0);h.push({id:n.id,position:e,from:n.position,distance:{x:c.x,y:c.y},dimensions:n.dimensions})}n(h,!0,!1)}}var h2=.1,g2=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function _2(){return B0(`Viewport not initialized yet.`),Promise.resolve(!1)}var v2={zoomIn:_2,zoomOut:_2,zoomTo:_2,fitView:_2,setCenter:_2,fitBounds:_2,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:_2,setTransform:_2,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function y2(e){function t(t,n){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(n?.interpolate===`linear`?jZ:GZ).scaleBy(b2(e.d3Selection,n?.duration,n?.ease,()=>{r(!0)}),t):r(!1)})}function n(t,n,r,i){return new Promise(a=>{var o;let{x:s,y:c}=b1({x:-t,y:-n},e.translateExtent),l=V$.translate(-s,-c).scale(r);e.d3Selection&&e.d3Zoom?(o=e.d3Zoom)==null||o.interpolate(i?.interpolate===`linear`?jZ:GZ).transform(b2(e.d3Selection,i?.duration,i?.ease,()=>{a(!0)}),l):a(!1)})}return R(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:e=>t(1.2,e),zoomOut:e=>t(1/1.2,e),zoomTo:(t,n)=>new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(n?.interpolate===`linear`?jZ:GZ).scaleTo(b2(e.d3Selection,n?.duration,n?.ease,()=>{r(!0)}),t):r(!1)}),setViewport:(e,t)=>n(e.x,e.y,e.zoom,t),setTransform:(e,t)=>n(e.x,e.y,e.zoom,t),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(t={padding:h2,includeHiddenNodes:!1,duration:0})=>{let r=[];for(let n of e.nodes)n.dimensions.width&&n.dimensions.height&&(t?.includeHiddenNodes||!n.hidden)&&(!t.nodes?.length||t.nodes?.length&&t.nodes.includes(n.id))&&r.push(n);if(!r.length)return Promise.resolve(!1);let{x:i,y:a,zoom:o}=K1(B1(r),e.dimensions.width,e.dimensions.height,t.minZoom??e.minZoom,t.maxZoom??e.maxZoom,t.padding??h2);return n(i,a,o,t)},setCenter:(t,r,i)=>{let a=i?.zoom===void 0?e.maxZoom:i.zoom;return n(e.dimensions.width/2-t*a,e.dimensions.height/2-r*a,a,i)},fitBounds:(t,r={padding:h2})=>{let{x:i,y:a,zoom:o}=K1(t,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??h2);return n(i,a,o,r)},project:t=>F1(t,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:t=>{if(e.vueFlowRef){let{x:n,y:r}=e.vueFlowRef.getBoundingClientRect();return F1({x:t.x-n,y:t.y-r},e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:t=>{if(e.vueFlowRef){let{x:n,y:r}=e.vueFlowRef.getBoundingClientRect();return P1({x:t.x+n,y:t.y+r},e.viewport)}return{x:0,y:0}}}:v2)}function b2(e,t=0,n=g2,r=()=>{}){let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e}function x2(e,t,n){let r=d(!0);return r.run(()=>{r.run(()=>{let t,r,i=!!(n.nodes.value.length||n.edges.value.length);t=Zq([e.modelValue,()=>e.modelValue?.value?.length],([e])=>{e&&Array.isArray(e)&&(r?.pause(),n.setElements(e),!r&&!i&&e.length?i=!0:r?.resume())}),r=Zq([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([n,r])=>{e.modelValue?.value&&Array.isArray(e.modelValue.value)&&(t?.pause(),e.modelValue.value=[...n,...r],le(()=>{t?.resume()}))},{immediate:i}),u(()=>{t?.stop(),r?.stop()})}),r.run(()=>{let t,r,i=!!n.nodes.value.length;t=Zq([e.nodes,()=>e.nodes?.value?.length],([e])=>{e&&Array.isArray(e)&&(r?.pause(),n.setNodes(e),!r&&!i&&e.length?i=!0:r?.resume())}),r=Zq([n.nodes,()=>n.nodes.value.length],([n])=>{e.nodes?.value&&Array.isArray(e.nodes.value)&&(t?.pause(),e.nodes.value=[...n],le(()=>{t?.resume()}))},{immediate:i}),u(()=>{t?.stop(),r?.stop()})}),r.run(()=>{let t,r,i=!!n.edges.value.length;t=Zq([e.edges,()=>e.edges?.value?.length],([e])=>{e&&Array.isArray(e)&&(r?.pause(),n.setEdges(e),!r&&!i&&e.length?i=!0:r?.resume())}),r=Zq([n.edges,()=>n.edges.value.length],([n])=>{e.edges?.value&&Array.isArray(e.edges.value)&&(t?.pause(),e.edges.value=[...n],le(()=>{t?.resume()}))},{immediate:i}),u(()=>{t?.stop(),r?.stop()})}),r.run(()=>{C(()=>t.minZoom,()=>{t.minZoom&&W0(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})}),r.run(()=>{C(()=>t.maxZoom,()=>{t.maxZoom&&W0(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})}),r.run(()=>{C(()=>t.translateExtent,()=>{t.translateExtent&&W0(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})}),r.run(()=>{C(()=>t.nodeExtent,()=>{t.nodeExtent&&W0(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})}),r.run(()=>{C(()=>t.applyDefault,()=>{W0(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})}),r.run(()=>{let e=async e=>{let r=e;typeof t.autoConnect==`function`&&(r=await t.autoConnect(e)),r!==!1&&n.addEdges([r])};C(()=>t.autoConnect,()=>{W0(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),C(n.autoConnect,(t,r,i)=>{t?n.onConnect(e):n.hooks.value.connect.off(e),i(()=>{n.hooks.value.connect.off(e)})},{immediate:!0})}),(()=>{let e=[`id`,`modelValue`,`translateExtent`,`nodeExtent`,`edges`,`nodes`,`maxZoom`,`minZoom`,`applyDefault`,`autoConnect`];for(let i of Object.keys(t)){let a=i;if(!e.includes(a)){let e=o(()=>t[a]),i=n[a];m(i)&&r.run(()=>{C(e,e=>{W0(e)&&(i.value=e)},{immediate:!0})})}}})()}),()=>r.stop()}function S2(){return{edgesChange:$(),nodesChange:$(),nodeDoubleClick:$(),nodeClick:$(),nodeMouseEnter:$(),nodeMouseMove:$(),nodeMouseLeave:$(),nodeContextMenu:$(),nodeDragStart:$(),nodeDrag:$(),nodeDragStop:$(),nodesInitialized:$(),miniMapNodeClick:$(),miniMapNodeDoubleClick:$(),miniMapNodeMouseEnter:$(),miniMapNodeMouseMove:$(),miniMapNodeMouseLeave:$(),connect:$(),connectStart:$(),connectEnd:$(),clickConnectStart:$(),clickConnectEnd:$(),paneReady:$(),init:$(),move:$(),moveStart:$(),moveEnd:$(),selectionDragStart:$(),selectionDrag:$(),selectionDragStop:$(),selectionContextMenu:$(),selectionStart:$(),selectionEnd:$(),viewportChangeStart:$(),viewportChange:$(),viewportChangeEnd:$(),paneScroll:$(),paneClick:$(),paneContextMenu:$(),paneMouseEnter:$(),paneMouseMove:$(),paneMouseLeave:$(),edgeContextMenu:$(),edgeMouseEnter:$(),edgeMouseMove:$(),edgeMouseLeave:$(),edgeDoubleClick:$(),edgeClick:$(),edgeUpdateStart:$(),edgeUpdate:$(),edgeUpdateEnd:$(),updateNodeInternals:$(),error:$(e=>B0(e.message))}}function C2(e,t){let n=T();oe(()=>{for(let[n,i]of Object.entries(t.value))i.setEmitter(t=>{e(n,t)}),zq(i.removeEmitter),i.setHasEmitListeners(()=>r(n)),zq(i.removeHasEmitListeners)});function r(e){let t=w2(e);return!!n?.vnode.props?.[t]}}function w2(e){let[t,...n]=e.split(`:`);return`on${t.replace(/(?:^|-)(\w)/g,(e,t)=>t.toUpperCase())}${n.length?`:${n.join(`:`)}`:``}`}function T2(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[-1/0,-1/0],[1/0,1/0]],nodeExtent:[[-1/0,-1/0],[1/0,1/0]],selectionMode:Z$.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:t1.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:`#b1b1b7`,connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:Q$.Bezier,style:{}},connectionMode:$$.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:NaN,y:NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:`Shift`,multiSelectionKeyCode:T0()?`Meta`:`Control`,zoomActivationKeyCode:T0()?`Meta`:`Control`,deleteKeyCode:`Backspace`,panActivationKeyCode:`Space`,hooks:S2(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:`nodrag`,noWheelClassName:`nowheel`,noPanClassName:`nopan`,defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:``}}var E2=[`id`,`vueFlowRef`,`viewportRef`,`initialized`,`modelValue`,`nodes`,`edges`,`maxZoom`,`minZoom`,`translateExtent`,`hooks`,`defaultEdgeOptions`];function D2(e,t,n){let r=y2(e),i=t=>{let n=t??[];e.hooks.updateNodeInternals.trigger(n)},a=t=>j1(t,e.nodes,e.edges),o=t=>A1(t,e.nodes,e.edges),s=t=>H1(t,e.edges),c=({id:t,type:n,nodeId:r})=>{let i=t?`-${n}-${t}`:`-${n}`;return Array.from(e.connectionLookup.get(`${r}${i}`)?.values()??[])},l=e=>{if(e)return t.value.get(e)},u=e=>{if(e)return n.value.get(e)},d=(t,n,r)=>{let i=[];for(let e of t){let t={id:e.id,type:`position`,dragging:r,from:e.from};if(n&&(t.position=e.position,e.parentNode)){let n=l(e.parentNode);t.position={x:t.position.x-(n?.computedPosition?.x??0),y:t.position.y-(n?.computedPosition?.y??0)}}i.push(t)}i?.length&&e.hooks.nodesChange.trigger(i)},f=t=>{if(!e.vueFlowRef)return;let n=e.vueFlowRef.querySelector(`.vue-flow__transformationpane`);if(!n)return;let i=window.getComputedStyle(n),{m22:a}=new window.DOMMatrixReadOnly(i.transform),o=[];for(let e of t){let t=e,n=l(t.id);if(n){let e=v1(t.nodeElement);if(e.width&&e.height&&(n.dimensions.width!==e.width||n.dimensions.height!==e.height||t.forceUpdate)){let r=t.nodeElement.getBoundingClientRect();n.dimensions=e,n.handleBounds.source=H0(`source`,t.nodeElement,r,a,n.id),n.handleBounds.target=H0(`target`,t.nodeElement,r,a,n.id),o.push({id:n.id,type:`dimensions`,dimensions:e})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&r.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),o.length&&e.hooks.nodesChange.trigger(o)},p=(r,i)=>{let a=new Set,o=new Set;for(let e of r)C1(e)?a.add(e.id):S1(e)&&o.add(e.id);let s=a0(t.value,a,!0),c=a0(n.value,o);if(e.multiSelectionActive){for(let e of a)s.push(t0(e,i));for(let e of o)c.push(t0(e,i))}s.length&&e.hooks.nodesChange.trigger(s),c.length&&e.hooks.edgesChange.trigger(c)},m=r=>{if(e.multiSelectionActive){let t=r.map(e=>t0(e.id,!0));e.hooks.nodesChange.trigger(t);return}e.hooks.nodesChange.trigger(a0(t.value,new Set(r.map(e=>e.id)),!0)),e.hooks.edgesChange.trigger(a0(n.value))},h=r=>{if(e.multiSelectionActive){let t=r.map(e=>t0(e.id,!0));e.hooks.edgesChange.trigger(t);return}e.hooks.edgesChange.trigger(a0(n.value,new Set(r.map(e=>e.id)))),e.hooks.nodesChange.trigger(a0(t.value,new Set,!0))},g=e=>{p(e,!0)},_=t=>{let n=(t||e.nodes).map(e=>(e.selected=!1,t0(e.id,!1)));e.hooks.nodesChange.trigger(n)},v=t=>{let n=(t||e.edges).map(e=>(e.selected=!1,t0(e.id,!1)));e.hooks.edgesChange.trigger(n)},y=t=>{if(!t||!t.length)return p([],!1);let n=t.reduce((e,t)=>{let n=t0(t.id,!1);return C1(t)?e.nodes.push(n):e.edges.push(n),e},{nodes:[],edges:[]});n.nodes.length&&e.hooks.nodesChange.trigger(n.nodes),n.edges.length&&e.hooks.edgesChange.trigger(n.edges)},b=t=>{var n;(n=e.d3Zoom)==null||n.scaleExtent([t,e.maxZoom]),e.minZoom=t},x=t=>{var n;(n=e.d3Zoom)==null||n.scaleExtent([e.minZoom,t]),e.maxZoom=t},S=t=>{var n;(n=e.d3Zoom)==null||n.translateExtent(t),e.translateExtent=t},C=t=>{e.nodeExtent=t,i()},w=t=>{var n;(n=e.d3Zoom)==null||n.clickDistance(t)},T=t=>{e.nodesDraggable=t,e.nodesConnectable=t,e.elementsSelectable=t},E=t=>{let n=t instanceof Function?t(e.nodes):t;(e.initialized||n.length)&&(e.nodes=q0(n,l,e.hooks.error.trigger))},D=t=>{let r=t instanceof Function?t(e.edges):t;if(!e.initialized&&!r.length)return;let i=Z0(r,e.isValidConnection,l,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Y0(e.connectionLookup,n.value,i),e.edges=i},ee=t=>{let n=t instanceof Function?t([...e.nodes,...e.edges]):t;(e.initialized||n.length)&&(E(n.filter(C1)),D(n.filter(S1)))},O=t=>{let n=t instanceof Function?t(e.nodes):t;n=Array.isArray(n)?n:[n];let r=q0(n,l,e.hooks.error.trigger),i=[];for(let e of r)i.push(n0(e));i.length&&e.hooks.nodesChange.trigger(i)},k=t=>{let n=t instanceof Function?t(e.edges):t;n=Array.isArray(n)?n:[n];let r=Z0(n,e.isValidConnection,l,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),i=[];for(let e of r)i.push(n0(e));i.length&&e.hooks.edgesChange.trigger(i)},A=(t,n=!0,r=!1)=>{let i=t instanceof Function?t(e.nodes):t,a=Array.isArray(i)?i:[i],o=[],c=[];function u(e){let t=s(e);for(let e of t)(!W0(e.deletable)||e.deletable)&&c.push(i0(e.id,e.source,e.target,e.sourceHandle,e.targetHandle))}function d(t){let r=[];for(let n of e.nodes)n.parentNode===t&&r.push(n);if(r.length){for(let e of r)o.push(r0(e.id));n&&u(r);for(let e of r)d(e.id)}}for(let e of a){let t=typeof e==`string`?l(e):e;t&&(!W0(t.deletable)||t.deletable)&&(o.push(r0(t.id)),n&&u([t]),r&&d(t.id))}c.length&&e.hooks.edgesChange.trigger(c),o.length&&e.hooks.nodesChange.trigger(o)},j=t=>{let n=t instanceof Function?t(e.edges):t,r=Array.isArray(n)?n:[n],i=[];for(let e of r){let t=typeof e==`string`?u(e):e;t&&(!W0(t.deletable)||t.deletable)&&i.push(i0(typeof e==`string`?e:e.id,t.source,t.target,t.sourceHandle,t.targetHandle))}e.hooks.edgesChange.trigger(i)},M=(t,r,i=!0)=>{let a=u(t.id);if(!a)return!1;let o=e.edges.indexOf(a),s=K0(t,r,a,i,e.hooks.error.trigger);if(s){let[t]=Z0([s],e.isValidConnection,l,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((e,n)=>n===o?t:e),Y0(e.connectionLookup,n.value,[t]),t}return!1},N=(e,t,n={replace:!1})=>{let r=u(e);if(!r)return;let i=typeof t==`function`?t(r):t;r.data=n.replace?i:{...r.data,...i}},P=t=>e0(t,e.nodes),F=t=>{let r=e0(t,e.edges);return Y0(e.connectionLookup,n.value,r),r},I=(t,n,r={replace:!1})=>{let i=l(t);if(!i)return;let a=typeof n==`function`?n(i):n;r.replace?e.nodes.splice(e.nodes.indexOf(i),1,a):Object.assign(i,a)},L=(e,t,n={replace:!1})=>{let r=l(e);if(!r)return;let i=typeof t==`function`?t(r):t;r.data=n.replace?i:{...r.data,...i}},te=(t,n,r=!1)=>{r?e.connectionClickStartHandle=t:e.connectionStartHandle=t,e.connectionEndHandle=null,e.connectionStatus=null,n&&(e.connectionPosition=n)},R=(t,n=null,r=null)=>{e.connectionStartHandle&&(e.connectionPosition=t,e.connectionEndHandle=n,e.connectionStatus=r)},ne=(t,n)=>{e.connectionPosition={x:NaN,y:NaN},e.connectionEndHandle=null,e.connectionStatus=null,n?e.connectionClickStartHandle=null:e.connectionStartHandle=null},re=e=>{let t=E1(e),n=t?null:w1(e)?e:l(e.id);return!t&&!n?[null,null,t]:[t?e:g1(n),n,t]},z=(t,n=!0,r=e.nodes)=>{let[i,a,o]=re(t);if(!i)return[];let s=[];for(let t of r||e.nodes){if(!o&&(t.id===a.id||!t.computedPosition))continue;let e=g1(t),r=_1(e,i);(n&&r>0||r>=e.width*e.height||r>=Number(i.width)*Number(i.height))&&s.push(t)}return s},B=(e,t,n=!0)=>{let[r]=re(e);if(!r)return!1;let i=_1(r,t);return n&&i>0||i>=Number(r.width)*Number(r.height)},ie=t=>{let{viewport:n,dimensions:r,d3Zoom:i,d3Selection:a,translateExtent:o}=e;if(!i||!a||!t.x&&!t.y)return!1;let s=V$.translate(n.x+t.x,n.y+t.y).scale(n.zoom),c=[[0,0],[r.width,r.height]],l=i.constrain()(s,c,o),u=e.viewport.x!==l.x||e.viewport.y!==l.y||e.viewport.zoom!==l.k;return i.transform(a,l),u},V=t=>{let n=t instanceof Function?t(e):t,r=[`d3Zoom`,`d3Selection`,`d3ZoomHandler`,`viewportRef`,`vueFlowRef`,`dimensions`,`hooks`];W0(n.defaultEdgeOptions)&&(e.defaultEdgeOptions=n.defaultEdgeOptions);let i=n.modelValue||n.nodes||n.edges?[]:void 0;i&&(n.modelValue&&i.push(...n.modelValue),n.nodes&&i.push(...n.nodes),n.edges&&i.push(...n.edges),ee(i));let a=()=>{W0(n.maxZoom)&&x(n.maxZoom),W0(n.minZoom)&&b(n.minZoom),W0(n.translateExtent)&&S(n.translateExtent)};for(let t of Object.keys(n)){let i=t,a=n[i];![...E2,...r].includes(i)&&W0(a)&&(e[i]=a)}eJ(()=>e.d3Zoom).not.toBeNull().then(a),e.initialized||=!0};return{updateNodePositions:d,updateNodeDimensions:f,setElements:ee,setNodes:E,setEdges:D,addNodes:O,addEdges:k,removeNodes:A,removeEdges:j,findNode:l,findEdge:u,updateEdge:M,updateEdgeData:N,updateNode:I,updateNodeData:L,applyEdgeChanges:F,applyNodeChanges:P,addSelectedElements:g,addSelectedNodes:m,addSelectedEdges:h,setMinZoom:b,setMaxZoom:x,setTranslateExtent:S,setNodeExtent:C,setPaneClickDistance:w,removeSelectedElements:y,removeSelectedNodes:_,removeSelectedEdges:v,startConnection:te,updateConnection:R,endConnection:ne,setInteractive:T,setState:V,getIntersectingNodes:z,getIncomers:a,getOutgoers:o,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:B,panBy:ie,fitView:e=>r.value.fitView(e),zoomIn:e=>r.value.zoomIn(e),zoomOut:e=>r.value.zoomOut(e),zoomTo:(e,t)=>r.value.zoomTo(e,t),setViewport:(e,t)=>r.value.setViewport(e,t),setTransform:(e,t)=>r.value.setTransform(e,t),getViewport:()=>r.value.getViewport(),getTransform:()=>r.value.getTransform(),setCenter:(e,t,n)=>r.value.setCenter(e,t,n),fitBounds:(e,t)=>r.value.fitBounds(e,t),project:e=>r.value.project(e),screenToFlowCoordinate:e=>r.value.screenToFlowCoordinate(e),flowToScreenCoordinate:e=>r.value.flowToScreenCoordinate(e),toObject:()=>{let t=[],n=[];for(let n of e.nodes){let{computedPosition:e,handleBounds:r,selected:i,dimensions:a,isParent:o,resizing:s,dragging:c,events:l,...u}=n;t.push(u)}for(let t of e.edges){let{selected:e,sourceNode:r,targetNode:i,events:a,...o}=t;n.push(o)}return JSON.parse(JSON.stringify({nodes:t,edges:n,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:t=>new Promise(n=>{let{nodes:i,edges:a,position:o,zoom:s,viewport:c}=t;i&&E(i),a&&D(a);let[l,u]=c?.x&&c?.y?[c.x,c.y]:o??[null,null];if(l&&u){let t=c?.zoom||s||e.viewport.zoom;return eJ(()=>r.value.viewportInitialized).toBe(!0).then(()=>{r.value.setViewport({x:l,y:u,zoom:t}).then(()=>{n(!0)})})}n(!0)}),updateNodeInternals:i,viewportHelper:r,$reset:()=>{let t=T2();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){let n=V$.translate(t.defaultViewport.x??0,t.defaultViewport.y??0).scale(y1(t.defaultViewport.zoom??1,t.minZoom,t.maxZoom)),r=e.viewportRef.getBoundingClientRect(),i=[[0,0],[r.width,r.height]],a=e.d3Zoom.constrain()(n,i,t.translateExtent);e.d3Zoom.transform(e.d3Selection,a)}V(t)},$destroy:()=>{}}}var O2=[`data-id`,`data-handleid`,`data-nodeid`,`data-handlepos`],k2=z({name:`Handle`,compatConfig:{MODE:3},props:{id:{default:null},type:{},position:{default:()=>Q.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){let n=ee(e,[`position`,`connectable`,`connectableStart`,`connectableEnd`,`id`]),a=o(()=>n.type??`source`),s=o(()=>n.isValidConnection??null),{id:c,connectionStartHandle:l,connectionClickStartHandle:u,connectionEndHandle:d,vueFlowRef:f,nodesConnectable:p,noDragClassName:m,noPanClassName:h}=f4(),{id:g,node:_,nodeEl:v,connectedEdges:y}=d2(),b=i(),x=o(()=>e.connectableStart===void 0||e.connectableStart),S=o(()=>e.connectableEnd===void 0||e.connectableEnd),C=o(()=>l.value?.nodeId===g&&l.value?.id===e.id&&l.value?.type===a.value||d.value?.nodeId===g&&d.value?.id===e.id&&d.value?.type===a.value),w=o(()=>u.value?.nodeId===g&&u.value?.id===e.id&&u.value?.type===a.value),{handlePointerDown:T,handleClick:E}=l2({nodeId:g,handleId:e.id,isValidConnection:s,type:a}),D=R(()=>typeof e.connectable==`string`&&e.connectable===`single`?!y.value.some(t=>{let n=t[`${a.value}Handle`];return t[a.value]===g?!n||n===e.id:!1}):typeof e.connectable==`number`?y.value.filter(t=>{let n=t[`${a.value}Handle`];return t[a.value]===g?!n||n===e.id:!1}).length<e.connectable:typeof e.connectable==`function`?e.connectable(_,y.value):W0(e.connectable)?e.connectable:p.value);F(()=>{if(!_.dimensions.width||!_.dimensions.height)return;let t=_.handleBounds[a.value]?.find(t=>t.id===e.id);if(!f.value||t)return;let n=f.value.querySelector(`.vue-flow__transformationpane`);if(!v.value||!b.value||!n||!e.id)return;let r=v.value.getBoundingClientRect(),i=b.value.getBoundingClientRect(),o=window.getComputedStyle(n),{m22:s}=new window.DOMMatrixReadOnly(o.transform),c={id:e.id,position:e.position,x:(i.left-r.left)/s,y:(i.top-r.top)/s,type:a.value,nodeId:g,...v1(b.value)};_.handleBounds[a.value]=[..._.handleBounds[a.value]??[],c]});function O(e){let t=S0(e);D.value&&x.value&&(t&&e.button===0||!t)&&T(e)}function k(e){g&&(u.value||x.value)&&D.value&&E(e)}return t({handleClick:E,handlePointerDown:T,onClick:k,onPointerDown:O}),(t,n)=>(B(),N(`div`,{ref_key:`handle`,ref:b,"data-id":`${r(c)}-${r(g)}-${e.id}-${a.value}`,"data-handleid":e.id,"data-nodeid":r(g),"data-handlepos":t.position,class:I([`vue-flow__handle`,[`vue-flow__handle-${t.position}`,`vue-flow__handle-${e.id}`,r(m),r(h),a.value,{connectable:D.value,connecting:w.value,connectablestart:x.value,connectableend:S.value,connectionindicator:D.value&&(x.value&&!C.value||S.value&&C.value)}]]),onMousedown:O,onTouchstartPassive:O,onClick:k},[fe(t.$slots,`default`,{id:t.id})],42,O2))}}),A2=function({sourcePosition:e=Q.Bottom,targetPosition:t=Q.Top,label:n,connectable:r=!0,isValidTargetPos:i,isValidSourcePos:a,data:o}){let s=o.label??n;return[v(k2,{type:`target`,position:t,connectable:r,isValidConnection:i}),typeof s!=`string`&&s?v(s):v(V,[s]),v(k2,{type:`source`,position:e,connectable:r,isValidConnection:a})]};A2.props=[`sourcePosition`,`targetPosition`,`label`,`isValidTargetPos`,`isValidSourcePos`,`connectable`,`data`],A2.inheritAttrs=!1,A2.compatConfig={MODE:3};var j2=A2,M2=function({targetPosition:e=Q.Top,label:t,connectable:n=!0,isValidTargetPos:r,data:i}){let a=i.label??t;return[v(k2,{type:`target`,position:e,connectable:n,isValidConnection:r}),typeof a!=`string`&&a?v(a):v(V,[a])]};M2.props=[`targetPosition`,`label`,`isValidTargetPos`,`connectable`,`data`],M2.inheritAttrs=!1,M2.compatConfig={MODE:3};var N2=M2,P2=function({sourcePosition:e=Q.Bottom,label:t,connectable:n=!0,isValidSourcePos:r,data:i}){let a=i.label??t;return[typeof a!=`string`&&a?v(a):v(V,[a]),v(k2,{type:`source`,position:e,connectable:n,isValidConnection:r})]};P2.props=[`sourcePosition`,`label`,`isValidSourcePos`,`connectable`,`data`],P2.inheritAttrs=!1,P2.compatConfig={MODE:3};var F2=P2,I2=[`transform`],L2=[`width`,`height`,`x`,`y`,`rx`,`ry`],R2=[`y`],z2=z({name:`EdgeText`,compatConfig:{MODE:3},props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){let t=i({x:0,y:0,width:0,height:0}),n=i(null),r=R(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);F(a),C([()=>e.x,()=>e.y,n,()=>e.label],a);function a(){if(!n.value)return;let e=n.value.getBBox();(e.width!==t.value.width||e.height!==t.value.height)&&(t.value=e)}return(e,i)=>(B(),N(`g`,{transform:r.value,class:`vue-flow__edge-textwrapper`},[e.labelShowBg?(B(),N(`rect`,{key:0,class:`vue-flow__edge-textbg`,width:`${t.value.width+2*e.labelBgPadding[0]}px`,height:`${t.value.height+2*e.labelBgPadding[1]}px`,x:-e.labelBgPadding[0],y:-e.labelBgPadding[1],style:ie(e.labelBgStyle),rx:e.labelBgBorderRadius,ry:e.labelBgBorderRadius},null,12,L2)):G(``,!0),M(`text`,L(e.$attrs,{ref_key:`el`,ref:n,class:`vue-flow__edge-text`,y:t.value.height/2,dy:`0.3em`,style:e.labelStyle}),[fe(e.$slots,`default`,{},()=>[typeof e.label==`string`?(B(),N(V,{key:1},[x(U(e.label),1)],64)):(B(),W(de(e.label),{key:0}))])],16,R2)],8,I2))}}),B2=[`id`,`d`,`marker-end`,`marker-start`],V2=[`d`,`stroke-width`],H2=z({name:`BaseEdge`,inheritAttrs:!1,compatConfig:{MODE:3},props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){let n=i(null),a=i(null),o=i(null),s=D();return t({pathEl:n,interactionEl:a,labelEl:o}),(e,t)=>(B(),N(V,null,[M(`path`,L(r(s),{id:e.id,ref_key:`pathEl`,ref:n,d:e.path,class:`vue-flow__edge-path`,"marker-end":e.markerEnd,"marker-start":e.markerStart}),null,16,B2),e.interactionWidth?(B(),N(`path`,{key:0,ref_key:`interactionEl`,ref:a,fill:`none`,d:e.path,"stroke-width":e.interactionWidth,"stroke-opacity":0,class:`vue-flow__edge-interaction`},null,8,V2)):G(``,!0),e.label&&e.labelX&&e.labelY?(B(),W(z2,{key:1,ref_key:`labelEl`,ref:o,x:e.labelX,y:e.labelY,label:e.label,"label-show-bg":e.labelShowBg,"label-bg-style":e.labelBgStyle,"label-bg-padding":e.labelBgPadding,"label-bg-border-radius":e.labelBgBorderRadius,"label-style":e.labelStyle},null,8,[`x`,`y`,`label`,`label-show-bg`,`label-bg-style`,`label-bg-padding`,`label-bg-border-radius`,`label-style`])):G(``,!0)],64))}});function U2({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function W2({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function G2(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function K2({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){let o,s;switch(e){case Q.Left:o=t-G2(t-r,a),s=n;break;case Q.Right:o=t+G2(r-t,a),s=n;break;case Q.Top:o=t,s=n-G2(n-i,a);break;case Q.Bottom:o=t,s=n+G2(i-n,a)}return[o,s]}function q2(e){let{sourceX:t,sourceY:n,sourcePosition:r=Q.Bottom,targetX:i,targetY:a,targetPosition:o=Q.Top,curvature:s=.25}=e,[c,l]=K2({pos:r,x1:t,y1:n,x2:i,y2:a,c:s}),[u,d]=K2({pos:o,x1:i,y1:a,x2:t,y2:n,c:s}),[f,p,m,h]=W2({sourceX:t,sourceY:n,targetX:i,targetY:a,sourceControlX:c,sourceControlY:l,targetControlX:u,targetControlY:d});return[`M${t},${n} C${c},${l} ${u},${d} ${i},${a}`,f,p,m,h]}function J2({pos:e,x1:t,y1:n,x2:r,y2:i}){let a,o;switch(e){case Q.Left:case Q.Right:a=.5*(t+r),o=n;break;case Q.Top:case Q.Bottom:a=t,o=.5*(n+i)}return[a,o]}function Y2(e){let{sourceX:t,sourceY:n,sourcePosition:r=Q.Bottom,targetX:i,targetY:a,targetPosition:o=Q.Top}=e,[s,c]=J2({pos:r,x1:t,y1:n,x2:i,y2:a}),[l,u]=J2({pos:o,x1:i,y1:a,x2:t,y2:n}),[d,f,p,m]=W2({sourceX:t,sourceY:n,targetX:i,targetY:a,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${t},${n} C${s},${c} ${l},${u} ${i},${a}`,d,f,p,m]}var X2={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}};function Z2({source:e,sourcePosition:t=Q.Bottom,target:n}){return t===Q.Left||t===Q.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1}}function Q2(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function $2({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a}){let o=X2[t],s=X2[r],c={x:e.x+o.x*a,y:e.y+o.y*a},l={x:n.x+s.x*a,y:n.y+s.y*a},u=Z2({source:c,sourcePosition:t,target:l}),d=u.x===0?`y`:`x`,f=u[d],p,m,h,g={x:0,y:0},_={x:0,y:0},[v,y,b,x]=U2({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[d]*s[d]===-1){m=i.x??v,h=i.y??y;let e=[{x:m,y:c.y},{x:m,y:l.y}],t=[{x:c.x,y:h},{x:l.x,y:h}];p=o[d]===f?d===`x`?e:t:d===`x`?t:e}else{let i=[{x:c.x,y:l.y}],u=[{x:l.x,y:c.y}];if(p=d===`x`?o.x===f?u:i:o.y===f?i:u,t===r){let t=Math.abs(e[d]-n[d]);if(t<=a){let r=Math.min(a-1,a-t);o[d]===f?g[d]=(c[d]>e[d]?-1:1)*r:_[d]=(l[d]>n[d]?-1:1)*r}}if(t!==r){let e=d===`x`?`y`:`x`,t=o[d]===s[e],n=c[e]>l[e],r=c[e]<l[e];(o[d]===1&&(!t&&n||t&&r)||o[d]!==1&&(!t&&r||t&&n))&&(p=d===`x`?i:u)}let v={x:c.x+g.x,y:c.y+g.y},y={x:l.x+_.x,y:l.y+_.y};Math.max(Math.abs(v.x-p[0].x),Math.abs(y.x-p[0].x))>=Math.max(Math.abs(v.y-p[0].y),Math.abs(y.y-p[0].y))?(m=(v.x+y.x)/2,h=p[0].y):(m=p[0].x,h=(v.y+y.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...p,{x:l.x+_.x,y:l.y+_.y},n],m,h,b,x]}function e4(e,t,n,r){let i=Math.min(Q2(e,t)/2,Q2(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function t4(e){let{sourceX:t,sourceY:n,sourcePosition:r=Q.Bottom,targetX:i,targetY:a,targetPosition:o=Q.Top,borderRadius:s=5,centerX:c,centerY:l,offset:u=20}=e,[d,f,p,m,h]=$2({source:{x:t,y:n},sourcePosition:r,target:{x:i,y:a},targetPosition:o,center:{x:c,y:l},offset:u});return[d.reduce((e,t,n)=>{let r;return r=n>0&&n<d.length-1?e4(d[n-1],t,d[n+1],s):`${n===0?`M`:`L`}${t.x} ${t.y}`,e+=r,e},``),f,p,m,h]}function n4(e){let{sourceX:t,sourceY:n,targetX:r,targetY:i}=e,[a,o,s,c]=U2({sourceX:t,sourceY:n,targetX:r,targetY:i});return[`M ${t},${n}L ${r},${i}`,a,o,s,c]}var r4=z({name:`StraightEdge`,props:[`label`,`labelStyle`,`labelShowBg`,`labelBgStyle`,`labelBgPadding`,`labelBgBorderRadius`,`sourceY`,`sourceX`,`targetX`,`targetY`,`markerEnd`,`markerStart`,`interactionWidth`],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{let[n,r,i]=n4(e);return v(H2,{path:n,labelX:r,labelY:i,...t,...e})}}}),i4=z({name:`SmoothStepEdge`,props:[`sourcePosition`,`targetPosition`,`label`,`labelStyle`,`labelShowBg`,`labelBgStyle`,`labelBgPadding`,`labelBgBorderRadius`,`sourceY`,`sourceX`,`targetX`,`targetY`,`borderRadius`,`markerEnd`,`markerStart`,`interactionWidth`,`offset`],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{let[n,r,i]=t4({...e,sourcePosition:e.sourcePosition??Q.Bottom,targetPosition:e.targetPosition??Q.Top});return v(H2,{path:n,labelX:r,labelY:i,...t,...e})}}}),a4=z({name:`StepEdge`,props:[`sourcePosition`,`targetPosition`,`label`,`labelStyle`,`labelShowBg`,`labelBgStyle`,`labelBgPadding`,`labelBgBorderRadius`,`sourceY`,`sourceX`,`targetX`,`targetY`,`markerEnd`,`markerStart`,`interactionWidth`],setup(e,{attrs:t}){return()=>v(i4,{...e,...t,borderRadius:0})}}),o4=z({name:`BezierEdge`,props:[`sourcePosition`,`targetPosition`,`label`,`labelStyle`,`labelShowBg`,`labelBgStyle`,`labelBgPadding`,`labelBgBorderRadius`,`sourceY`,`sourceX`,`targetX`,`targetY`,`curvature`,`markerEnd`,`markerStart`,`interactionWidth`],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{let[n,r,i]=q2({...e,sourcePosition:e.sourcePosition??Q.Bottom,targetPosition:e.targetPosition??Q.Top});return v(H2,{path:n,labelX:r,labelY:i,...t,...e})}}}),s4=z({name:`SimpleBezierEdge`,props:[`sourcePosition`,`targetPosition`,`label`,`labelStyle`,`labelShowBg`,`labelBgStyle`,`labelBgPadding`,`labelBgBorderRadius`,`sourceY`,`sourceX`,`targetX`,`targetY`,`markerEnd`,`markerStart`,`interactionWidth`],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{let[n,r,i]=Y2({...e,sourcePosition:e.sourcePosition??Q.Bottom,targetPosition:e.targetPosition??Q.Top});return v(H2,{path:n,labelX:r,labelY:i,...t,...e})}}}),c4={input:F2,default:j2,output:N2},l4={default:o4,straight:r4,step:a4,smoothstep:i4,simplebezier:s4};function u4(e,t,n){let r=R(()=>e=>t.value.get(e)),i=R(()=>e=>n.value.get(e)),a=R(()=>{let t={...l4,...e.edgeTypes},n=Object.keys(t);for(let r of e.edges)r.type&&!n.includes(r.type)&&(t[r.type]=r.type);return t}),o=R(()=>{let t={...c4,...e.nodeTypes},n=Object.keys(t);for(let r of e.nodes)r.type&&!n.includes(r.type)&&(t[r.type]=r.type);return t}),s=R(()=>e.onlyRenderVisibleElements?V1(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=R(()=>{if(e.onlyRenderVisibleElements){let n=[];for(let r of e.edges){let i=t.value.get(r.source),a=t.value.get(r.target);_0({sourcePos:i.computedPosition||{x:0,y:0},targetPos:a.computedPosition||{x:0,y:0},sourceWidth:i.dimensions.width,sourceHeight:i.dimensions.height,targetWidth:a.dimensions.width,targetHeight:a.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&n.push(r)}return n}return e.edges}),l=R(()=>[...s.value,...c.value]),u=R(()=>{let t=[];for(let n of e.nodes)n.selected&&t.push(n);return t}),d=R(()=>{let t=[];for(let n of e.edges)n.selected&&t.push(n);return t}),f=R(()=>[...u.value,...d.value]),p=R(()=>{let t=[];for(let n of e.nodes)n.dimensions.width&&n.dimensions.height&&n.handleBounds!==void 0&&t.push(n);return t});return{getNode:r,getEdge:i,getElements:l,getEdgeTypes:a,getNodeTypes:o,getEdges:c,getNodes:s,getSelectedElements:f,getSelectedNodes:u,getSelectedEdges:d,getNodesInitialized:p,areNodesInitialized:R(()=>s.value.length>0&&p.value.length===s.value.length)}}var d4=class e{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){let t=T()?.appContext.app,n=t?.config.globalProperties.$vueFlowStorage??e.instance;return e.instance=n??new e,t&&(t.config.globalProperties.$vueFlowStorage=e.instance),e.instance}set(e,t){return this.flows.set(e,t)}get(e){return this.flows.get(e)}remove(e){return this.flows.delete(e)}create(e,t){let n=T2(),r=g(n),i={};for(let[e,t]of Object.entries(r.hooks)){let n=`on${e.charAt(0).toUpperCase()+e.slice(1)}`;i[n]=t.on}let a={};for(let[e,t]of Object.entries(r.hooks))a[e]=t.trigger;let o=R(()=>{let e=new Map;for(let t of r.nodes)e.set(t.id,t);return e}),s=R(()=>{let e=new Map;for(let t of r.edges)e.set(t.id,t);return e}),c=u4(r,o,s),l=D2(r,o,s);l.setState({...r,...t});let u={...i,...c,...l,...Qq(r),nodeLookup:o,edgeLookup:s,emits:a,id:e,vueFlowVersion:`1.48.2`,$destroy:()=>{this.remove(e)}};return this.set(e,u),u}getId(){return`vue-flow-${this.currentId++}`}};function f4(e){let t=d4.getInstance(),n=p(),r=typeof e==`object`,i=r?e:{id:e},a=i.id,o=a??n?.vueFlowId,s;if(n){let e=w(Q0,null);e!=null&&(!o||e.id===o)&&(s=e)}if(s||o&&(s=t.get(o)),!s||o&&s.id!==o){let e=a??t.getId(),r=t.create(e,i);s=r,(n??d(!0)).run(()=>{C(r.applyDefault,(e,t,n)=>{let i=e=>{r.applyNodeChanges(e)},a=e=>{r.applyEdgeChanges(e)};e?(r.onNodesChange(i),r.onEdgesChange(a)):(r.hooks.value.nodesChange.off(i),r.hooks.value.edgesChange.off(a)),n(()=>{r.hooks.value.nodesChange.off(i),r.hooks.value.edgesChange.off(a)})},{immediate:!0}),zq(()=>{if(s){let e=t.get(s.id);e?e.$destroy():B0(`No store instance found for id ${s.id} in storage.`)}})})}else r&&s.setState(i);return n&&(ne(Q0,s),n.vueFlowId=s.id),r&&T()?.type.name!==`VueFlow`&&s.emits.error(new x0(y0.USEVUEFLOW_OPTIONS)),s}function p4(e){let{emits:t,dimensions:n}=f4(),r;F(()=>{let i=()=>{var r;if(!e.value||!((r=e.value).checkVisibility?.call(r)??!0))return;let i=v1(e.value);(i.width===0||i.height===0)&&t.error(new x0(y0.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:i.width||500,height:i.height||500}};i(),window.addEventListener(`resize`,i),e.value&&(r=new ResizeObserver(()=>i()),r.observe(e.value)),re(()=>{window.removeEventListener(`resize`,i),r&&e.value&&r.unobserve(e.value)})})}var m4=z({name:`UserSelection`,compatConfig:{MODE:3},props:{userSelectionRect:{}},setup(e){return(e,t)=>(B(),N(`div`,{class:`vue-flow__selection vue-flow__container`,style:ie({width:`${e.userSelectionRect.width}px`,height:`${e.userSelectionRect.height}px`,transform:`translate(${e.userSelectionRect.x}px, ${e.userSelectionRect.y}px)`})},null,4))}}),h4=[`tabIndex`],g4=z({name:`NodesSelection`,compatConfig:{MODE:3},setup(e){let{emits:t,viewport:n,getSelectedNodes:a,noPanClassName:o,disableKeyboardA11y:s,userSelectionActive:c}=f4(),l=m2(),u=i(null),d=i2({el:u,onStart(e){t.selectionDragStart(e),t.nodeDragStart(e)},onDrag(e){t.selectionDrag(e),t.nodeDrag(e)},onStop(e){t.selectionDragStop(e),t.nodeDragStop(e)}});F(()=>{var e;s.value||(e=u.value)==null||e.focus({preventScroll:!0})});let f=R(()=>B1(a.value)),p=R(()=>({width:`${f.value.width}px`,height:`${f.value.height}px`,top:`${f.value.y}px`,left:`${f.value.x}px`}));function m(e){t.selectionContextMenu({event:e,nodes:a.value})}function h(e){s.value||h1[e.key]&&(e.preventDefault(),l({x:h1[e.key].x,y:h1[e.key].y},e.shiftKey))}return(e,t)=>!r(c)&&f.value.width&&f.value.height?(B(),N(`div`,{key:0,class:I([`vue-flow__nodesselection vue-flow__container`,r(o)]),style:ie({transform:`translate(${r(n).x}px,${r(n).y}px) scale(${r(n).zoom})`})},[M(`div`,{ref_key:`el`,ref:u,class:I([{dragging:r(d)},`vue-flow__nodesselection-rect`]),style:ie(p.value),tabIndex:r(s)?void 0:-1,onContextmenu:m,onKeydown:h},null,46,h4)],6)):G(``,!0)}});function _4(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}var v4=z({name:`Pane`,compatConfig:{MODE:3},props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){let{vueFlowRef:t,nodes:n,viewport:i,emits:a,userSelectionActive:c,removeSelectedElements:l,userSelectionRect:u,elementsSelectable:d,nodesSelectionActive:f,getSelectedEdges:p,getSelectedNodes:m,removeNodes:h,removeEdges:g,selectionMode:_,deleteKeyCode:v,multiSelectionKeyCode:y,multiSelectionActive:b,edgeLookup:x,nodeLookup:S,connectionLookup:w,defaultEdgeOptions:T,connectionStartHandle:E,panOnDrag:D}=f4(),ee=s(null),O=s(new Set),k=s(new Set),A=s(null),j=o(()=>d.value&&(e.isSelecting||c.value)),M=o(()=>E.value!==null),P=!1,F=!1,L=u1(v,{actInsideInputWithModifier:!1}),te=u1(y);C(L,e=>{e&&(h(m.value),g(p.value),f.value=!1)}),C(te,e=>{b.value=e});function R(e,t){return n=>{n.target===t&&e?.(n)}}function ne(e){if(P||M.value){P=!1;return}a.paneClick(e),l(),f.value=!1}function re(e){if(Array.isArray(D.value)&&D.value?.includes(2)){e.preventDefault();return}a.paneContextMenu(e)}function z(e){a.paneScroll(e)}function ie(n){var r,i;if(A.value=t.value?.getBoundingClientRect()??null,!d.value||!e.isSelecting||n.button!==0||n.target!==ee.value||!A.value)return;(i=(r=n.target)?.setPointerCapture)==null||i.call(r,n.pointerId);let{x:o,y:s}=_4(n,A.value);F=!0,P=!1,l(),u.value={width:0,height:0,startX:o,startY:s,x:o,y:s},a.selectionStart(n)}function V(e){if(!A.value||!u.value)return;P=!0;let{x:t,y:r}=w0(e,A.value),{startX:o=0,startY:s=0}=u.value,l={startX:o,startY:s,x:t<o?t:o,y:r<s?r:s,width:Math.abs(t-o),height:Math.abs(r-s)},d=O.value,p=k.value;O.value=new Set(V1(n.value,l,i.value,_.value===Z$.Partial,!0).map(e=>e.id)),k.value=new Set;let m=T.value?.selectable??!0;for(let e of O.value){let t=w.value.get(e);if(t)for(let{edgeId:e}of t.values()){let t=x.value.get(e);t&&(t.selectable??m)&&k.value.add(e)}}if(!X0(d,O.value)){let e=a0(S.value,O.value,!0);a.nodesChange(e)}if(!X0(p,k.value)){let e=a0(x.value,k.value);a.edgesChange(e)}u.value=l,c.value=!0,f.value=!1}function ae(t){var n;t.button===0&&F&&((n=t.target)==null||n.releasePointerCapture(t.pointerId),!c.value&&u.value&&t.target===ee.value&&ne(t),c.value=!1,u.value=null,f.value=O.value.size>0,a.selectionEnd(t),e.selectionKeyPressed&&(P=!1),F=!1)}return(e,t)=>(B(),N(`div`,{ref_key:`container`,ref:ee,class:I([`vue-flow__pane vue-flow__container`,{selection:e.isSelecting}]),onClick:t[0]||=e=>j.value?void 0:R(ne,ee.value)(e),onContextmenu:t[1]||=e=>R(re,ee.value)(e),onWheelPassive:t[2]||=e=>R(z,ee.value)(e),onPointerenter:t[3]||=e=>j.value?void 0:r(a).paneMouseEnter(e),onPointerdown:t[4]||=e=>j.value?ie(e):r(a).paneMouseMove(e),onPointermove:t[5]||=e=>j.value?V(e):r(a).paneMouseMove(e),onPointerup:t[6]||=e=>j.value?ae(e):void 0,onPointerleave:t[7]||=e=>r(a).paneMouseLeave(e)},[fe(e.$slots,`default`),r(c)&&r(u)?(B(),W(m4,{key:0,"user-selection-rect":r(u)},null,8,[`user-selection-rect`])):G(``,!0),r(f)&&r(m).length?(B(),W(g4,{key:1})):G(``,!0)],34))}}),y4=z({name:`Transform`,compatConfig:{MODE:3},setup(e){let{viewport:t,fitViewOnInit:n,fitViewOnInitDone:r}=f4(),i=R(()=>n.value?!r.value:!1),a=R(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(e,t)=>(B(),N(`div`,{class:`vue-flow__transformationpane vue-flow__container`,style:ie({transform:a.value,opacity:i.value?0:void 0})},[fe(e.$slots,`default`)],4))}}),b4=z({name:`Viewport`,compatConfig:{MODE:3},setup(e){let{minZoom:t,maxZoom:n,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:c,selectionKeyCode:l,panActivationKeyCode:u,panOnScroll:d,panOnScrollMode:f,panOnScrollSpeed:p,panOnDrag:m,zoomOnDoubleClick:h,zoomOnPinch:g,zoomOnScroll:_,preventScrolling:v,noWheelClassName:y,noPanClassName:x,emits:S,connectionStartHandle:w,userSelectionActive:T,paneDragging:E,d3Zoom:D,d3Selection:ee,d3ZoomHandler:O,viewport:k,viewportRef:A,paneClickDistance:j}=f4();p4(A);let M=s(!1),P=s(!1),L=null,te=!1,R=0,ne={x:0,y:0,zoom:0},re=u1(u),z=u1(l),ie=u1(c),V=o(()=>(!z.value||z.value&&l.value===!0)&&(re.value||m.value)),ae=o(()=>re.value||d.value),U=o(()=>l.value===!0&&V.value!==!0),oe=o(()=>z.value&&l.value!==!0||T.value||U.value),se=o(()=>w.value!==null);F(()=>{if(!A.value){B0(`Viewport element is missing`);return}let e=A.value,r=e.getBoundingClientRect(),o=X$().clickDistance(j.value).scaleExtent([t.value,n.value]).translateExtent(a.value),s=pX(e).call(o),c=s.on(`wheel.zoom`),u=V$.translate(i.value.x??0,i.value.y??0).scale(y1(i.value.zoom??1,t.value,n.value)),b=[[0,0],[r.width,r.height]],w=o.constrain()(u,b,a.value);o.transform(s,w),o.wheelDelta(X1),D.value=o,ee.value=s,O.value=c,k.value={x:w.x,y:w.y,zoom:w.k},o.on(`start`,e=>{if(!e.sourceEvent)return null;R=e.sourceEvent.button,M.value=!0;let t=ue(e.transform);e.sourceEvent?.type===`mousedown`&&(E.value=!0),ne=t,S.viewportChangeStart(t),S.moveStart({event:e,flowTransform:t})}),o.on(`end`,e=>{if(!e.sourceEvent)return null;if(M.value=!1,E.value=!1,ce(V.value,R??0)&&!te&&S.paneContextMenu(e.sourceEvent),te=!1,le(ne,e.transform)){let t=ue(e.transform);ne=t,S.viewportChangeEnd(t),S.moveEnd({event:e,flowTransform:t})}}),o.filter(e=>{let t=ie.value||_.value,n=g.value&&e.ctrlKey,r=e.button,i=e.type===`wheel`;if(r===1&&e.type===`mousedown`&&(W(e,`vue-flow__node`)||W(e,`vue-flow__edge`)))return!0;if(!V.value&&!t&&!ae.value&&!h.value&&!g.value||T.value||se.value&&!i||!h.value&&e.type===`dblclick`||W(e,y.value)&&i||W(e,x.value)&&(!i||ae.value&&i&&!ie.value)||!g.value&&e.ctrlKey&&i||!t&&!ae.value&&!n&&i)return!1;if(!g&&e.type===`touchstart`&&e.touches?.length>1)return e.preventDefault(),!1;if(!V.value&&(e.type===`mousedown`||e.type===`touchstart`)||U.value&&Array.isArray(m.value)&&m.value.includes(0)&&r===0||Array.isArray(m.value)&&!m.value.includes(r)&&(e.type===`mousedown`||e.type===`touchstart`))return!1;let a=Array.isArray(m.value)&&m.value.includes(r)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!r||r<=1;return(!e.ctrlKey||re.value||i)&&a}),C([T,V],()=>{T.value&&!M.value?o.on(`zoom`,null):T.value||o.on(`zoom`,e=>{k.value={x:e.transform.x,y:e.transform.y,zoom:e.transform.k};let t=ue(e.transform);te=ce(V.value,R??0),S.viewportChange(t),S.move({event:e,flowTransform:t})})},{immediate:!0}),C([T,ae,f,ie,g,v,y],()=>{ae.value&&!ie.value&&!T.value?s.on(`wheel.zoom`,e=>{if(W(e,y.value))return!1;let t=ie.value||_.value,n=g.value&&e.ctrlKey;if(!(!v.value||ae.value||t||n))return!1;e.preventDefault(),e.stopImmediatePropagation();let r=s.property(`__zoom`).k||1,i=T0();if(!re.value&&e.ctrlKey&&g.value&&i){let t=hX(e),n=r*2**X1(e);o.scaleTo(s,n,t,e);return}let a=e.deltaMode===1?20:1,c=f.value===t1.Vertical?0:e.deltaX*a,l=f.value===t1.Horizontal?0:e.deltaY*a;!i&&e.shiftKey&&f.value!==t1.Vertical&&!c&&l&&(c=l,l=0),o.translateBy(s,-(c/r)*p.value,-(l/r)*p.value);let u=ue(s.property(`__zoom`));L&&clearTimeout(L),P.value?(S.move({event:e,flowTransform:u}),S.viewportChange(u),L=setTimeout(()=>{S.moveEnd({event:e,flowTransform:u}),S.viewportChangeEnd(u),P.value=!1},150)):(P.value=!0,S.moveStart({event:e,flowTransform:u}),S.viewportChangeStart(u))},{passive:!1}):c!==void 0&&s.on(`wheel.zoom`,function(e,t){let n=!v.value&&e.type===`wheel`&&!e.ctrlKey,r=ie.value||_.value,i=g.value&&e.ctrlKey;if(!r&&!d.value&&!i&&e.type===`wheel`||n||W(e,y.value))return null;e.preventDefault(),c.call(this,e,t)},{passive:!1})},{immediate:!0})});function ce(e,t){return t===2&&Array.isArray(e)&&e.includes(2)}function le(e,t){return e.x!==t.x&&!Number.isNaN(t.x)||e.y!==t.y&&!Number.isNaN(t.y)||e.zoom!==t.k&&!Number.isNaN(t.k)}function ue(e){return{x:e.x,y:e.y,zoom:e.k}}function W(e,t){return e.target.closest(`.${t}`)}return(e,t)=>(B(),N(`div`,{ref_key:`viewportRef`,ref:A,class:`vue-flow__viewport vue-flow__container`},[b(v4,{"is-selecting":oe.value,"selection-key-pressed":r(z),class:I({connecting:se.value,dragging:r(E),draggable:r(m)===!0||Array.isArray(r(m))&&r(m).includes(0)})},{default:H(()=>[b(y4,null,{default:H(()=>[fe(e.$slots,`default`)]),_:3})]),_:3},8,[`is-selecting`,`selection-key-pressed`,`class`])],512))}}),x4=[`id`],S4=[`id`],C4=[`id`],w4=z({name:`A11yDescriptions`,compatConfig:{MODE:3},setup(e){let{id:t,disableKeyboardA11y:n,ariaLiveMessage:i}=f4();return(e,a)=>(B(),N(V,null,[M(`div`,{id:`${r(d1)}-${r(t)}`,style:{display:`none`}},` Press enter or space to select a node. `+U(r(n)?``:`You can then use the arrow keys to move the node around.`)+` You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. `,9,x4),M(`div`,{id:`${r(f1)}-${r(t)}`,style:{display:`none`}},` Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. `,8,S4),r(n)?G(``,!0):(B(),N(`div`,{key:0,id:`${r(p1)}-${r(t)}`,"aria-live":`assertive`,"aria-atomic":`true`,style:{position:`absolute`,width:`1px`,height:`1px`,margin:`-1px`,border:`0`,padding:`0`,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,"clip-path":`inset(100%)`}},U(r(i)),9,C4))],64))}});function T4(){let e=f4();C(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function E4(e,t,n){return n===Q.Left?e-t:n===Q.Right?e+t:e}function D4(e,t,n){return n===Q.Top?e-t:n===Q.Bottom?e+t:e}var O4=function({radius:e=10,centerX:t=0,centerY:n=0,position:r=Q.Top,type:i}){return v(`circle`,{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:E4(t,e,r),cy:D4(n,e,r),r:e,stroke:`transparent`,fill:`transparent`})};O4.props=[`radius`,`centerX`,`centerY`,`position`,`type`],O4.compatConfig={MODE:3};var k4=O4,A4=z({name:`Edge`,compatConfig:{MODE:3},props:[`id`],setup(e){let{id:t,addSelectedEdges:n,connectionMode:r,edgeUpdaterRadius:a,emits:s,nodesSelectionActive:c,noPanClassName:l,getEdgeTypes:u,removeSelectedEdges:d,findEdge:f,findNode:p,isValidConnection:m,multiSelectionActive:h,disableKeyboardA11y:g,elementsSelectable:_,edgesUpdatable:y,edgesFocusable:b,hooks:x}=f4(),S=R(()=>f(e.id)),{emit:C,on:E}=o2(S.value,s),D=w(r2),ee=T(),k=i(!1),A=i(!1),j=i(``),M=i(null),N=i(`source`),P=i(null),F=o(()=>S.value.selectable===void 0?_.value:S.value.selectable),I=o(()=>S.value.updatable===void 0?y.value:S.value.updatable),L=o(()=>S.value.focusable===void 0?b.value:S.value.focusable);ne(t2,e.id),ne(n2,P);let te=R(()=>S.value.class instanceof Function?S.value.class(S.value):S.value.class),re=R(()=>S.value.style instanceof Function?S.value.style(S.value):S.value.style),z=R(()=>{let e=S.value.type||`default`,t=D?.[`edge-${e}`];if(t)return t;let n=S.value.template??u.value[e];if(typeof n==`string`&&ee){let t=Object.keys(ee.appContext.components);t&&t.includes(e)&&(n=O(e,!1))}return n&&typeof n!=`string`?n:(s.error(new x0(y0.EDGE_TYPE_MISSING,n)),!1)}),{handlePointerDown:B}=l2({nodeId:j,handleId:M,type:N,isValidConnection:m,edgeUpdaterType:N,onEdgeUpdate:ae,onEdgeUpdateEnd:H});return()=>{let n=p(S.value.source),i=p(S.value.target),o=`pathOptions`in S.value?S.value.pathOptions:{};if(!n&&!i)return s.error(new x0(y0.EDGE_SOURCE_TARGET_MISSING,S.value.id,S.value.source,S.value.target)),null;if(!n)return s.error(new x0(y0.EDGE_SOURCE_MISSING,S.value.id,S.value.source)),null;if(!i)return s.error(new x0(y0.EDGE_TARGET_MISSING,S.value.id,S.value.target)),null;if(!S.value||S.value.hidden||n.hidden||i.hidden)return null;let c;c=r.value===$$.Strict?n.handleBounds.source:[...n.handleBounds.source||[],...n.handleBounds.target||[]];let d=g0(c,S.value.sourceHandle),f;f=r.value===$$.Strict?i.handleBounds.target:[...i.handleBounds.target||[],...i.handleBounds.source||[]];let m=g0(f,S.value.targetHandle),h=d?.position||Q.Bottom,g=m?.position||Q.Top,{x:_,y}=h0(n,d,h),{x:b,y:C}=h0(i,m,g);return S.value.sourceX=_,S.value.sourceY=y,S.value.targetX=b,S.value.targetY=C,v(`g`,{ref:P,key:e.id,"data-id":e.id,class:[`vue-flow__edge`,`vue-flow__edge-${z.value===!1?`default`:S.value.type||`default`}`,l.value,te.value,{updating:k.value,selected:S.value.selected,animated:S.value.animated,inactive:!F.value&&!x.value.edgeClick.hasListeners()}],tabIndex:L.value?0:void 0,"aria-label":S.value.ariaLabel===null?void 0:S.value.ariaLabel??`Edge from ${S.value.source} to ${S.value.target}`,"aria-describedby":L.value?`${f1}-${t}`:void 0,"aria-roledescription":`edge`,role:L.value?`group`:`img`,...S.value.domAttributes,onClick:oe,onContextmenu:se,onDblclick:ce,onMouseenter:le,onMousemove:ue,onMouseleave:W,onKeyDown:L.value?G:void 0},[A.value?null:v(z.value===!1?u.value.default:z.value,{id:e.id,sourceNode:n,targetNode:i,source:S.value.source,target:S.value.target,type:S.value.type,updatable:I.value,selected:S.value.selected,animated:S.value.animated,label:S.value.label,labelStyle:S.value.labelStyle,labelShowBg:S.value.labelShowBg,labelBgStyle:S.value.labelBgStyle,labelBgPadding:S.value.labelBgPadding,labelBgBorderRadius:S.value.labelBgBorderRadius,data:S.value.data,events:{...S.value.events,...E},style:re.value,markerStart:`url('#${Y1(S.value.markerStart,t)}')`,markerEnd:`url('#${Y1(S.value.markerEnd,t)}')`,sourcePosition:h,targetPosition:g,sourceX:_,sourceY:y,targetX:b,targetY:C,sourceHandleId:S.value.sourceHandle,targetHandleId:S.value.targetHandle,interactionWidth:S.value.interactionWidth,...o}),[I.value===`source`||I.value===!0?[v(`g`,{onMousedown:de,onMouseenter:ie,onMouseout:V},v(k4,{position:h,centerX:_,centerY:y,radius:a.value,type:`source`,"data-type":`source`}))]:null,I.value===`target`||I.value===!0?[v(`g`,{onMousedown:fe,onMouseenter:ie,onMouseout:V},v(k4,{position:g,centerX:b,centerY:C,radius:a.value,type:`target`,"data-type":`target`}))]:null]])};function ie(){k.value=!0}function V(){k.value=!1}function ae(e,t){C.update({event:e,edge:S.value,connection:t})}function H(e){C.updateEnd({event:e,edge:S.value}),A.value=!1}function U(e,t){e.button===0&&(A.value=!0,j.value=t?S.value.target:S.value.source,M.value=(t?S.value.targetHandle:S.value.sourceHandle)??null,N.value=t?`target`:`source`,C.updateStart({event:e,edge:S.value}),B(e))}function oe(e){var t;let r={event:e,edge:S.value};F.value&&(c.value=!1,S.value.selected&&h.value?(d([S.value]),(t=P.value)==null||t.blur()):n([S.value])),C.click(r)}function se(e){C.contextMenu({event:e,edge:S.value})}function ce(e){C.doubleClick({event:e,edge:S.value})}function le(e){C.mouseEnter({event:e,edge:S.value})}function ue(e){C.mouseMove({event:e,edge:S.value})}function W(e){C.mouseLeave({event:e,edge:S.value})}function de(e){U(e,!0)}function fe(e){U(e,!1)}function G(t){var r;!g.value&&m1.includes(t.key)&&F.value&&(t.key===`Escape`?((r=P.value)==null||r.blur(),d([f(e.id)])):n([f(e.id)]))}}}),j4=z({name:`ConnectionLine`,compatConfig:{MODE:3},setup(){let{id:e,connectionMode:t,connectionStartHandle:n,connectionEndHandle:r,connectionPosition:i,connectionLineType:a,connectionLineStyle:o,connectionLineOptions:s,connectionStatus:c,viewport:l,findNode:u}=f4(),d=w(r2)?.[`connection-line`],f=R(()=>u(n.value?.nodeId)),p=R(()=>u(r.value?.nodeId)??null),m=R(()=>({x:(i.value.x-l.value.x)/l.value.zoom,y:(i.value.y-l.value.y)/l.value.zoom})),h=R(()=>s.value.markerStart?`url(#${Y1(s.value.markerStart,e)})`:``),g=R(()=>s.value.markerEnd?`url(#${Y1(s.value.markerEnd,e)})`:``);return()=>{if(!f.value||!n.value)return null;let e=n.value.id,i=n.value.type,l=f.value.handleBounds,u=l?.[i]??[];if(t.value===$$.Loose){let e=l?.[i===`source`?`target`:`source`]??[];u=[...u,...e]}if(!u)return null;let _=(e?u.find(t=>t.id===e):u[0])??null,y=_?.position??Q.Top,{x:b,y:x}=h0(f.value,_,y),S=null;p.value&&(S=t.value===$$.Strict?p.value.handleBounds[i===`source`?`target`:`source`]?.find(e=>e.id===r.value?.id)||null:[...p.value.handleBounds.source??[],...p.value.handleBounds.target??[]].find(e=>e.id===r.value?.id)||null);let C=r.value?.position??(y?R0[y]:null);if(!y||!C)return null;let w=a.value??s.value.type??Q$.Bezier,T=``,E={sourceX:b,sourceY:x,sourcePosition:y,targetX:m.value.x,targetY:m.value.y,targetPosition:C};return w===Q$.Bezier?[T]=q2(E):w===Q$.Step?[T]=t4({...E,borderRadius:0}):w===Q$.SmoothStep?[T]=t4(E):w===Q$.SimpleBezier?[T]=Y2(E):T=`M${b},${x} ${m.value.x},${m.value.y}`,v(`svg`,{class:`vue-flow__edges vue-flow__connectionline vue-flow__container`},v(`g`,{class:`vue-flow__connection`},d?v(d,{sourceX:b,sourceY:x,sourcePosition:y,targetX:m.value.x,targetY:m.value.y,targetPosition:C,sourceNode:f.value,sourceHandle:_,targetNode:p.value,targetHandle:S,markerEnd:g.value,markerStart:h.value,connectionStatus:c.value}):v(`path`,{d:T,class:[s.value.class,c.value,`vue-flow__connection-path`],style:{...o.value,...s.value.style},"marker-end":g.value,"marker-start":h.value})))}}}),M4=[`id`,`markerWidth`,`markerHeight`,`markerUnits`,`orient`],N4=z({name:`MarkerType`,compatConfig:{MODE:3},props:{id:{},type:{},color:{default:`none`},width:{default:12.5},height:{default:12.5},markerUnits:{default:`strokeWidth`},orient:{default:`auto-start-reverse`},strokeWidth:{default:1}},setup(e){return(e,t)=>(B(),N(`marker`,{id:e.id,class:`vue-flow__arrowhead`,viewBox:`-10 -10 20 20`,refX:`0`,refY:`0`,markerWidth:`${e.width}`,markerHeight:`${e.height}`,markerUnits:e.markerUnits,orient:e.orient},[e.type===r(e1).ArrowClosed?(B(),N(`polyline`,{key:0,style:ie({stroke:e.color,fill:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":`round`,"stroke-linejoin":`round`,points:`-5,-4 0,0 -5,4 -5,-4`},null,4)):G(``,!0),e.type===r(e1).Arrow?(B(),N(`polyline`,{key:1,style:ie({stroke:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":`round`,"stroke-linejoin":`round`,fill:`none`,points:`-5,-4 0,0 -5,4`},null,4)):G(``,!0)],8,M4))}}),P4={class:`vue-flow__marker vue-flow__container`,"aria-hidden":`true`},F4=z({name:`MarkerDefinitions`,compatConfig:{MODE:3},setup(e){let{id:t,edges:n,connectionLineOptions:r,defaultMarkerColor:i}=f4(),a=R(()=>{let e=new Set,a=[],o=n=>{if(n){let r=Y1(n,t);e.has(r)||(typeof n==`object`?a.push({...n,id:r,color:n.color||i.value}):a.push({id:r,color:i.value,type:n}),e.add(r))}};for(let e of[r.value.markerEnd,r.value.markerStart])o(e);for(let e of n.value)for(let t of[e.markerStart,e.markerEnd])o(t);return a.sort((e,t)=>e.id.localeCompare(t.id))});return(e,t)=>(B(),N(`svg`,P4,[M(`defs`,null,[(B(!0),N(V,null,P(a.value,e=>(B(),W(N4,{id:e.id,key:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,"stroke-width":e.strokeWidth,orient:e.orient},null,8,[`id`,`type`,`color`,`width`,`height`,`markerUnits`,`stroke-width`,`orient`]))),128))])]))}}),I4=z({name:`Edges`,compatConfig:{MODE:3},setup(e){let{findNode:t,getEdges:n,elevateEdgesOnSelect:i}=f4();return(e,a)=>(B(),N(V,null,[b(F4),(B(!0),N(V,null,P(r(n),e=>(B(),N(`svg`,{key:e.id,class:`vue-flow__edges vue-flow__container`,style:ie({zIndex:r(v0)(e,r(t),r(i))})},[b(r(A4),{id:e.id},null,8,[`id`])],4))),128)),b(r(j4))],64))}}),L4=z({name:`Node`,compatConfig:{MODE:3},props:[`id`,`resizeObserver`],setup(e){let{id:t,noPanClassName:n,selectNodesOnDrag:r,nodesSelectionActive:a,multiSelectionActive:s,emits:c,removeSelectedNodes:l,addSelectedNodes:u,updateNodeDimensions:d,onUpdateNodeInternals:f,getNodeTypes:p,nodeExtent:m,elevateNodesOnSelect:h,disableKeyboardA11y:g,ariaLiveMessage:_,snapToGrid:y,snapGrid:b,nodeDragThreshold:x,nodesDraggable:S,elementsSelectable:E,nodesConnectable:D,nodesFocusable:ee,hooks:k}=f4(),A=i(null);ne(e2,A),ne($0,e.id);let j=w(r2),M=T(),N=m2(),{node:P,parentNode:I}=d2(e.id),{emit:L,on:te}=p2(P,c),re=o(()=>P.draggable===void 0?S.value:P.draggable),z=o(()=>P.selectable===void 0?E.value:P.selectable),B=o(()=>P.connectable===void 0?D.value:P.connectable),ie=o(()=>P.focusable===void 0?ee.value:P.focusable),V=R(()=>z.value||re.value||k.value.nodeClick.hasListeners()||k.value.nodeDoubleClick.hasListeners()||k.value.nodeMouseEnter.hasListeners()||k.value.nodeMouseMove.hasListeners()||k.value.nodeMouseLeave.hasListeners()),ae=o(()=>!!P.dimensions.width&&!!P.dimensions.height),H=R(()=>{let e=P.type||`default`,t=j?.[`node-${e}`];if(t)return t;let n=P.template||p.value[e];if(typeof n==`string`&&M){let t=Object.keys(M.appContext.components);t&&t.includes(e)&&(n=O(e,!1))}return n&&typeof n!=`string`?n:(c.error(new x0(y0.NODE_TYPE_MISSING,n)),!1)}),U=i2({id:e.id,el:A,disabled:()=>!re.value,selectable:z,dragHandle:()=>P.dragHandle,onStart(e){L.dragStart(e)},onDrag(e){L.drag(e)},onStop(e){L.dragStop(e)},onClick(e){he(e)}}),oe=R(()=>P.class instanceof Function?P.class(P):P.class),se=R(()=>{let e=(P.style instanceof Function?P.style(P):P.style)||{},t=P.width instanceof Function?P.width(P):P.width,n=P.height instanceof Function?P.height(P):P.height;return!e.width&&t&&(e.width=typeof t==`string`?t:`${t}px`),!e.height&&n&&(e.height=typeof n==`string`?n:`${n}px`),e}),ce=o(()=>Number(P.zIndex??se.value.zIndex??0));return f(t=>{(t.includes(e.id)||!t.length)&&W()}),F(()=>{C(()=>P.hidden,(t=!1,n,r)=>{!t&&A.value&&(e.resizeObserver.observe(A.value),r(()=>{A.value&&e.resizeObserver.unobserve(A.value)}))},{immediate:!0,flush:`post`})}),C([()=>P.type,()=>P.sourcePosition,()=>P.targetPosition],()=>{le(()=>{d([{id:e.id,nodeElement:A.value,forceUpdate:!0}])})}),C([()=>P.position.x,()=>P.position.y,()=>I.value?.computedPosition.x,()=>I.value?.computedPosition.y,()=>I.value?.computedPosition.z,ce,()=>P.selected,()=>P.dimensions.height,()=>P.dimensions.width,()=>I.value?.dimensions.height,()=>I.value?.dimensions.width],([e,t,n,r,i,a])=>{let o={x:e,y:t,z:a+(h.value&&P.selected?1e3:0)};n!==void 0&&r!==void 0?P.computedPosition=q1({x:n,y:r,z:i},o):P.computedPosition=o},{flush:`post`,immediate:!0}),C([()=>P.extent,m],([e,t],[n,r])=>{(e!==n||t!==r)&&ue()}),P.extent===`parent`||typeof P.extent==`object`&&`range`in P.extent&&P.extent.range===`parent`?eJ(()=>ae).toBe(!0).then(ue):ue(),()=>P.hidden?null:v(`div`,{ref:A,"data-id":P.id,class:[`vue-flow__node`,`vue-flow__node-${H.value===!1?`default`:P.type||`default`}`,{[n.value]:re.value,dragging:U?.value,draggable:re.value,selected:P.selected,selectable:z.value,parent:P.isParent},oe.value],style:{visibility:ae.value?`visible`:`hidden`,zIndex:P.computedPosition.z??ce.value,transform:`translate(${P.computedPosition.x}px,${P.computedPosition.y}px)`,pointerEvents:V.value?`all`:`none`,...se.value},tabIndex:ie.value?0:void 0,role:ie.value?`group`:void 0,"aria-describedby":g.value?void 0:`${d1}-${t}`,"aria-label":P.ariaLabel,"aria-roledescription":`node`,...P.domAttributes,onMouseenter:de,onMousemove:fe,onMouseleave:G,onContextmenu:pe,onClick:he,onDblclick:me,onKeydown:ge},[v(H.value===!1?p.value.default:H.value,{id:P.id,type:P.type,data:P.data,events:{...P.events,...te},selected:P.selected,resizing:P.resizing,dragging:U.value,connectable:B.value,position:P.computedPosition,dimensions:P.dimensions,isValidTargetPos:P.isValidTargetPos,isValidSourcePos:P.isValidSourcePos,parent:P.parentNode,parentNodeId:P.parentNode,zIndex:P.computedPosition.z??ce.value,targetPosition:P.targetPosition,sourcePosition:P.sourcePosition,label:P.label,dragHandle:P.dragHandle,onUpdateNodeInternals:W})]);function ue(){let e=P.computedPosition,{computedPosition:t,position:n}=m0(P,y.value?D0(e,b.value):e,c.error,m.value,I.value);(P.computedPosition.x!==t.x||P.computedPosition.y!==t.y)&&(P.computedPosition={...P.computedPosition,...t}),(P.position.x!==n.x||P.position.y!==n.y)&&(P.position=n)}function W(){A.value&&d([{id:e.id,nodeElement:A.value,forceUpdate:!0}])}function de(e){U?.value||L.mouseEnter({event:e,node:P})}function fe(e){U?.value||L.mouseMove({event:e,node:P})}function G(e){U?.value||L.mouseLeave({event:e,node:P})}function pe(e){return L.contextMenu({event:e,node:P})}function me(e){return L.doubleClick({event:e,node:P})}function he(e){z.value&&(!r.value||!re.value||x.value>0)&&U0(P,s.value,u,l,a,!1,A.value),L.click({event:e,node:P})}function ge(e){if(!(a1(e)||g.value)){if(m1.includes(e.key)&&z.value){let t=e.key===`Escape`;U0(P,s.value,u,l,a,t,A.value)}else re.value&&P.selected&&h1[e.key]&&(e.preventDefault(),_.value=`Moved selected node ${e.key.replace(`Arrow`,``).toLowerCase()}. New position, x: ${~~P.position.x}, y: ${~~P.position.y}`,N({x:h1[e.key].x,y:h1[e.key].y},e.shiftKey))}}}});function R4(e={includeHiddenNodes:!1}){let{nodes:t}=f4();return R(()=>{if(t.value.length===0)return!1;for(let n of t.value)if((e.includeHiddenNodes||!n.hidden)&&(n?.handleBounds===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}var z4={class:`vue-flow__nodes vue-flow__container`},B4=z({name:`Nodes`,compatConfig:{MODE:3},setup(e){let{getNodes:t,updateNodeDimensions:n,emits:a}=f4(),o=R4(),s=i();return C(o,e=>{e&&le(()=>{a.nodesInitialized(t.value)})},{immediate:!0}),F(()=>{s.value=new ResizeObserver(e=>{let t=e.map(e=>({id:e.target.getAttribute(`data-id`),nodeElement:e.target,forceUpdate:!0}));le(()=>n(t))})}),re(()=>s.value?.disconnect()),(e,n)=>(B(),N(`div`,z4,[s.value?(B(!0),N(V,{key:0},P(r(t),(e,t,n,i)=>{let a=[e.id];if(i&&i.key===e.id&&A(i,a))return i;let o=(B(),W(r(L4),{id:e.id,key:e.id,"resize-observer":s.value},null,8,[`id`,`resize-observer`]));return o.memo=a,o},n,0),128)):G(``,!0)]))}});function V4(){let{emits:e}=f4();F(()=>{if(V0()){let t=document.querySelector(`.vue-flow__pane`);t&&window.getComputedStyle(t).zIndex!==`1`&&e.error(new x0(y0.MISSING_STYLES))}})}var H4=M(`div`,{class:`vue-flow__edge-labels`},null,-1),U4=z({name:`VueFlow`,compatConfig:{MODE:3},props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:`nodesChange.edgesChange.nodesInitialized.paneReady.init.updateNodeInternals.error.connect.connectStart.connectEnd.clickConnectStart.clickConnectEnd.moveStart.move.moveEnd.selectionDragStart.selectionDrag.selectionDragStop.selectionContextMenu.selectionStart.selectionEnd.viewportChangeStart.viewportChange.viewportChangeEnd.paneScroll.paneClick.paneContextMenu.paneMouseEnter.paneMouseMove.paneMouseLeave.edgeUpdate.edgeContextMenu.edgeMouseEnter.edgeMouseMove.edgeMouseLeave.edgeDoubleClick.edgeClick.edgeUpdateStart.edgeUpdateEnd.nodeContextMenu.nodeMouseEnter.nodeMouseMove.nodeMouseLeave.nodeDoubleClick.nodeClick.nodeDragStart.nodeDrag.nodeDragStop.miniMapNodeClick.miniMapNodeDoubleClick.miniMapNodeMouseEnter.miniMapNodeMouseMove.miniMapNodeMouseLeave.update:modelValue.update:nodes.update:edges`.split(`.`),setup(e,{expose:t,emit:n}){let i=e,a=E(),o=sJ(i,`modelValue`,n),s=sJ(i,`nodes`,n),c=sJ(i,`edges`,n),l=f4(i),u=x2({modelValue:o,nodes:s,edges:c},i,l);return C2(n,l.hooks),T4(),V4(),ne(r2,a),te(u),t(l),(e,t)=>(B(),N(`div`,{ref:r(l).vueFlowRef,class:`vue-flow`},[b(b4,null,{default:H(()=>[b(I4),H4,b(B4),fe(e.$slots,`zoom-pane`)]),_:3}),fe(e.$slots,`default`),b(w4)],512))}}),W4=z({name:`Panel`,compatConfig:{MODE:3},props:{position:{}},setup(e){let t=e,{userSelectionActive:n}=f4(),i=R(()=>`${t.position}`.split(`-`));return(e,t)=>(B(),N(`div`,{class:I([`vue-flow__panel`,i.value]),style:ie({pointerEvents:r(n)?`none`:`all`})},[fe(e.$slots,`default`)],6))}}),G4=`#818cf8`,K4=ze(z({inheritAttrs:!1,__name:`ScenarioGroupNode`,props:{id:{},data:{},selected:{type:Boolean},readonly:{type:Boolean}},emits:[`updateLabel`,`updateNodeInternals`,`remove`],setup(e,{emit:t}){let n=e,a=t,o=i(!1),s=i(``);function c(e){e.stopPropagation(),s.value=n.data.label,o.value=!0}function l(){o.value=!1,a(`updateLabel`,n.id,s.value)}function u(e){e.key===`Enter`&&l(),e.key===`Escape`&&(o.value=!1)}C(()=>n.data.label,e=>{o.value||(s.value=e)});let d=R(()=>n.data.color??G4),f=R(()=>n.selected?d.value:`${d.value}90`),p=R(()=>n.selected?`color-mix(in srgb, ${d.value} 28%, transparent)`:`color-mix(in srgb, ${d.value} 14%, transparent)`),m=R(()=>n.selected?d.value:`${d.value}cc`),h=R(()=>`${d.value}55`),g=R(()=>({borderColor:f.value,background:p.value,boxShadow:n.selected?`0 0 0 1px ${f.value}, 0 0 28px ${h.value}`:`0 0 0 0 transparent`})),_=R(()=>({color:m.value}));return R(()=>({borderColor:d.value})),(t,n)=>(B(),N(`div`,{class:`group-node`,style:ie(g.value)},[M(`div`,{class:`group-node__header`,onDblclick:n[3]||=t=>!e.readonly&&c(t)},[o.value?(B(),W(r(Ce),{key:0,modelValue:s.value,"onUpdate:modelValue":n[0]||=e=>s.value=e,class:`group-node__label-input`,style:ie({color:d.value,outlineColor:d.value}),autofocus:``,onBlur:l,onKeydown:u,onClick:n[1]||=he(()=>{},[`stop`])},null,8,[`modelValue`,`style`])):(B(),N(`span`,{key:1,class:`group-node__label`,style:ie(_.value)},U(e.data.label||`Team`),5)),e.selected&&!e.readonly?(B(),W(r(Le),{key:2,icon:`ti ti-trash`,variant:`text`,rounded:``,size:`small`,severity:`danger`,class:`group-node__remove`,onClick:n[2]||=he(t=>a(`remove`,e.id),[`stop`])})):G(``,!0)],32)],4))}}),[[`__scopeId`,`data-v-81199534`]]),q4={class:`efn__inner`},J4={class:`efn__icon-wrap`},Y4={class:`efn__content`},X4={class:`efn__label`},Z4={class:`efn__meta`},Q4={key:1,class:`efn__spinner`},$4={key:2,class:`efn__spinner efn__spinner--waiting-input`},e3={key:3,class:`efn__spinner efn__spinner--waiting`},t3=ze(z({inheritAttrs:!1,__name:`ScenarioFlowNode`,props:{id:{},data:{},selected:{type:Boolean}},emits:[`updateNodeInternals`],setup(e){let t=e,{updateNodeInternals:n}=f4();F(()=>n(t.id));let a=w(`efn-selected-node-id`,i(void 0)),o=w(`efn-node-states`,i({})),s=R(()=>o.value[t.id]??t.data.state??`idle`),c=R(()=>t.selected||a.value===t.id),l=R(()=>t.data.label||t.id),u=R(()=>t.data.isLeader??!1),d=R(()=>u.value?`ti ti-crown`:t.data.type===`ask`?`ti ti-message`:`ti ti-brain`),f=R(()=>(t.data.aiCli??`claude-code`)===`codex`?`Codex`:`Claude`),p=R(()=>t.data.model?.trim()||``),m=R(()=>{let e=p.value?`${f.value} · ${p.value}`:f.value;return t.data.roleName?`${t.data.roleName} · ${e}`:e}),h=w(`efn-open-pty-debug`,null),g=R(()=>!h||t.data.type===`ask`||(t.data.aiCli??`claude-code`)!==`claude-code`?!1:s.value===`done`||s.value===`synthesized`);function _(e){e.stopPropagation(),h?.(t.id)}return(t,n)=>(B(),N(V,null,[b(r(k2),{type:`target`,position:r(Q).Left,class:`efn-handle efn-handle--target`},null,8,[`position`]),M(`div`,{class:I([`efn`,u.value?`efn--leader`:`efn--node`,c.value&&`efn--selected`,s.value!==`idle`&&`efn--${s.value}`])},[n[6]||=M(`div`,{class:`efn__border`},null,-1),M(`div`,q4,[M(`div`,J4,[M(`i`,{class:I([d.value,`efn__icon`])},null,2)]),M(`div`,Y4,[M(`span`,X4,U(l.value),1),M(`span`,Z4,U(m.value),1)])]),g.value?(B(),N(`button`,{key:0,class:`efn__badge efn__badge--debug`,title:`Reprendre dans un terminal Claude (--resume)`,onClick:_,onMousedown:n[0]||=he(()=>{},[`stop`]),onPointerdown:n[1]||=he(()=>{},[`stop`])},[...n[2]||=[M(`i`,{class:`ti ti-device-desktop`},null,-1)]],32)):G(``,!0),s.value===`running`?(B(),N(`div`,Q4,[...n[3]||=[M(`i`,{class:`ti ti-spin ti-loader-2`},null,-1)]])):s.value===`waiting_input`?(B(),N(`div`,$4,[...n[4]||=[M(`i`,{class:`ti ti-help-circle`},null,-1)]])):s.value===`waiting`?(B(),N(`div`,e3,[...n[5]||=[M(`i`,{class:`ti ti-clock`},null,-1)]])):G(``,!0)],2),e.data.showBottomHandle===!1?G(``,!0):(B(),W(r(k2),{key:0,id:`source-bottom`,type:`source`,position:r(Q).Bottom,class:`efn-handle efn-handle--source efn-handle--source-bottom`,style:{left:`10px`}},null,8,[`position`])),e.data.showTopHandle?(B(),W(r(k2),{key:1,id:`source-top`,type:`source`,position:r(Q).Top,class:`efn-handle efn-handle--source efn-handle--source-top`,style:{left:`10px`}},null,8,[`position`])):G(``,!0)],64))}}),[[`__scopeId`,`data-v-feea8c6d`]]),n3={class:`scenario-run-view`},r3={key:0,class:`scenario-run-view__loading`},i3=`scenario-run-view`,a3=ze(z({__name:`ScenarioRunView`,props:{scenario:{},nodeStates:{},selectedNodeId:{},preset:{}},emits:[`node-click`],setup(e,{emit:t}){let n=e,i=t;ne(`efn-selected-node-id`,o(n,`selectedNodeId`)),ne(`efn-node-states`,o(n,`nodeStates`));let{updateEdge:a,getEdges:s}=f4(i3),c=R(()=>n.scenario),l=R(()=>{if(!c.value)return[];let e=(c.value.groups??[]).map(e=>({id:e.id,type:`group`,position:{...e.position},style:{width:`${e.width}px`,height:`${e.height}px`},data:{label:e.name,color:e.color??void 0},draggable:!1,selectable:!1})),t=c.value.nodes.map(e=>({id:e.id,position:{...e.position},label:e.label,data:{label:e.label,isLeader:e.id===c.value.leaderId,type:e.type,aiCli:e.aiCli,model:e.model,roleName:n.preset?.roles.find(t=>t.id===e.role)?.name},...e.groupId?{parentNode:e.groupId,extent:`parent`}:{}}));return[...e,...t]}),u=R(()=>{if(!c.value)return[];let e=[];for(let t of c.value.nodes)for(let n of t.parentIds??[])e.push({id:`e-${n}-${t.id}`,source:n,target:t.id,type:`step`,animated:!1,zIndex:1500,style:{stroke:`rgba(99,102,241,0.55)`,strokeWidth:2.5}});return e});return C(()=>n.nodeStates,e=>{let t=Object.values(e).some(e=>e===`running`);for(let e of s.value)a(e.id,{animated:t})},{deep:!0}),(e,t)=>(B(),N(`div`,n3,[c.value?(B(),W(r(U4),{key:1,id:i3,nodes:l.value,edges:u.value,"nodes-draggable":!0,"nodes-connectable":!1,"elements-selectable":!1,"fit-view-on-init":``,class:`scenario-run-view__flow scenario-flow-canvas`,onNodeClick:t[0]||=e=>i(`node-click`,e.node.id)},{"node-default":H(e=>[b(t3,ce(pe(e)),null,16)]),"node-group":H(e=>[b(K4,L(e,{readonly:!0}),null,16)]),_:1},8,[`nodes`,`edges`])):(B(),N(`div`,r3,[...t[1]||=[M(`i`,{class:`ti ti-spin ti-loader-2`},null,-1)]]))]))}}),[[`__scopeId`,`data-v-d046446e`]]),o3={class:`ai-chat-scenario-view`},s3={class:`ai-chat-scenario-view__graph`},c3={key:0,class:`ai-chat-scenario-view__synthesis-banner`},l3={class:`ai-chat-scenario-view__detail`},u3={key:0,class:`ai-chat-scenario-view__stop-bar`},d3={key:1,class:`ai-chat-scenario-view__stop-bar`},f3={style:{"font-size":`0.875rem`}},p3={class:`ai-chat-scenario-view__input-request-header`},m3={class:`ai-chat-scenario-view__input-request-name`},h3={class:`ai-chat-scenario-view__input-request-question`},g3={class:`ai-chat-scenario-view__input-request-form`},_3={class:`ai-chat-scenario-view__tabs`},v3={key:0,class:`ai-chat-scenario-view__tab-dot`},y3={key:0,class:I([`ai-chat-scenario-view__tab`,`ai-chat-scenario-view__tab--active`])},b3={key:0,class:`ai-chat-scenario-view__hint`},x3={key:1,class:`ai-chat-scenario-view__accordion`},S3={key:0,class:`ai-chat-scenario-view__accordion-item`},C3=[`innerHTML`],w3={key:1,class:`ai-chat-scenario-view__accordion-item`},T3=[`innerHTML`],E3={key:2,class:`ai-chat-scenario-view__cursor`},D3={key:0,class:`ai-chat-scenario-view__node-meta`},O3={class:`ai-chat-scenario-view__chip`},k3={key:0,class:`ai-chat-scenario-view__chip ai-chat-scenario-view__chip--model`},A3={key:1,class:`ai-chat-scenario-view__node-status`},j3={key:2,class:`ai-chat-scenario-view__thinking-block`},M3={key:0,class:`ai-chat-scenario-view__thinking-content`},N3={key:3,class:`ai-chat-scenario-view__tool-events`},P3={class:`ai-chat-scenario-view__tool-event-name`},F3={key:0,class:`ai-chat-scenario-view__tool-event-args ai-chat-scenario-view__tool-event-args--streaming`},I3={key:1,class:`ai-chat-scenario-view__tool-event-args`},L3={key:2,class:`ai-chat-scenario-view__tool-event-result`},R3=[`innerHTML`],z3={key:5,class:`ai-chat-scenario-view__node-empty`},B3={key:6,class:`ai-chat-scenario-view__node-duration`},V3={key:0,style:{padding:`1rem`,color:`#d4d4d4`}},H3={key:1,style:{padding:`1rem`,color:`#f87171`}},U3=ze(z({__name:`AiChatScenarioView`,props:{availablePresets:{}},emits:[`click-resume`],setup(e,{expose:t,emit:n}){let a=e,o=n,{t:s}=He(),c=De(),l=lt(),u=dt(),{activeConversation:d}=$e(l),f=i(null);t({messagesEl:f,resetNodeSelection:Ce,syncScenarioAccordionState:de});let p=i(null),m=i(!0),h=i(!1),g=i(null),_=i(null),v=i(!1),y=i(null);ne(`efn-open-pty-debug`,e=>{S(e)});async function S(e){let t=d.value;if(t){g.value=e,_.value=null,y.value=null,v.value=!0;try{let n=await yt.scenario.getNodeSession.query({conversationId:t.id,nodeId:e});n?_.value=n:y.value=`Ce nœud n'a pas encore de session Claude (jamais exécuté ?).`}catch(e){y.value=e.message}finally{v.value=!1}}}let C=/##\s*(?:✅\s*)?FINAL REPORT/i,w=R(()=>d.value?.scenarioNodeStates??{}),T=R(()=>d.value?.scenarioNodeOutputs??{}),E=R(()=>d.value?.scenarioRunning??!1),D=R(()=>d.value?.scenarioSynthesisRunning??!1),ee=R(()=>{let e=d.value;if(!e||e.workflowType!==`scenario`||E.value)return!1;let t=e.scenarioNodeStates??{};return Object.keys(t).length>0&&Object.values(t).some(e=>e!==`done`&&e!==`synthesized`)}),O=R(()=>d.value?.scenarioReadme??``),k=R(()=>{let e=O.value??``,t=C.exec(e);if(!t)return{runLog:e,finalReport:``};let n=t.index??0;return{runLog:e.slice(0,n).trim(),finalReport:e.slice(n).trim()}}),A=R(()=>{let e=d.value;return!e||e.workflowType!==`scenario`?null:e.scenarioSnapshot??u.scenarios.find(t=>t.id===e.workflowId)??null}),j=R(()=>a.availablePresets.find(e=>e.id===A.value?.presetId)),F=R(()=>!p.value||!A.value?null:A.value.nodes.find(e=>e.id===p.value)??null),L=R(()=>(F.value?.aiCli??`claude-code`)===`codex`?`Codex`:`Claude Code`),te=R(()=>{let e=F.value;return e&&e.model?.trim()||``}),re=R(()=>d.value?.scenarioWaitingInputs??{}),z=R(()=>d.value?.scenarioNodeStatuses??{}),ie=R(()=>d.value?.scenarioNodeThinking??{}),ae=R(()=>d.value?.scenarioNodeToolEvents??{}),oe=R(()=>d.value?.scenarioNodeDurations??{}),se=i(new Set),ce=R(()=>p.value),le=i({});async function ue(e){let t=d.value;if(!t)return;let n=le.value[e]?.trim();if(n)try{await l.sendNodeInput(t.id,e,n);let{[e]:r,...i}=le.value;le.value=i}catch(e){c.add({severity:`error`,summary:s(`common.error`),detail:e.message,life:4e3})}}function de(){let e=k.value.finalReport.length>0;m.value=!e,h.value=e}function fe(e){if(e===`run`){let e=!m.value;m.value=e,e&&(h.value=!1);return}let t=!h.value;h.value=t,t&&(m.value=!1)}let pe=new Map;function ge(e){return e.replace(/<pass\s+branch="(\d+)"\s*\/>/g,(e,t)=>`<span class="scenario-flag scenario-flag--pass">PASS ${t}</span>`).replace(/<pass\s*\/>/g,`<span class="scenario-flag scenario-flag--pass">PASS</span>`).replace(/<error>([\s\S]*?)<\/error>/g,(e,t)=>`<span class="scenario-flag scenario-flag--error">ERROR: ${t.trim()}</span>`).replace(/<ask_user>([\s\S]*?)<\/ask_user>/g,(e,t)=>`<span class="scenario-flag scenario-flag--ask">${t.trim()}</span>`).replace(/<kanban_move\s+column="([^"]*?)"\s*\/>/g,(e,t)=>`<span class="scenario-flag scenario-flag--kanban">📋 Move → ${t}</span>`).replace(/<kanban_comment>([\s\S]*?)<\/kanban_comment>/g,(e,t)=>`<span class="scenario-flag scenario-flag--kanban-comment">💬 ${t.trim()}</span>`).replace(/<kanban_add_card\s+column="([^"]*?)"\s+title="([^"]*?)">([\s\S]*?)<\/kanban_add_card>/g,(e,t,n)=>`<span class="scenario-flag scenario-flag--kanban">➕ Card "${n}" → ${t}</span>`).replace(/<next_person\s+name="([^"]*?)"\s*\/>/g,(e,t)=>`<span class="scenario-flag scenario-flag--delegate">🔀 ${t}</span>`).replace(/<next_person\s+name="([^"]*?)">([\s\S]*?)<\/next_person>/g,(e,t,n)=>`<span class="scenario-flag scenario-flag--delegate">🔀 <strong>${t}</strong> — ${n.trim()}</span>`).replace(/<hire_person\s+label="([^"]*?)"\s+role="([^"]*?)">([\s\S]*?)<\/hire_person>/g,(e,t,n)=>`<span class="scenario-flag scenario-flag--hire">🧑💼 Hire ${t} (${n})</span>`)}function _e(e){let t=pe.get(e);return t===void 0&&(t=sR.sanitize(RI.parse(ge(e),{async:!1})),pe.set(e,t)),t}function ve(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function ye(e){return e.name===`command_execution`&&typeof e.input?.command==`string`}function be(e){return ye(e)?`shell`:e.name}function xe(e){return!e.input||Object.keys(e.input).length===0?``:ye(e)?String(e.input.command??``):Object.entries(e.input).map(([e,t])=>`${e}=${t}`).join(`, `)}function Se(e,t){let n;if(typeof e==`string`)n=e;else try{n=JSON.stringify(e,null,2)}catch{n=`[unserializable result]`}return n.split(`
|
|
308
308
|
`).slice(-t).join(`
|
|
309
|
-
`)}function Ce(){p.value=null,de()}return(e,t)=>(B(),N(`div`,t3,[b(r(Ie),{layout:`horizontal`,"gutter-size":6,class:`ai-chat-scenario-view__splitter`},{default:H(()=>[b(r(Ze),{size:45,"min-size":0},{default:H(()=>[M(`div`,n3,[D.value?(B(),N(`div`,r3,[t[8]||=M(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),M(`span`,null,U(r(s)(`aiChatPage.scenario.synthesisInProgress`)),1)])):G(``,!0),(B(),W(e3,{key:`scenario-graph-${r(d)?.id}`,scenario:A.value,"node-states":w.value,"selected-node-id":p.value??void 0,preset:j.value,onNodeClick:t[0]||=e=>p.value=p.value===e?null:e},null,8,[`scenario`,`node-states`,`selected-node-id`,`preset`]))])]),_:1}),b(r(Ze),{size:55,"min-size":35},{default:H(()=>[M(`div`,i3,[E.value?(B(),N(`div`,a3,[...t[9]||=[M(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),M(`span`,null,`Scenario running...`,-1)]])):ee.value?(B(),N(`div`,o3,[t[10]||=M(`i`,{class:`ti ti-alert-triangle`,style:{color:`var(--r-orange-500, #f97316)`}},null,-1),M(`span`,s3,U(r(s)(`aiChatPage.scenario.interrupted`)),1),b(r(Le),{label:r(s)(`aiChatPage.resume`),icon:`ti ti-player-play`,size:`small`,onClick:t[1]||=e=>o(`click-resume`)},null,8,[`label`])])):G(``,!0),(B(!0),N(V,null,P(re.value,(e,n)=>(B(),N(`div`,{key:n,class:`ai-chat-scenario-view__input-request`},[M(`div`,c3,[t[11]||=M(`i`,{class:`ti ti-help-circle`},null,-1),M(`span`,l3,U(A.value?.nodes.find(e=>e.id===n)?.label||n)+` asks: `,1)]),M(`p`,u3,U(e),1),M(`div`,d3,[b(r(Ke),{modelValue:le.value[n],"onUpdate:modelValue":e=>le.value[n]=e,class:`ai-chat-scenario-view__input-request-field`,placeholder:`Your answer...`,disabled:!E.value,rows:3,"auto-resize":``,onKeydown:me(he(e=>E.value&&ue(n),[`exact`,`prevent`]),[`enter`])},null,8,[`modelValue`,`onUpdate:modelValue`,`disabled`,`onKeydown`]),b(r(Le),{icon:`ti ti-send`,size:`small`,disabled:!le.value[n]?.trim()||!E.value,title:E.value?void 0:r(s)(`aiChatPage.scenario.resumeToAnswer`),onClick:e=>ue(n)},null,8,[`disabled`,`title`,`onClick`])])]))),128)),M(`div`,f3,[M(`button`,{class:I([`ai-chat-scenario-view__tab`,{"ai-chat-scenario-view__tab--active":!p.value}]),onClick:t[2]||=e=>p.value=null},[t[12]||=M(`i`,{class:`ti ti-file`},null,-1),x(` `+U(r(s)(`aiChatPage.runLog`))+` `,1),E.value?(B(),N(`span`,p3)):G(``,!0)],2),p.value?(B(),N(`button`,m3,[t[13]||=M(`i`,{class:`ti ti-user`},null,-1),x(` `+U(F.value?.label||F.value?.id)+` `,1),M(`span`,{class:I([`ai-chat-scenario-view__node-state`,`ai-chat-scenario-view__node-state--${w.value[ce.value]??`idle`}`])},U(w.value[ce.value]??`idle`),3),M(`button`,{class:`ai-chat-scenario-view__tab-close`,onClick:t[3]||=he(e=>p.value=null,[`stop`])},`x`)])):G(``,!0)]),p.value?(B(),N(`div`,{key:`scenario-node-${r(d)?.id}-${ce.value}`,class:`ai-chat-scenario-view__node-output`},[F.value?(B(),N(`div`,S3,[M(`span`,C3,U(L.value),1),te.value?(B(),N(`span`,w3,U(te.value),1)):G(``,!0)])):G(``,!0),z.value[ce.value]&&w.value[ce.value]===`running`?(B(),N(`div`,T3,[t[17]||=M(`i`,{class:`ti ti-spin ti-settings`},null,-1),M(`span`,null,U(z.value[ce.value]),1)])):G(``,!0),ie.value[ce.value]?.length?(B(),N(`div`,E3,[M(`div`,{class:`ai-chat-scenario-view__thinking-header`,onClick:t[6]||=e=>se.value.has(ce.value)?se.value.delete(ce.value):se.value.add(ce.value)},[t[18]||=M(`i`,{class:`ti ti-sparkles`},null,-1),M(`span`,null,U(r(s)(`aiChatPage.thinking`)),1),M(`i`,{class:I([`ti`,se.value.has(ce.value)?`ti-chevron-up`:`ti-chevron-down`])},null,2)]),se.value.has(ce.value)?(B(),N(`pre`,D3,U(ie.value[ce.value].join(``)),1)):G(``,!0)])):G(``,!0),ae.value[ce.value]?.length?(B(),N(`div`,O3,[(B(!0),N(V,null,P(ae.value[ce.value],e=>(B(),N(`div`,{key:e.id,class:I([`ai-chat-scenario-view__tool-event`,{"ai-chat-scenario-view__tool-event--pending":e.pending,"ai-chat-scenario-view__tool-event--error":e.isError}])},[M(`i`,{class:I(e.pending?`ti ti-spin ti-loader-2`:e.isError?`ti ti-circle-x`:`ti ti-circle-check`)},null,2),M(`span`,k3,U(be(e)),1),e.pending&&e.rawInput?(B(),N(`span`,A3,[x(U(e.rawInput),1),t[19]||=M(`span`,{class:`ai-chat-scenario-view__cursor`},null,-1)])):xe(e)?(B(),N(`span`,j3,U(xe(e)),1)):G(``,!0),!e.pending&&e.result?(B(),N(`pre`,M3,U(Se(e.result,20)),1)):G(``,!0)],2))),128))])):G(``,!0),T.value[ce.value]?(B(),N(`div`,{key:4,class:`ai-chat-scenario-view__node-content ai-chat-scenario-view__markdown`,innerHTML:_e(T.value[ce.value])},null,8,N3)):(B(),N(`div`,P3,[t[20]||=M(`i`,{class:`ti ti-clock`},null,-1),M(`span`,null,U(w.value[ce.value]===`running`?`Running...`:`Waiting...`),1)])),oe.value[ce.value]===void 0?G(``,!0):(B(),N(`div`,F3,[t[21]||=M(`i`,{class:`ti ti-clock`},null,-1),M(`span`,null,U(ve(oe.value[ce.value])),1)]))])):(B(),N(`div`,{key:`scenario-readme-${r(d)?.id}`,ref_key:`messagesEl`,ref:f,class:`ai-chat-scenario-view__readme`},[O.value?(B(),N(`div`,g3,[k.value.runLog?(B(),N(`div`,_3,[M(`button`,{class:`ai-chat-scenario-view__accordion-header`,onClick:t[4]||=e=>fe(`run`)},[M(`span`,null,[t[15]||=M(`i`,{class:`ti ti-file`},null,-1),x(` `+U(r(s)(`aiChatPage.runLog`)),1)]),M(`i`,{class:I([`ti`,m.value?`ti-chevron-up`:`ti-chevron-down`])},null,2)]),m.value?(B(),N(`div`,{key:0,class:`ai-chat-scenario-view__accordion-content ai-chat-scenario-view__readme-content ai-chat-scenario-view__markdown`,innerHTML:_e(k.value.runLog)},null,8,v3)):G(``,!0)])):G(``,!0),k.value.finalReport?(B(),N(`div`,y3,[M(`button`,{class:`ai-chat-scenario-view__accordion-header`,onClick:t[5]||=e=>fe(`final`)},[M(`span`,null,[t[16]||=M(`i`,{class:`ti ti-file-check`},null,-1),x(` `+U(r(s)(`aiChatPage.finalReport`)),1)]),M(`i`,{class:I([`ti`,h.value?`ti-chevron-up`:`ti-chevron-down`])},null,2)]),h.value?(B(),N(`div`,{key:0,class:`ai-chat-scenario-view__accordion-content ai-chat-scenario-view__final-report ai-chat-scenario-view__markdown`,innerHTML:_e(k.value.finalReport)},null,8,b3)):G(``,!0)])):G(``,!0)])):(B(),N(`div`,h3,[t[14]||=M(`i`,{class:`ti ti-building`,style:{"font-size":`1.5rem`,opacity:`0.2`}},null,-1),M(`p`,null,U(r(s)(`aiChatPage.typeATask`)),1),M(`p`,null,U(r(s)(`aiChatPage.clickOrgChartHint`)),1)])),E.value?(B(),N(`span`,x3)):G(``,!0)]))])]),_:1})]),_:1}),b(r(Ne),{visible:!!g.value,modal:``,"dismissable-mask":``,header:`Claude · resume ${g.value??``}`,style:{width:`80vw`,height:`70vh`},"content-style":{padding:0,height:`100%`},"onUpdate:visible":t[7]||=e=>{e||(g.value=null,_.value=null,y.value=null)}},{default:H(()=>[v.value?(B(),N(`div`,I3,`Chargement…`)):y.value?(B(),N(`div`,L3,[t[22]||=M(`i`,{class:`ti ti-alert-triangle`},null,-1),x(` `+U(y.value),1)])):_.value?(B(),W(Nq,{key:2,"session-id":_.value.sessionId,"agent-id":_.value.agentId,resume:!0},null,8,[`session-id`,`agent-id`])):G(``,!0)]),_:1},8,[`visible`,`header`])]))}}),[[`__scopeId`,`data-v-531a3e9c`]]),z3={"claude-code":`Claude Code`,codex:`Codex`};function B3(e,t,n){return Object.keys(z3).map(r=>{let i=z3[r],a=!e[r]&&t!==r;return{value:r,disabled:a,label:a?n(i):i}})}function V3(e,t,n){let r=[{value:``,label:e},...t];return n&&!t.some(e=>e.value===n)&&r.push({value:n,label:n}),r}function H3(e,t){return[{value:``,label:e},...Yt.map(e=>({value:e,label:t(e)}))]}function U3(e,t,n,r,i=1){return Math.max(n,Math.min(Math.max(n,r),e+t*i))}function W3(e){let{axis:t,min:n,initial:r,storageKey:a,direction:o=1}=e,s=()=>typeof e.max==`function`?e.max():e.max,c=i(p()),l=i(!1),d=0,f=0;function p(){if(!a)return r;try{let e=Number(localStorage.getItem(a));if(Number.isFinite(e)&&e>=n&&e<=s())return e}catch{}return r}function m(){if(a)try{localStorage.setItem(a,String(c.value))}catch{}}let h=e=>{let r=(t===`x`?e.clientX:e.clientY)-d;c.value=U3(f,r,n,s(),o)},g=()=>{l.value=!1,document.removeEventListener(`pointermove`,h),document.removeEventListener(`pointerup`,g),document.removeEventListener(`pointercancel`,g),document.body.style.userSelect=``,document.body.style.cursor=``,m()};function _(e){l.value=!0,d=t===`x`?e.clientX:e.clientY,f=c.value,document.body.style.userSelect=`none`,document.body.style.cursor=t===`x`?`col-resize`:`row-resize`,document.addEventListener(`pointermove`,h),document.addEventListener(`pointerup`,g),document.addEventListener(`pointercancel`,g)}return u(()=>{l.value&&g()}),{size:c,isResizing:l,start:_}}var G3={class:`companion-panel__header`},K3={class:`companion-panel__title`},q3={key:0,class:`companion-panel__state companion-panel__state--reading`},J3=[`title`],Y3={key:2,class:`companion-panel__state`},X3={class:`companion-panel__header-actions`},Z3={class:`companion-panel__menu`},Q3=[`title`],$3=[`title`,`disabled`],e6=[`title`,`disabled`],t6={class:`companion-panel__hint`},n6={key:2,class:`companion-panel__empty`},r6=[`title`],i6=ze(z({__name:`CompanionPanel`,props:{enabled:{type:Boolean},runner:{},model:{},effort:{},companionConversationId:{},mainConversationId:{}},emits:[`enable`,`disable`,`update:runner`,`update:model`,`update:effort`],setup(e,{emit:t}){let n=e,a=t,{t:o}=He(),s=lt(),{claudeCodeAvailable:c,codexAvailable:l,cliModels:u}=$e(s),d=R(()=>B3({"claude-code":c.value,codex:l.value},n.runner,e=>o(`aiChatPage.runnerNotInstalled`,{runner:e}))),f=R(()=>V3(o(`aiChat.companionModelDefault`),u.value[n.runner],n.model));C(()=>n.runner,e=>{s.loadCliModels(e)},{immediate:!0});let p=R(()=>H3(o(`aiChat.companionEffortDefault`),e=>o(`aiChat.companionEffort_${e}`))),m=R(()=>n.companionConversationId?s.conversations.find(e=>e.id===n.companionConversationId)??null:null);C(()=>m.value?.messagesOmitted?m.value.id:null,e=>{e&&s.ensureConversationLoaded(e)},{immediate:!0});let h=i(!1),g=R(()=>n.enabled&&h.value),_=R(()=>(m.value?.messages??[]).filter(e=>e.role===`assistant`&&e.content.trim()).length),{size:v,isResizing:y,start:S}=W3({axis:`y`,min:180,max:()=>Math.round(window.innerHeight*.75),initial:380,storageKey:`runeya:companion-height`}),w=i();function T(e){w.value?.toggle(e)}let E=R(()=>m.value?.messages??[]),D=R(()=>s.isCompanionThinkingFor(n.mainConversationId)),ee=R(()=>s.companionSkipFor(n.mainConversationId)),O=R(()=>D.value||!!n.companionConversationId&&s.isConversationStreaming(n.companionConversationId));function k(e){a(`update:runner`,e===`codex`?`codex`:`claude-code`)}let A=i(!1),j=i(null);async function P(){if(!n.mainConversationId||!g.value){j.value=null;return}try{let e=await yt.chat.conversations.companionDelivery.query({id:n.mainConversationId});j.value=e.delivery}catch{j.value=null}}C(D,(e,t)=>{e&&!t&&s.refreshStreamingSessions()});let F=Rt(P,1500,`companion-delivery`);C(()=>[n.mainConversationId,g.value],([,e])=>{j.value=null,e?(F.start(),F.trigger()):F.stop()},{immediate:!0}),te(()=>F.stop());async function L(){if(n.mainConversationId){A.value=!0;try{await yt.chat.conversations.testCompanionBridge.mutate({id:n.mainConversationId})}catch{}finally{A.value=!1,await P()}}}let ne=i(!1);async function re(){if(n.mainConversationId){ne.value=!0;try{await yt.chat.conversations.runCompanionNow.mutate({id:n.mainConversationId})}catch{}finally{ne.value=!1}}}return(t,n)=>(B(),N(`section`,{class:I([`companion-panel`,{"companion-panel--resizing":r(y),"companion-panel--collapsed":!g.value}]),style:ie(g.value?{height:r(v)+`px`}:void 0)},[M(`header`,G3,[M(`span`,K3,[M(`i`,{class:I(e.enabled?`ti ti-eye`:`ti ti-eye-off`)},null,2),x(` `+U(r(o)(`aiChat.companionPanelTitle`)),1)]),e.enabled&&O.value?(B(),N(`span`,q3,[n[6]||=M(`i`,{class:`companion-panel__pulse`},null,-1),x(U(r(o)(`aiChat.companionReading`)),1)])):e.enabled&&ee.value?(B(),N(`span`,{key:1,class:`companion-panel__state companion-panel__state--skipped`,title:ee.value.detail},[n[7]||=M(`i`,{class:`ti ti-info-circle`},null,-1),x(U(r(o)(`aiChat.companionSkip_${ee.value.reason}`)),1)],8,J3)):e.enabled?G(``,!0):(B(),N(`span`,Y3,U(r(o)(`aiChat.companionPitchLead`)),1)),M(`div`,X3,[b(r(ke),{class:`companion-panel__runner`,"model-value":e.runner,options:d.value,"option-label":`label`,"option-value":`value`,"option-disabled":`disabled`,size:`small`,title:r(o)(`aiChat.companionRunner`),"onUpdate:modelValue":k},null,8,[`model-value`,`options`,`title`]),f.value.length>1?(B(),W(r(ke),{key:0,class:`companion-panel__runner companion-panel__model`,"model-value":e.model,options:f.value,"option-label":`label`,"option-value":`value`,size:`small`,title:r(o)(`aiChat.companionModel`),"aria-label":r(o)(`aiChat.companionModel`),"onUpdate:modelValue":n[0]||=e=>a(`update:model`,String(e??``))},null,8,[`model-value`,`options`,`title`,`aria-label`])):G(``,!0),b(r(ke),{class:`companion-panel__runner companion-panel__effort`,"model-value":e.effort,options:p.value,"option-label":`label`,"option-value":`value`,size:`small`,title:r(o)(`aiChat.companionEffort`),"aria-label":r(o)(`aiChat.companionEffort`),"onUpdate:modelValue":n[1]||=e=>a(`update:effort`,String(e??``))},null,8,[`model-value`,`options`,`title`,`aria-label`]),e.enabled?(B(),N(V,{key:2},[b(r(Le),{size:`small`,variant:`text`,severity:`danger`,icon:`ti ti-eye-off`,label:r(o)(`aiChat.companionDisable`),onClick:n[3]||=e=>a(`disable`)},null,8,[`label`]),b(r(Le),{class:`companion-panel__menu-btn`,size:`small`,variant:`text`,rounded:``,icon:`ti ti-dots-vertical`,title:r(o)(`aiChat.companionMore`),onClick:T},null,8,[`title`]),b(r(xe),{ref_key:`menu`,ref:w},{default:H(()=>[M(`div`,Z3,[M(`button`,{type:`button`,class:`companion-panel__menu-item`,title:r(o)(`aiChat.companionRawHint`),onClick:n[4]||=e=>h.value=!h.value},[n[8]||=M(`i`,{class:`ti ti-code`},null,-1),x(` `+U(h.value?r(o)(`aiChat.companionRawOff`):r(o)(`aiChat.companionRaw`)),1)],8,Q3),M(`button`,{type:`button`,class:`companion-panel__menu-item`,title:r(o)(`aiChat.companionRunNowHint`),disabled:ne.value||O.value,onClick:re},[M(`i`,{class:I(ne.value||O.value?`ti ti-spin ti-loader-2`:`ti ti-player-play`)},null,2),x(` `+U(r(o)(`aiChat.companionRunNow`)),1)],8,$3),M(`button`,{type:`button`,class:`companion-panel__menu-item`,title:r(o)(`aiChat.companionTestBridgeHint`),disabled:A.value,onClick:L},[M(`i`,{class:I(A.value?`ti ti-spin ti-loader-2`:`ti ti-send`)},null,2),x(` `+U(r(o)(`aiChat.companionTestBridge`)),1)],8,e6)])]),_:1},512)],64)):(B(),W(r(Le),{key:1,size:`small`,icon:`ti ti-eye`,label:r(o)(`aiChat.companionEnable`),onClick:n[2]||=e=>a(`enable`)},null,8,[`label`]))])]),g.value?(B(),N(V,{key:0},[M(`p`,t6,U(r(o)(`aiChat.companionRawNotice`,{n:_.value})),1),j.value?(B(),N(`p`,{key:0,class:I([`companion-panel__delivery`,`companion-panel__delivery--${j.value.route}`])},U(r(o)(`aiChat.companionDelivery_${j.value.route}`)),3)):G(``,!0),E.value.length?(B(),W(LR,{key:1,class:`companion-panel__messages`,messages:E.value,"is-streaming":O.value},null,8,[`messages`,`is-streaming`])):(B(),N(`p`,n6,U(O.value?r(o)(`aiChat.companionReadingNow`):r(o)(`aiChat.companionNoRunYet`)),1)),M(`div`,{class:`companion-panel__grip`,role:`separator`,title:r(o)(`aiChat.companionResize`),onPointerdown:n[5]||=he((...e)=>r(S)&&r(S)(...e),[`prevent`])},null,40,r6)],64)):G(``,!0)],6))}}),[[`__scopeId`,`data-v-25278c84`]]),a6=`runeya:terminal-font-size`;function o6(e){let{sessionId:t,agentId:n,replay:r,onError:i}=e,a=document.createElement(`div`);a.style.width=`100%`,a.style.height=`100%`;let o=new YK({cursorBlink:!0,fontFamily:`monospace`,fontSize:sq(a6,14),theme:{background:`#1a1b1e`,foreground:`#d4d4d4`,cursor:`#d4d4d4`},allowProposedApi:!1}),s=new QK;o.loadAddon(s),o.open(a);let c=e=>{yt.terminal.write.mutate({agentId:n,sessionId:t,data:e}).catch(()=>{})};o.onData(c);let l=tq(o,c),u=aq(o,a),d=lq(o),f={terminal:o,fitAddon:s,container:a,subscription:yt.terminal.onData.subscribe({agentId:n,sessionId:t,replay:r},{onData(e){d.write(e)},onError(e){i?.(e.message)}}),detachDeadKeyFix:l,detachTouchScroll:u,detachZoom:null,writer:d};return f.detachZoom=cq({terminal:o,container:a,storageKey:a6,onResize:()=>l6(f,n,t)}),f}function s6(e){e.detachDeadKeyFix?.(),e.detachTouchScroll?.(),e.detachZoom?.(),e.writer.dispose(),e.subscription?.unsubscribe(),e.terminal.dispose(),e.container.remove()}function c6(e,t){e.container.parentElement!==t&&t.appendChild(e.container)}function l6(e,t,n){if(e.container.isConnected){try{e.fitAddon.fit()}catch{return}yt.terminal.resize.mutate({agentId:t,sessionId:n,cols:e.terminal.cols,rows:e.terminal.rows}).catch(()=>{})}}var u6=`runeya.conversation-terminals`,d6=new Map;function f6(){try{let e=localStorage.getItem(u6);if(!e)return{};let t=JSON.parse(e);return t?.version!==1||typeof t.sessions!=`object`||!t.sessions?{}:t.sessions}catch{return{}}}function p6(e){try{let t={version:1,sessions:e};localStorage.setItem(u6,JSON.stringify(t))}catch{}}function m6(e,t){let n=f6();t?n[e]=t:delete n[e],p6(n)}var h6=i(null),g6=i(!1);function _6(){async function e(e,t,n){if(h6.value=null,d6.has(e))return!0;g6.value=!0;try{let r=f6()[e];if(r&&r.agentId===t){let{sessions:n}=await yt.terminal.list.query({agentId:t});if(n.some(e=>e.sessionId===r.sessionId))return d6.set(e,o6({sessionId:r.sessionId,agentId:t,replay:!0,onError:e=>{h6.value=e}})),!0}let i=await yt.terminal.create.mutate({agentId:t,...n?.projectId?{projectId:n.projectId,orgId:n.orgId??null}:{},cols:80,rows:24,title:`Chat ${e.slice(0,8)}`});return m6(e,{agentId:t,sessionId:i.sessionId}),d6.set(e,o6({sessionId:i.sessionId,agentId:t,replay:!1,onError:e=>{h6.value=e}})),!0}catch(e){return h6.value=e.message,!1}finally{g6.value=!1}}function t(e,t){let n=d6.get(e);n&&(c6(n,t),r(e),n.terminal.focus())}function n(e){return d6.get(e)?.terminal??null}function r(e){let t=d6.get(e),n=f6()[e];t&&n&&l6(t,n.agentId,n.sessionId)}async function i(e){let t=d6.get(e);t&&(s6(t),d6.delete(e));let n=f6()[e];m6(e,null),n&&await yt.terminal.destroy.mutate({agentId:n.agentId,sessionId:n.sessionId}).catch(()=>{})}return{open:e,attach:t,fit:r,destroy:i,getTerminal:n,errorMsg:h6,loading:g6}}var v6={class:`terminal-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},y6=ze(z({__name:`TerminalIcon`,setup(e){return(e,t)=>(B(),N(`svg`,v6,[...t[0]||=[M(`polyline`,{points:`4 17 10 11 4 5`},null,-1),M(`line`,{x1:`12`,y1:`19`,x2:`20`,y2:`19`},null,-1)]]))}}),[[`__scopeId`,`data-v-cb1db4b3`]]),b6={class:`conversation-terminal__header`},x6={class:`conversation-terminal__title`},S6={key:0,class:`conversation-terminal__error`},C6={key:1,class:`conversation-terminal__error`},w6=ze(z({__name:`ConversationTerminalDialog`,props:_({conversationId:{},agentId:{}},{visible:{type:Boolean,required:!0},visibleModifiers:{}}),emits:[`update:visible`],setup(e){let t=e,n=S(e,`visible`),{t:a}=He(),o=tt(),{open:c,attach:l,fit:u,destroy:d,getTerminal:f,errorMsg:p,loading:m}=_6(),h=i(null),g=s(null),_=null;async function v(){await c(t.conversationId,t.agentId,o.activeProjectId?{projectId:o.activeProjectId,orgId:o.activeOrgId}:void 0)&&h.value&&(h.value.replaceChildren(),l(t.conversationId,h.value),g.value=f(t.conversationId),_?.disconnect(),_=new ResizeObserver(()=>u(t.conversationId)),_.observe(h.value))}function y(){_?.disconnect(),_=null,g.value=null}async function w(){y(),await d(t.conversationId),n.value=!1}return C(n,e=>{e||y()}),C(()=>t.conversationId,()=>{n.value&&v()}),re(y),(e,t)=>(B(),W(r(Ne),{visible:n.value,"onUpdate:visible":t[0]||=e=>n.value=e,modal:``,maximizable:``,"dismissable-mask":``,style:{width:`70vw`,height:`70vh`},"content-class":`conversation-terminal__content`,onShow:v},{header:H(()=>[M(`div`,b6,[M(`span`,x6,[b(y6),x(` `+U(r(a)(`aiChat.terminalTitle`)),1)]),b(r(Le),{size:`small`,variant:`text`,severity:`danger`,icon:`ti ti-power`,title:r(a)(`aiChat.terminalKill`),onClick:w},null,8,[`title`])])]),default:H(()=>[r(p)?(B(),N(`div`,S6,[t[1]||=M(`i`,{class:`ti ti-alert-triangle`},null,-1),x(` `+U(r(p)),1)])):r(m)?(B(),N(`div`,C6,[...t[2]||=[M(`i`,{class:`ti ti-spin ti-loader-2`},null,-1)]])):G(``,!0),b(Aq,{terminal:g.value},null,8,[`terminal`]),M(`div`,{ref_key:`hostEl`,ref:h,class:`conversation-terminal__host`},null,512)]),_:1},8,[`visible`]))}}),[[`__scopeId`,`data-v-b1e2454e`]]);function T6(e,t){return`${e}:${t}`}function E6(e){let t=i({}),n=new Map,r=new Set,a=R(()=>{let n={};for(let r of e.value){let e=t.value[r.boardId];if(!e)continue;let i=(e.columns??[]).find(e=>e.cards.some(e=>e.id===r.cardId));i&&(n[T6(r.boardId,r.cardId)]=i.title)}return n}),o=R(()=>{let e={};for(let[n,r]of Object.entries(t.value))e[n]=r.name;return e});async function s(e){if(!r.has(e)){r.add(e);try{let n=(await It.$fetch(`/kanban/board/get`,{method:`GET`,query:{id:e}}))?.data?.board??null;if(!n)return;t.value={...t.value,[e]:n},n.organizationId&&c(n.organizationId)}catch{}finally{r.delete(e)}}}function c(e){if(n.has(e)||typeof EventSource>`u`)return;let r=new EventSource(Lt(e));r.onmessage=e=>{try{let n=JSON.parse(e.data),r=t.value[n.boardId];if(!r||n.type===`board.changed`&&n.updatedAt===r.updatedAt)return;s(n.boardId)}catch{}},n.set(e,r)}return C(e,e=>{for(let n of new Set(e.map(e=>e.boardId)))t.value[n]||s(n)},{immediate:!0,deep:!0}),u(()=>{for(let e of n.values())e.close();n.clear()}),{columnTitles:a,boardNames:o}}function D6(e,t){let{columnTitles:n,boardNames:r}=E6(R(()=>e.value&&t.value?[{boardId:e.value,cardId:t.value}]:[]));return{columnTitle:R(()=>e.value&&t.value?n.value[T6(e.value,t.value)]??``:``),boardName:R(()=>e.value?r.value[e.value]??``:``)}}var O6=i(null),k6=i(null);function A6(){function e(e){O6.value=e,k6.value=null}function t(e){k6.value=e}function n(){O6.value=null}function r(){k6.value=null}return{pendingConvId:O6,generatedCode:k6,setPendingConv:e,setGeneratedCode:t,clear:n,clearResult:r}}var j6={class:`ai-chat-page__main`},M6={key:0,class:`ai-chat-page__empty`},N6={class:`ai-chat-page__header`},P6={class:`ai-chat-page__header-left`},F6={class:`ai-chat-page__header-title`},I6=[`title`],L6={class:`ai-chat-page__title-text`},R6={class:`ai-chat-page__conv-meta`},z6={key:0,class:`ai-chat-page__runner-badge`},B6={key:1,class:`ai-chat-page__claude-thinking`,title:`Claude est en train de générer une réponse`},V6={key:2,class:`ai-chat-page__claude-idle`,title:`Le process Claude est actif (en attente de saisie)`},H6=[`title`],U6={class:`ai-chat-page__context-progress-bar`},W6={class:`ai-chat-page__context-progress-label`},G6={key:0,class:`ai-chat-page__kanban-column`},K6=[`title`],q6={class:`ai-chat-page__header-actions`},J6={class:`ai-chat-page__git-add`},Y6={class:`ai-chat-page__git-del`},X6={key:1,class:`ti ti-code`},Z6={class:`conv-menu`},Q6=[`disabled`],$6={class:`ai-chat-page__git-notice`},e8={key:0,class:`ai-chat-page__pty-debug`},t8={class:`ai-chat-page__pty-debug-header`},n8=5e3,r8=z({__name:`AiChatPage`,setup(e){let{t}=He(),n=it(),a=De(),o=lt(),s=dt(),{activeId:c,activeConversation:l,isStreaming:u,streamingConvId:d,activeContextUsage:f,contextPercent:p}=$e(o),m=i(!1);async function h(){let e=l.value;if(e&&!m.value){m.value=!0;try{await yt.chat.pty.syncTranscript.mutate({conversationId:e.id})}catch(e){a.add({severity:`warn`,summary:`Sync failed`,detail:e.message,life:4e3})}finally{m.value=!1}}}let g=R(()=>new URLSearchParams(window.location.search).has(`debugPty`)),_=i(!1),v=i(null),y=i(void 0),S=i(0);async function w(){let e=l.value;if(!e)return;let t=window.prompt(`PTY stress: bytes per second?`,`200000`);if(!t)return;let n=Number(t);try{let t=await yt.chat.pty.debugStress.mutate({sessionId:e.id,agentId:e.agentId,bytesPerSec:n,chunkSize:512,durationMs:3e4});v.value=t.spawnId,y.value=t.agentId,S.value=n,_.value=!0,a.add({severity:`info`,summary:`PTY stress started`,detail:`${n.toLocaleString()} B/s for 30s`,life:3e3})}catch(e){a.add({severity:`error`,summary:`Stress failed`,detail:e.message,life:4e3})}}function T(){_.value=!1,v.value=null}let E=R(()=>{let e=l.value;return e?e.runner??(e.isCli&&!e.providerId?`claude-code`:null):null}),D=R(()=>E.value===`claude-code`),ee=R(()=>E.value===`codex`),O=R(()=>D.value||ee.value),k=i(!1),A=i(null),j=i(Date.now()),P=null,L=R(()=>!k.value||!A.value?!1:j.value-A.value<1500);async function ne(){let e=l.value;if(!e||!D.value){k.value=!1,A.value=null;return}try{let t=await yt.chat.pty.activity.query({sessionId:e.id,agentId:e.agentId});k.value=t.running,A.value=t.idleMs===null?null:Date.now()-t.idleMs}catch{k.value=!1}}let re=Rt(ne,1e3,`ai-chat-page:activity`);function z(){re.stop(),P&&=(clearInterval(P),null),k.value=!1,A.value=null}function oe(){z(),P||=setInterval(()=>{j.value=Date.now()},500),re.start(),re.trigger()}C([()=>l.value?.id,D],([e,t])=>{e&&t?oe():z()},{immediate:!0}),te(()=>z());let se=R(()=>{let e=l.value;if(!e||e.workflowType===`scenario`)return null;let t=e.runner??(e.isCli&&!e.providerId?`claude-code`:null);if(t===`codex`)return`Codex`;if(t===`claude-code`)return`Claude Code`;if(e.providerId){let t=o.providers.find(t=>t.id===e.providerId);if(t)return t.label}return null}),ce=i(``),ue=i(!1),de=i(!1),fe=i(!1),pe=i(``),ge=i(null),_e=R(()=>l.value?.companionRunner??E.value??`claude-code`);function ve(){let e=l.value;e&&o.setCompanion(e.id,!0)}function ye(){let e=l.value;e&&o.setCompanion(e.id,!1)}function be(e){let t=l.value;if(!t)return;let n=e===`codex`?`codex`:`claude-code`,r=n===_e.value?void 0:``;o.setCompanion(t.id,!!t.companionEnabled,{runner:n,model:r})}function Se(e){let t=l.value;if(!t)return;let n=e===`low`||e===`normal`||e===`high`?e:``;o.setCompanion(t.id,!!t.companionEnabled,{effort:n})}function we(e){let t=l.value;t&&o.setCompanion(t.id,!!t.companionEnabled,{model:typeof e==`string`?e:``})}function Te(){l.value&&(pe.value=l.value.title,fe.value=!0,le(()=>ge.value?.$el?.select()))}async function Ee(){if(!l.value)return;let e=pe.value.trim();e&&await o.renameConversation(l.value.id,e),fe.value=!1}function Oe(){fe.value=!1}function ke(e){return e.messagesOmitted?(e.messageCount??0)>0:(e.messages?.length??0)>0}function Ae(e){navigator.clipboard.writeText(e),a.add({severity:`success`,summary:t(`aiChat.conversationIdCopied`),life:2e3})}let je=i(null),Me=i(null),Pe=i(null),Fe=i([]),Ie=0,Re=()=>new Date().toISOString(),ze=Rt(async()=>{let e=o.refreshStreamingSessions;typeof e==`function`?await e():await o.init()},1500,`ai-chat-page:streaming-refresh`),Be=R(()=>u.value&&d.value===c.value);function Ve(){return l.value?.workflowType===`scenario`?Me.value?.messagesEl??null:je.value?.messagesEl??null}function Ue(){let e=Ve();if(!e)return!0;let{scrollTop:t,scrollHeight:n,clientHeight:r}=e;return n-t-r<80}async function We(e=!1){if(!e&&!Ue())return;await le();let t=Ve();t&&(t.scrollTop=t.scrollHeight),t?.querySelectorAll(`.ai-chat-scenario-view__thinking-content, .ai-chat-message-list__thinking-content`).forEach(e=>{e.scrollTop=e.scrollHeight})}function Ge(){c.value=null,ue.value=!0,o.pendingNewConversation=!0,de.value=!1}function Ke(e){o.pendingNewConversation=!1,o.selectConversation(e),de.value=!1,ue.value=!1,Me.value?.resetNodeSelection()}async function qe(e){o.deleteConversation(e)}async function Je(e=`keep`,t,n){ue.value=!1,o.pendingNewConversation=!1,await o.createConversation({runner:e===`keep`?void 0:e,providerId:e===`keep`?t??void 0:void 0,agentId:n}),ce.value=``}function Ye(e,t,n,r){ue.value=!1,o.pendingNewConversation=!1,Pe.value?.showScenarioDialog(e,void 0,t,n??void 0,r)}async function Xe(e,n,r,i,s,c){try{let t=await o.createConversation({scenarioId:e,scenarioInput:n,title:n?`Scenario: ${n}`:`Scenario conversation`,providerId:s,agentId:c});if(await We(!0),n&&t){let a=r===`codex`?``:i.trim(),s=r!==`keep`||a||c?{...r===`keep`?{}:{runnerOverride:r},...a?{modelOverride:a}:{},...c?{agentId:c}:{}}:void 0;o.startScenarioRun(t.id,e,n,()=>We(!1),s)}}catch(e){a.add({severity:`error`,summary:t(`common.error`),detail:e.message,life:4e3})}}async function Ze(){let e=l.value;e&&e.workflowType===`scenario`&&await o.stopScenario(e.id)}function Qe(){Pe.value?.showResumeScenarioDialog()}async function et(e,n){let r=l.value;if(!r)return;let i=e===`keep`?void 0:e;try{await o.resumeScenario(r.id,()=>We(!1),{...i?{runnerOverride:i}:{},...n?{agentId:n}:{}})}catch(e){a.add({severity:`error`,summary:t(`common.error`),detail:e.message,life:4e3})}}async function nt(){let e=ce.value,n=ce.value.trim(),{pendingContext:r,pendingPopulateContext:i}=Ut();if(!n&&o.pendingImages.length===0&&!r.value&&!i.value||(!n&&r.value&&(n=`Voici le contexte ci-joint, aide-moi à avancer.`),!n&&i.value&&(n=i.value),!l.value&&(await Je(),!l.value)))return;let s=l.value;try{if(s.workflowType===`scenario`){if(s.scenarioRunning)return;ce.value=``,o.startScenarioRun(s.id,s.workflowId,n,()=>We(!1),s.scenarioRunOverrides),await We(!0);return}ce.value=``,i.value=null,await o.send(n,We)}catch(n){ce.value||=e,a.add({severity:`error`,summary:t(`common.error`),detail:n.message,life:3500})}}function rt(e,t){let n=null;C(d,t=>{t&&e(t)&&(n=t)}),C(u,async e=>{if(e||!n)return;let r=n;n=null,await t(r),await o.deleteConversation(r),Ut().close()})}let{columnTitle:at}=D6(R(()=>l.value?.kanbanBoardId),R(()=>l.value?.kanbanCardId));function ot(e,t){n.push(t?{name:`kanban-card`,params:{id:e,cardId:t}}:{name:`kanban-board`,params:{id:e}})}rt(e=>{let t=o.conversations.find(t=>t.id===e);return!(!t?.kanbanBoardId||t.kanbanCardId)},async()=>{});let st=A6();rt(e=>e===st.pendingConvId.value,async e=>{st.clear();let t=o.conversations.find(t=>t.id===e);if(!t)return;let n=t.messages.filter(e=>e.role===`assistant`),r=n[n.length-1];if(r?.content){let e=r.content.match(/```(?:javascript|js|typescript|ts)?\n([\s\S]+?)```/);e&&st.setGeneratedCode(e[1].trim())}}),C(()=>l.value?.id,async e=>{if(Me.value?.resetNodeSelection(),e&&l.value?.workflowType===`scenario`&&await s.fetchScenarios(),e&&D.value)try{await yt.chat.pty.syncTranscript.mutate({conversationId:e})}catch{}}),C(c,e=>{e&&(ue.value=!1),le(()=>We(!0))},{flush:`sync`});let ut=!0;C(()=>{let e=l.value?.messages;if(!e||e.length===0)return``;let t=e[e.length-1];return`${e.length}|${t?.content?.length??0}|${t?.parts?.length??0}`},()=>{ut=Ue()},{flush:`pre`}),C(()=>{let e=l.value?.messages;if(!e||e.length===0)return``;let t=e[e.length-1];return`${e.length}|${t?.content?.length??0}|${t?.parts?.length??0}`},()=>{if(!ut)return;let e=Ve();e&&(e.scrollTop=e.scrollHeight)},{flush:`post`});let{autoSendPending:ft,hideSidebar:pt}=Ut(),mt=i(!1),ht=Zt(),gt=tt(),_t=i(!1),{size:vt,isResizing:bt,start:xt}=W3({axis:`x`,min:180,max:()=>Math.min(560,window.innerWidth-320),initial:280,storageKey:`runeya.ai-chat.sidebar-width`}),St=i(null);function Ct(e){St.value?.hide(),e()}let wt=R(()=>l.value?.agentId??ht.connectedAgents[0]?.config.id??null),Tt=i(null),Et=i(!1),Dt=R(()=>{let e=l.value;if(!e)return null;let t=e.projectId&&e.projectId===gt.activeProjectId?gt.activeOrgId:void 0;return{agentId:e.agentId,projectId:e.projectId,orgId:t}}),Ot=R(()=>{let e=Dt.value?.agentId;return e?ht.getById(e)?.config.name??null:null}),kt=R(()=>Ot.value?`${t(`aiChat.viewGitChanges`)} — ${Ot.value}`:t(`aiChat.viewGitChanges`));async function At(){let e=Dt.value;if(!e){Tt.value=null,Et.value=!1;return}try{let t=await yt.git.status.query(e);Tt.value={additions:t.additions??0,deletions:t.deletions??0},Et.value=!0}catch{Tt.value=null,Et.value=!1}}C(Dt,()=>At(),{immediate:!0}),C(mt,e=>{e||At()});let jt=Rt(async()=>{document.hidden||mt.value||await At()},n8,`ai-chat-page:git-stats`);function Mt(){jt.stop()}function Nt(){Mt(),jt.start()}C(()=>l.value?.messages?.length??0,()=>{mt.value||At()}),F(()=>Nt()),te(()=>Mt());async function Pt(){ft.value&&l.value&&(O.value||(ft.value=!1,await le(),nt()))}return C([ft,l],()=>Pt()),F(async()=>{ct()&&console.time(`[ai-chat][page] mount`),ct()&&console.log(`[ai-chat][page]`,Re(),`mounted`,{drawerHideSidebar:pt.value,activeId:c.value}),o.isChatPageVisible=!0,await o.init(),o.setScrollCallback(We),s.fetchScenarios(),yt.scenario.listPresets.query().then(e=>{Fe.value=e}).catch(()=>{}),le(()=>We(!0)),Pt(),ze.start(),ct()&&console.timeEnd(`[ai-chat][page] mount`)}),ae(()=>{Ie+=1,ct()&&console.log(`[ai-chat][page]`,Re(),`updated`,{count:Ie,activeId:c.value,hasConversation:!!l.value,isStreaming:u.value,drawerHideSidebar:pt.value})}),te(()=>{ct()&&console.log(`[ai-chat][page]`,Re(),`unmounted`,{updates:Ie,activeId:c.value}),ze.stop(),o.isChatPageVisible=!1,o.setScrollCallback(()=>{})}),(e,n)=>(B(),N(V,null,[M(`div`,{class:I([`ai-chat-page`,{"ai-chat-page--no-sidebar":r(pt)}]),style:ie(r(pt)?void 0:{gridTemplateColumns:`${r(vt)}px 0 1fr`})},[r(pt)?G(``,!0):(B(),N(`div`,{key:0,class:I([`ai-chat-page__sidebar-wrap`,{"ai-chat-page__sidebar-wrap--open":de.value}])},[b(tF,{onStartNew:Ge,onSelectConversation:Ke,onDeleteConversation:qe})],2)),r(pt)?G(``,!0):(B(),N(`div`,{key:1,class:I([`ai-chat-page__resizer`,{"ai-chat-page__resizer--active":r(bt)}]),onPointerdown:n[0]||=he((...e)=>r(xt)&&r(xt)(...e),[`prevent`])},null,34)),de.value&&!r(pt)?(B(),N(`div`,{key:2,class:`ai-chat-page__backdrop`,onClick:n[1]||=e=>de.value=!1})):G(``,!0),M(`section`,j6,[ue.value||!r(l)?(B(),N(`div`,M6,[b(r(Le),{class:`ai-chat-page__menu-btn ai-chat-page__menu-btn--empty`,icon:`ti ti-menu-2`,variant:`text`,rounded:``,size:`small`,onClick:n[2]||=e=>de.value=!de.value}),b(zt,{onSelectScenario:Ye,onSkip:Je})])):(B(),N(V,{key:1},[M(`header`,N6,[M(`div`,P6,[b(r(Le),{class:`ai-chat-page__menu-btn`,icon:`ti ti-menu-2`,variant:`text`,rounded:``,size:`small`,onClick:n[3]||=e=>de.value=!de.value}),M(`div`,F6,[fe.value?(B(),W(r(Ce),{key:0,ref_key:`renameInputEl`,ref:ge,modelValue:pe.value,"onUpdate:modelValue":n[4]||=e=>pe.value=e,class:`ai-chat-page__rename-input`,size:`small`,onKeydown:[me(Ee,[`enter`]),me(Oe,[`escape`])],onBlur:Ee},null,8,[`modelValue`])):(B(),N(`h2`,{key:1,class:`ai-chat-page__title`,role:`button`,tabindex:`0`,title:r(t)(`aiChat.rename`),onClick:Te,onKeydown:me(Te,[`enter`])},[M(`span`,L6,U(r(l).title),1),n[19]||=M(`i`,{class:`ti ti-pencil ai-chat-page__title-pencil`},null,-1)],40,I6)),M(`div`,R6,[se.value?(B(),N(`span`,z6,U(se.value),1)):G(``,!0),D.value&&L.value?(B(),N(`span`,B6,[...n[20]||=[M(`i`,{class:`ti ti-spin ti-circle-filled`},null,-1),x(` Claude réfléchit… `,-1)]])):D.value&&k.value?(B(),N(`span`,V6,[...n[21]||=[M(`i`,{class:`ti ti-circle-filled`},null,-1),x(` Actif `,-1)]])):G(``,!0),r(f)?(B(),N(`div`,{key:3,class:`ai-chat-page__context-progress`,title:`Context: ${r(f).inputTokens.toLocaleString()} / ${r(f).contextWindow.toLocaleString()} tokens`},[M(`div`,U6,[M(`div`,{class:I([`ai-chat-page__context-progress-fill`,{"ai-chat-page__context-progress-fill--warn":r(p)>=70,"ai-chat-page__context-progress-fill--danger":r(p)>=90}]),style:ie({width:r(p)+`%`})},null,6)]),M(`span`,W6,U(r(p))+`%`,1)],8,H6)):G(``,!0),r(l).kanbanBoardId?(B(),N(`a`,{key:4,class:`ai-chat-page__kanban-link`,title:`Ouvrir le tableau Kanban`,onClick:n[5]||=e=>ot(r(l).kanbanBoardId,r(l).kanbanCardId)},[n[22]||=M(`i`,{class:`ti ti-table`,style:{"font-size":`0.7rem`}},null,-1),n[23]||=x(` Kanban `,-1),r(at)?(B(),N(`span`,G6,`· `+U(r(at)),1)):G(``,!0)])):G(``,!0),r(l).id?(B(),N(`span`,{key:5,class:`ai-chat-page__conv-id`,title:r(l).id,onClick:n[6]||=e=>Ae(r(l).id)},`ID: `+U(r(l).id.slice(0,8))+`…`,9,K6)):G(``,!0)])])]),M(`div`,q6,[Dt.value&&Et.value?(B(),W(r(Le),{key:0,class:`ai-chat-page__git-btn`,size:`small`,variant:`text`,title:kt.value,onClick:n[7]||=e=>mt.value=!0},{default:H(()=>[Tt.value&&(Tt.value.additions||Tt.value.deletions)?(B(),N(V,{key:0},[M(`span`,J6,`+`+U(Tt.value.additions),1),M(`span`,Y6,`-`+U(Tt.value.deletions),1)],64)):(B(),N(`i`,X6))]),_:1},8,[`title`])):G(``,!0),r(l).workflowType===`scenario`&&r(l).scenarioRunning?(B(),W(r(Le),{key:1,size:`small`,severity:`danger`,icon:`ti ti-player-stop`,label:`Stop`,onClick:Ze})):G(``,!0),g.value&&D.value?(B(),W(r(Le),{key:2,size:`small`,variant:`text`,severity:`warn`,icon:`ti ti-bolt`,title:`Debug: lance un PTY de stress (random data) sur cette session`,onClick:w})):G(``,!0),wt.value?(B(),W(r(Le),{key:3,size:`small`,variant:`text`,title:r(t)(`aiChat.openTerminal`),onClick:n[8]||=e=>_t.value=!0},{default:H(()=>[b(y6)]),_:1},8,[`title`])):G(``,!0),b(r(Le),{size:`small`,variant:`text`,icon:`ti ti-dots-vertical`,title:r(t)(`aiChat.menu`),"aria-label":r(t)(`aiChat.menu`),onClick:n[9]||=e=>St.value?.toggle(e)},null,8,[`title`,`aria-label`]),b(r(xe),{ref_key:`convMenu`,ref:St},{default:H(()=>[M(`div`,Z6,[D.value?(B(),N(`button`,{key:0,class:`conv-menu__item`,disabled:m.value,onClick:n[10]||=e=>Ct(h)},[M(`i`,{class:I(m.value?`ti ti-spin ti-loader-2`:`ti ti-refresh`)},null,2),M(`span`,null,U(r(t)(`aiChat.syncTranscript`)),1)],8,Q6)):G(``,!0),M(`button`,{class:`conv-menu__item`,onClick:n[11]||=e=>Ct(()=>r(o).pinConversation(r(l).id,r(l).pinOrder===void 0))},[M(`i`,{class:`ti ti-pin`,style:ie(r(l).pinOrder===void 0?void 0:`opacity:0.5`)},null,4),M(`span`,null,U(r(l).pinOrder===void 0?r(t)(`aiChatPage.pin`):r(t)(`aiChatPage.unpin`)),1)]),M(`button`,{class:`conv-menu__item`,onClick:n[12]||=e=>Ct(()=>r(o).archiveConversation(r(l).id,!r(l).archived))},[M(`i`,{class:`ti ti-inbox`,style:ie(r(l).archived?`opacity:0.5`:void 0)},null,4),M(`span`,null,U(r(l).archived?r(t)(`aiChatPage.unarchive`):r(t)(`aiChatPage.archive`)),1)]),M(`button`,{class:`conv-menu__item conv-menu__item--danger`,onClick:n[13]||=e=>Ct(()=>r(o).deleteConversation(r(l).id))},[n[24]||=M(`i`,{class:`ti ti-trash`},null,-1),M(`span`,null,U(r(t)(`aiChat.deleteConversation`)),1)])])]),_:1},512)])]),wt.value?(B(),W(w6,{key:0,visible:_t.value,"onUpdate:visible":n[14]||=e=>_t.value=e,"conversation-id":r(l).id,"agent-id":wt.value},null,8,[`visible`,`conversation-id`,`agent-id`])):G(``,!0),r(l).isCompanion?G(``,!0):(B(),W(i6,{key:1,enabled:!!r(l).companionEnabled,runner:_e.value,model:r(l).companionModel??``,effort:r(l).companionEffort??``,"companion-conversation-id":r(l).companionConversationId,"main-conversation-id":r(l).id,onEnable:ve,onDisable:ye,"onUpdate:runner":be,"onUpdate:model":we,"onUpdate:effort":Se},null,8,[`enabled`,`runner`,`model`,`effort`,`companion-conversation-id`,`main-conversation-id`])),r(l).workflowType===`scenario`?(B(),W(R3,{key:2,ref_key:`scenarioViewRef`,ref:Me,"available-presets":Fe.value,onClickResume:Qe},null,8,[`available-presets`])):O.value?(B(),W(Nq,{key:3,"session-id":r(l).id,runner:E.value??`claude-code`,resume:ke(r(l)),"agent-id":r(l).agentId},null,8,[`session-id`,`runner`,`resume`,`agent-id`])):(B(),W(LR,{key:4,ref_key:`messageListRef`,ref:je,messages:r(l).messages,"is-streaming":r(u),onOpenImagePreview:n[15]||=(e,t)=>Pe.value?.openImagePreview(e,t)},null,8,[`messages`,`is-streaming`])),r(l).workflowType!==`scenario`&&!O.value?(B(),W(QR,{key:5,input:ce.value,"onUpdate:input":n[16]||=e=>ce.value=e,"is-streaming":r(u),"is-streaming-current-conv":Be.value,"active-conversation-id":r(l).id,onSubmit:nt,onOpenImagePreview:n[17]||=(e,t)=>Pe.value?.openImagePreview(e,t)},null,8,[`input`,`is-streaming`,`is-streaming-current-conv`,`active-conversation-id`])):G(``,!0)],64))])],6),b(Bt,{ref_key:`modalsRef`,ref:Pe,onConfirmScenarioStart:Xe,onConfirmResumeScenario:et},null,512),b(r(Ne),{visible:mt.value,"onUpdate:visible":n[18]||=e=>mt.value=e,header:kt.value,modal:``,"dismissable-mask":``,maximizable:``,style:{width:`85vw`,height:`85vh`},"content-style":{padding:0,height:`100%`,display:`flex`,flexDirection:`column`,overflow:`hidden`}},{default:H(()=>[M(`div`,$6,[n[25]||=M(`i`,{class:`ti ti-info-circle`},null,-1),M(`span`,null,U(r(t)(`aiChat.gitChangesNotice`)),1)]),Dt.value&&mt.value?(B(),W(Vt,{key:0,"agent-id":Dt.value.agentId,"project-id":Dt.value.projectId,"org-id":Dt.value.orgId},null,8,[`agent-id`,`project-id`,`org-id`])):G(``,!0)]),_:1},8,[`visible`,`header`]),_.value&&v.value?(B(),N(`div`,e8,[M(`div`,t8,[n[26]||=M(`i`,{class:`ti ti-bolt`},null,-1),M(`span`,null,`PTY stress · `+U(S.value.toLocaleString())+` B/s`,1),M(`button`,{type:`button`,class:`ai-chat-page__pty-debug-close`,onClick:T},`×`)]),(B(),W(Nq,{key:v.value,"attach-spawn-id":v.value,"agent-id":y.value,resume:!1},null,8,[`attach-spawn-id`,`agent-id`]))])):G(``,!0)],64))}}),i8=t({default:()=>a8}),a8=ze(r8,[[`__scopeId`,`data-v-98d2d826`]]),o8={scenario_waiting_input:!0,ai_conversation_complete:!0,ai_conversation_error:!0,service_error_log:!0,service_status_changed:!0,service_health_changed:!0,service_error_log_excluded:[],service_status_changed_excluded:[],service_health_changed_excluded:[]},s8=new Set([`service_error_log_excluded`,`service_status_changed_excluded`,`service_health_changed_excluded`]),c8=0,l8=500,u8=80,d8=new Set(Object.keys(o8));function f8(e){if(!e)return;let t=e.trim();if(t&&t.startsWith(`/`)&&!t.startsWith(`//`))try{let e=new URL(t,window.location.origin);return e.origin===window.location.origin?`${e.pathname}${e.search}${e.hash}`:void 0}catch{return}}function p8(e,t){let n=e.trim();return n.length>t?`${n.slice(0,t-3)}...`:n}function m8(e){let t={};for(let[n,r]of Object.entries(e)){let e=n;if(d8.has(e)){if(s8.has(e)){if(!Array.isArray(r))continue;t[e]=r.filter(e=>typeof e==`string`&&e.length<=100).slice(0,500)}else{if(typeof r!=`boolean`)continue;t[e]=r}}}return t}var h8=et(`notification`,()=>{let e=i([]),t=i({...o8}),n=i(!1),r=R(()=>e.value.filter(e=>!e.read).length),a=R(()=>Object.entries(t.value).filter(([,e])=>e).map(([e])=>e));function o(e){return t.value[e]}function s(e,n){if(!t.value[e])return!1;let r=`${e}_excluded`;return!t.value[r]?.includes(n)}function c(e,n,r){let i=`${e}_excluded`,a=t.value[i]??[],o=r?[...new Set([...a,n])]:a.filter(e=>e!==n);return h({[i]:o})}function l(t){if(!o(t.category)||t.serviceId&&!s(t.category,t.serviceId))return;let n=f8(t.link);c8++,e.value=[{id:`notif-${c8}`,type:t.type,category:t.category,title:p8(t.title,l8),message:p8(t.message,l8),link:n,linkLabel:t.linkLabel?p8(t.linkLabel,u8):void 0,timestamp:Date.now(),read:!1},...e.value]}function u(t){e.value=e.value.map(e=>e.id===t?{...e,read:!0}:e)}function d(){e.value=e.value.map(e=>({...e,read:!0}))}function f(t){e.value=e.value.filter(e=>e.id!==t)}function p(){e.value=[]}async function m(){if(!n.value){n.value=!0;try{let e=await yt.settings.getNotificationPreferences.query(Wt());t.value={...o8,...e}}finally{n.value=!1}}}async function h(e){let r=m8(e);if(Object.keys(r).length===0)return t.value;n.value=!0;try{let e=await yt.settings.updateNotificationPreferences.mutate({...r,...Wt()});return t.value={...o8,...e},t.value}finally{n.value=!1}}return{notifications:e,unreadCount:r,preferences:t,enabledCategories:a,preferencesLoading:n,isCategoryEnabled:o,isServiceEnabled:s,setServiceExcluded:c,add:l,markRead:u,markAllRead:d,remove:f,clear:p,loadPreferences:m,updatePreferences:h}}),g8=t({useProcessStore:()=>C8}),_8=5,v8=qt,y8=5e3,b8=`runeya:ws-debug`;function x8(){try{return localStorage.getItem(b8)===`1`}catch{return!1}}function S8(...e){x8()&&console.log(`[process.store][ws]`,new Date().toISOString(),...e)}var C8=et(`process`,()=>{let e=i([]),t=i(!1),n=i(null),r=i({}),a=null,o=0,s=null,c=null,l=new Map,u=new Map,d=new Map,f=new Map,p=R(()=>e.value.length),m=R(()=>e.value.filter(e=>e.state===`running`)),h=R(()=>(t,n)=>e.value.find(e=>e.agentId===t&&e.id===n)??null),g=R(()=>t=>e.value.filter(e=>e.serviceId===t));function _(e,t){return`${e}::${t}`}function v(e,t){return`/process/${e}/${t}`}function y(e){return Xt().getById(e)?.name??e}function b(e,t){if(e.state===t.state)return;let n=h8(),r=y(t.serviceId),i=t.state===`errored`;n.add({type:i?`error`:`info`,category:`service_status_changed`,title:i?`Service errored`:`Service status changed`,message:`${r}: ${e.state} -> ${t.state}`,link:v(t.agentId,t.id),linkLabel:`Open ${r}`,serviceId:t.serviceId})}function x(e,t){if(e.healthStatus===t.healthStatus)return;let n=h8(),r=y(t.serviceId),i=t.healthStatus===`unhealthy`?`warn`:t.healthStatus===`healthy`?`success`:`info`;n.add({type:i,category:`service_health_changed`,title:`Service health changed`,message:`${r}: ${e.healthStatus} -> ${t.healthStatus}`,link:v(t.agentId,t.id),linkLabel:`Open ${r}`,serviceId:t.serviceId})}function S(e){let t=f.get(e);if(!t||t.size<=400)return;let n=Array.from(t).slice(-200);f.set(e,new Set(n))}function C(e,t){let n=_(e.agentId,e.id),r=Date.now();if(r-(d.get(n)??0)<y8)return;let i=f.get(n)??new Set;if(i.has(t.id))return;i.add(t.id),f.set(n,i),S(n),d.set(n,r);let a=h8(),o=y(e.serviceId),s=t.message.length>180?`${t.message.slice(0,177)}...`:t.message;a.add({type:`error`,category:`service_error_log`,title:`Error log on ${o}`,message:s,link:v(e.agentId,e.id),linkLabel:`Open ${o}`,serviceId:e.serviceId})}function w(e){let t=u.get(e);t&&(t.unsubscribe(),u.delete(e),d.delete(e),f.delete(e))}function T(){let t=new Set(e.value.filter(e=>e.state===`running`||e.state===`starting`).map(e=>_(e.agentId,e.id)));for(let e of Array.from(u.keys()))t.has(e)||w(e);for(let t of e.value){if(t.state!==`running`&&t.state!==`starting`)continue;let n=_(t.agentId,t.id);if(u.has(n))continue;let r=yt.process.onLog.subscribe({agentId:t.agentId,processId:t.id},{onData(n){let r=n,i=e.value.find(e=>e.id===t.id&&e.agentId===t.agentId);if(i)for(let e of r)(e.level===`error`||e.level===`fatal`)&&C(i,e)},onError(){w(n)}});u.set(n,r)}}function E(t){let n=e.value.find(e=>e.id===t.id&&e.agentId===t.agentId),i=e.value.findIndex(e=>e.id===t.id&&e.agentId===t.agentId);if(i>=0){let n=[...e.value];n[i]=t,e.value=n}else e.value=[...e.value,t];r.value={...r.value,[_(t.agentId,t.id)]:Date.now()},n&&(b(n,t),x(n,t)),T()}function D(e,t){let n=_(e.agentId,e.id),i=l.get(n);i&&(clearTimeout(i),l.delete(n));let a=setTimeout(()=>{l.delete(n),(r.value[n]??0)<=t&&E(e)},900);l.set(n,a)}function ee(){S8(`subscribeStatus()`),a=yt.process.onStatus.subscribe({},{onData(e){o=0,S8(`onStatus data`,{id:e.id,agentId:e.agentId,state:e.state}),E(e)},onError(e){a=null,console.error(`[process.store] Status subscription error:`,e.message),S8(`onStatus error`,e.message,{retryCount:o}),O()}})}function O(){if(o>=_8){console.warn(`[process.store] Max retries (${_8}) reached for status subscription`),S8(`scheduleRetry max reached`,{retryCount:o});return}let e=v8*2**o+Math.random()*300;S8(`scheduleRetry`,{retryCount:o,delay:e}),o++,s=setTimeout(()=>{s=null,S8(`retry timer fired`),ee()},e)}function k(e=!1){S8(`startStatusStream()`,{force:e,hasSub:!!a,hasRetryTimer:!!s}),c||=_t(()=>{S8(`onWsReopen — forcing status stream restart`),o=0,k(!0)}),s&&(clearTimeout(s),s=null,S8(`cleared pending retry timer`)),e&&a&&(a.unsubscribe(),a=null,S8(`forced unsubscribe existing statusSub`)),!a&&(o=0,ee())}function A(){S8(`stopStatusStream()`),c&&=(c(),null),l.forEach(e=>clearTimeout(e)),l.clear(),s&&=(clearTimeout(s),null),a&&=(a.unsubscribe(),null);for(let e of Array.from(u.keys()))w(e);o=0}async function j(){t.value=!0,n.value=null;try{e.value=await yt.process.list.query(),T()}catch(e){n.value=Pt(e)??`Failed to fetch processes`}finally{t.value=!1}}async function M(e,t){n.value=null;try{let n=Date.now(),r=await yt.process.start.mutate({agentId:e,processId:t});D(r,n);let i=tt();return i.activeProjectId&&r.serviceId&&i.addServiceToSelection({id:i.activeProjectId,orgId:i.activeOrgId},r.serviceId),r}catch(e){throw fP().openFromError(e)||(n.value=Pt(e)??`Failed to start process`),e}}async function N(e,t){n.value=null;try{let n=Date.now(),r=await yt.process.stop.mutate({agentId:e,processId:t});D(r,n);let i=tt();return i.activeProjectId&&r.serviceId&&i.removeServiceFromSelection({id:i.activeProjectId,orgId:i.activeOrgId},r.serviceId),r}catch(e){throw n.value=Pt(e)??`Failed to stop process`,e}}async function P(e,t){n.value=null;try{let n=Date.now(),r=await yt.process.restart.mutate({agentId:e,processId:t});return D(r,n),r}catch(e){throw fP().openFromError(e)||(n.value=Pt(e)??`Failed to restart process`),e}}return{processes:e,loading:t,error:n,processCount:p,runningProcesses:m,getById:h,getByService:g,fetchAll:j,start:M,stop:N,restart:P,startStatusStream:k,stopStatusStream:A}});async function w8(e){e.initTrpcWs(),await e.loadPreferences().catch(()=>{}),e.startStatusStream(),e.startDataStream()}var T8=null;function E8(){T8||=yt.project.onDataChanged.subscribe(void 0,{onData({collections:e}){if(e.includes(`projects`)&&Dt().fetchAll(),e.includes(`services`)&&Xt().fetchAll(),e.includes(`environments`)){let e=Ot(),t=e.currentProjectId;t&&e.fetchAll(t,!0)}},onError(){T8=null}})}function D8(){T8?.unsubscribe(),T8=null}var O8={class:`app-root`},k8={class:`app-root__view`},A8=[`title`],j8={key:0,class:`disconnected-overlay`},M8={class:`disconnected-box`},N8={class:`disconnected-title`},P8={class:`disconnected-subtitle`},F8=5e3,I8=ze(z({__name:`App`,setup(e){let{missing:t,visible:n,checkEnvironment:i}=fP(),a={"runeya:locale":Kt([`fr`,`en`]),"runeya-dark-mode":Kt([`0`,`1`]),"runeya-theme-color":Kt([`slate`,`orange`,`amber`,`emerald`,`teal`,`sky`,`blue`,`violet`,`pink`,`custom`]),"runeya-theme-gradient":Kt([`0`,`1`]),"runeya:mode":Kt([`local-simple`,`cloud`]),"runeya:cloudUrl":Gt().url().max(2048),"runeya:ai-chat-model":Gt().max(200),"runeya:ai-chat-effort":Kt([`low`,`medium`,`high`]),[Wn(`app`)]:Gt().max(32),[Wn(`cloud`)]:Gt().max(32)},o=[`runeya-mode`,`runeya-cloud-url`,`runeya-setup-complete`,`runeya-theme-preset`];function s(){for(let e of o)localStorage.removeItem(e);for(let[e,t]of Object.entries(a)){let n=localStorage.getItem(e);n!==null&&(t.safeParse(n).success||(console.warn(`[localStorage] Invalid value for "${e}", clearing:`,n),localStorage.removeItem(e)))}}s();let{t:c}=He(),l=De(),u=it(),d=On();async function f(){await d.check();let{status:e,current:t,latest:n}=d;e.value===`outdated`&&n.value&&l.add({severity:`warn`,summary:c(`settingsPage.updateAvailable`),detail:c(`settingsPage.updateAvailableDetail`,{current:t.value,latest:n.value}),life:8e3})}let p=C8(),h=h8(),{state:g}=vt(),{isOpen:_,isExpanded:v,toggle:y,close:x}=Ut(),S=()=>new Date().toISOString();function w(){ct()&&console.log(`[ai-chat][drawer]`,S(),`show`,{expanded:v.value,route:u.currentRoute.value.fullPath})}function T(){ct()&&console.log(`[ai-chat][drawer]`,S(),`hide`,{expanded:v.value,route:u.currentRoute.value.fullPath})}function E(e){e.ctrlKey&&e.shiftKey&&e.code===`Space`&&e.preventDefault()}function D(e){e.ctrlKey&&e.shiftKey&&e.code===`Space`&&y()}let ee=new Set([`unlock`,`setup`]),O=R(()=>ee.has(u.currentRoute.value.name)),{lockedProjectId:k}=ft(),A=R(()=>!k.value&&!O.value&&u.currentRoute.value.name!==`migrate-vault`),j=tt();function P(e){return e===`launch-services`?`launch-services:${j.activeOrgId??`local`}:${j.activeProjectId}`:void 0}let L=!1,ne=null;C(g,(e,t)=>{if(e!==`connected`){ne===null&&(ne=Date.now());return}let n=ne===null?0:Date.now()-ne;if(ne=null,!L){L=!0;return}t!==`connected`&&!O.value&&n>=F8&&window.location.reload()}),F(()=>{window.addEventListener(`keydown`,E),window.addEventListener(`keyup`,D),f(),!O.value&&Ct()&&w8({loadPreferences:()=>h.loadPreferences(),initTrpcWs:bt,startStatusStream:()=>p.startStatusStream(),startDataStream:()=>E8()})}),te(()=>{p.stopStatusStream(),D8(),window.removeEventListener(`keydown`,E),window.removeEventListener(`keyup`,D)}),C(()=>u.currentRoute.value.name,(e,t)=>{let n=ee.has(t??``),r=ee.has(e??``);n&&!r&&Ct()&&w8({loadPreferences:()=>h.loadPreferences(),initTrpcWs:bt,startStatusStream:()=>p.startStatusStream(),startDataStream:()=>E8()})});let re=Dt();return C(()=>re.currentProject?.name,e=>{document.title=e?`${e} · Runeya`:`Runeya`},{immediate:!0}),C(()=>`${re.currentProject?.id??``}::${re.currentProject?.activeEnvironmentId??``}`,()=>{let e=re.currentProject?.activeEnvironmentId;e&&i(e)},{immediate:!0}),(e,i)=>(B(),N(V,null,[b(r(Te)),b(r(be)),b(XN,{visible:r(n),"onUpdate:visible":i[0]||=e=>m(n)?n.value=e:null,missing:r(t)},null,8,[`visible`,`missing`]),A.value?(B(),W(cP,{key:0})):G(``,!0),M(`div`,O8,[b(Hn),b(nr),M(`div`,k8,[b(bn,null,{default:H(()=>[b(r(ot),null,{default:H(({Component:e,route:t})=>[(B(),W(de(e),{key:P(t.name)}))]),_:1})]),_:1})])]),b(r(We),{visible:r(_),"onUpdate:visible":i[2]||=e=>m(_)?_.value=e:null,position:`right`,"show-close-icon":!1,onShow:w,onHide:T,header:r(c)(`drawer.aiChatTitle`),"show-header":!1,class:`ai-chat-drawer`,style:ie({width:r(v)?`calc(100vw - 70px)`:`560px`})},{default:H(()=>[M(`button`,{class:`ai-drawer-expand-btn`,title:r(v)?r(c)(`drawer.collapse`):r(c)(`drawer.expand`),onClick:i[1]||=e=>v.value=!r(v)},[M(`i`,{class:I([`ti`,r(v)?`ti-chevron-right`:`ti-chevron-left`])},null,2)],8,A8),b(a8)]),_:1},8,[`visible`,`header`,`style`]),b(ve,{name:`overlay`},{default:H(()=>[r(g)!==`connected`&&!O.value?(B(),N(`div`,j8,[M(`div`,M8,[i[3]||=M(`i`,{class:`ti ti-cloud-off disconnected-icon`},null,-1),M(`h1`,N8,U(r(c)(`connection.unreachable`)),1),M(`p`,P8,U(r(c)(`connection.reconnecting`)),1),i[4]||=M(`i`,{class:`ti ti-spin ti-loader-2 disconnected-spinner`},null,-1)])])):G(``,!0)]),_:1})],64))}}),[[`__scopeId`,`data-v-4f9d37e5`]]),L8=t({router:()=>R8}),R8=st({history:at(),routes:[{path:`/unlock`,name:`unlock`,component:()=>xt(()=>import(`./UnlockPage-17EgfpJs.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))},{path:`/migrate-vault`,name:`migrate-vault`,component:()=>xt(()=>import(`./VaultMigrationPage-DeMxpXXJ.js`),__vite__mapDeps([14,1,2,3,4,5,6,7,10,9,15,16]))},{path:`/launch/project`,name:`launch-project`,component:()=>xt(()=>import(`./LaunchProjectPage-BVs1JwbV.js`),__vite__mapDeps([17,1,2,4,5,3,6,18,8,9,10,7,19,15,20,21,22,23,24,25,26,27,28,29,30,11,12,31,32]))},{path:`/launch/services`,name:`launch-services`,component:()=>xt(()=>import(`./LaunchServicesPage-PBYJly9N.js`),__vite__mapDeps([33,1,2,4,5,3,6,18,8,9,10,7,34,19,15,35,36,37,38,39,40,26,27,30,11,12,31,41]))},{path:`/`,component:()=>xt(()=>import(`./AppLayout-BTg2CADo.js`),__vite__mapDeps([42,1,2,3,4,5,6,18,8,9,10,43,7,44,34,19,15,21,20,22,23,45,46,47,48,37,38,35,36,39,49,50,51,52,53,54,55,56,57,58,59,60,24,25,28,26,27,29,61,62,40,63])),children:[{path:``,name:`dashboard`,component:()=>xt(()=>import(`./DashboardPage-CRntTMKY.js`),__vite__mapDeps([64,1,2,3,4,5,6,18,8,9,10,7,34,19,15,22,35,36,37,38,39,58,59,26,27,28,21,20,23,24,25,29,61,62,65])),meta:{titleKey:`dashboard.title`}},{path:`cloud`,name:`cloud-account`,component:()=>xt(()=>import(`./CloudAccountPage-CHL61gLe.js`).then(e=>e.n),__vite__mapDeps([66,5,1,2,4,3,6,8,9,10,19,18,15,21,22,23,46,24,25,67]))},{path:`cloud/messaging`,name:`cloud-messaging`,component:()=>xt(()=>import(`./CloudMessagingPage-cgKnABPH.js`),__vite__mapDeps([68,1,2,4,5,3,6,7,69,18,8,9,10,43,19,15,46,48,70,37,38,35,71,21,22,23,72,73,74,75,76,77,36,78,51,45,52,49,50,79,80,81])),meta:{titleKey:`cloudMessaging.title`}},{path:`agents`,name:`agents`,redirect:{path:`/settings`,query:{section:`agents`}}},{path:`kanban`,name:`kanban-list`,component:()=>xt(()=>import(`./KanbanListPage-B0jlfKqs.js`),__vite__mapDeps([82,1,2,3,4,5,6,7,19,18,8,9,10,15,21,23,45,50,53,79,80,22,83,84,85])),meta:{titleKey:`kanban.list.title`}},{path:`issues`,name:`issues-list`,component:()=>xt(()=>import(`./KanbanListPage-B0jlfKqs.js`),__vite__mapDeps([82,1,2,3,4,5,6,7,19,18,8,9,10,15,21,23,45,50,53,79,80,22,83,84,85])),props:{mode:`list`},meta:{titleKey:`kanban.issues.title`}},{path:`kanban/:id`,name:`kanban-board`,component:()=>xt(()=>import(`./KanbanBoardPage-BZHbEj-q.js`),__vite__mapDeps([86,1,2,3,4,5,6,18,8,9,10,7,69,43,19,15,46,48,70,37,38,35,71,21,23,45,72,73,74,75,76,77,36,78,50,79,80,22,83,84,87,51,52,88])),props:!0,meta:{pageKey:`kanban-board`}},{path:`kanban/:id/card/:cardId`,name:`kanban-card`,component:()=>xt(()=>import(`./KanbanBoardPage-BZHbEj-q.js`),__vite__mapDeps([86,1,2,3,4,5,6,18,8,9,10,7,69,43,19,15,46,48,70,37,38,35,71,21,23,45,72,73,74,75,76,77,36,78,50,79,80,22,83,84,87,51,52,88])),props:!0,meta:{pageKey:`kanban-board`}},{path:`issues/:id`,name:`issues-board`,component:()=>xt(()=>import(`./KanbanBoardPage-BZHbEj-q.js`),__vite__mapDeps([86,1,2,3,4,5,6,18,8,9,10,7,69,43,19,15,46,48,70,37,38,35,71,21,23,45,72,73,74,75,76,77,36,78,50,79,80,22,83,84,87,51,52,88])),props:!0,meta:{pageKey:`kanban-board`}},{path:`issues/:id/card/:cardId`,name:`issues-card`,component:()=>xt(()=>import(`./KanbanBoardPage-BZHbEj-q.js`),__vite__mapDeps([86,1,2,3,4,5,6,18,8,9,10,7,69,43,19,15,46,48,70,37,38,35,71,21,23,45,72,73,74,75,76,77,36,78,50,79,80,22,83,84,87,51,52,88])),props:!0,meta:{pageKey:`kanban-board`}},{path:`agent-terminal`,name:`agent-terminal`,component:()=>xt(()=>import(`./AgentTerminalPage-BTH3yCS2.js`),__vite__mapDeps([89,1,2,3,4,5,6,18,8,9,10,36,15,37,38,90,91]))},{path:`audit`,name:`audit`,component:()=>xt(()=>import(`./AuditPage-2PKKGLZs.js`),__vite__mapDeps([92,1,2,4,5,3,6,8,9,10,93]))},{path:`settings`,name:`settings`,component:()=>xt(()=>import(`./SettingsPage-BSSHxxjM.js`).then(e=>e.t),__vite__mapDeps([94,5,1,2,3,4,6,18,8,9,10,7,69,43,19,15,46,48,70,37,38,35,71,22,23,45,72,73,74,75,76,77,36,78,47,54,55,24,25,66,21,67,95,96,97,80,87,51,52,98,99,100,101,102,103])),meta:{titleKey:`settingsPage.title`}},{path:`api-keys`,name:`api-keys`,redirect:{path:`/settings`,query:{section:`api-keys`}}},{path:`api-docs`,name:`api-docs`,redirect:{path:`/settings`,query:{section:`api-docs`}}},{path:`ai-chat`,name:`ai-chat`,component:()=>xt(()=>Promise.resolve().then(()=>i8),void 0)},{path:`scenario/new`,name:`scenario-new`,component:()=>xt(()=>import(`./ScenarioEditorPage-DFVsMVu5.js`),__vite__mapDeps([104,1,2,3,4,5,6,18,8,9,10,7,69,43,19,15,46,48,70,37,38,35,71,90,105]))},{path:`scenario/:id/edit`,name:`scenario-edit`,component:()=>xt(()=>import(`./ScenarioEditorPage-DFVsMVu5.js`),__vite__mapDeps([104,1,2,3,4,5,6,18,8,9,10,7,69,43,19,15,46,48,70,37,38,35,71,90,105])),props:!0},{path:`services/new`,name:`service-create`,component:()=>xt(()=>import(`./ServiceFormPage-RliAfS3_.js`),__vite__mapDeps([106,1,2,3,4,5,6,18,8,9,10,7,19,15,35,36,37,38,107]))},{path:`services/:id/edit`,name:`service-edit`,component:()=>xt(()=>import(`./ServiceFormPage-RliAfS3_.js`),__vite__mapDeps([106,1,2,3,4,5,6,18,8,9,10,7,19,15,35,36,37,38,107])),props:!0},{path:`services/:id/:tab?`,name:`service-detail`,component:()=>xt(()=>import(`./ServiceDetailPage-DGIXgHwR.js`),__vite__mapDeps([108,1,2,3,4,5,6,18,8,9,10,7,44,19,15,72,69,43,46,48,70,37,38,35,71,73,74,75,76,77,36,78,109,47,110,39,57,58,59,60,90,111,56,95,96,112,113,114,97,80,22,87,23,51,45,52,98,99,115,116,117]))},{path:`projects`,name:`projects`,redirect:{name:`dashboard`}},{path:`projects/:projectId`,name:`project-detail`,beforeEnter:async e=>{let{useProjectLaunchStore:t}=await xt(async()=>{let{useProjectLaunchStore:e}=await import(`./project-launch.store-B5nhdGdh.js`).then(e=>e.t);return{useProjectLaunchStore:e}},__vite__mapDeps([18,5,1,2,8,9,10])),{useProjectStore:n}=await xt(async()=>{let{useProjectStore:e}=await import(`./project.store-Bm2JWNbd.js`).then(e=>e.t);return{useProjectStore:e}},__vite__mapDeps([19,5,1,2,18,8,9,10,15])),r=t(),i=n(),a=e.params.projectId,o=i.getById(a);return o?r.setActiveProject(o.id,o.orgId??null):r.setActiveProject(a),{name:`dashboard`}}},{path:`projects/:projectId/environments`,name:`environments`,component:()=>xt(()=>import(`./EnvironmentListPage-Dw9ziaI8.js`),__vite__mapDeps([118,1,2,3,4,5,6,18,8,9,10,7,19,15,53,119,36,37,38,111,35,56,90,95,96,112,120,121])),meta:{titleKey:`environmentList.title`}},{path:`projects/:projectId/environments/:id/edit`,name:`environment-edit`,component:()=>xt(()=>import(`./EnvironmentFormPage-ChorAd63.js`),__vite__mapDeps([122,1,2,4,5,3,6,7,19,18,8,9,10,15,119,36,37,38,111,35,56,90,95,96,112,120,123])),meta:{titleKey:`environmentFormPage.editTitle`,backTo:`environments`}},{path:`process/:agentId/:processId`,name:`process-detail`,component:()=>xt(()=>import(`./ProcessDetailPage-BZ9kIQqn.js`),__vite__mapDeps([124,1,2,4,5,3,6,7,8,9,10,36,18,15,37,38,58,59,113,114,97,69,43,19,46,48,70,35,71,72,73,74,75,76,77,78,80,22,87,23,51,45,52,98,125])),props:!0},{path:`wiki`,name:`wiki-global`,component:()=>xt(()=>import(`./WikiPage-GtwpJPqf.js`),__vite__mapDeps([126,2,1,115,3,4,5,6,7,8,9,10,116]))},{path:`dev/random-job-test`,name:`dev-random-job-test`,component:()=>xt(()=>import(`./RandomJobTestPage-BFNC827R.js`),__vite__mapDeps([127,1,2,4,5,3,6,8,9,10,128]))}]}]}),z8=new Set([`launch-project`,`launch-services`]),B8=!1,V8=!1,H8=!1;async function U8(){if(H8)return!1;H8=!0;let e=tt();try{let t=await yt.process.list.query(),n=Qt(t);if(n.size===0)return!1;let r=await yt.project.list.query(),i=null,a=0;for(let e of r){let t=e.serviceIds.filter(e=>n.has(e)).length;t>a&&(a=t,i=e)}return i?(e.setActiveProject(i.id,i.orgId??null),e.completeLaunch(),!0):!1}catch(e){return console.error(`[router] Failed to detect running services:`,e),!1}}var W8=null;async function G8(e){if(W8!==null)return W8;try{let t=(await yt.project.list.query()).find(t=>t.id===e);W8=t?{id:t.id,orgId:t.orgId??null}:!1,t||console.warn(`[router] Projet ${e} (--project) introuvable : liste des projets affichée.`)}catch(e){return console.error(`[router] Failed to resolve locked project:`,e),!1}return W8}async function K8(e){let t=mt();if(!t)return;let n=await G8(t);if(!n)return;let r=tt();if((r.activeProjectId!==n.id||r.activeOrgId!==n.orgId)&&(r.setActiveProject(n.id,n.orgId),r.launchCompleted=!1,e.name!==`launch-services`)||e.name===`launch-project`)return{name:`launch-services`,replace:!0};let i=e.params.projectId;if(typeof i==`string`&&i!==n.id)return{name:`dashboard`,replace:!0}}R8.beforeEach(async e=>{if(e.name===`unlock`)return;if(!B8){B8=!0;try{let t=await wt();if(St(t.ciMode===!0),t.state!==`unlocked`||!t.ciMode&&!Tt())return{name:`unlock`,replace:!0};if(t.legacyVault&&e.name!==`migrate-vault`)return{name:`migrate-vault`,replace:!0}}catch{return{name:`unlock`,replace:!0}}}if(!Tt())try{let e=await wt();if(St(e.ciMode===!0),e.state!==`unlocked`||!e.ciMode)return{name:`unlock`,replace:!0}}catch{return{name:`unlock`,replace:!0}}if(e.name===`migrate-vault`)return;await gt();let t=await K8(e);if(t)return t;if(z8.has(e.name))return;let n=tt();if(!n.launchCompleted&&!n.activeProjectId&&!await U8())return{name:`launch-project`};if(!V8&&n.activeProjectId){V8=!0;try{if(!(await yt.project.list.query()).some(e=>e.id===n.activeProjectId&&(e.orgId??null)===n.activeOrgId))return n.resetLaunch(),{name:`launch-project`}}catch(e){return console.error(`[router] Failed to validate current project:`,e),n.resetLaunch(),{name:`launch-project`}}}});var q8={class:`trigger-blob`},J8={class:`theme-layer`},Y8={class:`theme-picker`},X8={class:`theme-section theme-section--row`},Z8={class:`section-label`},Q8={class:`theme-section theme-section--row`},$8={class:`section-label`},e5={class:`theme-section`},t5={class:`section-label`},n5={class:`swatches`},r5=[`title`,`aria-label`,`aria-pressed`,`onClick`],i5={class:`custom-hue-header`},a5={class:`section-label`},o5={class:`custom-hue-track-wrap`},s5=`#18181b`,c5=`#f8fafc`,l5=ze(z({__name:`ThemePicker`,setup(e){let t=dn.map(e=>({id:e,label:e[0].toUpperCase()+e.slice(1)}));function n(e){let t=nn(e);return[t[700],t[500],t[300],t[100]]}function a(e){let t=Number.parseInt(e.slice(1,3),16)/255,n=Number.parseInt(e.slice(3,5),16)/255,r=Number.parseInt(e.slice(5,7),16)/255,i=Math.max(t,n,r),a=Math.min(t,n,r);if(i===a)return 0;let o=i-a,s=0;return s=i===t?((n-r)/o+(n<r?6:0))/6:i===n?((r-t)/o+2)/6:((t-n)/o+4)/6,Math.round(s*360)}let o=localStorage.getItem(`runeya-theme-color`)??`emerald`,s=localStorage.getItem(`runeya-theme-custom`)??`#10b981`,c=localStorage.getItem(`runeya-dark-mode`)===`1`,l=localStorage.getItem(`runeya-theme-gradient`)===`1`,u=i(o),d=i(s),f=i(a(s)),p=i(c),m=i(l),{t:h}=He(),g=R(()=>{if(u.value===`custom`)return d.value;let e=t.find(e=>e.id===u.value)??t[3];return tn[e.id][500]}),_=R(()=>n(g.value));function v(e){m.value=e,localStorage.setItem(`runeya-theme-gradient`,e?`1`:`0`),ln(e)}function y(e){u.value=e,localStorage.setItem(`runeya-theme-color`,e),rn(e,p.value,d.value)}function S(e){p.value=e,localStorage.setItem(`runeya-dark-mode`,e?`1`:`0`),rn(u.value,e,d.value)}function w(e){let t=e?.[0];t!==void 0&&(f.value=t,d.value=cn(t),localStorage.setItem(`runeya-theme-custom`,d.value),u.value=on,localStorage.setItem(`runeya-theme-color`,on),rn(on,p.value,d.value))}return C(d,e=>{/^#[0-9a-f]{6}$/i.test(e)&&(f.value=a(e))}),(e,i)=>(B(),W(r(Ue),null,{default:H(()=>[b(r(gn),{class:`theme-trigger`,title:r(h)(`themePicker.title`),"aria-label":r(h)(`themePicker.title`)},{default:H(()=>[M(`span`,q8,[(B(!0),N(V,null,P(_.value,(e,t)=>(B(),N(`span`,{key:t,class:`rad`,style:ie({backgroundColor:e})},null,4))),128))])]),_:1},8,[`title`,`aria-label`]),(B(),W(ue,{to:`body`},[M(`div`,J8,[b(r(Xe),{class:`theme-popover`,side:`bottom`,align:`end`,"side-offset":6,"collision-padding":8},{default:H(()=>[M(`div`,Y8,[M(`div`,X8,[M(`span`,Z8,U(r(h)(`themePicker.gradient`)),1),b(r(Re),{class:`gradient-toggle`,"model-value":m.value,"aria-label":m.value?r(h)(`themePicker.disableGradient`):r(h)(`themePicker.enableGradient`),"onUpdate:modelValue":v},{default:H(()=>[b(r(ye),{class:`gradient-toggle__thumb`})]),_:1},8,[`model-value`,`aria-label`])]),i[3]||=M(`div`,{class:`theme-divider`},null,-1),M(`div`,Q8,[M(`span`,$8,U(r(h)(`themePicker.mode`)),1),b(r(Oe),{type:`single`,class:`mode-toggle`,"model-value":p.value?`dark`:`light`,"aria-label":r(h)(`themePicker.mode`),"onUpdate:modelValue":i[0]||=e=>e&&S(e===`dark`)},{default:H(()=>[b(r(Me),{value:`dark`,class:`mode-btn`},{default:H(()=>[i[1]||=M(`i`,{class:`ti ti-moon`,"aria-hidden":`true`},null,-1),x(` `+U(r(h)(`themePicker.dark`)),1)]),_:1}),b(r(Me),{value:`light`,class:`mode-btn`},{default:H(()=>[i[2]||=M(`i`,{class:`ti ti-sun`,"aria-hidden":`true`},null,-1),x(` `+U(r(h)(`themePicker.light`)),1)]),_:1})]),_:1},8,[`model-value`,`aria-label`])]),i[4]||=M(`div`,{class:`theme-divider`},null,-1),M(`div`,e5,[M(`span`,t5,U(r(h)(`themePicker.accentColor`)),1),M(`div`,n5,[(B(!0),N(V,null,P(r(t),e=>(B(),N(`button`,{key:e.id,type:`button`,class:I([`swatch`,{active:u.value===e.id}]),title:e.label,"aria-label":e.label,"aria-pressed":u.value===e.id,style:ie({"--swatch-bg":p.value?s5:c5}),onClick:t=>y(e.id)},[M(`span`,{class:`viewwindow`,style:ie({backgroundColor:p.value?s5:c5})},[(B(!0),N(V,null,P(n(r(tn)[e.id][500]),(e,t)=>(B(),N(`span`,{key:t,class:`rad`,style:ie({backgroundColor:e})},null,4))),128))],4)],14,r5))),128))])]),M(`div`,{class:I([`theme-section custom-hue-section`,{"custom-hue-section--active":u.value===r(on)}])},[M(`div`,i5,[M(`span`,a5,U(r(h)(`themePicker.customColor`)),1),M(`span`,{class:`custom-hue-preview`,style:ie({backgroundColor:d.value})},null,4)]),M(`div`,o5,[b(r(Ge),{class:`custom-hue-slider`,"model-value":[f.value],min:0,max:359,"aria-label":r(h)(`themePicker.customColor`),"onUpdate:modelValue":w},{default:H(()=>[b(r(Be),{class:`custom-hue-slider__track`}),b(r(Pe),{class:`custom-hue-slider__thumb`})]),_:1},8,[`model-value`,`aria-label`])])],2)])]),_:1})])]))]),_:1}))}}),[[`__scopeId`,`data-v-53186dc2`]]),u5=[`width`,`height`],d5=[`rx`],f5=[`transform`],p5=[`d`,`stroke-width`],m5=[`cx`,`cy`,`r`],h5=ze(z({__name:`RuneyaLogo`,props:{size:{default:28}},setup(e){return(t,n)=>(B(),N(`svg`,{class:`runeya-logo`,viewBox:`0 0 100 100`,width:e.size,height:e.size,"aria-hidden":`true`},[M(`rect`,{class:`runeya-logo__bg`,width:`100`,height:`100`,rx:r(en).radius},null,8,d5),M(`g`,{transform:`translate(50 50) scale(${r(an)}) translate(-50 -50)`},[M(`path`,{class:`runeya-logo__stroke`,d:r(fn).path,fill:`none`,"stroke-width":r(fn).stroke,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,8,p5),(B(!0),N(V,null,P(r(fn).dots,([e,t],n)=>(B(),N(`circle`,{key:n,class:`runeya-logo__fill`,cx:e,cy:t,r:r(fn).dotRadius},null,8,m5))),128))],8,f5)],8,u5))}}),[[`__scopeId`,`data-v-85f26936`]]),g5=t({announceThemeToServer:()=>_5});async function _5(){try{await yt.desktop.setTrayAccent.mutate({color:un()})}catch{}}globalThis.Buffer=hn.Buffer;async function v5(){try{let e=await yt.config.cloud.query();kt(e)}catch(e){console.warn(`[cloud] Failed to fetch cloud config, using defaults:`,e)}}async function y5(){try{ht(await yt.config.app.query())}catch(e){console.warn(`[app] Failed to fetch app mode:`,e)}finally{pt()}}var b5=_e(I8);b5.use(nt()),b5.use(R8),b5.use(rt),sn(()=>{_5()}),$t(),_t(()=>{_5()}),b5.directive(`tooltip`,Ye),Ee(e=>{try{let t=h8(),n={info:`info`,warn:`warn`,error:`error`,success:`success`,secondary:`info`}[e.severity??`info`]??`info`;t.add({type:n,title:String(e.summary??``),message:String(e.detail??``),category:`service_status_changed`})}catch{}}),b5.config.errorHandler=(e,t,n)=>{console.error(`[Vue Error]`,e,n);let r=e instanceof Error?e.message:`An unexpected error occurred`;De().add({severity:`error`,summary:`Unexpected Error`,detail:r,life:5e3})};async function x5(){if(Tt()){Et(),bt();return}try{let e=await wt();St(e.ciMode===!0),e.state===`unlocked`&&e.ciMode&&bt()}catch{}}Promise.all([v5(),y5(),x5()]).finally(()=>{b5.mount(`#app`)});export{b0 as A,VN as B,V4 as C,P1 as D,R4 as E,NI as F,er as G,kd as H,TP as I,Jn as K,EP as L,G1 as M,Aq as N,L1 as O,nR as P,$N as R,X4 as S,z4 as T,Fd as U,BN as V,Ad as W,l6 as _,E8 as a,V3 as b,C8 as c,T6 as d,E6 as f,s6 as g,o6 as h,L8 as i,s4 as j,F1 as k,h8 as l,c6 as m,h5 as n,w8 as o,y6 as p,On as q,l5 as r,g8 as s,g5 as t,A6 as u,W3 as v,Z$ as w,B3 as x,H3 as y,QN as z};
|
|
309
|
+
`)}function Ce(){p.value=null,de()}return(e,t)=>(B(),N(`div`,o3,[b(r(Ie),{layout:`horizontal`,"gutter-size":6,class:`ai-chat-scenario-view__splitter`},{default:H(()=>[b(r(Ze),{size:45,"min-size":0},{default:H(()=>[M(`div`,s3,[D.value?(B(),N(`div`,c3,[t[8]||=M(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),M(`span`,null,U(r(s)(`aiChatPage.scenario.synthesisInProgress`)),1)])):G(``,!0),(B(),W(a3,{key:`scenario-graph-${r(d)?.id}`,scenario:A.value,"node-states":w.value,"selected-node-id":p.value??void 0,preset:j.value,onNodeClick:t[0]||=e=>p.value=p.value===e?null:e},null,8,[`scenario`,`node-states`,`selected-node-id`,`preset`]))])]),_:1}),b(r(Ze),{size:55,"min-size":35},{default:H(()=>[M(`div`,l3,[E.value?(B(),N(`div`,u3,[...t[9]||=[M(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),M(`span`,null,`Scenario running...`,-1)]])):ee.value?(B(),N(`div`,d3,[t[10]||=M(`i`,{class:`ti ti-alert-triangle`,style:{color:`var(--r-orange-500, #f97316)`}},null,-1),M(`span`,f3,U(r(s)(`aiChatPage.scenario.interrupted`)),1),b(r(Le),{label:r(s)(`aiChatPage.resume`),icon:`ti ti-player-play`,size:`small`,onClick:t[1]||=e=>o(`click-resume`)},null,8,[`label`])])):G(``,!0),(B(!0),N(V,null,P(re.value,(e,n)=>(B(),N(`div`,{key:n,class:`ai-chat-scenario-view__input-request`},[M(`div`,p3,[t[11]||=M(`i`,{class:`ti ti-help-circle`},null,-1),M(`span`,m3,U(A.value?.nodes.find(e=>e.id===n)?.label||n)+` asks: `,1)]),M(`p`,h3,U(e),1),M(`div`,g3,[b(r(Ke),{modelValue:le.value[n],"onUpdate:modelValue":e=>le.value[n]=e,class:`ai-chat-scenario-view__input-request-field`,placeholder:`Your answer...`,disabled:!E.value,rows:3,"auto-resize":``,onKeydown:me(he(e=>E.value&&ue(n),[`exact`,`prevent`]),[`enter`])},null,8,[`modelValue`,`onUpdate:modelValue`,`disabled`,`onKeydown`]),b(r(Le),{icon:`ti ti-send`,size:`small`,disabled:!le.value[n]?.trim()||!E.value,title:E.value?void 0:r(s)(`aiChatPage.scenario.resumeToAnswer`),onClick:e=>ue(n)},null,8,[`disabled`,`title`,`onClick`])])]))),128)),M(`div`,_3,[M(`button`,{class:I([`ai-chat-scenario-view__tab`,{"ai-chat-scenario-view__tab--active":!p.value}]),onClick:t[2]||=e=>p.value=null},[t[12]||=M(`i`,{class:`ti ti-file`},null,-1),x(` `+U(r(s)(`aiChatPage.runLog`))+` `,1),E.value?(B(),N(`span`,v3)):G(``,!0)],2),p.value?(B(),N(`button`,y3,[t[13]||=M(`i`,{class:`ti ti-user`},null,-1),x(` `+U(F.value?.label||F.value?.id)+` `,1),M(`span`,{class:I([`ai-chat-scenario-view__node-state`,`ai-chat-scenario-view__node-state--${w.value[ce.value]??`idle`}`])},U(w.value[ce.value]??`idle`),3),M(`button`,{class:`ai-chat-scenario-view__tab-close`,onClick:t[3]||=he(e=>p.value=null,[`stop`])},`x`)])):G(``,!0)]),p.value?(B(),N(`div`,{key:`scenario-node-${r(d)?.id}-${ce.value}`,class:`ai-chat-scenario-view__node-output`},[F.value?(B(),N(`div`,D3,[M(`span`,O3,U(L.value),1),te.value?(B(),N(`span`,k3,U(te.value),1)):G(``,!0)])):G(``,!0),z.value[ce.value]&&w.value[ce.value]===`running`?(B(),N(`div`,A3,[t[17]||=M(`i`,{class:`ti ti-spin ti-settings`},null,-1),M(`span`,null,U(z.value[ce.value]),1)])):G(``,!0),ie.value[ce.value]?.length?(B(),N(`div`,j3,[M(`div`,{class:`ai-chat-scenario-view__thinking-header`,onClick:t[6]||=e=>se.value.has(ce.value)?se.value.delete(ce.value):se.value.add(ce.value)},[t[18]||=M(`i`,{class:`ti ti-sparkles`},null,-1),M(`span`,null,U(r(s)(`aiChatPage.thinking`)),1),M(`i`,{class:I([`ti`,se.value.has(ce.value)?`ti-chevron-up`:`ti-chevron-down`])},null,2)]),se.value.has(ce.value)?(B(),N(`pre`,M3,U(ie.value[ce.value].join(``)),1)):G(``,!0)])):G(``,!0),ae.value[ce.value]?.length?(B(),N(`div`,N3,[(B(!0),N(V,null,P(ae.value[ce.value],e=>(B(),N(`div`,{key:e.id,class:I([`ai-chat-scenario-view__tool-event`,{"ai-chat-scenario-view__tool-event--pending":e.pending,"ai-chat-scenario-view__tool-event--error":e.isError}])},[M(`i`,{class:I(e.pending?`ti ti-spin ti-loader-2`:e.isError?`ti ti-circle-x`:`ti ti-circle-check`)},null,2),M(`span`,P3,U(be(e)),1),e.pending&&e.rawInput?(B(),N(`span`,F3,[x(U(e.rawInput),1),t[19]||=M(`span`,{class:`ai-chat-scenario-view__cursor`},null,-1)])):xe(e)?(B(),N(`span`,I3,U(xe(e)),1)):G(``,!0),!e.pending&&e.result?(B(),N(`pre`,L3,U(Se(e.result,20)),1)):G(``,!0)],2))),128))])):G(``,!0),T.value[ce.value]?(B(),N(`div`,{key:4,class:`ai-chat-scenario-view__node-content ai-chat-scenario-view__markdown`,innerHTML:_e(T.value[ce.value])},null,8,R3)):(B(),N(`div`,z3,[t[20]||=M(`i`,{class:`ti ti-clock`},null,-1),M(`span`,null,U(w.value[ce.value]===`running`?`Running...`:`Waiting...`),1)])),oe.value[ce.value]===void 0?G(``,!0):(B(),N(`div`,B3,[t[21]||=M(`i`,{class:`ti ti-clock`},null,-1),M(`span`,null,U(ve(oe.value[ce.value])),1)]))])):(B(),N(`div`,{key:`scenario-readme-${r(d)?.id}`,ref_key:`messagesEl`,ref:f,class:`ai-chat-scenario-view__readme`},[O.value?(B(),N(`div`,x3,[k.value.runLog?(B(),N(`div`,S3,[M(`button`,{class:`ai-chat-scenario-view__accordion-header`,onClick:t[4]||=e=>fe(`run`)},[M(`span`,null,[t[15]||=M(`i`,{class:`ti ti-file`},null,-1),x(` `+U(r(s)(`aiChatPage.runLog`)),1)]),M(`i`,{class:I([`ti`,m.value?`ti-chevron-up`:`ti-chevron-down`])},null,2)]),m.value?(B(),N(`div`,{key:0,class:`ai-chat-scenario-view__accordion-content ai-chat-scenario-view__readme-content ai-chat-scenario-view__markdown`,innerHTML:_e(k.value.runLog)},null,8,C3)):G(``,!0)])):G(``,!0),k.value.finalReport?(B(),N(`div`,w3,[M(`button`,{class:`ai-chat-scenario-view__accordion-header`,onClick:t[5]||=e=>fe(`final`)},[M(`span`,null,[t[16]||=M(`i`,{class:`ti ti-file-check`},null,-1),x(` `+U(r(s)(`aiChatPage.finalReport`)),1)]),M(`i`,{class:I([`ti`,h.value?`ti-chevron-up`:`ti-chevron-down`])},null,2)]),h.value?(B(),N(`div`,{key:0,class:`ai-chat-scenario-view__accordion-content ai-chat-scenario-view__final-report ai-chat-scenario-view__markdown`,innerHTML:_e(k.value.finalReport)},null,8,T3)):G(``,!0)])):G(``,!0)])):(B(),N(`div`,b3,[t[14]||=M(`i`,{class:`ti ti-building`,style:{"font-size":`1.5rem`,opacity:`0.2`}},null,-1),M(`p`,null,U(r(s)(`aiChatPage.typeATask`)),1),M(`p`,null,U(r(s)(`aiChatPage.clickOrgChartHint`)),1)])),E.value?(B(),N(`span`,E3)):G(``,!0)]))])]),_:1})]),_:1}),b(r(Ne),{visible:!!g.value,modal:``,"dismissable-mask":``,header:`Claude · resume ${g.value??``}`,style:{width:`80vw`,height:`70vh`},"content-style":{padding:0,height:`100%`},"onUpdate:visible":t[7]||=e=>{e||(g.value=null,_.value=null,y.value=null)}},{default:H(()=>[v.value?(B(),N(`div`,V3,`Chargement…`)):y.value?(B(),N(`div`,H3,[t[22]||=M(`i`,{class:`ti ti-alert-triangle`},null,-1),x(` `+U(y.value),1)])):_.value?(B(),W(Rq,{key:2,"session-id":_.value.sessionId,"agent-id":_.value.agentId,resume:!0},null,8,[`session-id`,`agent-id`])):G(``,!0)]),_:1},8,[`visible`,`header`])]))}}),[[`__scopeId`,`data-v-531a3e9c`]]),W3={"claude-code":`Claude Code`,codex:`Codex`};function G3(e,t,n){return Object.keys(W3).map(r=>{let i=W3[r],a=!e[r]&&t!==r;return{value:r,disabled:a,label:a?n(i):i}})}function K3(e,t,n){let r=[{value:``,label:e},...t];return n&&!t.some(e=>e.value===n)&&r.push({value:n,label:n}),r}function q3(e,t){return[{value:``,label:e},...Yt.map(e=>({value:e,label:t(e)}))]}function J3(e,t,n,r,i=1){return Math.max(n,Math.min(Math.max(n,r),e+t*i))}function Y3(e){let{axis:t,min:n,initial:r,storageKey:a,direction:o=1}=e,s=()=>typeof e.max==`function`?e.max():e.max,c=i(p()),l=i(!1),d=0,f=0;function p(){if(!a)return r;try{let e=Number(localStorage.getItem(a));if(Number.isFinite(e)&&e>=n&&e<=s())return e}catch{}return r}function m(){if(a)try{localStorage.setItem(a,String(c.value))}catch{}}let h=e=>{let r=(t===`x`?e.clientX:e.clientY)-d;c.value=J3(f,r,n,s(),o)},g=()=>{l.value=!1,document.removeEventListener(`pointermove`,h),document.removeEventListener(`pointerup`,g),document.removeEventListener(`pointercancel`,g),document.body.style.userSelect=``,document.body.style.cursor=``,m()};function _(e){l.value=!0,d=t===`x`?e.clientX:e.clientY,f=c.value,document.body.style.userSelect=`none`,document.body.style.cursor=t===`x`?`col-resize`:`row-resize`,document.addEventListener(`pointermove`,h),document.addEventListener(`pointerup`,g),document.addEventListener(`pointercancel`,g)}return u(()=>{l.value&&g()}),{size:c,isResizing:l,start:_}}var X3={class:`companion-panel__header`},Z3={class:`companion-panel__title`},Q3={key:0,class:`companion-panel__state companion-panel__state--reading`},$3=[`title`],e6={key:2,class:`companion-panel__state`},t6={class:`companion-panel__header-actions`},n6={class:`companion-panel__menu`},r6=[`title`],i6=[`title`,`disabled`],a6=[`title`,`disabled`],o6={class:`companion-panel__hint`},s6={key:2,class:`companion-panel__empty`},c6=[`title`],l6=ze(z({__name:`CompanionPanel`,props:{enabled:{type:Boolean},runner:{},model:{},effort:{},companionConversationId:{},mainConversationId:{}},emits:[`enable`,`disable`,`update:runner`,`update:model`,`update:effort`],setup(e,{emit:t}){let n=e,a=t,{t:o}=He(),s=lt(),{claudeCodeAvailable:c,codexAvailable:l,cliModels:u}=$e(s),d=R(()=>G3({"claude-code":c.value,codex:l.value},n.runner,e=>o(`aiChatPage.runnerNotInstalled`,{runner:e}))),f=R(()=>K3(o(`aiChat.companionModelDefault`),u.value[n.runner],n.model));C(()=>n.runner,e=>{s.loadCliModels(e)},{immediate:!0});let p=R(()=>q3(o(`aiChat.companionEffortDefault`),e=>o(`aiChat.companionEffort_${e}`))),m=R(()=>n.companionConversationId?s.conversations.find(e=>e.id===n.companionConversationId)??null:null);C(()=>m.value?.messagesOmitted?m.value.id:null,e=>{e&&s.ensureConversationLoaded(e)},{immediate:!0});let h=i(!1),g=R(()=>n.enabled&&h.value),_=R(()=>(m.value?.messages??[]).filter(e=>e.role===`assistant`&&e.content.trim()).length),{size:v,isResizing:y,start:S}=Y3({axis:`y`,min:180,max:()=>Math.round(window.innerHeight*.75),initial:380,storageKey:`runeya:companion-height`}),w=i();function T(e){w.value?.toggle(e)}let E=R(()=>m.value?.messages??[]),D=R(()=>s.isCompanionThinkingFor(n.mainConversationId)),ee=R(()=>s.companionSkipFor(n.mainConversationId)),O=R(()=>D.value||!!n.companionConversationId&&s.isConversationStreaming(n.companionConversationId));function k(e){a(`update:runner`,e===`codex`?`codex`:`claude-code`)}let A=i(!1),j=i(null);async function P(){if(!n.mainConversationId||!g.value){j.value=null;return}try{let e=await yt.chat.conversations.companionDelivery.query({id:n.mainConversationId});j.value=e.delivery}catch{j.value=null}}C(D,(e,t)=>{e&&!t&&s.refreshStreamingSessions()});let F=Rt(P,1500,`companion-delivery`);C(()=>[n.mainConversationId,g.value],([,e])=>{j.value=null,e?(F.start(),F.trigger()):F.stop()},{immediate:!0}),te(()=>F.stop());async function L(){if(n.mainConversationId){A.value=!0;try{await yt.chat.conversations.testCompanionBridge.mutate({id:n.mainConversationId})}catch{}finally{A.value=!1,await P()}}}let ne=i(!1);async function re(){if(n.mainConversationId){ne.value=!0;try{await yt.chat.conversations.runCompanionNow.mutate({id:n.mainConversationId})}catch{}finally{ne.value=!1}}}return(t,n)=>(B(),N(`section`,{class:I([`companion-panel`,{"companion-panel--resizing":r(y),"companion-panel--collapsed":!g.value}]),style:ie(g.value?{height:r(v)+`px`}:void 0)},[M(`header`,X3,[M(`span`,Z3,[M(`i`,{class:I(e.enabled?`ti ti-eye`:`ti ti-eye-off`)},null,2),x(` `+U(r(o)(`aiChat.companionPanelTitle`)),1)]),e.enabled&&O.value?(B(),N(`span`,Q3,[n[6]||=M(`i`,{class:`companion-panel__pulse`},null,-1),x(U(r(o)(`aiChat.companionReading`)),1)])):e.enabled&&ee.value?(B(),N(`span`,{key:1,class:`companion-panel__state companion-panel__state--skipped`,title:ee.value.detail},[n[7]||=M(`i`,{class:`ti ti-info-circle`},null,-1),x(U(r(o)(`aiChat.companionSkip_${ee.value.reason}`)),1)],8,$3)):e.enabled?G(``,!0):(B(),N(`span`,e6,U(r(o)(`aiChat.companionPitchLead`)),1)),M(`div`,t6,[b(r(ke),{class:`companion-panel__runner`,"model-value":e.runner,options:d.value,"option-label":`label`,"option-value":`value`,"option-disabled":`disabled`,size:`small`,title:r(o)(`aiChat.companionRunner`),"onUpdate:modelValue":k},null,8,[`model-value`,`options`,`title`]),f.value.length>1?(B(),W(r(ke),{key:0,class:`companion-panel__runner companion-panel__model`,"model-value":e.model,options:f.value,"option-label":`label`,"option-value":`value`,size:`small`,title:r(o)(`aiChat.companionModel`),"aria-label":r(o)(`aiChat.companionModel`),"onUpdate:modelValue":n[0]||=e=>a(`update:model`,String(e??``))},null,8,[`model-value`,`options`,`title`,`aria-label`])):G(``,!0),b(r(ke),{class:`companion-panel__runner companion-panel__effort`,"model-value":e.effort,options:p.value,"option-label":`label`,"option-value":`value`,size:`small`,title:r(o)(`aiChat.companionEffort`),"aria-label":r(o)(`aiChat.companionEffort`),"onUpdate:modelValue":n[1]||=e=>a(`update:effort`,String(e??``))},null,8,[`model-value`,`options`,`title`,`aria-label`]),e.enabled?(B(),N(V,{key:2},[b(r(Le),{size:`small`,variant:`text`,severity:`danger`,icon:`ti ti-eye-off`,label:r(o)(`aiChat.companionDisable`),onClick:n[3]||=e=>a(`disable`)},null,8,[`label`]),b(r(Le),{class:`companion-panel__menu-btn`,size:`small`,variant:`text`,rounded:``,icon:`ti ti-dots-vertical`,title:r(o)(`aiChat.companionMore`),onClick:T},null,8,[`title`]),b(r(xe),{ref_key:`menu`,ref:w},{default:H(()=>[M(`div`,n6,[M(`button`,{type:`button`,class:`companion-panel__menu-item`,title:r(o)(`aiChat.companionRawHint`),onClick:n[4]||=e=>h.value=!h.value},[n[8]||=M(`i`,{class:`ti ti-code`},null,-1),x(` `+U(h.value?r(o)(`aiChat.companionRawOff`):r(o)(`aiChat.companionRaw`)),1)],8,r6),M(`button`,{type:`button`,class:`companion-panel__menu-item`,title:r(o)(`aiChat.companionRunNowHint`),disabled:ne.value||O.value,onClick:re},[M(`i`,{class:I(ne.value||O.value?`ti ti-spin ti-loader-2`:`ti ti-player-play`)},null,2),x(` `+U(r(o)(`aiChat.companionRunNow`)),1)],8,i6),M(`button`,{type:`button`,class:`companion-panel__menu-item`,title:r(o)(`aiChat.companionTestBridgeHint`),disabled:A.value,onClick:L},[M(`i`,{class:I(A.value?`ti ti-spin ti-loader-2`:`ti ti-send`)},null,2),x(` `+U(r(o)(`aiChat.companionTestBridge`)),1)],8,a6)])]),_:1},512)],64)):(B(),W(r(Le),{key:1,size:`small`,icon:`ti ti-eye`,label:r(o)(`aiChat.companionEnable`),onClick:n[2]||=e=>a(`enable`)},null,8,[`label`]))])]),g.value?(B(),N(V,{key:0},[M(`p`,o6,U(r(o)(`aiChat.companionRawNotice`,{n:_.value})),1),j.value?(B(),N(`p`,{key:0,class:I([`companion-panel__delivery`,`companion-panel__delivery--${j.value.route}`])},U(r(o)(`aiChat.companionDelivery_${j.value.route}`)),3)):G(``,!0),E.value.length?(B(),W(HR,{key:1,class:`companion-panel__messages`,messages:E.value,"is-streaming":O.value},null,8,[`messages`,`is-streaming`])):(B(),N(`p`,s6,U(O.value?r(o)(`aiChat.companionReadingNow`):r(o)(`aiChat.companionNoRunYet`)),1)),M(`div`,{class:`companion-panel__grip`,role:`separator`,title:r(o)(`aiChat.companionResize`),onPointerdown:n[5]||=he((...e)=>r(S)&&r(S)(...e),[`prevent`])},null,40,c6)],64)):G(``,!0)],6))}}),[[`__scopeId`,`data-v-25278c84`]]),u6=`runeya:terminal-font-size`;function d6(e){let{sessionId:t,agentId:n,replay:r,onError:i}=e,a=document.createElement(`div`);a.style.width=`100%`,a.style.height=`100%`;let o=new eq({cursorBlink:!0,fontFamily:`monospace`,fontSize:fq(u6,14),theme:{background:`#1a1b1e`,foreground:`#d4d4d4`,cursor:`#d4d4d4`},allowProposedApi:!1}),s=new rq;o.loadAddon(s),o.open(a);let c=e=>{yt.terminal.write.mutate({agentId:n,sessionId:t,data:e}).catch(()=>{})};o.onData(c);let l=oq(o,c),u=uq(o,a),d=mq(o),f={terminal:o,fitAddon:s,container:a,subscription:yt.terminal.onData.subscribe({agentId:n,sessionId:t,replay:r},{onData(e){d.write(e)},onError(e){i?.(e.message)}}),detachDeadKeyFix:l,detachTouchScroll:u,detachZoom:null,writer:d};return f.detachZoom=pq({terminal:o,container:a,storageKey:u6,onResize:()=>m6(f,n,t)}),f}function f6(e){e.detachDeadKeyFix?.(),e.detachTouchScroll?.(),e.detachZoom?.(),e.writer.dispose(),e.subscription?.unsubscribe(),e.terminal.dispose(),e.container.remove()}function p6(e,t){e.container.parentElement!==t&&t.appendChild(e.container)}function m6(e,t,n){if(e.container.isConnected){try{e.fitAddon.fit()}catch{return}yt.terminal.resize.mutate({agentId:t,sessionId:n,cols:e.terminal.cols,rows:e.terminal.rows}).catch(()=>{})}}var h6=`runeya.conversation-terminals`,g6=new Map;function _6(){try{let e=localStorage.getItem(h6);if(!e)return{};let t=JSON.parse(e);return t?.version!==1||typeof t.sessions!=`object`||!t.sessions?{}:t.sessions}catch{return{}}}function v6(e){try{let t={version:1,sessions:e};localStorage.setItem(h6,JSON.stringify(t))}catch{}}function y6(e,t){let n=_6();t?n[e]=t:delete n[e],v6(n)}var b6=i(null),x6=i(!1);function S6(){async function e(e,t,n){if(b6.value=null,g6.has(e))return!0;x6.value=!0;try{let r=_6()[e];if(r&&r.agentId===t){let{sessions:n}=await yt.terminal.list.query({agentId:t});if(n.some(e=>e.sessionId===r.sessionId))return g6.set(e,d6({sessionId:r.sessionId,agentId:t,replay:!0,onError:e=>{b6.value=e}})),!0}let i=await yt.terminal.create.mutate({agentId:t,...n?.projectId?{projectId:n.projectId,orgId:n.orgId??null}:{},cols:80,rows:24,title:`Chat ${e.slice(0,8)}`});return y6(e,{agentId:t,sessionId:i.sessionId}),g6.set(e,d6({sessionId:i.sessionId,agentId:t,replay:!1,onError:e=>{b6.value=e}})),!0}catch(e){return b6.value=e.message,!1}finally{x6.value=!1}}function t(e,t){let n=g6.get(e);n&&(p6(n,t),r(e),n.terminal.focus())}function n(e){return g6.get(e)?.terminal??null}function r(e){let t=g6.get(e),n=_6()[e];t&&n&&m6(t,n.agentId,n.sessionId)}async function i(e){let t=g6.get(e);t&&(f6(t),g6.delete(e));let n=_6()[e];y6(e,null),n&&await yt.terminal.destroy.mutate({agentId:n.agentId,sessionId:n.sessionId}).catch(()=>{})}return{open:e,attach:t,fit:r,destroy:i,getTerminal:n,errorMsg:b6,loading:x6}}var C6={class:`terminal-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},w6=ze(z({__name:`TerminalIcon`,setup(e){return(e,t)=>(B(),N(`svg`,C6,[...t[0]||=[M(`polyline`,{points:`4 17 10 11 4 5`},null,-1),M(`line`,{x1:`12`,y1:`19`,x2:`20`,y2:`19`},null,-1)]]))}}),[[`__scopeId`,`data-v-cb1db4b3`]]),T6={class:`conversation-terminal__header`},E6={class:`conversation-terminal__title`},D6={key:0,class:`conversation-terminal__error`},O6={key:1,class:`conversation-terminal__error`},k6=ze(z({__name:`ConversationTerminalDialog`,props:_({conversationId:{},agentId:{}},{visible:{type:Boolean,required:!0},visibleModifiers:{}}),emits:[`update:visible`],setup(e){let t=e,n=S(e,`visible`),{t:a}=He(),o=tt(),{open:c,attach:l,fit:u,destroy:d,getTerminal:f,errorMsg:p,loading:m}=S6(),h=i(null),g=s(null),_=null;async function v(){await c(t.conversationId,t.agentId,o.activeProjectId?{projectId:o.activeProjectId,orgId:o.activeOrgId}:void 0)&&h.value&&(h.value.replaceChildren(),l(t.conversationId,h.value),g.value=f(t.conversationId),_?.disconnect(),_=new ResizeObserver(()=>u(t.conversationId)),_.observe(h.value))}function y(){_?.disconnect(),_=null,g.value=null}async function w(){y(),await d(t.conversationId),n.value=!1}return C(n,e=>{e||y()}),C(()=>t.conversationId,()=>{n.value&&v()}),re(y),(e,t)=>(B(),W(r(Ne),{visible:n.value,"onUpdate:visible":t[0]||=e=>n.value=e,modal:``,maximizable:``,"dismissable-mask":``,style:{width:`70vw`,height:`70vh`},"content-class":`conversation-terminal__content`,onShow:v},{header:H(()=>[M(`div`,T6,[M(`span`,E6,[b(w6),x(` `+U(r(a)(`aiChat.terminalTitle`)),1)]),b(r(Le),{size:`small`,variant:`text`,severity:`danger`,icon:`ti ti-power`,title:r(a)(`aiChat.terminalKill`),onClick:w},null,8,[`title`])])]),default:H(()=>[r(p)?(B(),N(`div`,D6,[t[1]||=M(`i`,{class:`ti ti-alert-triangle`},null,-1),x(` `+U(r(p)),1)])):r(m)?(B(),N(`div`,O6,[...t[2]||=[M(`i`,{class:`ti ti-spin ti-loader-2`},null,-1)]])):G(``,!0),b(Fq,{terminal:g.value},null,8,[`terminal`]),M(`div`,{ref_key:`hostEl`,ref:h,class:`conversation-terminal__host`},null,512)]),_:1},8,[`visible`]))}}),[[`__scopeId`,`data-v-b1e2454e`]]);function A6(e,t){return`${e}:${t}`}function j6(e){let t=i({}),n=new Map,r=new Set,a=R(()=>{let n={};for(let r of e.value){let e=t.value[r.boardId];if(!e)continue;let i=(e.columns??[]).find(e=>e.cards.some(e=>e.id===r.cardId));i&&(n[A6(r.boardId,r.cardId)]=i.title)}return n}),o=R(()=>{let e={};for(let[n,r]of Object.entries(t.value))e[n]=r.name;return e});async function s(e){if(!r.has(e)){r.add(e);try{let n=(await It.$fetch(`/kanban/board/get`,{method:`GET`,query:{id:e}}))?.data?.board??null;if(!n)return;t.value={...t.value,[e]:n},n.organizationId&&c(n.organizationId)}catch{}finally{r.delete(e)}}}function c(e){if(n.has(e)||typeof EventSource>`u`)return;let r=new EventSource(Lt(e));r.onmessage=e=>{try{let n=JSON.parse(e.data),r=t.value[n.boardId];if(!r||n.type===`board.changed`&&n.updatedAt===r.updatedAt)return;s(n.boardId)}catch{}},n.set(e,r)}return C(e,e=>{for(let n of new Set(e.map(e=>e.boardId)))t.value[n]||s(n)},{immediate:!0,deep:!0}),u(()=>{for(let e of n.values())e.close();n.clear()}),{columnTitles:a,boardNames:o}}function M6(e,t){let{columnTitles:n,boardNames:r}=j6(R(()=>e.value&&t.value?[{boardId:e.value,cardId:t.value}]:[]));return{columnTitle:R(()=>e.value&&t.value?n.value[A6(e.value,t.value)]??``:``),boardName:R(()=>e.value?r.value[e.value]??``:``)}}var N6=i(null),P6=i(null);function F6(){function e(e){N6.value=e,P6.value=null}function t(e){P6.value=e}function n(){N6.value=null}function r(){P6.value=null}return{pendingConvId:N6,generatedCode:P6,setPendingConv:e,setGeneratedCode:t,clear:n,clearResult:r}}var I6={class:`ai-chat-page__main`},L6={key:0,class:`ai-chat-page__empty`},R6={class:`ai-chat-page__header`},z6={class:`ai-chat-page__header-left`},B6={class:`ai-chat-page__header-title`},V6=[`title`],H6={class:`ai-chat-page__title-text`},U6={class:`ai-chat-page__conv-meta`},W6={key:0,class:`ai-chat-page__runner-badge`},G6={key:1,class:`ai-chat-page__claude-thinking`,title:`Claude est en train de générer une réponse`},K6={key:2,class:`ai-chat-page__claude-idle`,title:`Le process Claude est actif (en attente de saisie)`},q6=[`title`],J6={class:`ai-chat-page__context-progress-bar`},Y6={class:`ai-chat-page__context-progress-label`},X6={key:0,class:`ai-chat-page__kanban-column`},Z6=[`title`],Q6={class:`ai-chat-page__header-actions`},$6={class:`ai-chat-page__git-add`},e8={class:`ai-chat-page__git-del`},t8={key:1,class:`ti ti-code`},n8={class:`conv-menu`},r8=[`disabled`],i8={class:`ai-chat-page__git-notice`},a8={key:0,class:`ai-chat-page__pty-debug`},o8={class:`ai-chat-page__pty-debug-header`},s8=5e3,c8=z({__name:`AiChatPage`,setup(e){let{t}=He(),n=it(),a=De(),o=lt(),s=dt(),{activeId:c,activeConversation:l,isStreaming:u,streamingConvId:d,activeContextUsage:f,contextPercent:p}=$e(o),m=i(!1);async function h(){let e=l.value;if(e&&!m.value){m.value=!0;try{await yt.chat.pty.syncTranscript.mutate({conversationId:e.id})}catch(e){a.add({severity:`warn`,summary:`Sync failed`,detail:e.message,life:4e3})}finally{m.value=!1}}}let g=R(()=>new URLSearchParams(window.location.search).has(`debugPty`)),_=i(!1),v=i(null),y=i(void 0),S=i(0);async function w(){let e=l.value;if(!e)return;let t=window.prompt(`PTY stress: bytes per second?`,`200000`);if(!t)return;let n=Number(t);try{let t=await yt.chat.pty.debugStress.mutate({sessionId:e.id,agentId:e.agentId,bytesPerSec:n,chunkSize:512,durationMs:3e4});v.value=t.spawnId,y.value=t.agentId,S.value=n,_.value=!0,a.add({severity:`info`,summary:`PTY stress started`,detail:`${n.toLocaleString()} B/s for 30s`,life:3e3})}catch(e){a.add({severity:`error`,summary:`Stress failed`,detail:e.message,life:4e3})}}function T(){_.value=!1,v.value=null}let E=R(()=>{let e=l.value;return e?e.runner??(e.isCli&&!e.providerId?`claude-code`:null):null}),D=R(()=>E.value===`claude-code`),ee=R(()=>E.value===`codex`),O=R(()=>D.value||ee.value),k=i(!1),A=i(null),j=i(Date.now()),P=null,L=R(()=>!k.value||!A.value?!1:j.value-A.value<1500);async function ne(){let e=l.value;if(!e||!D.value){k.value=!1,A.value=null;return}try{let t=await yt.chat.pty.activity.query({sessionId:e.id,agentId:e.agentId});k.value=t.running,A.value=t.idleMs===null?null:Date.now()-t.idleMs}catch{k.value=!1}}let re=Rt(ne,1e3,`ai-chat-page:activity`);function z(){re.stop(),P&&=(clearInterval(P),null),k.value=!1,A.value=null}function oe(){z(),P||=setInterval(()=>{j.value=Date.now()},500),re.start(),re.trigger()}C([()=>l.value?.id,D],([e,t])=>{e&&t?oe():z()},{immediate:!0}),te(()=>z());let se=R(()=>{let e=l.value;if(!e||e.workflowType===`scenario`)return null;let t=e.runner??(e.isCli&&!e.providerId?`claude-code`:null);if(t===`codex`)return`Codex`;if(t===`claude-code`)return`Claude Code`;if(e.providerId){let t=o.providers.find(t=>t.id===e.providerId);if(t)return t.label}return null}),ce=i(``),ue=i(!1),de=i(!1),fe=i(!1),pe=i(``),ge=i(null),_e=R(()=>l.value?.companionRunner??E.value??`claude-code`);function ve(){let e=l.value;e&&o.setCompanion(e.id,!0)}function ye(){let e=l.value;e&&o.setCompanion(e.id,!1)}function be(e){let t=l.value;if(!t)return;let n=e===`codex`?`codex`:`claude-code`,r=n===_e.value?void 0:``;o.setCompanion(t.id,!!t.companionEnabled,{runner:n,model:r})}function Se(e){let t=l.value;if(!t)return;let n=e===`low`||e===`normal`||e===`high`?e:``;o.setCompanion(t.id,!!t.companionEnabled,{effort:n})}function we(e){let t=l.value;t&&o.setCompanion(t.id,!!t.companionEnabled,{model:typeof e==`string`?e:``})}function Te(){l.value&&(pe.value=l.value.title,fe.value=!0,le(()=>ge.value?.$el?.select()))}async function Ee(){if(!l.value)return;let e=pe.value.trim();e&&await o.renameConversation(l.value.id,e),fe.value=!1}function Oe(){fe.value=!1}function ke(e){return e.messagesOmitted?(e.messageCount??0)>0:(e.messages?.length??0)>0}function Ae(e){navigator.clipboard.writeText(e),a.add({severity:`success`,summary:t(`aiChat.conversationIdCopied`),life:2e3})}let je=i(null),Me=i(null),Pe=i(null),Fe=i([]),Ie=0,Re=()=>new Date().toISOString(),ze=Rt(async()=>{let e=o.refreshStreamingSessions;typeof e==`function`?await e():await o.init()},1500,`ai-chat-page:streaming-refresh`),Be=R(()=>u.value&&d.value===c.value);function Ve(){return l.value?.workflowType===`scenario`?Me.value?.messagesEl??null:je.value?.messagesEl??null}function Ue(){let e=Ve();if(!e)return!0;let{scrollTop:t,scrollHeight:n,clientHeight:r}=e;return n-t-r<80}async function We(e=!1){if(!e&&!Ue())return;await le();let t=Ve();t&&(t.scrollTop=t.scrollHeight),t?.querySelectorAll(`.ai-chat-scenario-view__thinking-content, .ai-chat-message-list__thinking-content`).forEach(e=>{e.scrollTop=e.scrollHeight})}function Ge(){c.value=null,ue.value=!0,o.pendingNewConversation=!0,de.value=!1}function Ke(e){o.pendingNewConversation=!1,o.selectConversation(e),de.value=!1,ue.value=!1,Me.value?.resetNodeSelection()}async function qe(e){o.deleteConversation(e)}async function Je(e=`keep`,t,n){ue.value=!1,o.pendingNewConversation=!1,await o.createConversation({runner:e===`keep`?void 0:e,providerId:e===`keep`?t??void 0:void 0,agentId:n}),ce.value=``}function Ye(e,t,n,r){ue.value=!1,o.pendingNewConversation=!1,Pe.value?.showScenarioDialog(e,void 0,t,n??void 0,r)}async function Xe(e,n,r,i,s,c){try{let t=await o.createConversation({scenarioId:e,scenarioInput:n,title:n?`Scenario: ${n}`:`Scenario conversation`,providerId:s,agentId:c});if(await We(!0),n&&t){let a=r===`codex`?``:i.trim(),s=r!==`keep`||a||c?{...r===`keep`?{}:{runnerOverride:r},...a?{modelOverride:a}:{},...c?{agentId:c}:{}}:void 0;o.startScenarioRun(t.id,e,n,()=>We(!1),s)}}catch(e){a.add({severity:`error`,summary:t(`common.error`),detail:e.message,life:4e3})}}async function Ze(){let e=l.value;e&&e.workflowType===`scenario`&&await o.stopScenario(e.id)}function Qe(){Pe.value?.showResumeScenarioDialog()}async function et(e,n){let r=l.value;if(!r)return;let i=e===`keep`?void 0:e;try{await o.resumeScenario(r.id,()=>We(!1),{...i?{runnerOverride:i}:{},...n?{agentId:n}:{}})}catch(e){a.add({severity:`error`,summary:t(`common.error`),detail:e.message,life:4e3})}}async function nt(){let e=ce.value,n=ce.value.trim(),{pendingContext:r,pendingPopulateContext:i}=Ut();if(!n&&o.pendingImages.length===0&&!r.value&&!i.value||(!n&&r.value&&(n=`Voici le contexte ci-joint, aide-moi à avancer.`),!n&&i.value&&(n=i.value),!l.value&&(await Je(),!l.value)))return;let s=l.value;try{if(s.workflowType===`scenario`){if(s.scenarioRunning)return;ce.value=``,o.startScenarioRun(s.id,s.workflowId,n,()=>We(!1),s.scenarioRunOverrides),await We(!0);return}ce.value=``,i.value=null,await o.send(n,We)}catch(n){ce.value||=e,a.add({severity:`error`,summary:t(`common.error`),detail:n.message,life:3500})}}function rt(e,t){let n=null;C(d,t=>{t&&e(t)&&(n=t)}),C(u,async e=>{if(e||!n)return;let r=n;n=null,await t(r),await o.deleteConversation(r),Ut().close()})}let{columnTitle:at}=M6(R(()=>l.value?.kanbanBoardId),R(()=>l.value?.kanbanCardId));function ot(e,t){n.push(t?{name:`kanban-card`,params:{id:e,cardId:t}}:{name:`kanban-board`,params:{id:e}})}rt(e=>{let t=o.conversations.find(t=>t.id===e);return!(!t?.kanbanBoardId||t.kanbanCardId)},async()=>{});let st=F6();rt(e=>e===st.pendingConvId.value,async e=>{st.clear();let t=o.conversations.find(t=>t.id===e);if(!t)return;let n=t.messages.filter(e=>e.role===`assistant`),r=n[n.length-1];if(r?.content){let e=r.content.match(/```(?:javascript|js|typescript|ts)?\n([\s\S]+?)```/);e&&st.setGeneratedCode(e[1].trim())}}),C(()=>l.value?.id,async e=>{if(Me.value?.resetNodeSelection(),e&&l.value?.workflowType===`scenario`&&await s.fetchScenarios(),e&&D.value)try{await yt.chat.pty.syncTranscript.mutate({conversationId:e})}catch{}}),C(c,e=>{e&&(ue.value=!1),le(()=>We(!0))},{flush:`sync`});let ut=!0;C(()=>{let e=l.value?.messages;if(!e||e.length===0)return``;let t=e[e.length-1];return`${e.length}|${t?.content?.length??0}|${t?.parts?.length??0}`},()=>{ut=Ue()},{flush:`pre`}),C(()=>{let e=l.value?.messages;if(!e||e.length===0)return``;let t=e[e.length-1];return`${e.length}|${t?.content?.length??0}|${t?.parts?.length??0}`},()=>{if(!ut)return;let e=Ve();e&&(e.scrollTop=e.scrollHeight)},{flush:`post`});let{autoSendPending:ft,hideSidebar:pt}=Ut(),mt=i(!1),ht=Zt(),gt=tt(),_t=i(!1),{size:vt,isResizing:bt,start:xt}=Y3({axis:`x`,min:180,max:()=>Math.min(560,window.innerWidth-320),initial:280,storageKey:`runeya.ai-chat.sidebar-width`}),St=i(null);function Ct(e){St.value?.hide(),e()}let wt=R(()=>l.value?.agentId??ht.connectedAgents[0]?.config.id??null),Tt=i(null),Et=i(!1),Dt=R(()=>{let e=l.value;if(!e)return null;let t=e.projectId&&e.projectId===gt.activeProjectId?gt.activeOrgId:void 0;return{agentId:e.agentId,projectId:e.projectId,orgId:t}}),Ot=R(()=>{let e=Dt.value?.agentId;return e?ht.getById(e)?.config.name??null:null}),kt=R(()=>Ot.value?`${t(`aiChat.viewGitChanges`)} — ${Ot.value}`:t(`aiChat.viewGitChanges`));async function At(){let e=Dt.value;if(!e){Tt.value=null,Et.value=!1;return}try{let t=await yt.git.status.query(e);Tt.value={additions:t.additions??0,deletions:t.deletions??0},Et.value=!0}catch{Tt.value=null,Et.value=!1}}C(Dt,()=>At(),{immediate:!0}),C(mt,e=>{e||At()});let jt=Rt(async()=>{document.hidden||mt.value||await At()},s8,`ai-chat-page:git-stats`);function Mt(){jt.stop()}function Nt(){Mt(),jt.start()}C(()=>l.value?.messages?.length??0,()=>{mt.value||At()}),F(()=>Nt()),te(()=>Mt());async function Pt(){ft.value&&l.value&&(O.value||(ft.value=!1,await le(),nt()))}return C([ft,l],()=>Pt()),F(async()=>{ct()&&console.time(`[ai-chat][page] mount`),ct()&&console.log(`[ai-chat][page]`,Re(),`mounted`,{drawerHideSidebar:pt.value,activeId:c.value}),o.isChatPageVisible=!0,await o.init(),o.setScrollCallback(We),s.fetchScenarios(),yt.scenario.listPresets.query().then(e=>{Fe.value=e}).catch(()=>{}),le(()=>We(!0)),Pt(),ze.start(),ct()&&console.timeEnd(`[ai-chat][page] mount`)}),ae(()=>{Ie+=1,ct()&&console.log(`[ai-chat][page]`,Re(),`updated`,{count:Ie,activeId:c.value,hasConversation:!!l.value,isStreaming:u.value,drawerHideSidebar:pt.value})}),te(()=>{ct()&&console.log(`[ai-chat][page]`,Re(),`unmounted`,{updates:Ie,activeId:c.value}),ze.stop(),o.isChatPageVisible=!1,o.setScrollCallback(()=>{})}),(e,n)=>(B(),N(V,null,[M(`div`,{class:I([`ai-chat-page`,{"ai-chat-page--no-sidebar":r(pt)}]),style:ie(r(pt)?void 0:{gridTemplateColumns:`${r(vt)}px 0 1fr`})},[r(pt)?G(``,!0):(B(),N(`div`,{key:0,class:I([`ai-chat-page__sidebar-wrap`,{"ai-chat-page__sidebar-wrap--open":de.value}])},[b(oF,{onStartNew:Ge,onSelectConversation:Ke,onDeleteConversation:qe})],2)),r(pt)?G(``,!0):(B(),N(`div`,{key:1,class:I([`ai-chat-page__resizer`,{"ai-chat-page__resizer--active":r(bt)}]),onPointerdown:n[0]||=he((...e)=>r(xt)&&r(xt)(...e),[`prevent`])},null,34)),de.value&&!r(pt)?(B(),N(`div`,{key:2,class:`ai-chat-page__backdrop`,onClick:n[1]||=e=>de.value=!1})):G(``,!0),M(`section`,I6,[ue.value||!r(l)?(B(),N(`div`,L6,[b(r(Le),{class:`ai-chat-page__menu-btn ai-chat-page__menu-btn--empty`,icon:`ti ti-menu-2`,variant:`text`,rounded:``,size:`small`,onClick:n[2]||=e=>de.value=!de.value}),b(zt,{onSelectScenario:Ye,onSkip:Je})])):(B(),N(V,{key:1},[M(`header`,R6,[M(`div`,z6,[b(r(Le),{class:`ai-chat-page__menu-btn`,icon:`ti ti-menu-2`,variant:`text`,rounded:``,size:`small`,onClick:n[3]||=e=>de.value=!de.value}),M(`div`,B6,[fe.value?(B(),W(r(Ce),{key:0,ref_key:`renameInputEl`,ref:ge,modelValue:pe.value,"onUpdate:modelValue":n[4]||=e=>pe.value=e,class:`ai-chat-page__rename-input`,size:`small`,onKeydown:[me(Ee,[`enter`]),me(Oe,[`escape`])],onBlur:Ee},null,8,[`modelValue`])):(B(),N(`h2`,{key:1,class:`ai-chat-page__title`,role:`button`,tabindex:`0`,title:r(t)(`aiChat.rename`),onClick:Te,onKeydown:me(Te,[`enter`])},[M(`span`,H6,U(r(l).title),1),n[19]||=M(`i`,{class:`ti ti-pencil ai-chat-page__title-pencil`},null,-1)],40,V6)),M(`div`,U6,[se.value?(B(),N(`span`,W6,U(se.value),1)):G(``,!0),D.value&&L.value?(B(),N(`span`,G6,[...n[20]||=[M(`i`,{class:`ti ti-spin ti-circle-filled`},null,-1),x(` Claude réfléchit… `,-1)]])):D.value&&k.value?(B(),N(`span`,K6,[...n[21]||=[M(`i`,{class:`ti ti-circle-filled`},null,-1),x(` Actif `,-1)]])):G(``,!0),r(f)?(B(),N(`div`,{key:3,class:`ai-chat-page__context-progress`,title:`Context: ${r(f).inputTokens.toLocaleString()} / ${r(f).contextWindow.toLocaleString()} tokens`},[M(`div`,J6,[M(`div`,{class:I([`ai-chat-page__context-progress-fill`,{"ai-chat-page__context-progress-fill--warn":r(p)>=70,"ai-chat-page__context-progress-fill--danger":r(p)>=90}]),style:ie({width:r(p)+`%`})},null,6)]),M(`span`,Y6,U(r(p))+`%`,1)],8,q6)):G(``,!0),r(l).kanbanBoardId?(B(),N(`a`,{key:4,class:`ai-chat-page__kanban-link`,title:`Ouvrir le tableau Kanban`,onClick:n[5]||=e=>ot(r(l).kanbanBoardId,r(l).kanbanCardId)},[n[22]||=M(`i`,{class:`ti ti-table`,style:{"font-size":`0.7rem`}},null,-1),n[23]||=x(` Kanban `,-1),r(at)?(B(),N(`span`,X6,`· `+U(r(at)),1)):G(``,!0)])):G(``,!0),r(l).id?(B(),N(`span`,{key:5,class:`ai-chat-page__conv-id`,title:r(l).id,onClick:n[6]||=e=>Ae(r(l).id)},`ID: `+U(r(l).id.slice(0,8))+`…`,9,Z6)):G(``,!0)])])]),M(`div`,Q6,[Dt.value&&Et.value?(B(),W(r(Le),{key:0,class:`ai-chat-page__git-btn`,size:`small`,variant:`text`,title:kt.value,onClick:n[7]||=e=>mt.value=!0},{default:H(()=>[Tt.value&&(Tt.value.additions||Tt.value.deletions)?(B(),N(V,{key:0},[M(`span`,$6,`+`+U(Tt.value.additions),1),M(`span`,e8,`-`+U(Tt.value.deletions),1)],64)):(B(),N(`i`,t8))]),_:1},8,[`title`])):G(``,!0),r(l).workflowType===`scenario`&&r(l).scenarioRunning?(B(),W(r(Le),{key:1,size:`small`,severity:`danger`,icon:`ti ti-player-stop`,label:`Stop`,onClick:Ze})):G(``,!0),g.value&&D.value?(B(),W(r(Le),{key:2,size:`small`,variant:`text`,severity:`warn`,icon:`ti ti-bolt`,title:`Debug: lance un PTY de stress (random data) sur cette session`,onClick:w})):G(``,!0),wt.value?(B(),W(r(Le),{key:3,size:`small`,variant:`text`,title:r(t)(`aiChat.openTerminal`),onClick:n[8]||=e=>_t.value=!0},{default:H(()=>[b(w6)]),_:1},8,[`title`])):G(``,!0),b(r(Le),{size:`small`,variant:`text`,icon:`ti ti-dots-vertical`,title:r(t)(`aiChat.menu`),"aria-label":r(t)(`aiChat.menu`),onClick:n[9]||=e=>St.value?.toggle(e)},null,8,[`title`,`aria-label`]),b(r(xe),{ref_key:`convMenu`,ref:St},{default:H(()=>[M(`div`,n8,[D.value?(B(),N(`button`,{key:0,class:`conv-menu__item`,disabled:m.value,onClick:n[10]||=e=>Ct(h)},[M(`i`,{class:I(m.value?`ti ti-spin ti-loader-2`:`ti ti-refresh`)},null,2),M(`span`,null,U(r(t)(`aiChat.syncTranscript`)),1)],8,r8)):G(``,!0),M(`button`,{class:`conv-menu__item`,onClick:n[11]||=e=>Ct(()=>r(o).pinConversation(r(l).id,r(l).pinOrder===void 0))},[M(`i`,{class:`ti ti-pin`,style:ie(r(l).pinOrder===void 0?void 0:`opacity:0.5`)},null,4),M(`span`,null,U(r(l).pinOrder===void 0?r(t)(`aiChatPage.pin`):r(t)(`aiChatPage.unpin`)),1)]),M(`button`,{class:`conv-menu__item`,onClick:n[12]||=e=>Ct(()=>r(o).archiveConversation(r(l).id,!r(l).archived))},[M(`i`,{class:`ti ti-inbox`,style:ie(r(l).archived?`opacity:0.5`:void 0)},null,4),M(`span`,null,U(r(l).archived?r(t)(`aiChatPage.unarchive`):r(t)(`aiChatPage.archive`)),1)]),M(`button`,{class:`conv-menu__item conv-menu__item--danger`,onClick:n[13]||=e=>Ct(()=>r(o).deleteConversation(r(l).id))},[n[24]||=M(`i`,{class:`ti ti-trash`},null,-1),M(`span`,null,U(r(t)(`aiChat.deleteConversation`)),1)])])]),_:1},512)])]),wt.value?(B(),W(k6,{key:0,visible:_t.value,"onUpdate:visible":n[14]||=e=>_t.value=e,"conversation-id":r(l).id,"agent-id":wt.value},null,8,[`visible`,`conversation-id`,`agent-id`])):G(``,!0),r(l).isCompanion?G(``,!0):(B(),W(l6,{key:1,enabled:!!r(l).companionEnabled,runner:_e.value,model:r(l).companionModel??``,effort:r(l).companionEffort??``,"companion-conversation-id":r(l).companionConversationId,"main-conversation-id":r(l).id,onEnable:ve,onDisable:ye,"onUpdate:runner":be,"onUpdate:model":we,"onUpdate:effort":Se},null,8,[`enabled`,`runner`,`model`,`effort`,`companion-conversation-id`,`main-conversation-id`])),r(l).workflowType===`scenario`?(B(),W(U3,{key:2,ref_key:`scenarioViewRef`,ref:Me,"available-presets":Fe.value,onClickResume:Qe},null,8,[`available-presets`])):O.value?(B(),W(Rq,{key:3,"session-id":r(l).id,runner:E.value??`claude-code`,resume:ke(r(l)),"agent-id":r(l).agentId},null,8,[`session-id`,`runner`,`resume`,`agent-id`])):(B(),W(HR,{key:4,ref_key:`messageListRef`,ref:je,messages:r(l).messages,"is-streaming":r(u),onOpenImagePreview:n[15]||=(e,t)=>Pe.value?.openImagePreview(e,t)},null,8,[`messages`,`is-streaming`])),r(l).workflowType!==`scenario`&&!O.value?(B(),W(rz,{key:5,input:ce.value,"onUpdate:input":n[16]||=e=>ce.value=e,"is-streaming":r(u),"is-streaming-current-conv":Be.value,"active-conversation-id":r(l).id,onSubmit:nt,onOpenImagePreview:n[17]||=(e,t)=>Pe.value?.openImagePreview(e,t)},null,8,[`input`,`is-streaming`,`is-streaming-current-conv`,`active-conversation-id`])):G(``,!0)],64))])],6),b(Bt,{ref_key:`modalsRef`,ref:Pe,onConfirmScenarioStart:Xe,onConfirmResumeScenario:et},null,512),b(r(Ne),{visible:mt.value,"onUpdate:visible":n[18]||=e=>mt.value=e,header:kt.value,modal:``,"dismissable-mask":``,maximizable:``,style:{width:`85vw`,height:`85vh`},"content-style":{padding:0,height:`100%`,display:`flex`,flexDirection:`column`,overflow:`hidden`}},{default:H(()=>[M(`div`,i8,[n[25]||=M(`i`,{class:`ti ti-info-circle`},null,-1),M(`span`,null,U(r(t)(`aiChat.gitChangesNotice`)),1)]),Dt.value&&mt.value?(B(),W(Vt,{key:0,"agent-id":Dt.value.agentId,"project-id":Dt.value.projectId,"org-id":Dt.value.orgId},null,8,[`agent-id`,`project-id`,`org-id`])):G(``,!0)]),_:1},8,[`visible`,`header`]),_.value&&v.value?(B(),N(`div`,a8,[M(`div`,o8,[n[26]||=M(`i`,{class:`ti ti-bolt`},null,-1),M(`span`,null,`PTY stress · `+U(S.value.toLocaleString())+` B/s`,1),M(`button`,{type:`button`,class:`ai-chat-page__pty-debug-close`,onClick:T},`×`)]),(B(),W(Rq,{key:v.value,"attach-spawn-id":v.value,"agent-id":y.value,resume:!1},null,8,[`attach-spawn-id`,`agent-id`]))])):G(``,!0)],64))}}),l8=t({default:()=>u8}),u8=ze(c8,[[`__scopeId`,`data-v-98d2d826`]]),d8={scenario_waiting_input:!0,ai_conversation_complete:!0,ai_conversation_error:!0,service_error_log:!0,service_status_changed:!0,service_health_changed:!0,service_error_log_excluded:[],service_status_changed_excluded:[],service_health_changed_excluded:[]},f8=new Set([`service_error_log_excluded`,`service_status_changed_excluded`,`service_health_changed_excluded`]),p8=0,m8=500,h8=80,g8=new Set(Object.keys(d8));function _8(e){if(!e)return;let t=e.trim();if(t&&t.startsWith(`/`)&&!t.startsWith(`//`))try{let e=new URL(t,window.location.origin);return e.origin===window.location.origin?`${e.pathname}${e.search}${e.hash}`:void 0}catch{return}}function v8(e,t){let n=e.trim();return n.length>t?`${n.slice(0,t-3)}...`:n}function y8(e){let t={};for(let[n,r]of Object.entries(e)){let e=n;if(g8.has(e)){if(f8.has(e)){if(!Array.isArray(r))continue;t[e]=r.filter(e=>typeof e==`string`&&e.length<=100).slice(0,500)}else{if(typeof r!=`boolean`)continue;t[e]=r}}}return t}var b8=et(`notification`,()=>{let e=i([]),t=i({...d8}),n=i(!1),r=R(()=>e.value.filter(e=>!e.read).length),a=R(()=>Object.entries(t.value).filter(([,e])=>e).map(([e])=>e));function o(e){return t.value[e]}function s(e,n){if(!t.value[e])return!1;let r=`${e}_excluded`;return!t.value[r]?.includes(n)}function c(e,n,r){let i=`${e}_excluded`,a=t.value[i]??[],o=r?[...new Set([...a,n])]:a.filter(e=>e!==n);return h({[i]:o})}function l(t){if(!o(t.category)||t.serviceId&&!s(t.category,t.serviceId))return;let n=_8(t.link);p8++,e.value=[{id:`notif-${p8}`,type:t.type,category:t.category,title:v8(t.title,m8),message:v8(t.message,m8),link:n,linkLabel:t.linkLabel?v8(t.linkLabel,h8):void 0,timestamp:Date.now(),read:!1},...e.value]}function u(t){e.value=e.value.map(e=>e.id===t?{...e,read:!0}:e)}function d(){e.value=e.value.map(e=>({...e,read:!0}))}function f(t){e.value=e.value.filter(e=>e.id!==t)}function p(){e.value=[]}async function m(){if(!n.value){n.value=!0;try{let e=await yt.settings.getNotificationPreferences.query(Wt());t.value={...d8,...e}}finally{n.value=!1}}}async function h(e){let r=y8(e);if(Object.keys(r).length===0)return t.value;n.value=!0;try{let e=await yt.settings.updateNotificationPreferences.mutate({...r,...Wt()});return t.value={...d8,...e},t.value}finally{n.value=!1}}return{notifications:e,unreadCount:r,preferences:t,enabledCategories:a,preferencesLoading:n,isCategoryEnabled:o,isServiceEnabled:s,setServiceExcluded:c,add:l,markRead:u,markAllRead:d,remove:f,clear:p,loadPreferences:m,updatePreferences:h}}),x8=t({useProcessStore:()=>O8}),S8=5,C8=qt,w8=5e3,T8=`runeya:ws-debug`;function E8(){try{return localStorage.getItem(T8)===`1`}catch{return!1}}function D8(...e){E8()&&console.log(`[process.store][ws]`,new Date().toISOString(),...e)}var O8=et(`process`,()=>{let e=i([]),t=i(!1),n=i(null),r=i({}),a=null,o=0,s=null,c=null,l=new Map,u=new Map,d=new Map,f=new Map,p=R(()=>e.value.length),m=R(()=>e.value.filter(e=>e.state===`running`)),h=R(()=>(t,n)=>e.value.find(e=>e.agentId===t&&e.id===n)??null),g=R(()=>t=>e.value.filter(e=>e.serviceId===t));function _(e,t){return`${e}::${t}`}function v(e,t){return`/process/${e}/${t}`}function y(e){return Xt().getById(e)?.name??e}function b(e,t){if(e.state===t.state)return;let n=b8(),r=y(t.serviceId),i=t.state===`errored`;n.add({type:i?`error`:`info`,category:`service_status_changed`,title:i?`Service errored`:`Service status changed`,message:`${r}: ${e.state} -> ${t.state}`,link:v(t.agentId,t.id),linkLabel:`Open ${r}`,serviceId:t.serviceId})}function x(e,t){if(e.healthStatus===t.healthStatus)return;let n=b8(),r=y(t.serviceId),i=t.healthStatus===`unhealthy`?`warn`:t.healthStatus===`healthy`?`success`:`info`;n.add({type:i,category:`service_health_changed`,title:`Service health changed`,message:`${r}: ${e.healthStatus} -> ${t.healthStatus}`,link:v(t.agentId,t.id),linkLabel:`Open ${r}`,serviceId:t.serviceId})}function S(e){let t=f.get(e);if(!t||t.size<=400)return;let n=Array.from(t).slice(-200);f.set(e,new Set(n))}function C(e,t){let n=_(e.agentId,e.id),r=Date.now();if(r-(d.get(n)??0)<w8)return;let i=f.get(n)??new Set;if(i.has(t.id))return;i.add(t.id),f.set(n,i),S(n),d.set(n,r);let a=b8(),o=y(e.serviceId),s=t.message.length>180?`${t.message.slice(0,177)}...`:t.message;a.add({type:`error`,category:`service_error_log`,title:`Error log on ${o}`,message:s,link:v(e.agentId,e.id),linkLabel:`Open ${o}`,serviceId:e.serviceId})}function w(e){let t=u.get(e);t&&(t.unsubscribe(),u.delete(e),d.delete(e),f.delete(e))}function T(){let t=new Set(e.value.filter(e=>e.state===`running`||e.state===`starting`).map(e=>_(e.agentId,e.id)));for(let e of Array.from(u.keys()))t.has(e)||w(e);for(let t of e.value){if(t.state!==`running`&&t.state!==`starting`)continue;let n=_(t.agentId,t.id);if(u.has(n))continue;let r=yt.process.onLog.subscribe({agentId:t.agentId,processId:t.id},{onData(n){let r=n,i=e.value.find(e=>e.id===t.id&&e.agentId===t.agentId);if(i)for(let e of r)(e.level===`error`||e.level===`fatal`)&&C(i,e)},onError(){w(n)}});u.set(n,r)}}function E(t){let n=e.value.find(e=>e.id===t.id&&e.agentId===t.agentId),i=e.value.findIndex(e=>e.id===t.id&&e.agentId===t.agentId);if(i>=0){let n=[...e.value];n[i]=t,e.value=n}else e.value=[...e.value,t];r.value={...r.value,[_(t.agentId,t.id)]:Date.now()},n&&(b(n,t),x(n,t)),T()}function D(e,t){let n=_(e.agentId,e.id),i=l.get(n);i&&(clearTimeout(i),l.delete(n));let a=setTimeout(()=>{l.delete(n),(r.value[n]??0)<=t&&E(e)},900);l.set(n,a)}function ee(){D8(`subscribeStatus()`),a=yt.process.onStatus.subscribe({},{onData(e){o=0,D8(`onStatus data`,{id:e.id,agentId:e.agentId,state:e.state}),E(e)},onError(e){a=null,console.error(`[process.store] Status subscription error:`,e.message),D8(`onStatus error`,e.message,{retryCount:o}),O()}})}function O(){if(o>=S8){console.warn(`[process.store] Max retries (${S8}) reached for status subscription`),D8(`scheduleRetry max reached`,{retryCount:o});return}let e=C8*2**o+Math.random()*300;D8(`scheduleRetry`,{retryCount:o,delay:e}),o++,s=setTimeout(()=>{s=null,D8(`retry timer fired`),ee()},e)}function k(e=!1){D8(`startStatusStream()`,{force:e,hasSub:!!a,hasRetryTimer:!!s}),c||=_t(()=>{D8(`onWsReopen — forcing status stream restart`),o=0,k(!0)}),s&&(clearTimeout(s),s=null,D8(`cleared pending retry timer`)),e&&a&&(a.unsubscribe(),a=null,D8(`forced unsubscribe existing statusSub`)),!a&&(o=0,ee())}function A(){D8(`stopStatusStream()`),c&&=(c(),null),l.forEach(e=>clearTimeout(e)),l.clear(),s&&=(clearTimeout(s),null),a&&=(a.unsubscribe(),null);for(let e of Array.from(u.keys()))w(e);o=0}async function j(){t.value=!0,n.value=null;try{e.value=await yt.process.list.query(),T()}catch(e){n.value=Pt(e)??`Failed to fetch processes`}finally{t.value=!1}}async function M(e,t){n.value=null;try{let n=Date.now(),r=await yt.process.start.mutate({agentId:e,processId:t});D(r,n);let i=tt();return i.activeProjectId&&r.serviceId&&i.addServiceToSelection({id:i.activeProjectId,orgId:i.activeOrgId},r.serviceId),r}catch(e){throw _P().openFromError(e)||(n.value=Pt(e)??`Failed to start process`),e}}async function N(e,t){n.value=null;try{let n=Date.now(),r=await yt.process.stop.mutate({agentId:e,processId:t});D(r,n);let i=tt();return i.activeProjectId&&r.serviceId&&i.removeServiceFromSelection({id:i.activeProjectId,orgId:i.activeOrgId},r.serviceId),r}catch(e){throw n.value=Pt(e)??`Failed to stop process`,e}}async function P(e,t){n.value=null;try{let n=Date.now(),r=await yt.process.restart.mutate({agentId:e,processId:t});return D(r,n),r}catch(e){throw _P().openFromError(e)||(n.value=Pt(e)??`Failed to restart process`),e}}return{processes:e,loading:t,error:n,processCount:p,runningProcesses:m,getById:h,getByService:g,fetchAll:j,start:M,stop:N,restart:P,startStatusStream:k,stopStatusStream:A}});async function k8(e){e.initTrpcWs(),await e.loadPreferences().catch(()=>{}),e.startStatusStream(),e.startDataStream()}var A8=null;function j8(){A8||=yt.project.onDataChanged.subscribe(void 0,{onData({collections:e}){if(e.includes(`projects`)&&Dt().fetchAll(),e.includes(`services`)&&Xt().fetchAll(),e.includes(`environments`)){let e=Ot(),t=e.currentProjectId;t&&e.fetchAll(t,!0)}},onError(){A8=null}})}function M8(){A8?.unsubscribe(),A8=null}var N8={class:`app-root`},P8={class:`app-root__view`},F8=[`title`],I8={key:0,class:`disconnected-overlay`},L8={class:`disconnected-box`},R8={class:`disconnected-title`},z8={class:`disconnected-subtitle`},B8=5e3,V8=ze(z({__name:`App`,setup(e){let{missing:t,visible:n,checkEnvironment:i}=_P(),a={"runeya:locale":Kt([`fr`,`en`]),"runeya-dark-mode":Kt([`0`,`1`]),"runeya-theme-color":Kt([`slate`,`orange`,`amber`,`emerald`,`teal`,`sky`,`blue`,`violet`,`pink`,`custom`]),"runeya-theme-gradient":Kt([`0`,`1`]),"runeya:mode":Kt([`local-simple`,`cloud`]),"runeya:cloudUrl":Gt().url().max(2048),"runeya:ai-chat-model":Gt().max(200),"runeya:ai-chat-effort":Kt([`low`,`medium`,`high`]),[Wn(`app`)]:Gt().max(32),[Wn(`cloud`)]:Gt().max(32)},o=[`runeya-mode`,`runeya-cloud-url`,`runeya-setup-complete`,`runeya-theme-preset`];function s(){for(let e of o)localStorage.removeItem(e);for(let[e,t]of Object.entries(a)){let n=localStorage.getItem(e);n!==null&&(t.safeParse(n).success||(console.warn(`[localStorage] Invalid value for "${e}", clearing:`,n),localStorage.removeItem(e)))}}s();let{t:c}=He(),l=De(),u=it(),d=On();async function f(){await d.check();let{status:e,current:t,latest:n}=d;e.value===`outdated`&&n.value&&l.add({severity:`warn`,summary:c(`settingsPage.updateAvailable`),detail:c(`settingsPage.updateAvailableDetail`,{current:t.value,latest:n.value}),life:8e3})}let p=O8(),h=b8(),{state:g}=vt(),{isOpen:_,isExpanded:v,toggle:y,close:x}=Ut(),S=()=>new Date().toISOString();function w(){ct()&&console.log(`[ai-chat][drawer]`,S(),`show`,{expanded:v.value,route:u.currentRoute.value.fullPath})}function T(){ct()&&console.log(`[ai-chat][drawer]`,S(),`hide`,{expanded:v.value,route:u.currentRoute.value.fullPath})}function E(e){e.ctrlKey&&e.shiftKey&&e.code===`Space`&&e.preventDefault()}function D(e){e.ctrlKey&&e.shiftKey&&e.code===`Space`&&y()}let ee=new Set([`unlock`,`setup`]),O=R(()=>ee.has(u.currentRoute.value.name)),{lockedProjectId:k}=ft(),A=R(()=>!k.value&&!O.value&&u.currentRoute.value.name!==`migrate-vault`),j=tt();function P(e){return e===`launch-services`?`launch-services:${j.activeOrgId??`local`}:${j.activeProjectId}`:void 0}let L=!1,ne=null;C(g,(e,t)=>{if(e!==`connected`){ne===null&&(ne=Date.now());return}let n=ne===null?0:Date.now()-ne;if(ne=null,!L){L=!0;return}t!==`connected`&&!O.value&&n>=B8&&window.location.reload()}),F(()=>{window.addEventListener(`keydown`,E),window.addEventListener(`keyup`,D),f(),!O.value&&Ct()&&k8({loadPreferences:()=>h.loadPreferences(),initTrpcWs:bt,startStatusStream:()=>p.startStatusStream(),startDataStream:()=>j8()})}),te(()=>{p.stopStatusStream(),M8(),window.removeEventListener(`keydown`,E),window.removeEventListener(`keyup`,D)}),C(()=>u.currentRoute.value.name,(e,t)=>{let n=ee.has(t??``),r=ee.has(e??``);n&&!r&&Ct()&&k8({loadPreferences:()=>h.loadPreferences(),initTrpcWs:bt,startStatusStream:()=>p.startStatusStream(),startDataStream:()=>j8()})});let re=Dt();return C(()=>re.currentProject?.name,e=>{document.title=e?`${e} · Runeya`:`Runeya`},{immediate:!0}),C(()=>`${re.currentProject?.id??``}::${re.currentProject?.activeEnvironmentId??``}`,()=>{let e=re.currentProject?.activeEnvironmentId;e&&i(e)},{immediate:!0}),(e,i)=>(B(),N(V,null,[b(r(Te)),b(r(be)),b(XN,{visible:r(n),"onUpdate:visible":i[0]||=e=>m(n)?n.value=e:null,missing:r(t)},null,8,[`visible`,`missing`]),A.value?(B(),W(cP,{key:0})):G(``,!0),!O.value&&r(Ct)()?(B(),W(pP,{key:1})):G(``,!0),M(`div`,N8,[b(Hn),b(nr),M(`div`,P8,[b(bn,null,{default:H(()=>[b(r(ot),null,{default:H(({Component:e,route:t})=>[(B(),W(de(e),{key:P(t.name)}))]),_:1})]),_:1})])]),b(r(We),{visible:r(_),"onUpdate:visible":i[2]||=e=>m(_)?_.value=e:null,position:`right`,"show-close-icon":!1,onShow:w,onHide:T,header:r(c)(`drawer.aiChatTitle`),"show-header":!1,class:`ai-chat-drawer`,style:ie({width:r(v)?`calc(100vw - 70px)`:`560px`})},{default:H(()=>[M(`button`,{class:`ai-drawer-expand-btn`,title:r(v)?r(c)(`drawer.collapse`):r(c)(`drawer.expand`),onClick:i[1]||=e=>v.value=!r(v)},[M(`i`,{class:I([`ti`,r(v)?`ti-chevron-right`:`ti-chevron-left`])},null,2)],8,F8),b(u8)]),_:1},8,[`visible`,`header`,`style`]),b(ve,{name:`overlay`},{default:H(()=>[r(g)!==`connected`&&!O.value?(B(),N(`div`,I8,[M(`div`,L8,[i[3]||=M(`i`,{class:`ti ti-cloud-off disconnected-icon`},null,-1),M(`h1`,R8,U(r(c)(`connection.unreachable`)),1),M(`p`,z8,U(r(c)(`connection.reconnecting`)),1),i[4]||=M(`i`,{class:`ti ti-spin ti-loader-2 disconnected-spinner`},null,-1)])])):G(``,!0)]),_:1})],64))}}),[[`__scopeId`,`data-v-52960071`]]),H8=t({router:()=>U8}),U8=st({history:at(),routes:[{path:`/unlock`,name:`unlock`,component:()=>xt(()=>import(`./UnlockPage-s8SgVcKk.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))},{path:`/migrate-vault`,name:`migrate-vault`,component:()=>xt(()=>import(`./VaultMigrationPage-s0b44MDM.js`),__vite__mapDeps([14,1,2,3,4,5,6,7,10,9,15,16]))},{path:`/launch/project`,name:`launch-project`,component:()=>xt(()=>import(`./LaunchProjectPage-saSmC7Pr.js`),__vite__mapDeps([17,1,2,4,5,3,6,18,8,9,10,7,19,15,20,21,22,23,24,25,26,27,28,29,30,11,12,31,32]))},{path:`/launch/services`,name:`launch-services`,component:()=>xt(()=>import(`./LaunchServicesPage-BkKyLMEz.js`),__vite__mapDeps([33,1,2,4,5,3,6,18,8,9,10,7,34,19,15,35,36,37,38,39,40,26,27,30,11,12,31,41]))},{path:`/`,component:()=>xt(()=>import(`./AppLayout-BMQUjPKe.js`),__vite__mapDeps([42,1,2,3,4,5,6,18,8,9,10,43,7,44,34,19,15,21,20,22,23,45,46,47,48,37,38,35,36,39,49,50,51,52,53,54,55,56,57,58,59,60,24,25,28,26,27,29,61,62,40,63])),children:[{path:``,name:`dashboard`,component:()=>xt(()=>import(`./DashboardPage-9RV7sx3e.js`),__vite__mapDeps([64,1,2,3,4,5,6,18,8,9,10,7,34,19,15,22,35,36,37,38,39,58,59,26,27,28,21,20,23,24,25,29,61,62,65])),meta:{titleKey:`dashboard.title`}},{path:`cloud`,name:`cloud-account`,component:()=>xt(()=>import(`./CloudAccountPage-B6oPg0BZ.js`).then(e=>e.n),__vite__mapDeps([66,5,1,2,4,3,6,8,9,10,19,18,15,21,22,23,46,24,25,67]))},{path:`cloud/messaging`,name:`cloud-messaging`,component:()=>xt(()=>import(`./CloudMessagingPage-C5fwVe-F.js`),__vite__mapDeps([68,1,2,4,5,3,6,7,69,18,8,9,10,43,19,15,46,48,70,37,38,35,71,21,22,23,72,73,74,75,76,77,36,78,51,45,52,49,50,79,80,81])),meta:{titleKey:`cloudMessaging.title`}},{path:`agents`,name:`agents`,redirect:{path:`/settings`,query:{section:`agents`}}},{path:`kanban`,name:`kanban-list`,component:()=>xt(()=>import(`./KanbanListPage-CWZqkjD6.js`),__vite__mapDeps([82,1,2,3,4,5,6,7,19,18,8,9,10,15,21,23,45,50,53,79,80,22,83,84,85])),meta:{titleKey:`kanban.list.title`}},{path:`issues`,name:`issues-list`,component:()=>xt(()=>import(`./KanbanListPage-CWZqkjD6.js`),__vite__mapDeps([82,1,2,3,4,5,6,7,19,18,8,9,10,15,21,23,45,50,53,79,80,22,83,84,85])),props:{mode:`list`},meta:{titleKey:`kanban.issues.title`}},{path:`kanban/:id`,name:`kanban-board`,component:()=>xt(()=>import(`./KanbanBoardPage-CQsOkRUf.js`),__vite__mapDeps([86,1,2,3,4,5,6,18,8,9,10,7,69,43,19,15,46,48,70,37,38,35,71,21,23,45,72,73,74,75,76,77,36,78,50,79,80,22,83,84,87,51,52,88])),props:!0,meta:{pageKey:`kanban-board`}},{path:`kanban/:id/card/:cardId`,name:`kanban-card`,component:()=>xt(()=>import(`./KanbanBoardPage-CQsOkRUf.js`),__vite__mapDeps([86,1,2,3,4,5,6,18,8,9,10,7,69,43,19,15,46,48,70,37,38,35,71,21,23,45,72,73,74,75,76,77,36,78,50,79,80,22,83,84,87,51,52,88])),props:!0,meta:{pageKey:`kanban-board`}},{path:`issues/:id`,name:`issues-board`,component:()=>xt(()=>import(`./KanbanBoardPage-CQsOkRUf.js`),__vite__mapDeps([86,1,2,3,4,5,6,18,8,9,10,7,69,43,19,15,46,48,70,37,38,35,71,21,23,45,72,73,74,75,76,77,36,78,50,79,80,22,83,84,87,51,52,88])),props:!0,meta:{pageKey:`kanban-board`}},{path:`issues/:id/card/:cardId`,name:`issues-card`,component:()=>xt(()=>import(`./KanbanBoardPage-CQsOkRUf.js`),__vite__mapDeps([86,1,2,3,4,5,6,18,8,9,10,7,69,43,19,15,46,48,70,37,38,35,71,21,23,45,72,73,74,75,76,77,36,78,50,79,80,22,83,84,87,51,52,88])),props:!0,meta:{pageKey:`kanban-board`}},{path:`agent-terminal`,name:`agent-terminal`,component:()=>xt(()=>import(`./AgentTerminalPage-C3TJ1NL9.js`),__vite__mapDeps([89,1,2,3,4,5,6,18,8,9,10,36,15,37,38,90,91]))},{path:`audit`,name:`audit`,component:()=>xt(()=>import(`./AuditPage-CKcExBws.js`),__vite__mapDeps([92,1,2,4,5,3,6,8,9,10,93]))},{path:`settings`,name:`settings`,component:()=>xt(()=>import(`./SettingsPage-DS2YhMIM.js`).then(e=>e.t),__vite__mapDeps([94,5,1,2,3,4,6,18,8,9,10,7,69,43,19,15,46,48,70,37,38,35,71,22,23,45,72,73,74,75,76,77,36,78,47,54,55,24,25,66,21,67,95,96,97,80,87,51,52,98,99,100,101,102,103])),meta:{titleKey:`settingsPage.title`}},{path:`api-keys`,name:`api-keys`,redirect:{path:`/settings`,query:{section:`api-keys`}}},{path:`api-docs`,name:`api-docs`,redirect:{path:`/settings`,query:{section:`api-docs`}}},{path:`ai-chat`,name:`ai-chat`,component:()=>xt(()=>Promise.resolve().then(()=>l8),void 0)},{path:`scenario/new`,name:`scenario-new`,component:()=>xt(()=>import(`./ScenarioEditorPage-MIAGh2us.js`),__vite__mapDeps([104,1,2,3,4,5,6,18,8,9,10,7,69,43,19,15,46,48,70,37,38,35,71,90,105]))},{path:`scenario/:id/edit`,name:`scenario-edit`,component:()=>xt(()=>import(`./ScenarioEditorPage-MIAGh2us.js`),__vite__mapDeps([104,1,2,3,4,5,6,18,8,9,10,7,69,43,19,15,46,48,70,37,38,35,71,90,105])),props:!0},{path:`services/new`,name:`service-create`,component:()=>xt(()=>import(`./ServiceFormPage-DXqhqXg8.js`),__vite__mapDeps([106,1,2,3,4,5,6,18,8,9,10,7,19,15,35,36,37,38,107]))},{path:`services/:id/edit`,name:`service-edit`,component:()=>xt(()=>import(`./ServiceFormPage-DXqhqXg8.js`),__vite__mapDeps([106,1,2,3,4,5,6,18,8,9,10,7,19,15,35,36,37,38,107])),props:!0},{path:`services/:id/:tab?`,name:`service-detail`,component:()=>xt(()=>import(`./ServiceDetailPage-hkSAzZ-l.js`),__vite__mapDeps([108,1,2,3,4,5,6,18,8,9,10,7,44,19,15,72,69,43,46,48,70,37,38,35,71,73,74,75,76,77,36,78,109,47,110,39,57,58,59,60,90,111,56,95,96,112,113,114,97,80,22,87,23,51,45,52,98,99,115,116,117]))},{path:`projects`,name:`projects`,redirect:{name:`dashboard`}},{path:`projects/:projectId`,name:`project-detail`,beforeEnter:async e=>{let{useProjectLaunchStore:t}=await xt(async()=>{let{useProjectLaunchStore:e}=await import(`./project-launch.store-y7JBMNiE.js`).then(e=>e.t);return{useProjectLaunchStore:e}},__vite__mapDeps([18,5,1,2,8,9,10])),{useProjectStore:n}=await xt(async()=>{let{useProjectStore:e}=await import(`./project.store-DGJr0Qr9.js`).then(e=>e.t);return{useProjectStore:e}},__vite__mapDeps([19,5,1,2,18,8,9,10,15])),r=t(),i=n(),a=e.params.projectId,o=i.getById(a);return o?r.setActiveProject(o.id,o.orgId??null):r.setActiveProject(a),{name:`dashboard`}}},{path:`projects/:projectId/environments`,name:`environments`,component:()=>xt(()=>import(`./EnvironmentListPage-B8uATPBI.js`),__vite__mapDeps([118,1,2,3,4,5,6,18,8,9,10,7,19,15,53,119,36,37,38,111,35,56,90,95,96,112,120,121])),meta:{titleKey:`environmentList.title`}},{path:`projects/:projectId/environments/:id/edit`,name:`environment-edit`,component:()=>xt(()=>import(`./EnvironmentFormPage-BmAxhN-m.js`),__vite__mapDeps([122,1,2,4,5,3,6,7,19,18,8,9,10,15,119,36,37,38,111,35,56,90,95,96,112,120,123])),meta:{titleKey:`environmentFormPage.editTitle`,backTo:`environments`}},{path:`process/:agentId/:processId`,name:`process-detail`,component:()=>xt(()=>import(`./ProcessDetailPage-CQgu5uKm.js`),__vite__mapDeps([124,1,2,4,5,3,6,7,8,9,10,36,18,15,37,38,58,59,113,114,97,69,43,19,46,48,70,35,71,72,73,74,75,76,77,78,80,22,87,23,51,45,52,98,125])),props:!0},{path:`wiki`,name:`wiki-global`,component:()=>xt(()=>import(`./WikiPage-DADu8WUA.js`),__vite__mapDeps([126,2,1,115,3,4,5,6,7,8,9,10,116]))},{path:`dev/random-job-test`,name:`dev-random-job-test`,component:()=>xt(()=>import(`./RandomJobTestPage-BUS2Ty6-.js`),__vite__mapDeps([127,1,2,4,5,3,6,8,9,10,128]))}]}]}),W8=new Set([`launch-project`,`launch-services`]),G8=!1,K8=!1,q8=!1;async function J8(){if(q8)return!1;q8=!0;let e=tt();try{let t=await yt.process.list.query(),n=Qt(t);if(n.size===0)return!1;let r=await yt.project.list.query(),i=null,a=0;for(let e of r){let t=e.serviceIds.filter(e=>n.has(e)).length;t>a&&(a=t,i=e)}return i?(e.setActiveProject(i.id,i.orgId??null),e.completeLaunch(),!0):!1}catch(e){return console.error(`[router] Failed to detect running services:`,e),!1}}var Y8=null;async function X8(e){if(Y8!==null)return Y8;try{let t=(await yt.project.list.query()).find(t=>t.id===e);Y8=t?{id:t.id,orgId:t.orgId??null}:!1,t||console.warn(`[router] Projet ${e} (--project) introuvable : liste des projets affichée.`)}catch(e){return console.error(`[router] Failed to resolve locked project:`,e),!1}return Y8}async function Z8(e){let t=mt();if(!t)return;let n=await X8(t);if(!n)return;let r=tt();if((r.activeProjectId!==n.id||r.activeOrgId!==n.orgId)&&(r.setActiveProject(n.id,n.orgId),r.launchCompleted=!1,e.name!==`launch-services`)||e.name===`launch-project`)return{name:`launch-services`,replace:!0};let i=e.params.projectId;if(typeof i==`string`&&i!==n.id)return{name:`dashboard`,replace:!0}}U8.beforeEach(async e=>{if(e.name===`unlock`)return;if(!G8){G8=!0;try{let t=await wt();if(St(t.ciMode===!0),t.state!==`unlocked`||!t.ciMode&&!Tt())return{name:`unlock`,replace:!0};if(t.legacyVault&&e.name!==`migrate-vault`)return{name:`migrate-vault`,replace:!0}}catch{return{name:`unlock`,replace:!0}}}if(!Tt())try{let e=await wt();if(St(e.ciMode===!0),e.state!==`unlocked`||!e.ciMode)return{name:`unlock`,replace:!0}}catch{return{name:`unlock`,replace:!0}}if(e.name===`migrate-vault`)return;await gt();let t=await Z8(e);if(t)return t;if(W8.has(e.name))return;let n=tt();if(!n.launchCompleted&&!n.activeProjectId&&!await J8())return{name:`launch-project`};if(!K8&&n.activeProjectId){K8=!0;try{if(!(await yt.project.list.query()).some(e=>e.id===n.activeProjectId&&(e.orgId??null)===n.activeOrgId))return n.resetLaunch(),{name:`launch-project`}}catch(e){return console.error(`[router] Failed to validate current project:`,e),n.resetLaunch(),{name:`launch-project`}}}});var Q8={class:`trigger-blob`},$8={class:`theme-layer`},e5={class:`theme-picker`},t5={class:`theme-section theme-section--row`},n5={class:`section-label`},r5={class:`theme-section theme-section--row`},i5={class:`section-label`},a5={class:`theme-section`},o5={class:`section-label`},s5={class:`swatches`},c5=[`title`,`aria-label`,`aria-pressed`,`onClick`],l5={class:`custom-hue-header`},u5={class:`section-label`},d5={class:`custom-hue-track-wrap`},f5=`#18181b`,p5=`#f8fafc`,m5=ze(z({__name:`ThemePicker`,setup(e){let t=dn.map(e=>({id:e,label:e[0].toUpperCase()+e.slice(1)}));function n(e){let t=nn(e);return[t[700],t[500],t[300],t[100]]}function a(e){let t=Number.parseInt(e.slice(1,3),16)/255,n=Number.parseInt(e.slice(3,5),16)/255,r=Number.parseInt(e.slice(5,7),16)/255,i=Math.max(t,n,r),a=Math.min(t,n,r);if(i===a)return 0;let o=i-a,s=0;return s=i===t?((n-r)/o+(n<r?6:0))/6:i===n?((r-t)/o+2)/6:((t-n)/o+4)/6,Math.round(s*360)}let o=localStorage.getItem(`runeya-theme-color`)??`emerald`,s=localStorage.getItem(`runeya-theme-custom`)??`#10b981`,c=localStorage.getItem(`runeya-dark-mode`)===`1`,l=localStorage.getItem(`runeya-theme-gradient`)===`1`,u=i(o),d=i(s),f=i(a(s)),p=i(c),m=i(l),{t:h}=He(),g=R(()=>{if(u.value===`custom`)return d.value;let e=t.find(e=>e.id===u.value)??t[3];return tn[e.id][500]}),_=R(()=>n(g.value));function v(e){m.value=e,localStorage.setItem(`runeya-theme-gradient`,e?`1`:`0`),ln(e)}function y(e){u.value=e,localStorage.setItem(`runeya-theme-color`,e),rn(e,p.value,d.value)}function S(e){p.value=e,localStorage.setItem(`runeya-dark-mode`,e?`1`:`0`),rn(u.value,e,d.value)}function w(e){let t=e?.[0];t!==void 0&&(f.value=t,d.value=cn(t),localStorage.setItem(`runeya-theme-custom`,d.value),u.value=on,localStorage.setItem(`runeya-theme-color`,on),rn(on,p.value,d.value))}return C(d,e=>{/^#[0-9a-f]{6}$/i.test(e)&&(f.value=a(e))}),(e,i)=>(B(),W(r(Ue),null,{default:H(()=>[b(r(gn),{class:`theme-trigger`,title:r(h)(`themePicker.title`),"aria-label":r(h)(`themePicker.title`)},{default:H(()=>[M(`span`,Q8,[(B(!0),N(V,null,P(_.value,(e,t)=>(B(),N(`span`,{key:t,class:`rad`,style:ie({backgroundColor:e})},null,4))),128))])]),_:1},8,[`title`,`aria-label`]),(B(),W(ue,{to:`body`},[M(`div`,$8,[b(r(Xe),{class:`theme-popover`,side:`bottom`,align:`end`,"side-offset":6,"collision-padding":8},{default:H(()=>[M(`div`,e5,[M(`div`,t5,[M(`span`,n5,U(r(h)(`themePicker.gradient`)),1),b(r(Re),{class:`gradient-toggle`,"model-value":m.value,"aria-label":m.value?r(h)(`themePicker.disableGradient`):r(h)(`themePicker.enableGradient`),"onUpdate:modelValue":v},{default:H(()=>[b(r(ye),{class:`gradient-toggle__thumb`})]),_:1},8,[`model-value`,`aria-label`])]),i[3]||=M(`div`,{class:`theme-divider`},null,-1),M(`div`,r5,[M(`span`,i5,U(r(h)(`themePicker.mode`)),1),b(r(Oe),{type:`single`,class:`mode-toggle`,"model-value":p.value?`dark`:`light`,"aria-label":r(h)(`themePicker.mode`),"onUpdate:modelValue":i[0]||=e=>e&&S(e===`dark`)},{default:H(()=>[b(r(Me),{value:`dark`,class:`mode-btn`},{default:H(()=>[i[1]||=M(`i`,{class:`ti ti-moon`,"aria-hidden":`true`},null,-1),x(` `+U(r(h)(`themePicker.dark`)),1)]),_:1}),b(r(Me),{value:`light`,class:`mode-btn`},{default:H(()=>[i[2]||=M(`i`,{class:`ti ti-sun`,"aria-hidden":`true`},null,-1),x(` `+U(r(h)(`themePicker.light`)),1)]),_:1})]),_:1},8,[`model-value`,`aria-label`])]),i[4]||=M(`div`,{class:`theme-divider`},null,-1),M(`div`,a5,[M(`span`,o5,U(r(h)(`themePicker.accentColor`)),1),M(`div`,s5,[(B(!0),N(V,null,P(r(t),e=>(B(),N(`button`,{key:e.id,type:`button`,class:I([`swatch`,{active:u.value===e.id}]),title:e.label,"aria-label":e.label,"aria-pressed":u.value===e.id,style:ie({"--swatch-bg":p.value?f5:p5}),onClick:t=>y(e.id)},[M(`span`,{class:`viewwindow`,style:ie({backgroundColor:p.value?f5:p5})},[(B(!0),N(V,null,P(n(r(tn)[e.id][500]),(e,t)=>(B(),N(`span`,{key:t,class:`rad`,style:ie({backgroundColor:e})},null,4))),128))],4)],14,c5))),128))])]),M(`div`,{class:I([`theme-section custom-hue-section`,{"custom-hue-section--active":u.value===r(on)}])},[M(`div`,l5,[M(`span`,u5,U(r(h)(`themePicker.customColor`)),1),M(`span`,{class:`custom-hue-preview`,style:ie({backgroundColor:d.value})},null,4)]),M(`div`,d5,[b(r(Ge),{class:`custom-hue-slider`,"model-value":[f.value],min:0,max:359,"aria-label":r(h)(`themePicker.customColor`),"onUpdate:modelValue":w},{default:H(()=>[b(r(Be),{class:`custom-hue-slider__track`}),b(r(Pe),{class:`custom-hue-slider__thumb`})]),_:1},8,[`model-value`,`aria-label`])])],2)])]),_:1})])]))]),_:1}))}}),[[`__scopeId`,`data-v-53186dc2`]]),h5=[`width`,`height`],g5=[`rx`],_5=[`transform`],v5=[`d`,`stroke-width`],y5=[`cx`,`cy`,`r`],b5=ze(z({__name:`RuneyaLogo`,props:{size:{default:28}},setup(e){return(t,n)=>(B(),N(`svg`,{class:`runeya-logo`,viewBox:`0 0 100 100`,width:e.size,height:e.size,"aria-hidden":`true`},[M(`rect`,{class:`runeya-logo__bg`,width:`100`,height:`100`,rx:r(en).radius},null,8,g5),M(`g`,{transform:`translate(50 50) scale(${r(an)}) translate(-50 -50)`},[M(`path`,{class:`runeya-logo__stroke`,d:r(fn).path,fill:`none`,"stroke-width":r(fn).stroke,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,8,v5),(B(!0),N(V,null,P(r(fn).dots,([e,t],n)=>(B(),N(`circle`,{key:n,class:`runeya-logo__fill`,cx:e,cy:t,r:r(fn).dotRadius},null,8,y5))),128))],8,_5)],8,h5))}}),[[`__scopeId`,`data-v-85f26936`]]),x5=t({announceThemeToServer:()=>S5});async function S5(){try{await yt.desktop.setTrayAccent.mutate({color:un()})}catch{}}globalThis.Buffer=hn.Buffer;async function C5(){try{let e=await yt.config.cloud.query();kt(e)}catch(e){console.warn(`[cloud] Failed to fetch cloud config, using defaults:`,e)}}async function w5(){try{ht(await yt.config.app.query())}catch(e){console.warn(`[app] Failed to fetch app mode:`,e)}finally{pt()}}var T5=_e(V8);T5.use(nt()),T5.use(U8),T5.use(rt),sn(()=>{S5()}),$t(),_t(()=>{S5()}),T5.directive(`tooltip`,Ye),Ee(e=>{try{let t=b8(),n={info:`info`,warn:`warn`,error:`error`,success:`success`,secondary:`info`}[e.severity??`info`]??`info`;t.add({type:n,title:String(e.summary??``),message:String(e.detail??``),category:`service_status_changed`})}catch{}}),T5.config.errorHandler=(e,t,n)=>{console.error(`[Vue Error]`,e,n);let r=e instanceof Error?e.message:`An unexpected error occurred`;De().add({severity:`error`,summary:`Unexpected Error`,detail:r,life:5e3})};async function E5(){if(Tt()){Et(),bt();return}try{let e=await wt();St(e.ciMode===!0),e.state===`unlocked`&&e.ciMode&&bt()}catch{}}Promise.all([C5(),w5(),E5()]).finally(()=>{T5.mount(`#app`)});export{T0 as A,VN as B,K4 as C,z1 as D,U4 as E,RI as F,er as G,kd as H,AP as I,Jn as K,jP as L,X1 as M,Fq as N,H1 as O,sR as P,$N as R,t3 as S,W4 as T,Fd as U,BN as V,Ad as W,m6 as _,j8 as a,K3 as b,O8 as c,A6 as d,j6 as f,f6 as g,d6 as h,H8 as i,f4 as j,B1 as k,b8 as l,p6 as m,b5 as n,k8 as o,w6 as p,On as q,m5 as r,x8 as s,x5 as t,F6 as u,Y3 as v,n1 as w,G3 as x,q3 as y,QN as z};
|