@runeya/runeya 2.0.155 → 2.0.156
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/package.json +1 -1
- package/web/assets/{AgentScalarChatInterface.vue-Ck92wZRY.js → AgentScalarChatInterface.vue-CtkvKRSd.js} +1 -1
- package/web/assets/{AgentTerminalPage-CWxJgIyT.js → AgentTerminalPage-Dt9S2kZX.js} +1 -1
- package/web/assets/{AiChatModals-CZfc7DCS.js → AiChatModals-BEpSEXmp.js} +1 -1
- package/web/assets/{AppLayout-C-zC5Nq5.js → AppLayout-DIAQvecQ.js} +1 -1
- package/web/assets/{AuditPage-CG-iKGRS.js → AuditPage-BEt0m-rM.js} +1 -1
- package/web/assets/{CloudAccountPage-C0SaUlEP.js → CloudAccountPage-BGijgepw.js} +1 -1
- package/web/assets/{CloudMessagingPage-BbG6aW1i.js → CloudMessagingPage-C9uWAT8S.js} +1 -1
- package/web/assets/{DashboardPage-C1_Lr5-g.js → DashboardPage-DFiL6A-k.js} +1 -1
- package/web/assets/{DirectoryPickerDialog-BBOr9Jkh.js → DirectoryPickerDialog-C8dwWIUa.js} +1 -1
- package/web/assets/{EnvironmentForm-Dq0FHywb.js → EnvironmentForm-DZgZitCy.js} +1 -1
- package/web/assets/{EnvironmentFormPage-CyNvvWUf.js → EnvironmentFormPage-ubP8cX3l.js} +1 -1
- package/web/assets/{EnvironmentListPage-LAtCQh6k.js → EnvironmentListPage-CPs1uuvs.js} +1 -1
- package/web/assets/{KanbanBoardPage-BLnT_9si.js → KanbanBoardPage-C9NqOqdD.js} +3 -3
- package/web/assets/{KanbanListPage-DZmHgO6H.js → KanbanListPage-D_ZpIbT2.js} +1 -1
- package/web/assets/{KnowledgeListPage-BAxHAgMa.js → KnowledgeListPage-BoaV9hBg.js} +1 -1
- package/web/assets/{KnowledgePagePage-C-hLZet3.js → KnowledgePagePage-UGJGJY4d.js} +1 -1
- package/web/assets/{LaunchProjectPage-B2DsNWz6.js → LaunchProjectPage-B0Lg5Kr5.js} +1 -1
- package/web/assets/{LaunchServicesPage-DIZOLOO_.js → LaunchServicesPage-D_pqkdXt.js} +1 -1
- package/web/assets/{LaunchShell-B_uaNliB.js → LaunchShell-CJtXkSUp.js} +1 -1
- package/web/assets/{LogViewer-B58dkD3M.js → LogViewer-DLxO4-gP.js} +1 -1
- package/web/assets/{OrgKeyPrompt-CXlxmdhU.js → OrgKeyPrompt-Cbx4cLL0.js} +1 -1
- package/web/assets/{ProcessControls-DJZgFpWJ.js → ProcessControls-Cx-QzqxQ.js} +1 -1
- package/web/assets/{ProcessDetailPage-GBZ6Ks3X.js → ProcessDetailPage-Bxwv0984.js} +1 -1
- package/web/assets/{ProjectCreateDialog-U4EMua6x.js → ProjectCreateDialog-HcYVX36i.js} +1 -1
- package/web/assets/{ProjectLocationGate-CMAv9dl7.js → ProjectLocationGate-PR92Tdos.js} +1 -1
- package/web/assets/{ProjectPublishDialog-CV0dp1Hm.js → ProjectPublishDialog-YvOeVDCP.js} +1 -1
- package/web/assets/{RandomJobTestPage-y3jSAISj.js → RandomJobTestPage-Bp9qone4.js} +1 -1
- package/web/assets/{ScenarioEditorPage-CeeD0EYJ.js → ScenarioEditorPage-Cjkkz3JB.js} +1 -1
- package/web/assets/{SendToChatDialog-C-iQSBC2.js → SendToChatDialog-CQbi2P_L.js} +1 -1
- package/web/assets/{ServiceControlsBar-DpWmXwXA.js → ServiceControlsBar-9jsN3h0c.js} +1 -1
- package/web/assets/{ServiceDetailPage-CDSHAgOi.js → ServiceDetailPage-COHMUw51.js} +1 -1
- package/web/assets/{ServiceFormPage-BDyi1Lvc.js → ServiceFormPage-B4n8scwP.js} +1 -1
- package/web/assets/{SettingsPage-BHYV-7ne.js → SettingsPage-C3PnwdxZ.js} +4 -4
- package/web/assets/{UnlockPage-BBkZa-OK.js → UnlockPage-BIB0NtWF.js} +1 -1
- package/web/assets/{VaultMigrationPage-CaLuNVJP.js → VaultMigrationPage-D27SeEVr.js} +1 -1
- package/web/assets/{VersionBadge-DsexD25N.js → VersionBadge-FeuuTMz7.js} +1 -1
- package/web/assets/{WikiPage-DM5LpnlK.js → WikiPage-A8C0dEDX.js} +1 -1
- package/web/assets/{WikiView-CXeS9asq.js → WikiView-D3c0r5q8.js} +1 -1
- package/web/assets/{add-scalar-classes-CkQNvwHs.js → add-scalar-classes-Ohd6-7G3.js} +1 -1
- package/web/assets/{agent.store-Cwfle88d.js → agent.store-BwUoohNu.js} +1 -1
- package/web/assets/{auth-B64yo032.js → auth-DdEdmJV5.js} +2 -2
- package/web/assets/{cloud-chat.store-C9FNT6Qr.js → cloud-chat.store-za5cBdZx.js} +1 -1
- package/web/assets/{cloud-client-SZTY3IQP.js → cloud-client-zXY8HZtj.js} +2 -2
- package/web/assets/{cloud-session-BmIlHjQN.js → cloud-session-DqfQKW5D.js} +2 -2
- package/web/assets/{index-aI2QzxNG.js → index-CYcPxjSC.js} +4 -4
- package/web/assets/{index-BKbnsVKD.css → index-DozDRY7J.css} +1 -1
- package/web/assets/{knowledge-host-DOhNIg0F.js → knowledge-host-ButMqDET.js} +3 -3
- package/web/assets/{modal-Ba8aIfHn.js → modal-B9eahS9q.js} +1 -1
- package/web/assets/{notification.store-PIPjftPf.js → notification.store-CWs6iQmx.js} +1 -1
- package/web/assets/{project-launch.store-CEJebMgi.js → project-launch.store-DkD7Q9jW.js} +1 -1
- package/web/assets/{project.store-C88HetpW.js → project.store-CnflI3la.js} +1 -1
- package/web/assets/{scenario.store-CkrvgMMi.js → scenario.store-DGt8nNt5.js} +1 -1
- package/web/assets/{service.store-Dq07zl0D.js → service.store-yECOKc1C.js} +1 -1
- package/web/assets/{settings-scope-B8S18shP.js → settings-scope-Ca1LjLG1.js} +1 -1
- package/web/assets/{settings.store-DRNoHPt8.js → settings.store-Cyop63CA.js} +1 -1
- package/web/assets/{src-C35Mv-XP.js → src-8YjxNhhv.js} +1 -1
- package/web/assets/{src-nJXWA92m.js → src-BD3q9_go.js} +1 -1
- package/web/assets/{trpc-CDNqXCOY.js → trpc-DlM4IpMe.js} +3 -3
- package/web/assets/{useCloudOrg-DhN5nrBd.js → useCloudOrg-Ck6Ef1iD.js} +1 -1
- package/web/assets/{useEnvVarAutocomplete-DqQSK0lV.js → useEnvVarAutocomplete-B0fhZK-_.js} +1 -1
- package/web/assets/{useProjectCatalog-DXYezh7t.js → useProjectCatalog-D1RgJoOm.js} +1 -1
- package/web/assets/{useProjectCloudOrg-C2pj6wfv.js → useProjectCloudOrg-tnlpo5R1.js} +1 -1
- package/web/assets/{useServiceUrlHost-BOwIYVml.js → useServiceUrlHost-Xzj6EOft.js} +1 -1
- package/web/index.html +15 -15
|
@@ -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 O,St as k,Ut as A,Y as j,Yt as M,_ as N,b as P,bt as F,ct as I,en as L,et as R,ft as ee,g as z,gt as te,it as ne,k as B,mt as V,nn as re,o as H,pt as ie,qt as U,rn as W,rt as ae,st as oe,tn as se,tt as ce,u as le,v as G,wt as ue,xt as de,y as K,z as fe}from"./runtime-core.esm-bundler-DujKY9QV.js";import{C as pe,S as me,i as he,t as ge,w as _e}from"./runtime-dom.esm-bundler-CyEVRK6B.js";import{n as ve}from"./vue-i18n-o7yraQpR.js";import{a as ye,i as be,n as xe,r as Se}from"./project-launch.store-CEJebMgi.js";import{r as Ce}from"./i18n-B8hHo8g2.js";import{g as we,h as Te}from"./useApi-s_02lHjl-DZYO2tHU.js";import{i as Ee,n as De,r as Oe}from"./vue-router--yRg_Dd_.js";import{$ as ke,A as Ae,C as je,H as Me,J as Ne,L as Pe,M as Fe,N as Ie,P as Le,Q as Re,S as ze,U as Be,W as Ve,X as He,Y as Ue,at as We,ct as Ge,d as Ke,dt as q,et as qe,ft as Je,it as Ye,lt as Xe,nt as Ze,o as Qe,ot as $e,q as et,rt as tt,st as nt,t as rt,tt as it,u as at,ut as ot,w as st}from"./src-CcVk2-Gw.js";import{a as ct,i as lt,o as ut,r as dt,t as ft}from"./scenario.store-CkrvgMMi.js";import{a as pt,i as mt,n as ht,r as gt,t as _t}from"./app-mode-BVpTuh0i.js";import{n as vt,o as yt,r as J,t as bt}from"./trpc-CDNqXCOY.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-B64yo032.js";import{n as Dt,r as Ot}from"./project.store-C88HetpW.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-DXYezh7t.js";import{n as Pt,r as Ft}from"./error-DpF7X5iu.js";import{n as It,r as Lt}from"./cloud-client-SZTY3IQP.js";import{t as Rt}from"./use-polling-CEkhIY_9.js";import{o as zt}from"./editor.api-Bef3xeth.js";import{i as Bt,r as Vt,t as Ht}from"./AiChatModals-CZfc7DCS.js";import{t as Ut}from"./useAiChatDrawer-D_ofn8Eo.js";import{g as Wt,n as Gt}from"./schemas-68I2iCLF.js";import{a as Kt,n as qt,r as Jt}from"./dist-Cx_klvkk.js";import{t as Yt}from"./service.store-Dq07zl0D.js";import{t as Xt}from"./notification.store-PIPjftPf.js";import{t as Zt}from"./agent.store-Cwfle88d.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(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(K(e,SharedArrayBuffer)||e&&K(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(K(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`||fe(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(K(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),K(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(K(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)||K(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 ce(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return ue(e).length;default:if(i)return r?-1:ce(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 F(this,t,n);case`utf8`:case`utf-8`:return A(this,t,n);case`ascii`:return N(this,t,n);case`latin1`:case`binary`:return P(this,t,n);case`base64`:return k(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return I(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?A(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(K(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,fe(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(fe(r))return o;e[n+o]=r}return o}function T(e,t,n,r){return de(ce(t,e.length-n),e,n,r)}function E(e,t,n,r){return de(le(t),e,n,r)}function D(e,t,n,r){return de(ue(t),e,n,r)}function O(e,t,n,r){return de(G(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 O(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 k(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function A(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 M(r)}var j=4096;function M(e){let t=e.length;if(t<=j)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=j));return n}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]&127);return r}function P(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 F(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+=pe[e[r]];return i}function I(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 L(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||L(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||L(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||L(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(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||L(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=me(function(e){e>>>=0,W(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ae(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=me(function(e){e>>>=0,W(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ae(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||L(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||L(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||L(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||L(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||L(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||L(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||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=me(function(e){e>>>=0,W(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ae(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=me(function(e){e>>>=0,W(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ae(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||L(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!1,52,8)};function R(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;R(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;R(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||R(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||R(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||R(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||R(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||R(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 ee(e,t,n,r,i){U(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 z(e,t,n,r,i){U(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=me(function(e,t=0){return ee(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=me(function(e,t=0){return z(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);R(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);R(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||R(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||R(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||R(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||R(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||R(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=me(function(e,t=0){return ee(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=me(function(e,t=0){return z(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function te(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function ne(e,t,r,i,a){return t=+t,r>>>=0,a||te(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return ne(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return ne(this,e,t,!1,n)};function B(e,t,r,i,a){return t=+t,r>>>=0,a||te(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return B(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 V={};function re(e,t,n){V[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}`}}}re(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),re(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),re(`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=H(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=H(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function H(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 ie(e,t,n){W(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&ae(t,e.length-(n+1))}function U(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 V.ERR_OUT_OF_RANGE(`value`,i,e)}ie(r,i,a)}function W(e,t){if(typeof e!=`number`)throw new V.ERR_INVALID_ARG_TYPE(t,`number`,e)}function ae(e,t,n){throw Math.floor(e)===e?t<0?new V.ERR_BUFFER_OUT_OF_BOUNDS:new V.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(W(e,n),new V.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var oe=/[^+/0-9A-Za-z-_]/g;function se(e){if(e=e.split(`=`)[0],e=e.trim().replace(oe,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function ce(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 le(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function G(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 ue(e){return t.toByteArray(se(e))}function de(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 K(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function fe(e){return e!==e}var pe=(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 me(e){return typeof BigInt>`u`?he:e}function he(){throw Error(`BigInt not supported`)}}))(),gn=B({__name:`PopoverTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,n=tt(),{forwardRef:i,currentElement:a}=ot();return n.triggerId||=Xe(void 0,`reka-popover-trigger`),n.contentId||=Xe(void 0,`reka-popover-content`),I(()=>{n.triggerElement.value=a.value}),(e,a)=>(V(),G(ue(r(n).hasCustomAnchor.value?r(Ge):r(nt)),{"as-child":``},{default:U(()=>[b(r(Ge),{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:U(()=>[de(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=Je(B({__name:`ErrorBoundary`,setup(e){let{t}=ve(),n=i(null);oe(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?(V(),P(`div`,_n,[N(`div`,vn,[i[0]||=N(`i`,{class:`ti ti-alert-triangle error-icon`},null,-1),N(`h3`,null,W(r(t)(`errorBoundary.title`)),1),N(`p`,yn,W(n.value.message),1),b(r(q),{label:r(t)(`errorBoundary.tryAgain`),icon:`ti ti-refresh`,onClick:a},null,8,[`label`])])])):de(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 J.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:z(()=>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=Je(B({__name:`AppUpdateDialog`,props:{visible:{type:Boolean},currentVersion:{},latestVersion:{}},emits:[`update:visible`,`updated`],setup(e,{emit:t}){let{t:n}=ve(),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 J.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 J.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 J.appUpdate.restart.mutate()}catch{}}return C(()=>a.visible,e=>{e&&f()}),(t,i)=>(V(),G(r(Ue),{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:U(()=>[s.value===`blocked`||s.value===`failed`?(V(),G(r(q),{key:0,label:r(n)(`appUpdate.retry`),severity:`secondary`,onClick:f},null,8,[`label`])):K(``,!0),s.value===`ready`?(V(),G(r(q),{key:1,label:r(n)(`appUpdate.install`),icon:`ti ti-download`,onClick:p},null,8,[`label`])):K(``,!0),s.value===`installed`?(V(),G(r(q),{key:2,label:r(n)(`appUpdate.restartLater`),severity:`secondary`,onClick:i[0]||=e=>o(`update:visible`,!1)},null,8,[`label`])):K(``,!0),s.value===`installed`?(V(),G(r(q),{key:3,label:r(n)(`appUpdate.restartNow`),icon:`ti ti-refresh`,onClick:m},null,8,[`label`])):K(``,!0),s.value===`restarting`?(V(),G(r(q),{key:4,label:r(n)(`appUpdate.restarting`),icon:`ti ti-spin ti-loader-2`,disabled:``},null,8,[`label`])):K(``,!0)]),default:U(()=>[N(`p`,kn,W(r(n)(`appUpdate.dialogLead`,{current:e.currentVersion??`—`,latest:e.latestVersion??`—`})),1),s.value===`checking`?(V(),P(`div`,An,[b(r(Me),{style:{width:`1.5rem`,height:`1.5rem`},strokeWidth:`6`}),N(`span`,null,W(r(n)(`appUpdate.checking`)),1)])):c.value?(V(),P(`div`,jn,[N(`div`,Mn,[i[2]||=N(`i`,{class:`ti ti-circle-check update-dialog__ok`},null,-1),N(`span`,null,W(r(n)(`appUpdate.nodeFound`,{version:c.value.nodeVersion})),1)]),N(`div`,Nn,[N(`i`,{class:L(c.value.npmVersion?`ti ti-circle-check update-dialog__ok`:`ti ti-circle-x update-dialog__ko`)},null,2),c.value.npmVersion?(V(),P(`span`,Pn,W(r(n)(`appUpdate.npmFound`,{version:c.value.npmVersion,path:c.value.npmPath})),1)):(V(),P(`span`,Fn,W(r(n)(`appUpdate.npmMissing`)),1))]),c.value.globalPrefix?(V(),P(`div`,In,[i[3]||=N(`i`,{class:`ti ti-folder update-dialog__info`},null,-1),N(`span`,null,W(r(n)(`appUpdate.installTarget`,{prefix:c.value.globalPrefix})),1)])):K(``,!0)])):K(``,!0),s.value===`blocked`&&!c.value?.npmVersion?(V(),G(r(Ve),{key:2,severity:`warn`},{default:U(()=>[x(W(r(n)(`appUpdate.npmMissingHelp`)),1)]),_:1})):K(``,!0),d.value?(V(),G(r(Ve),{key:3,severity:`error`},{default:U(()=>[x(W(d.value),1)]),_:1})):K(``,!0),s.value===`installing`?(V(),P(`div`,Ln,[b(r(Me),{style:{width:`1.5rem`,height:`1.5rem`},strokeWidth:`6`}),N(`span`,null,W(r(n)(`appUpdate.installing`)),1)])):K(``,!0),s.value===`installed`?(V(),G(r(Ve),{key:5,severity:`success`},{default:U(()=>[x(W(r(n)(`appUpdate.installed`,{version:u.value??e.latestVersion??``})),1)]),_:1})):K(``,!0),s.value===`failed`?(V(),G(r(Ve),{key:6,severity:`error`},{default:U(()=>[x(W(r(n)(`appUpdate.installFailed`)),1)]),_:1})):K(``,!0),l.value?(V(),P(`pre`,Rn,W(l.value),1)):K(``,!0),s.value===`installed`?(V(),G(r(Ve),{key:8,severity:`info`},{default:U(()=>[x(W(r(n)(`appUpdate.restartNeeded`)),1)]),_:1})):K(``,!0)]),_:1},8,[`visible`,`header`,`closable`]))}}),[[`__scopeId`,`data-v-bcce910d`]]),Bn={key:0,class:`update-banner`},Vn=3e5,Hn=Je(B({__name:`AppUpdateBanner`,setup(e){let{t}=ve(),{isDesktop:n}=pt(),{current:a,latest:o,outdated:s,check:c}=On(),l=i(!1),u=null;function d(){document.visibilityState===`visible`&&c()}return I(()=>{n.value&&(c(),u=setInterval(()=>void c(),Vn),document.addEventListener(`visibilitychange`,d))}),ee(()=>{u!==null&&clearInterval(u),document.removeEventListener(`visibilitychange`,d)}),(e,i)=>(V(),P(H,null,[r(n)&&r(s)?(V(),P(`div`,Bn,[i[3]||=N(`i`,{class:`ti ti-circle-arrow-up update-banner__icon`},null,-1),N(`span`,null,W(r(t)(`appUpdate.bannerText`,{current:r(a),latest:r(o)})),1),b(r(q),{label:r(t)(`appUpdate.bannerAction`),size:`small`,severity:`contrast`,onClick:i[0]||=e=>l.value=!0},null,8,[`label`])])):K(``,!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 J.changelog.index.query({surface:`app`,since:null});return Kn(`app`,e[0]?.version??`0`),[]}let{releases:t}=await J.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 J.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=Je(B({__name:`ChangelogReleases`,props:{releases:{}},setup(e){let{t,locale:n}=ve(),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)=>(V(),P(`ol`,Yn,[(V(!0),P(H,null,F(e.releases,e=>(V(),P(`li`,{key:`${e.surface}-${e.version}`,class:`release`},[N(`header`,Xn,[a(e)?(V(),P(`span`,Zn,W(a(e)),1)):K(``,!0),N(`span`,{class:L([`release__date`,{"release__date--lead":!a(e)}])},W(e.date),3)]),e.title?(V(),P(`h4`,Qn,W(o(e.title)),1)):K(``,!0),N(`ul`,$n,[(V(!0),P(H,null,F(e.changes,(e,n)=>(V(),P(`li`,{key:n,class:`change`},[N(`span`,{class:L([`change__kind`,`change__kind--${e.kind}`])},W(r(t)(i[e.kind])),3),N(`span`,null,W(o(e.text)),1)]))),128))])]))),128))]))}}),[[`__scopeId`,`data-v-ad6af3bd`]]),tr={class:`lead`},nr=Je(B({__name:`AppChangelogDialog`,setup(e){let{t}=ve(),n=i(!1),a=i([]);return I(async()=>{let e=await qn(),t=e[0];t&&(a.value=e,n.value=!0,Kn(`app`,t.version))}),(e,i)=>(V(),G(r(Ue),{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:U(()=>[b(r(q),{label:r(t)(`changelog.close`),onClick:i[0]||=e=>n.value=!1},null,8,[`label`])]),default:U(()=>[N(`p`,tr,W(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 Y=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)`:``))}};Y.empty=new Y([],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{},pr=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=hr(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(mr(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(Y.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)}};pr.empty=new pr(Y.empty,0,0);function mr(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(mr(a.content,t-i-1,n-i-1)))}function hr(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=hr(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 gr(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 _r(e,t,n,0)}function _r(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=_r(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}if(!n.content.size)return Sr(a,wr(e,t,r));if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Sr(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}{let{start:i,end:o}=Tr(n,e);return Sr(a,Cr(e,i,o,t,r))}}function vr(e,t){if(!t.type.compatibleContent(e.type))throw new fr(`Cannot join `+t.type.name+` onto `+e.type.name)}function yr(e,t,n){let r=e.node(n);return vr(r,t.node(n)),r}function br(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 xr(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&&(br(e.nodeAfter,r),a++));for(let e=a;e<o;e++)br(i.child(e),r);t&&t.depth==n&&t.textOffset&&br(t.nodeBefore,r)}function Sr(e,t){if(!e.type.validContent(t))throw new fr(`Invalid content for node `+e.type.name);return e.copy(t)}function Cr(e,t,n,r,i){let a=e.depth>i&&yr(e,t,i+1),o=r.depth>i&&yr(n,r,i+1),s=[];return xr(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(vr(a,o),br(Sr(a,Cr(e,t,n,r,i+1)),s)):(a&&br(Sr(a,wr(e,t,i+1)),s),xr(t,n,i,s),o&&br(Sr(o,wr(n,r,i+1)),s)),xr(r,null,i,s),new Y(s)}function wr(e,t,n){let r=[];return xr(null,e,n,r),e.depth>n&&br(Sr(yr(e,t,n+1),wr(e,t,n+1)),r),xr(t,null,n,r),new Y(r)}function Tr(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(Y.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Er=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 Ar(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=kr.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 kr.set(t,r=new Dr);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Or,i}},Dr=class{constructor(){this.elts=[],this.i=0}},Or=12,kr=new WeakMap,Ar=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)}},jr=Object.create(null),Mr=class e{constructor(e,t,n,r=dr.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Y.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||jr)&&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 pr.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new pr(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return gr(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 Er.resolveCached(this,e)}resolveNoCache(e){return Er.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()+`)`),Pr(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=Y.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=Y.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};Mr.prototype.text=void 0;var Nr=class e extends Mr{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):Pr(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 Pr(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Fr=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Ir(t,n);if(r.next==null)return e.empty;let i=Lr(r);r.next&&r.err(`Unexpected trailing text`);let a=qr(Wr(i));return Jr(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 Y.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-BIB0NtWF.js","assets/reactivity.esm-bundler-BQ9SB2vv.js","assets/runtime-core.esm-bundler-DujKY9QV.js","assets/runtime-dom.esm-bundler-CyEVRK6B.js","assets/vue-i18n-o7yraQpR.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/useApi-s_02lHjl-DZYO2tHU.js","assets/src-CcVk2-Gw.js","assets/floating-ui.dom-DF3oyfHd.js","assets/src-DOziuDw8.css","assets/trpc-DlM4IpMe.js","assets/preload-helper-BZ1Pz5am.js","assets/auth-DdEdmJV5.js","assets/notification.store-CWs6iQmx.js","assets/project-launch.store-DkD7Q9jW.js","assets/settings-scope-Ca1LjLG1.js","assets/project.store-CnflI3la.js","assets/error-DpF7X5iu.js","assets/VersionBadge-FeuuTMz7.js","assets/VersionBadge-CtFji3sv.css","assets/UnlockPage-Ce0qsHfn.css","assets/VaultMigrationPage-D27SeEVr.js","assets/VaultMigrationPage-DMiPJOSR.css","assets/LaunchProjectPage-B0Lg5Kr5.js","assets/useProjectCatalog-D1RgJoOm.js","assets/cloud-auth-D_am4FlK.js","assets/cloud-session-DqfQKW5D.js","assets/cloud-client-zXY8HZtj.js","assets/OrgKeyPrompt-Cbx4cLL0.js","assets/OrgKeyPrompt-FmlWgsj4.css","assets/DirectoryPickerDialog-C8dwWIUa.js","assets/DirectoryPickerDialog-3lnhU2DU.css","assets/ProjectCreateDialog-HcYVX36i.js","assets/ProjectCreateDialog-BfY7qA0G.css","assets/LaunchShell-CJtXkSUp.js","assets/LaunchShell-y_3rrtGa.css","assets/LaunchProjectPage-CyKA9pY5.css","assets/LaunchServicesPage-D_pqkdXt.js","assets/app-mode-BVpTuh0i.js","assets/service.store-yECOKc1C.js","assets/agent.store-BwUoohNu.js","assets/dist-Cx_klvkk.js","assets/schemas-68I2iCLF.js","assets/process-BWkHpZOM.js","assets/ProjectLocationGate-PR92Tdos.js","assets/LaunchServicesPage-h5o3zLcy.css","assets/AppLayout-DIAQvecQ.js","assets/vue-router--yRg_Dd_.js","assets/devtools-DCoWQoU_-D2vs4YXr.js","assets/composables-CCbqJqnd.js","assets/use-polling-CEkhIY_9.js","assets/useAiChatDrawer-D_ofn8Eo.js","assets/cloud-chat.store-za5cBdZx.js","assets/shared-sse-Dcj_cNvF.js","assets/src-BD3q9_go.js","assets/src-16-vEwhK.css","assets/page-actions-CSvO7j9F.js","assets/EditorIcon-Cx11i-sC.js","assets/EditorIcon-84kLQJ1r.css","assets/useServiceUrlHost-Xzj6EOft.js","assets/ServiceControlsBar-9jsN3h0c.js","assets/ProcessControls-Cx-QzqxQ.js","assets/ProcessControls-B7hWVqiR.css","assets/ServiceControlsBar-CRwt-Xry.css","assets/ProjectPublishDialog-YvOeVDCP.js","assets/ProjectPublishDialog-Cd-9yn6d.css","assets/AppLayout-B1-D2-jx.css","assets/DashboardPage-DFiL6A-k.js","assets/DashboardPage-FvNuC_e4.css","assets/CloudAccountPage-BGijgepw.js","assets/CloudAccountPage-CYcW_3tO.css","assets/CloudMessagingPage-C9uWAT8S.js","assets/scenario.store-DGt8nNt5.js","assets/i18n-B8hHo8g2.js","assets/scenario-DOeZsRCE.css","assets/AiChatModals-BEpSEXmp.js","assets/editor.api-Bef3xeth.js","assets/editor-8AbsNvUX.css","assets/toggleHighContrast-Dqz1Qao1.js","assets/toggleHighContrast--ixms01u.css","assets/register-BLGIM2pN.js","assets/AiChatModals-DS5R3Oz1.css","assets/scenario-run-overrides-BqTAaZZz.js","assets/useCloudOrg-Ck6Ef1iD.js","assets/useProjectCloudOrg-tnlpo5R1.js","assets/CloudMessagingPage-grbGyoki.css","assets/KnowledgeListPage-BoaV9hBg.js","assets/knowledge-host-ButMqDET.js","assets/uuid-B2pLMyOM.js","assets/knowledge-host-CfNnk0oz.css","assets/KnowledgeListPage-BjfZa5Wu.css","assets/KnowledgePagePage-UGJGJY4d.js","assets/KnowledgePagePage-qnvlYhD5.css","assets/KanbanListPage-D_ZpIbT2.js","assets/src-8YjxNhhv.js","assets/src-B-YFvUDL.css","assets/KanbanListPage-DCK-N3nw.css","assets/KanbanBoardPage-C9NqOqdD.js","assets/SendToChatDialog-CQbi2P_L.js","assets/KanbanBoardPage-Cy1VPXZs.css","assets/AgentTerminalPage-Dt9S2kZX.js","assets/uuid-DfCowYZy.js","assets/AgentTerminalPage-DbPtGy0f.css","assets/AuditPage-BEt0m-rM.js","assets/AuditPage-DRnnuzwq.css","assets/SettingsPage-C3PnwdxZ.js","assets/FlagChip-UumVjPY9.js","assets/FlagChip-hKL2frzh.css","assets/LogViewer-DLxO4-gP.js","assets/LogViewer-nXZtMJDA.css","assets/settings.store-Cyop63CA.js","assets/add-scalar-classes-Ohd6-7G3.js","assets/interface-content-folder.svg-CnsmgXBU.js","assets/browser-BpWB_ayN.js","assets/SettingsPage-Dsuzjo8r.css","assets/ScenarioEditorPage-Cjkkz3JB.js","assets/ScenarioEditorPage-BwLBCVeS.css","assets/ServiceFormPage-B4n8scwP.js","assets/ServiceFormPage-CQ6xL0Rr.css","assets/ServiceDetailPage-COHMUw51.js","assets/useEnvVarAutocomplete-B0fhZK-_.js","assets/useEnvVarAutocomplete-gV2loQYv.css","assets/ProcessMetrics-DisQYLu6.js","assets/ProcessMetrics-kCY31aHV.css","assets/WikiView-D3c0r5q8.js","assets/WikiView-CGsHxjvn.css","assets/ServiceDetailPage-DuXvqXk4.css","assets/EnvironmentListPage-CPs1uuvs.js","assets/EnvironmentForm-DZgZitCy.js","assets/EnvironmentForm-BnTLokUw.css","assets/EnvironmentListPage-BKhq_xXN.css","assets/EnvironmentFormPage-ubP8cX3l.js","assets/EnvironmentFormPage-C1gS0BI_.css","assets/ProcessDetailPage-Bxwv0984.js","assets/ProcessDetailPage-B7bD2jmj.css","assets/WikiPage-A8C0dEDX.js","assets/RandomJobTestPage-Bp9qone4.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 O,St as k,Ut as A,Y as j,Yt as M,_ as N,b as P,bt as F,ct as I,en as L,et as R,ft as ee,g as z,gt as te,it as ne,k as B,mt as V,nn as re,o as H,pt as ie,qt as U,rn as W,rt as ae,st as oe,tn as se,tt as ce,u as le,v as G,wt as ue,xt as de,y as K,z as fe}from"./runtime-core.esm-bundler-DujKY9QV.js";import{C as pe,S as me,i as he,t as ge,w as _e}from"./runtime-dom.esm-bundler-CyEVRK6B.js";import{n as ve}from"./vue-i18n-o7yraQpR.js";import{a as ye,i as be,n as xe,r as Se}from"./project-launch.store-DkD7Q9jW.js";import{r as Ce}from"./i18n-B8hHo8g2.js";import{g as we,h as Te}from"./useApi-s_02lHjl-DZYO2tHU.js";import{i as Ee,n as De,r as Oe}from"./vue-router--yRg_Dd_.js";import{$ as ke,A as Ae,C as je,H as Me,J as Ne,L as Pe,M as Fe,N as Ie,P as Le,Q as Re,S as ze,U as Be,W as Ve,X as He,Y as Ue,at as We,ct as Ge,d as Ke,dt as q,et as qe,ft as Je,it as Ye,lt as Xe,nt as Ze,o as Qe,ot as $e,q as et,rt as tt,st as nt,t as rt,tt as it,u as at,ut as ot,w as st}from"./src-CcVk2-Gw.js";import{a as ct,i as lt,o as ut,r as dt,t as ft}from"./scenario.store-DGt8nNt5.js";import{a as pt,i as mt,n as ht,r as gt,t as _t}from"./app-mode-BVpTuh0i.js";import{n as vt,o as yt,r as J,t as bt}from"./trpc-DlM4IpMe.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-DdEdmJV5.js";import{n as Dt,r as Ot}from"./project.store-CnflI3la.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-D1RgJoOm.js";import{n as Pt,r as Ft}from"./error-DpF7X5iu.js";import{n as It,r as Lt}from"./cloud-client-zXY8HZtj.js";import{t as Rt}from"./use-polling-CEkhIY_9.js";import{o as zt}from"./editor.api-Bef3xeth.js";import{i as Bt,r as Vt,t as Ht}from"./AiChatModals-BEpSEXmp.js";import{t as Ut}from"./useAiChatDrawer-D_ofn8Eo.js";import{g as Wt,n as Gt}from"./schemas-68I2iCLF.js";import{a as Kt,n as qt,r as Jt}from"./dist-Cx_klvkk.js";import{t as Yt}from"./service.store-yECOKc1C.js";import{t as Xt}from"./notification.store-CWs6iQmx.js";import{t as Zt}from"./agent.store-BwUoohNu.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(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(K(e,SharedArrayBuffer)||e&&K(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(K(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`||fe(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(K(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),K(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(K(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)||K(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 ce(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return ue(e).length;default:if(i)return r?-1:ce(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 F(this,t,n);case`utf8`:case`utf-8`:return A(this,t,n);case`ascii`:return N(this,t,n);case`latin1`:case`binary`:return P(this,t,n);case`base64`:return k(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return I(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?A(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(K(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,fe(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(fe(r))return o;e[n+o]=r}return o}function T(e,t,n,r){return de(ce(t,e.length-n),e,n,r)}function E(e,t,n,r){return de(le(t),e,n,r)}function D(e,t,n,r){return de(ue(t),e,n,r)}function O(e,t,n,r){return de(G(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 O(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 k(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function A(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 M(r)}var j=4096;function M(e){let t=e.length;if(t<=j)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=j));return n}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]&127);return r}function P(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 F(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+=pe[e[r]];return i}function I(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 L(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||L(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||L(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||L(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(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||L(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=me(function(e){e>>>=0,W(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ae(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=me(function(e){e>>>=0,W(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ae(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||L(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||L(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||L(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||L(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||L(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||L(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||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=me(function(e){e>>>=0,W(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ae(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=me(function(e){e>>>=0,W(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ae(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||L(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!1,52,8)};function R(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;R(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;R(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||R(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||R(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||R(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||R(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||R(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 ee(e,t,n,r,i){U(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 z(e,t,n,r,i){U(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=me(function(e,t=0){return ee(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=me(function(e,t=0){return z(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);R(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);R(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||R(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||R(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||R(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||R(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||R(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=me(function(e,t=0){return ee(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=me(function(e,t=0){return z(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function te(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function ne(e,t,r,i,a){return t=+t,r>>>=0,a||te(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return ne(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return ne(this,e,t,!1,n)};function B(e,t,r,i,a){return t=+t,r>>>=0,a||te(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return B(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 V={};function re(e,t,n){V[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}`}}}re(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),re(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),re(`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=H(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=H(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function H(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 ie(e,t,n){W(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&ae(t,e.length-(n+1))}function U(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 V.ERR_OUT_OF_RANGE(`value`,i,e)}ie(r,i,a)}function W(e,t){if(typeof e!=`number`)throw new V.ERR_INVALID_ARG_TYPE(t,`number`,e)}function ae(e,t,n){throw Math.floor(e)===e?t<0?new V.ERR_BUFFER_OUT_OF_BOUNDS:new V.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(W(e,n),new V.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var oe=/[^+/0-9A-Za-z-_]/g;function se(e){if(e=e.split(`=`)[0],e=e.trim().replace(oe,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function ce(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 le(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function G(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 ue(e){return t.toByteArray(se(e))}function de(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 K(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function fe(e){return e!==e}var pe=(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 me(e){return typeof BigInt>`u`?he:e}function he(){throw Error(`BigInt not supported`)}}))(),gn=B({__name:`PopoverTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,n=tt(),{forwardRef:i,currentElement:a}=ot();return n.triggerId||=Xe(void 0,`reka-popover-trigger`),n.contentId||=Xe(void 0,`reka-popover-content`),I(()=>{n.triggerElement.value=a.value}),(e,a)=>(V(),G(ue(r(n).hasCustomAnchor.value?r(Ge):r(nt)),{"as-child":``},{default:U(()=>[b(r(Ge),{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:U(()=>[de(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=Je(B({__name:`ErrorBoundary`,setup(e){let{t}=ve(),n=i(null);oe(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?(V(),P(`div`,_n,[N(`div`,vn,[i[0]||=N(`i`,{class:`ti ti-alert-triangle error-icon`},null,-1),N(`h3`,null,W(r(t)(`errorBoundary.title`)),1),N(`p`,yn,W(n.value.message),1),b(r(q),{label:r(t)(`errorBoundary.tryAgain`),icon:`ti ti-refresh`,onClick:a},null,8,[`label`])])])):de(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 J.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:z(()=>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=Je(B({__name:`AppUpdateDialog`,props:{visible:{type:Boolean},currentVersion:{},latestVersion:{}},emits:[`update:visible`,`updated`],setup(e,{emit:t}){let{t:n}=ve(),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 J.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 J.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 J.appUpdate.restart.mutate()}catch{}}return C(()=>a.visible,e=>{e&&f()}),(t,i)=>(V(),G(r(Ue),{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:U(()=>[s.value===`blocked`||s.value===`failed`?(V(),G(r(q),{key:0,label:r(n)(`appUpdate.retry`),severity:`secondary`,onClick:f},null,8,[`label`])):K(``,!0),s.value===`ready`?(V(),G(r(q),{key:1,label:r(n)(`appUpdate.install`),icon:`ti ti-download`,onClick:p},null,8,[`label`])):K(``,!0),s.value===`installed`?(V(),G(r(q),{key:2,label:r(n)(`appUpdate.restartLater`),severity:`secondary`,onClick:i[0]||=e=>o(`update:visible`,!1)},null,8,[`label`])):K(``,!0),s.value===`installed`?(V(),G(r(q),{key:3,label:r(n)(`appUpdate.restartNow`),icon:`ti ti-refresh`,onClick:m},null,8,[`label`])):K(``,!0),s.value===`restarting`?(V(),G(r(q),{key:4,label:r(n)(`appUpdate.restarting`),icon:`ti ti-spin ti-loader-2`,disabled:``},null,8,[`label`])):K(``,!0)]),default:U(()=>[N(`p`,kn,W(r(n)(`appUpdate.dialogLead`,{current:e.currentVersion??`—`,latest:e.latestVersion??`—`})),1),s.value===`checking`?(V(),P(`div`,An,[b(r(Me),{style:{width:`1.5rem`,height:`1.5rem`},strokeWidth:`6`}),N(`span`,null,W(r(n)(`appUpdate.checking`)),1)])):c.value?(V(),P(`div`,jn,[N(`div`,Mn,[i[2]||=N(`i`,{class:`ti ti-circle-check update-dialog__ok`},null,-1),N(`span`,null,W(r(n)(`appUpdate.nodeFound`,{version:c.value.nodeVersion})),1)]),N(`div`,Nn,[N(`i`,{class:L(c.value.npmVersion?`ti ti-circle-check update-dialog__ok`:`ti ti-circle-x update-dialog__ko`)},null,2),c.value.npmVersion?(V(),P(`span`,Pn,W(r(n)(`appUpdate.npmFound`,{version:c.value.npmVersion,path:c.value.npmPath})),1)):(V(),P(`span`,Fn,W(r(n)(`appUpdate.npmMissing`)),1))]),c.value.globalPrefix?(V(),P(`div`,In,[i[3]||=N(`i`,{class:`ti ti-folder update-dialog__info`},null,-1),N(`span`,null,W(r(n)(`appUpdate.installTarget`,{prefix:c.value.globalPrefix})),1)])):K(``,!0)])):K(``,!0),s.value===`blocked`&&!c.value?.npmVersion?(V(),G(r(Ve),{key:2,severity:`warn`},{default:U(()=>[x(W(r(n)(`appUpdate.npmMissingHelp`)),1)]),_:1})):K(``,!0),d.value?(V(),G(r(Ve),{key:3,severity:`error`},{default:U(()=>[x(W(d.value),1)]),_:1})):K(``,!0),s.value===`installing`?(V(),P(`div`,Ln,[b(r(Me),{style:{width:`1.5rem`,height:`1.5rem`},strokeWidth:`6`}),N(`span`,null,W(r(n)(`appUpdate.installing`)),1)])):K(``,!0),s.value===`installed`?(V(),G(r(Ve),{key:5,severity:`success`},{default:U(()=>[x(W(r(n)(`appUpdate.installed`,{version:u.value??e.latestVersion??``})),1)]),_:1})):K(``,!0),s.value===`failed`?(V(),G(r(Ve),{key:6,severity:`error`},{default:U(()=>[x(W(r(n)(`appUpdate.installFailed`)),1)]),_:1})):K(``,!0),l.value?(V(),P(`pre`,Rn,W(l.value),1)):K(``,!0),s.value===`installed`?(V(),G(r(Ve),{key:8,severity:`info`},{default:U(()=>[x(W(r(n)(`appUpdate.restartNeeded`)),1)]),_:1})):K(``,!0)]),_:1},8,[`visible`,`header`,`closable`]))}}),[[`__scopeId`,`data-v-bcce910d`]]),Bn={key:0,class:`update-banner`},Vn=3e5,Hn=Je(B({__name:`AppUpdateBanner`,setup(e){let{t}=ve(),{isDesktop:n}=pt(),{current:a,latest:o,outdated:s,check:c}=On(),l=i(!1),u=null;function d(){document.visibilityState===`visible`&&c()}return I(()=>{n.value&&(c(),u=setInterval(()=>void c(),Vn),document.addEventListener(`visibilitychange`,d))}),ee(()=>{u!==null&&clearInterval(u),document.removeEventListener(`visibilitychange`,d)}),(e,i)=>(V(),P(H,null,[r(n)&&r(s)?(V(),P(`div`,Bn,[i[3]||=N(`i`,{class:`ti ti-circle-arrow-up update-banner__icon`},null,-1),N(`span`,null,W(r(t)(`appUpdate.bannerText`,{current:r(a),latest:r(o)})),1),b(r(q),{label:r(t)(`appUpdate.bannerAction`),size:`small`,severity:`contrast`,onClick:i[0]||=e=>l.value=!0},null,8,[`label`])])):K(``,!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 J.changelog.index.query({surface:`app`,since:null});return Kn(`app`,e[0]?.version??`0`),[]}let{releases:t}=await J.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 J.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=Je(B({__name:`ChangelogReleases`,props:{releases:{}},setup(e){let{t,locale:n}=ve(),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)=>(V(),P(`ol`,Yn,[(V(!0),P(H,null,F(e.releases,e=>(V(),P(`li`,{key:`${e.surface}-${e.version}`,class:`release`},[N(`header`,Xn,[a(e)?(V(),P(`span`,Zn,W(a(e)),1)):K(``,!0),N(`span`,{class:L([`release__date`,{"release__date--lead":!a(e)}])},W(e.date),3)]),e.title?(V(),P(`h4`,Qn,W(o(e.title)),1)):K(``,!0),N(`ul`,$n,[(V(!0),P(H,null,F(e.changes,(e,n)=>(V(),P(`li`,{key:n,class:`change`},[N(`span`,{class:L([`change__kind`,`change__kind--${e.kind}`])},W(r(t)(i[e.kind])),3),N(`span`,null,W(o(e.text)),1)]))),128))])]))),128))]))}}),[[`__scopeId`,`data-v-ad6af3bd`]]),tr={class:`lead`},nr=Je(B({__name:`AppChangelogDialog`,setup(e){let{t}=ve(),n=i(!1),a=i([]);return I(async()=>{let e=await qn(),t=e[0];t&&(a.value=e,n.value=!0,Kn(`app`,t.version))}),(e,i)=>(V(),G(r(Ue),{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:U(()=>[b(r(q),{label:r(t)(`changelog.close`),onClick:i[0]||=e=>n.value=!1},null,8,[`label`])]),default:U(()=>[N(`p`,tr,W(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 Y=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)`:``))}};Y.empty=new Y([],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{},pr=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=hr(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(mr(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(Y.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)}};pr.empty=new pr(Y.empty,0,0);function mr(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(mr(a.content,t-i-1,n-i-1)))}function hr(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=hr(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 gr(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 _r(e,t,n,0)}function _r(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=_r(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}if(!n.content.size)return Sr(a,wr(e,t,r));if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Sr(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}{let{start:i,end:o}=Tr(n,e);return Sr(a,Cr(e,i,o,t,r))}}function vr(e,t){if(!t.type.compatibleContent(e.type))throw new fr(`Cannot join `+t.type.name+` onto `+e.type.name)}function yr(e,t,n){let r=e.node(n);return vr(r,t.node(n)),r}function br(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 xr(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&&(br(e.nodeAfter,r),a++));for(let e=a;e<o;e++)br(i.child(e),r);t&&t.depth==n&&t.textOffset&&br(t.nodeBefore,r)}function Sr(e,t){if(!e.type.validContent(t))throw new fr(`Invalid content for node `+e.type.name);return e.copy(t)}function Cr(e,t,n,r,i){let a=e.depth>i&&yr(e,t,i+1),o=r.depth>i&&yr(n,r,i+1),s=[];return xr(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(vr(a,o),br(Sr(a,Cr(e,t,n,r,i+1)),s)):(a&&br(Sr(a,wr(e,t,i+1)),s),xr(t,n,i,s),o&&br(Sr(o,wr(n,r,i+1)),s)),xr(r,null,i,s),new Y(s)}function wr(e,t,n){let r=[];return xr(null,e,n,r),e.depth>n&&br(Sr(yr(e,t,n+1),wr(e,t,n+1)),r),xr(t,null,n,r),new Y(r)}function Tr(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(Y.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Er=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 Ar(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=kr.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 kr.set(t,r=new Dr);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Or,i}},Dr=class{constructor(){this.elts=[],this.i=0}},Or=12,kr=new WeakMap,Ar=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)}},jr=Object.create(null),Mr=class e{constructor(e,t,n,r=dr.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Y.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||jr)&&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 pr.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new pr(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return gr(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 Er.resolveCached(this,e)}resolveNoCache(e){return Er.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()+`)`),Pr(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=Y.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=Y.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};Mr.prototype.text=void 0;var Nr=class e extends Mr{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):Pr(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 Pr(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Fr=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Ir(t,n);if(r.next==null)return e.empty;let i=Lr(r);r.next&&r.err(`Unexpected trailing text`);let a=qr(Wr(i));return Jr(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 Y.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
|
`)}};Fr.empty=new Fr(!0);var Ir=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 Lr(e){let t=[];do t.push(Rr(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Rr(e){let t=[];do t.push(zr(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function zr(e){let t=Ur(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=Vr(e,t);else break;return t}function Br(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Vr(e,t){let n=Br(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Br(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Hr(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 Ur(e){if(e.eat(`(`)){let t=Lr(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Hr(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 Wr(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 Gr(e,t){return t-e}function Kr(e,t){let n=[];return r(t),n.sort(Gr);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 qr(e){let t=Object.create(null);return n(Kr(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]);Kr(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Fr(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Gr);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Jr(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 Yr(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 Xr(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 Zr(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 Qr(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new ti(e,r,t[r]);return n}var $r=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=Qr(e,n.attrs),this.defaultAttrs=Yr(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==Fr.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:Xr(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new Mr(this,this.computeAttrs(e),Y.from(t),dr.setFrom(n))}createChecked(e=null,t,n){return t=Y.from(t),this.checkContent(t),new Mr(this,this.computeAttrs(e),t,dr.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=Y.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(Y.empty,!0);return i?new Mr(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){Zr(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 ei(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 ti=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?ei(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},ni=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Qr(e,r.attrs),this.excluded=null;let i=Yr(this.attrs);this.instance=i?new dr(this,i):null}create(e=null){return!e&&this.instance?this.instance:new dr(this,Xr(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){Zr(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},ri=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=$r.compile(this.spec.nodes,this),this.marks=ni.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]=Fr.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?ii(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==``?[]:ii(this,n.split(` `))}this.nodeFromJSON=e=>Mr.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 $r))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 Nr(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 ii(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 ai(e){return e.tag!=null}function oi(e){return e.style!=null}var si=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(ai(e))this.tags.push(e);else if(oi(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 gi(this,t,!1);return n.addAll(e,dr.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new gi(this,t,!0);return n.addAll(e,dr.none,t.from,t.to),pr.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(vi(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=yi(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=yi(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)))}},ci={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},li={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ui={ol:!0,ul:!0},di=1,fi=2,pi=4;function mi(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?di:0)|(t===`full`?fi:0)}var hi=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&pi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Y.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&di)){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=Y.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Y.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&&!ci.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},gi=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=mi(null,t.preserveWhitespace,0)|(n?pi:0);i=r?new hi(r.type,r.attrs,dr.none,!0,t.topMatch||r.type.contentMatch,a):n?new hi(null,null,dr.none,!0,null,a):new hi(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&fi?`full`:this.localPreserveWS||(r.options&di)>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;ui.hasOwnProperty(a)&&this.parser.normalizeLists&&_i(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:li.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(ci.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):bi(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=mi(e,i,a.options);a.options&pi&&a.content.length==0&&(o|=pi);let s=dr.none;return n=n.filter(t=>!(a.type?a.type.allowsMarkType(t.type):bi(t.type,e))||(s=t.addToSet(s),!1)),this.nodes.push(new hi(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|=di);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 _i(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&ui.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function vi(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function yi(e){let t={};for(let n in e)t[n]=e[n];return t}function bi(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 xi=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=Ci(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 Ci(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Di(Ci(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&&Di(Ci(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:Di(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=Si(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return Si(e.marks)}};function Si(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Ci(e){return e.document||window.document}var wi=new WeakMap;function Ti(e){let t=wi.get(e);return t===void 0&&wi.set(e,t=Ei(e)),t}function Ei(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 Di(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=Ti(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}=Di(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Oi=65535,ki=2**16;function Ai(e,t){return e+t*ki}function ji(e){return e&Oi}function Mi(e){return(e-(e&Oi))/ki}var Ni=1,Pi=2,Fi=4,Ii=8,Li=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Ii)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&Fi)>0}},Ri=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=ji(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+Mi(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:Ai(o/3,e-s),f=e==s?Pi:e==u?Ni:Fi;return(t<0?e!=s:e!=u)&&(f|=Ii),new Li(a,f,d)}r+=l-c}return n?e+r:new Li(e+r,0,null)}touches(e,t){let n=0,r=ji(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])}};Ri.empty=new Ri([]);var zi=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 Li(e,r,null)}},Bi=Object.create(null),Vi=class{getMap(){return Ri.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=Bi[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Bi)throw RangeError(`Duplicate use of step JSON ID `+e);return Bi[e]=t,t.prototype.jsonID=e,t}},Hi=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 Ui(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(Ui(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return Y.fromArray(r)}var Wi=class e extends Vi{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 pr(Ui(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 Hi.fromReplace(e,this.from,this.to,i)}invert(){return new Gi(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))}};Vi.jsonID(`addMark`,Wi);var Gi=class e extends Vi{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 pr(Ui(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return Hi.fromReplace(e,this.from,this.to,n)}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:`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))}};Vi.jsonID(`removeMark`,Gi);var Ki=class e extends Vi{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Hi.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Hi.fromReplace(e,this.pos,this.pos+1,new pr(Y.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 qi(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))}};Vi.jsonID(`addNodeMark`,Ki);var qi=class e extends Vi{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Hi.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Hi.fromReplace(e,this.pos,this.pos+1,new pr(Y.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this: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:`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))}};Vi.jsonID(`removeNodeMark`,qi);var Ji=class e extends Vi{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Xi(e,this.from,this.to)?Hi.fail(`Structure replace would overwrite content`):Hi.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ri([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?pr.empty:new pr(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?pr.empty:new pr(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,pr.fromJSON(t,n.slice),!!n.structure)}};Ji.MAP_BIAS=1,Vi.jsonID(`replace`,Ji);var Yi=class e extends Vi{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&&(Xi(e,this.from,this.gapFrom)||Xi(e,this.gapTo,this.to)))return Hi.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Hi.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?Hi.fromReplace(e,this.from,this.to,n):Hi.fail(`Content does not fit in gap`)}getMap(){return new Ri([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,pr.fromJSON(t,n.slice),n.insert,!!n.structure)}};Vi.jsonID(`replaceAround`,Yi);function Xi(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 Zi(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 Gi(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new Wi(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function Qi(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 ni){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 Gi(t.from,t.to,t.style)))}function $i(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 Ji(s,l,pr.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new Gi(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 pr(Y.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new Ji(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(Y.empty,!0);e.replace(s,s,new pr(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function ea(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function ta(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||!ea(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function na(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=Y.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=Y.from(r.node(e).copy(u)),d++):c--;let f=Y.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=Y.from(i.node(e).copy(f)),p++):l++;e.step(new Yi(c,l,o,s,new pr(u.append(f),d,p),u.size-d,!0))}function ra(e,t,n=null,r=e){let i=aa(e,t),a=i&&oa(r,t);return a?i.map(ia).concat({type:t,attrs:n}).concat(a.map(ia)):null}function ia(e){return{type:e,attrs:null}}function aa(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 oa(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 sa(e,t,n){let r=Y.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=Y.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new Yi(i,a,i,a,new pr(r,0,0),n.length,!0))}function ca(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)&&da(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&&ua(e,t,n,a),$i(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 Yi(c,l,c+1,l-1,new pr(Y.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&la(e,t,n,a),!1}})}function la(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 ua(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(`
|
|
@@ -267,7 +267,7 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
|
|
|
267
267
|
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),pG&&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=IG(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=ZW(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,-LG),LG),t/=LG,t/Math.abs(t)+Math.round(t*(RG-1)))}shouldForceSelection(e){return lG?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(),zG)}_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&&!(lG&&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<BG&&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=SG(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=IG(n,this._bufferService.cols)}};HG=aB([oB(3,NB),oB(4,FB),oB(5,qB),oB(6,zB),oB(7,JB),oB(8,KB)],HG);var UG=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={}}},WG=class{constructor(){this._color=new UG,this._css=new UG}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()}},GG=Object.freeze((()=>{let e=[yW.toColor(`#2e3436`),yW.toColor(`#cc0000`),yW.toColor(`#4e9a06`),yW.toColor(`#c4a000`),yW.toColor(`#3465a4`),yW.toColor(`#75507b`),yW.toColor(`#06989a`),yW.toColor(`#d3d7cf`),yW.toColor(`#555753`),yW.toColor(`#ef2929`),yW.toColor(`#8ae234`),yW.toColor(`#fce94f`),yW.toColor(`#729fcf`),yW.toColor(`#ad7fa8`),yW.toColor(`#34e2e2`),yW.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:_W.toCss(r,i,a),rgba:_W.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:_W.toCss(n,n,n),rgba:_W.toRgba(n,n,n)})}return e})()),KG=yW.toColor(`#ffffff`),qG=yW.toColor(`#000000`),JG=yW.toColor(`#ffffff`),YG=qG,XG={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},ZG=KG,QG=class extends SV{constructor(e){super(),this._optionsService=e,this._contrastCache=new WG,this._halfContrastCache=new WG,this._onChangeColors=this._register(new Q),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:KG,background:qG,cursor:JG,cursorAccent:YG,selectionForeground:void 0,selectionBackgroundTransparent:XG,selectionBackgroundOpaque:vW.blend(qG,XG),selectionInactiveBackgroundTransparent:XG,selectionInactiveBackgroundOpaque:vW.blend(qG,XG),scrollbarSliderBackground:vW.opacity(KG,.2),scrollbarSliderHoverBackground:vW.opacity(KG,.4),scrollbarSliderActiveBackground:vW.opacity(KG,.5),overviewRulerBorder:KG,ansi:GG.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=$G(e.foreground,KG),t.background=$G(e.background,qG),t.cursor=vW.blend(t.background,$G(e.cursor,JG)),t.cursorAccent=vW.blend(t.background,$G(e.cursorAccent,YG)),t.selectionBackgroundTransparent=$G(e.selectionBackground,XG),t.selectionBackgroundOpaque=vW.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=$G(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=vW.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?$G(e.selectionForeground,gW):void 0,t.selectionForeground===gW&&(t.selectionForeground=void 0),vW.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=vW.opacity(t.selectionBackgroundTransparent,.3)),vW.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=vW.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=$G(e.scrollbarSliderBackground,vW.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=$G(e.scrollbarSliderHoverBackground,vW.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=$G(e.scrollbarSliderActiveBackground,vW.opacity(t.foreground,.5)),t.overviewRulerBorder=$G(e.overviewRulerBorder,ZG),t.ansi=GG.slice(),t.ansi[0]=$G(e.black,GG[0]),t.ansi[1]=$G(e.red,GG[1]),t.ansi[2]=$G(e.green,GG[2]),t.ansi[3]=$G(e.yellow,GG[3]),t.ansi[4]=$G(e.blue,GG[4]),t.ansi[5]=$G(e.magenta,GG[5]),t.ansi[6]=$G(e.cyan,GG[6]),t.ansi[7]=$G(e.white,GG[7]),t.ansi[8]=$G(e.brightBlack,GG[8]),t.ansi[9]=$G(e.brightRed,GG[9]),t.ansi[10]=$G(e.brightGreen,GG[10]),t.ansi[11]=$G(e.brightYellow,GG[11]),t.ansi[12]=$G(e.brightBlue,GG[12]),t.ansi[13]=$G(e.brightMagenta,GG[13]),t.ansi[14]=$G(e.brightCyan,GG[14]),t.ansi[15]=$G(e.brightWhite,GG[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]=$G(e.extendedAnsi[r],GG[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()}}};QG=aB([oB(0,zB)],QG);function $G(e,t){if(e!==void 0)try{return yW.toColor(e)}catch{}return t}var eK=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)}},tK=class{constructor(){this._services=new eK,this._services.set(LB,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=AB(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)}},nK={trace:0,debug:1,info:2,warn:3,error:4,off:5},rK=`xterm.js: `,iK=class extends SV{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),aK=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=nK[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?``:rK)+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)}};iK=aB([oB(0,zB)],iK);var aK,oK=class extends SV{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Q),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Q),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Q),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}},sK=3,cK=Object.freeze(new wB),lK=0,uK=2,dK=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*sK);let r=t||EB.fromCharData([0,SB,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*sK+0],n=t&2097151;return[this._data[e*sK+1],t&2097152?this._combined[e]:n?vB(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*sK+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*sK+0]=e|2097152|t[2]<<22):this._data[e*sK+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*sK+0]>>22}hasWidth(e){return this._data[e*sK+0]&12582912}getFg(e){return this._data[e*sK+1]}getBg(e){return this._data[e*sK+2]}hasContent(e){return this._data[e*sK+0]&4194303}getCodePoint(e){let t=this._data[e*sK+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*sK+0]&2097152}getString(e){let t=this._data[e*sK+0];return t&2097152?this._combined[e]:t&2097151?vB(t&2097151):``}isProtected(e){return this._data[e*sK+2]&536870912}loadCell(e,t){return lK=e*sK,t.content=this._data[lK+0],t.fg=this._data[lK+1],t.bg=this._data[lK+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*sK+0]=t.content,this._data[e*sK+1]=t.fg,this._data[e*sK+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*sK+0]=t|n<<22,this._data[e*sK+1]=r.fg,this._data[e*sK+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*sK+0];r&2097152?this._combined[e]+=vB(t):r&2097151?(this._combined[e]=vB(r&2097151)+vB(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*sK+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 EB;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 EB;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*uK<this._data.buffer.byteLength;let n=e*sK;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*uK<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*uK<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*sK+0]&4194303)return e+(this._data[e*sK+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*sK+0]&4194303||this._data[e*sK+2]&50331648)return e+(this._data[e*sK+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<sK;e++)this._data[(n+i)*sK+e]=a[(t+i)*sK+e];a[(t+i)*sK+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<sK;e++)this._data[(n+i)*sK+e]=a[(t+i)*sK+e];a[(t+i)*sK+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*sK+0],n=e&2097151,a=e&2097152?this._combined[t]:n?vB(n):CB;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 fK(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=gK(u,d,t),p=1,m=0;for(;p<u.length;){let e=gK(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 pK(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 mK(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 hK(e,t,n){let r=[],i=e.map((n,r)=>gK(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=gK(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 gK(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 _K=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new Q),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),_V(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};_K._nextId=1;var vK=_K,yK={},bK=yK.B;yK[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},yK.A={"#":`£`},yK.B=void 0,yK[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},yK.C=yK[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},yK.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},yK.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},yK.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},yK.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},yK.E=yK[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},yK.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},yK.H=yK[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},yK[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var xK=4294967295,SK=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=cK.clone(),this.savedCharset=bK,this.markers=[],this._nullCell=EB.fromCharData([0,SB,1,0]),this._whitespaceCell=EB.fromCharData([0,CB,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new vG,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new oK(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 TB),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 TB),this._whitespaceCell}getBlankLine(e,t){return new dK(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>xK?xK:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=cK);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 oK(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(cK),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 dK(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 dK(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=fK(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(cK),n);if(r.length>0){let n=pK(this.lines,r);mK(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(cK),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new dK(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(cK),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=hK(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(cK,!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--,_=gK(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 vK(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)}},CK=class extends SV{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Q),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 SK(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new SK(!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)}},wK=2,TK=1,EK=class extends SV{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,wK),this.rows=Math.max(e.rawOptions.rows||0,TK),this.buffers=this._register(new CK(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))}};EK=aB([oB(0,zB)],EK);var DK={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:lG,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},OK=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],kK=class extends SV{constructor(e){super(),this._onOptionChange=this._register(new Q),this.onOptionChange=this._onOptionChange.event;let t={...DK};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(yV(()=>{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 DK))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in DK))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||=DK[e],!AK(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=DK[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=OK.includes(t)?t:DK[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 AK(e){return e===`block`||e===`underline`||e===`bar`}function jK(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]&&jK(e[r],t-1);return n}var MK=Object.freeze({insertMode:!1}),NK=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),PK=class extends SV{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 Q),this.onData=this._onData.event,this._onUserInput=this._register(new Q),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Q),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=jK(MK),this.decPrivateModes=jK(NK)}reset(){this.modes=jK(MK),this.decPrivateModes=jK(NK)}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))}};PK=aB([oB(0,NB),oB(1,RB),oB(2,zB)],PK);var FK={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 IK(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 LK=String.fromCharCode,RK={DEFAULT:e=>{let t=[IK(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${LK(t[0])}${LK(t[1])}${LK(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${IK(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${IK(e,!0)};${e.x};${e.y}${t}`}},zK=class extends SV{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 Q),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(FK))this.addProtocol(e,FK[e]);for(let e of Object.keys(RK))this.addEncoding(e,RK[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}};zK=aB([oB(0,NB),oB(1,FB),oB(2,zB)],zK);var BK=[[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]],VK=[[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]],HK;function UK(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 WK=class{constructor(){if(this.version=`6`,!HK){HK=new Uint8Array(65536),HK.fill(1),HK[0]=0,HK.fill(0,1,32),HK.fill(0,127,160),HK.fill(2,4352,4448),HK[9001]=2,HK[9002]=2,HK.fill(2,11904,42192),HK[12351]=1,HK.fill(2,44032,55204),HK.fill(2,63744,64256),HK.fill(2,65040,65050),HK.fill(2,65072,65136),HK.fill(2,65280,65377),HK.fill(2,65504,65511);for(let e=0;e<BK.length;++e)HK.fill(0,BK[e][0],BK[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?HK[e]:UK(e,VK)?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=GK.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return GK.createPropertyValue(0,n,r)}},GK=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Q,this.onChange=this._onChange.event;let e=new WK;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)}},KK=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 qK(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 JK=2147483647,YK=256,XK=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>YK)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>JK?JK: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>JK?JK: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,JK):e}},ZK=[],QK=class{constructor(){this._state=0,this._active=ZK,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=ZK}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=ZK,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ZK,!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`,yB(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=ZK,this._id=-1,this._state=0}}},$K=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+=yB(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}},eq=[],tq=class{constructor(){this._handlers=Object.create(null),this._active=eq,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=eq}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=eq,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||eq,!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`,yB(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=eq,this._ident=0}},nq=new XK;nq.addParam(0);var rq=class{constructor(e){this._handler=e,this._data=``,this._params=nq,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():nq,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=yB(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=nq,this._data=``,this._hitLimit=!1,e));return this._params=nq,this._data=``,this._hitLimit=!1,t}},iq=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}},aq=160,oq=function(){let e=new iq(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(aq,0,2,0),e.add(aq,8,5,8),e.add(aq,6,0,6),e.add(aq,11,0,11),e.add(aq,13,13,13),e}(),sq=class extends SV{constructor(e=oq){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 XK,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(yV(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new QK),this._dcsParser=this._register(new tq),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:aq)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<aq){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<aq){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<aq){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<aq){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<aq){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<aq){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}}},cq=/^([\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})$/,lq=/^[\da-f]+$/;function uq(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=cq.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),lq.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 dq(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 fq(e,t=16){let[n,r,i]=e;return`rgb:${dq(n,t)}/${dq(r,t)}/${dq(i,t)}`}var pq={"(":0,")":1,"*":2,"+":3,"-":1,".":2},mq=131072,hq=10;function gq(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 _q=5e3,vq=0,yq=class extends SV{constructor(e,t,n,r,i,a,o,s,c=new sq){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 bB,this._utf8Decoder=new xB,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=cK.clone(),this._eraseAttrDataInternal=cK.clone(),this._onRequestBell=this._register(new Q),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Q),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Q),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Q),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Q),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Q),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Q),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Q),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Q),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 bq(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($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(lW.IND,()=>this.index()),this._parser.setExecuteHandler(lW.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(lW.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new $K(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new $K(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new $K(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new $K(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new $K(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new $K(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new $K(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new $K(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new $K(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new $K(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new $K(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new $K(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 yK)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 rq((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`),_q))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${_q} 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>mq&&(a=this._parseStack.position+mq)}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<mq&&(this._parseBuffer=new Uint32Array(Math.min(e.length,mq))),o||this._dirtyRowTracker.clearRange(),e.length>mq)for(let t=a;t<e.length;t+=mq){let a=t+mq<e.length?t+mq: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=GK.extractWidth(t);let n=GK.extractShouldJoin(t),m=n?GK.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(vB(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 dK&&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=>!gq(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new rq(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new $K(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(cK));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=GK.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($.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent($.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent($.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent($.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent($.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,bK),this._charsetService.setgCharset(1,bK),this._charsetService.setgCharset(2,bK),this._charsetService.setgCharset(3,bK);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(`${$.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|=wB.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=cK.fg,e.bg=cK.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|=cK.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=cK.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|=cK.fg&16777215,r.bg&=-67108864,r.bg|=cK.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.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(`${$.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=cK.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(!gq(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(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>hq&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>hq&&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(xq(n)){if(r===`?`)t.push({type:0,index:n});else{let e=uq(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=uq(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]);xq(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,bK),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(pq[e[0]],yK[e[1]]||bK),!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=cK.clone(),this._eraseAttrDataInternal=cK.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 EB;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(`${$.ESC}${e}${$.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)}},bq=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&&(vq=e,e=t,t=vq),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};bq=aB([oB(0,NB)],bq);function xq(e){return 0<=e&&e<256}var Sq=5e7,Cq=12,wq=50,Tq=class extends SV{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 Q),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>Sq)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>=Cq?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>=Cq)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>wq&&(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()}},Eq=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)))}};Eq=aB([oB(0,NB)],Eq);var Dq=!1,Oq=class extends SV{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new CV),this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onData=this._register(new Q),this.onData=this._onData.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Q),this._instantiationService=new tK,this.optionsService=this._register(new kK(e)),this._instantiationService.setService(zB,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(EK)),this._instantiationService.setService(NB,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(iK)),this._instantiationService.setService(RB,this._logService),this.coreService=this._register(this._instantiationService.createInstance(PK)),this._instantiationService.setService(FB,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(zK)),this._instantiationService.setService(PB,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(GK)),this._instantiationService.setService(VB,this.unicodeService),this._charsetService=this._instantiationService.createInstance(KK),this._instantiationService.setService(IB,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Eq),this._instantiationService.setService(BB,this._oscLinkService),this._inputHandler=this._register(new yq(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(AV.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(AV.forward(this._bufferService.onResize,this._onResize)),this._register(AV.forward(this.coreService.onData,this._onData)),this._register(AV.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 Tq((e,t)=>this._inputHandler.parse(e,t))),this._register(AV.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Q),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&&!Dq&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),Dq=!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,wK),t=Math.max(t,TK),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(qK.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(qK(this._bufferService),!1))),this._windowsWrappingHeuristics.value=yV(()=>{for(let t of e)t.dispose()})}}},kq={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 Aq(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?$.ESC+`OA`:$.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?$.ESC+`OD`:$.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?$.ESC+`OC`:$.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?$.ESC+`OB`:$.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:$.DEL,e.altKey&&(i.key=$.ESC+i.key);break;case 9:if(e.shiftKey){i.key=$.ESC+`[Z`;break}i.key=$.HT,i.cancel=!0;break;case 13:i.key=e.altKey?$.ESC+$.CR:$.CR,i.cancel=!0;break;case 27:i.key=$.ESC,e.altKey&&(i.key=$.ESC+$.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`D`:t?$.ESC+`OD`:$.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`C`:t?$.ESC+`OC`:$.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`A`:t?$.ESC+`OA`:$.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`B`:t?$.ESC+`OB`:$.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=$.ESC+`[2~`);break;case 46:i.key=a?$.ESC+`[3;`+(a+1)+`~`:$.ESC+`[3~`;break;case 36:i.key=a?$.ESC+`[1;`+(a+1)+`H`:t?$.ESC+`OH`:$.ESC+`[H`;break;case 35:i.key=a?$.ESC+`[1;`+(a+1)+`F`:t?$.ESC+`OF`:$.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?$.ESC+`[5;`+(a+1)+`~`:$.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?$.ESC+`[6;`+(a+1)+`~`:$.ESC+`[6~`;break;case 112:i.key=a?$.ESC+`[1;`+(a+1)+`P`:$.ESC+`OP`;break;case 113:i.key=a?$.ESC+`[1;`+(a+1)+`Q`:$.ESC+`OQ`;break;case 114:i.key=a?$.ESC+`[1;`+(a+1)+`R`:$.ESC+`OR`;break;case 115:i.key=a?$.ESC+`[1;`+(a+1)+`S`:$.ESC+`OS`;break;case 116:i.key=a?$.ESC+`[15;`+(a+1)+`~`:$.ESC+`[15~`;break;case 117:i.key=a?$.ESC+`[17;`+(a+1)+`~`:$.ESC+`[17~`;break;case 118:i.key=a?$.ESC+`[18;`+(a+1)+`~`:$.ESC+`[18~`;break;case 119:i.key=a?$.ESC+`[19;`+(a+1)+`~`:$.ESC+`[19~`;break;case 120:i.key=a?$.ESC+`[20;`+(a+1)+`~`:$.ESC+`[20~`;break;case 121:i.key=a?$.ESC+`[21;`+(a+1)+`~`:$.ESC+`[21~`;break;case 122:i.key=a?$.ESC+`[23;`+(a+1)+`~`:$.ESC+`[23~`;break;case 123:i.key=a?$.ESC+`[24;`+(a+1)+`~`:$.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=$.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=$.DEL:e.keyCode===219?i.key=$.ESC:e.keyCode===220?i.key=$.FS:e.keyCode===221&&(i.key=$.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=kq[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=$.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=$.ESC+n}else if(e.keyCode===32)i.key=$.ESC+(e.ctrlKey?$.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=$.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=$.US),e.key===`@`&&(i.key=$.NUL))}return i}var jq=0,Mq=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new vG,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new vG,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||(jq=this._search(t),jq===-1)||this._getKey(this._array[jq])!==t)return!1;do if(this._array[jq]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(jq),!0;while(++jq<this._array.length&&this._getKey(this._array[jq])===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&&(jq=this._search(e),!(jq<0||jq>=this._array.length)&&this._getKey(this._array[jq])===e))do yield this._array[jq];while(++jq<this._array.length&&this._getKey(this._array[jq])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(jq=this._search(e),!(jq<0||jq>=this._array.length)&&this._getKey(this._array[jq])===e))do t(this._array[jq]);while(++jq<this._array.length&&this._getKey(this._array[jq])===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}},Nq=0,Pq=0,Fq=class extends SV{constructor(){super(),this._decorations=new Mq(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Q),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Q),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(yV(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Iq(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=>{Nq=t.options.x??0,Pq=Nq+(t.options.width??1),e>=Nq&&e<Pq&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},Iq=class extends xV{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Q),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Q),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?yW.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?yW.toColor(this.options.foregroundColor):void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Lq=1e3,Rq=class{constructor(e,t=Lq){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)}},zq=20,Bq=class extends SV{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 Rq(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(`
|
|
268
268
|
`))),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(fU(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(yV(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<zq+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
269
269
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===zq+1&&(this._liveRegion.textContent+=uB.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})`}};Bq=aB([oB(1,LB),oB(2,KB),oB(3,JB)],Bq);var Vq=class extends SV{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 Q),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Q),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(yV(()=>{_V(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(fU(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(fU(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(fU(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(fU(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&&Hq(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,_V(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}}};Vq=aB([oB(1,qB),oB(2,JB),oB(3,NB),oB(4,QB)],Vq);function Hq(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 Uq=class extends Oq{constructor(e={}){super(e),this._linkifier=this._register(new CV),this.browser=tG,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new CV),this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Q),this.onKey=this._onKey.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Q),this.onBell=this._onBell.event,this._onFocus=this._register(new Q),this._onBlur=this._register(new Q),this._onA11yCharEmitter=this._register(new Q),this._onA11yTabEmitter=this._register(new Q),this._onWillOpen=this._register(new Q),this._setup(),this._decorationService=this._instantiationService.createInstance(Fq),this._instantiationService.setService(HB,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(XW),this._instantiationService.setService(QB,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(UB)),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(AV.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(AV.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(AV.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(AV.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(yV(()=>{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=vW.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${$.ESC}]${n};${fq(r)}${uW.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=_W.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=_W.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(Bq,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.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($.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(fU(this.element,`copy`,e=>{this.hasSelection()&&pB(e,this._selectionService)}));let e=e=>mB(e,this.textarea,this.coreService,this.optionsService);this._register(fU(this.textarea,`paste`,e)),this._register(fU(this.element,`paste`,e)),aG?this._register(fU(this.element,`mousedown`,e=>{e.button===2&&_B(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(fU(this.element,`contextmenu`,e=>{_B(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),pG&&this._register(fU(this.element,`auxclick`,e=>{e.button===1&&gB(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(fU(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(fU(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(fU(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(fU(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(fU(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(fU(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(fU(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(fU(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`,cB.get()),mG||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(JW,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(KB,this._coreBrowserService),this._register(fU(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(fU(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(WW,this._document,this._helperContainer),this._instantiationService.setService(GB,this._charSizeService),this._themeService=this._instantiationService.createInstance(QG),this._instantiationService.setService(ZB,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(TW),this._instantiationService.setService(XB,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(bG,this.rows,this.screenElement)),this._instantiationService.setService(JB,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(dW,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance($W),this._instantiationService.setService(qB,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Vq,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(nW,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(HG,this.element,this.screenElement,r)),this._instantiationService.setService(YB,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(AV.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(rW,this.screenElement)),this._register(fU(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(Bq,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(cW,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(cW,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(UW,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(fU(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(fU(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=$.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){hB(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=Aq(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===$.ETX||n.key===$.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)&&(Wq(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(cK));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($.ESC+`[I`):this.coreService.triggerDataEvent($.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(`${$.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(`${$.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}};function Wq(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Gq=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)}},Kq=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 EB)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},qq=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 Kq(t)}getNullCell(){return new EB}},Jq=class extends SV{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Q),this.onBufferChange=this._onBufferChange.event,this._normal=new qq(this._core.buffers.normal,`normal`),this._alternate=new qq(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)}},Yq=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)}},Xq=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}},Zq=[`cols`,`rows`],Qq=0,$q=class extends SV{constructor(e){super(),this._core=this._register(new Uq(e)),this._addonManager=this._register(new Gq),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(Zq.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 Yq(this._core),this._parser}get unicode(){return this._checkProposedApi(),new Xq(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 Jq(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
|
|
270
|
-
`,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 cB.get()},set promptLabel(e){cB.set(e)},get tooMuchOutput(){return uB.get()},set tooMuchOutput(e){uB.set(e)}}}_verifyIntegers(...e){for(Qq of e)if(Qq===1/0||isNaN(Qq)||Qq%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Qq of e)if(Qq&&(Qq===1/0||isNaN(Qq)||Qq%1!=0||Qq<0))throw Error(`This API only accepts positive integers`)}},eJ=2,tJ=1,nJ=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(eJ,Math.floor(u/e.css.cell.width)),rows:Math.max(tJ,Math.floor(l/e.css.cell.height))}}},rJ={key:0,class:`pty-context-bar`},iJ=Je(B({__name:`PtyContextBar`,setup(e){let{attachedContexts:t,removeAttachedContext:n}=Ut();return(e,i)=>r(t).length>0?(V(),P(`div`,rJ,[(V(!0),P(H,null,F(r(t),(e,t)=>(V(),G(Yz,{key:t,icon:e.icon,label:e.label,text:e.text,removable:``,onRemove:e=>r(n)(t)},null,8,[`icon`,`label`,`text`,`onRemove`]))),128))])):K(``,!0)}}),[[`__scopeId`,`data-v-cfcb3a01`]]);function aJ(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)}}var oJ=[`#2e3436`,`#cc0000`,`#4e9a06`,`#c4a000`,`#3465a4`,`#75507b`,`#06989a`,`#d3d7cf`,`#555753`,`#ef2929`,`#8ae234`,`#fce94f`,`#729fcf`,`#ad7fa8`,`#34e2e2`,`#eeeeec`],sJ=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`];function cJ(e){return e.toString(16).padStart(2,`0`)}function lJ(e,t={}){if(e<16)return t[sJ[e]]??oJ[e];if(e<232){let t=[0,95,135,175,215,255],n=e-16;return`#${cJ(t[Math.floor(n/36)])}${cJ(t[Math.floor(n/6)%6])}${cJ(t[n%6])}`}let n=8+(e-232)*10;return`#${cJ(n)}${cJ(n)}${cJ(n)}`}function uJ(e,t,n,r){let i=e===`fg`;if(i?t.isFgDefault():t.isBgDefault())return null;let a=i?t.getFgColor():t.getBgColor();return(i?t.isFgRGB():t.isBgRGB())?`#${a.toString(16).padStart(6,`0`)}`:lJ(i&&r&&a<8?a+8:a,n)}function dJ(e,t){let n=e.isBold()!==0,r=uJ(`fg`,e,t,n),i=uJ(`bg`,e,t,!1);e.isInverse()&&([r,i]=[i??t.background??`#000`,r??t.foreground??`#fff`]);let a=[];r&&a.push(`color:${r}`),i&&a.push(`background:${i}`),n&&a.push(`font-weight:bold`),e.isItalic()&&a.push(`font-style:italic`),e.isDim()&&a.push(`opacity:0.5`);let o=[e.isUnderline()?`underline`:``,e.isStrikethrough()?`line-through`:``,e.isOverline()?`overline`:``].filter(Boolean);return o.length&&a.push(`text-decoration:${o.join(` `)}`),e.isInvisible()&&a.push(`visibility:hidden`),a.join(`;`)}function fJ(e,t,n,r){let i=[],a=r;for(let r=0;r<t&&(a=e.getCell(r,a),a);r+=1){if(a.getWidth()===0)continue;let e=a.getChars()||` `,t=dJ(a,n),r=i[i.length-1];r&&r.style===t?r.text+=e:i.push({text:e,style:t})}for(;i.length;){let e=i[i.length-1];if(e.style.includes(`background`)||e.style.includes(`text-decoration`)||(e.text=e.text.trimEnd(),e.text))break;i.pop()}return i}function pJ(e,t,n,r,i){let a=(t.querySelector(`.xterm-screen`)??t).getBoundingClientRect(),o=t.getBoundingClientRect(),s=a.height/(e.rows||24),c=document.createElement(`div`);c.className=`terminal-native-selection`,c.contentEditable=`true`,c.spellcheck=!1,c.setAttribute(`inputmode`,`none`),c.setAttribute(`autocapitalize`,`off`),c.setAttribute(`autocorrect`,`off`),c.setAttribute(`aria-label`,Ce.global.t(`terminal.nativeSelection`)),Object.assign(c.style,{position:`absolute`,left:`${a.left-o.left}px`,top:`${a.top-o.top}px`,width:`${a.width}px`,height:`${a.height}px`,zIndex:`6`,margin:`0`,overflowX:`hidden`,overflowY:`auto`,overscrollBehavior:`contain`,whiteSpace:`pre`,outline:`none`,caretColor:`transparent`,fontFamily:e.options.fontFamily??`monospace`,fontSize:`${e.options.fontSize??14}px`,lineHeight:`${s}px`,background:e.options.theme?.background??`#000`,color:e.options.theme?.foreground??`#fff`,userSelect:`text`,webkitUserSelect:`text`,touchAction:`auto`});let l=e.options.theme??{},u=e.buffer.active,d=u.getNullCell();for(let t=0;t<u.length;t+=1){let n=document.createElement(`div`),r=u.getLine(t),i=r?fJ(r,e.cols,l,d):[];for(let e of i){let t=document.createElement(`span`);t.textContent=e.text,e.style&&(t.style.cssText=e.style),n.appendChild(t)}i.length||(n.textContent=`\xA0`),c.appendChild(n)}let f=document.createElement(`button`);f.type=`button`,f.textContent=Ce.global.t(`terminal.closeSelection`),Object.assign(f.style,{position:`absolute`,top:`8px`,right:`8px`,zIndex:`7`,padding:`6px 12px`,border:`0`,borderRadius:`6px`,font:`inherit`,fontSize:`14px`,background:`var(--r-primary)`,color:`var(--r-primary-contrast)`});let p=e=>e.stopPropagation(),m=e=>e.preventDefault(),h=t=>{t.preventDefault();let n=t.clipboardData?.getData(`text/plain`);y(),n&&(e.paste(n),e.focus())},g=()=>{setTimeout(y,0)},_=e=>{e.key===`Escape`&&y()},v=!1;function y(){v||(v=!0,c.remove(),f.remove(),i())}return c.addEventListener(`touchstart`,p,{passive:!0}),c.addEventListener(`touchmove`,p,{passive:!0}),c.addEventListener(`touchend`,p,{passive:!0}),c.addEventListener(`beforeinput`,m),c.addEventListener(`paste`,h),c.addEventListener(`copy`,g),c.addEventListener(`keydown`,_),f.addEventListener(`touchstart`,p,{passive:!0}),f.addEventListener(`click`,e=>{e.preventDefault(),y()}),getComputedStyle(t).position===`static`&&(t.style.position=`relative`),t.appendChild(c),t.appendChild(f),c.scrollTop=e.buffer.active.viewportY*s,c.focus({preventScroll:!0}),mJ(c,n,r),y}function mJ(e,t,n){let r=window.getSelection(),i=document.caretRangeFromPoint?.(t,n);if(!r||!i||!e.contains(i.startContainer))return;r.removeAllRanges(),r.addRange(i);let a=r;a.modify&&(a.modify(`move`,`backward`,`word`),a.modify(`extend`,`forward`,`word`))}var hJ=450;function gJ(e,t){let n=null,r=0,i=0,a=`none`,o=0,s=0,c=0,l=null,u=null,d=!1,f=null;function p(){u!==null&&(clearTimeout(u),u=null)}let m=()=>{let n=e.rows||24,r=t.querySelector(`.xterm-viewport`)?.clientHeight??t.clientHeight;return r>0?r/n:17},h=1,g=1;function _(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;h=Math.min(Math.max(o,1),e.cols),g=Math.min(Math.max(s,1),e.rows)}function v(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};${h};${g}M`;for(let t=0;t<r;t+=1)e.input(i,!0)}function y(){l!==null&&(cancelAnimationFrame(l),l=null)}function b(){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 x=l=>{if(y(),p(),d=!1,l.touches.length!==1){n=null;return}n=l.touches[0].clientY,r=l.touches[0].clientX,_(r,n),i=n,a=`none`,o=0,s=0,c=performance.now();let m=r,h=i;u=setTimeout(()=>{u=null,!(a!==`none`||f)&&(d=!0,n=null,f=pJ(e,t,m,h,()=>{f=null}),navigator.vibrate?.(10))},hJ)},S=t=>{if(n===null||t.touches.length!==1)return;t.preventDefault();let l=t.touches[0].clientY;if(a===`none`){let e=Math.abs(t.touches[0].clientX-r),n=Math.abs(l-i);if(Math.max(e,n)<8)return;if(p(),e>n){a=`horizontal`;return}a=`vertical`}if(a!==`vertical`)return;let u=n-l;n=l;let d=u/m(),f=performance.now(),h=f-c;c=f,h>0&&h<100&&(s=s*.7+d/h*.3),o+=d;let g=Math.trunc(o);g!==0&&(o-=g,e.buffer.active.type===`alternate`?v(g):e.scrollLines(g))},C=e=>{if(p(),d){d=!1,e.cancelable&&e.preventDefault();return}a===`vertical`&&b(),n=null,a=`none`};t.addEventListener(`touchstart`,x,{passive:!0}),t.addEventListener(`touchmove`,S,{passive:!1}),t.addEventListener(`touchend`,C,{passive:!1}),t.addEventListener(`touchcancel`,C,{passive:!0});let w=e=>{d&&e.preventDefault()};return t.addEventListener(`contextmenu`,w),()=>{y(),p(),f?.(),t.removeEventListener(`contextmenu`,w),t.removeEventListener(`touchstart`,x),t.removeEventListener(`touchmove`,S),t.removeEventListener(`touchend`,C),t.removeEventListener(`touchcancel`,C)}}function _J(e,t){let n=e+(t>0?-1:1);return Math.min(Math.max(n,8),32)}function vJ(e,t){try{let t=Number(localStorage.getItem(e));if(Number.isFinite(t)&&t>=8&&t<=32)return t}catch{}return t}function yJ(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=_J(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 bJ(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 xJ=150,SJ=1.01,CJ=i(!1),wJ=0,TJ=0;function EJ(){let e=document.activeElement;return e?e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable:!1}var DJ=0,OJ=null;function kJ(){return typeof window>`u`?!1:window.matchMedia?.(`(pointer: coarse)`).matches?!0:(navigator.maxTouchPoints??0)>0}function AJ(e){return!e.editing||e.scale>SJ?{visible:!1}:{visible:Math.max(e.maxHeight-e.innerHeight,e.innerHeight-e.viewportHeight)>=xJ}}function jJ(e=!1){let t=window.visualViewport;if(!t){CJ.value=!1;return}let n=EJ();(window.innerWidth!==TJ||e&&!n)&&(TJ=window.innerWidth,wJ=0),wJ=Math.max(wJ,window.innerHeight),CJ.value=AJ({innerHeight:window.innerHeight,viewportHeight:t.height,maxHeight:wJ,scale:t.scale,editing:n}).visible}function MJ(){if(!kJ()||(DJ+=1,OJ))return;let e=window.visualViewport;if(!e)return;let t=()=>jJ(!0),n=()=>jJ(!1);e.addEventListener(`resize`,t),e.addEventListener(`scroll`,n),window.addEventListener(`resize`,t),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),OJ=()=>{e.removeEventListener(`resize`,t),e.removeEventListener(`scroll`,n),window.removeEventListener(`resize`,t),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)},jJ()}function NJ(){DJ=Math.max(0,DJ-1),!(DJ>0||!OJ)&&(OJ(),OJ=null,CJ.value=!1)}function PJ(){return I(MJ),ee(NJ),{keyboardVisible:l(CJ)}}var FJ=`\x1B`,IJ={up:`A`,down:`B`,right:`C`,left:`D`};function LJ(e,t){switch(e){case`up`:case`down`:case`left`:case`right`:return`${FJ}${t?`O`:`[`}${IJ[e]}`;case`esc`:return FJ;case`tab`:return` `;case`enter`:return`\r`;case`ctrl-c`:return``}}var RJ=[`aria-label`],zJ=[`title`,`aria-label`,`onPointerdown`],BJ={class:`terminal-key-bar__cap`},VJ=Je(B({__name:`TerminalKeyBar`,props:{terminal:{}},setup(e){let t=e,{t:n}=ve(),{keyboardVisible:a}=PJ(),o=kJ(),s=i(!1);function c(){let e=t.terminal?.element;s.value=e!=null&&e.contains(document.activeElement)}I(()=>{document.addEventListener(`focusin`,c),document.addEventListener(`focusout`,c),c()}),ee(()=>{document.removeEventListener(`focusin`,c),document.removeEventListener(`focusout`,c)});let l=z(()=>o&&s.value),u=z(()=>a.value);function d(e){return LJ(e,t.terminal?.modes.applicationCursorKeysMode===!0)}let f=z(()=>[{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 p(e,n){n.preventDefault(),t.terminal?.input(d(e.id),!0),t.terminal?.focus()}return(e,t)=>(V(),G(le,{to:`body`,disabled:!u.value},[l.value?(V(),P(`div`,{key:0,class:L([`terminal-key-bar`,{"terminal-key-bar--inline":!u.value}]),role:`toolbar`,"aria-label":r(n)(`terminal.keyBar.label`)},[(V(!0),P(H,null,F(f.value,e=>(V(),P(`button`,{key:e.id,type:`button`,class:L([`terminal-key-bar__key`,{"terminal-key-bar__key--wide":e.wide}]),title:e.title,"aria-label":e.title,onPointerdown:t=>p(e,t)},[N(`kbd`,BJ,W(e.label),1)],42,zJ))),128))],10,RJ)):K(``,!0)],8,[`disabled`]))}}),[[`__scopeId`,`data-v-b7ba3648`]]),HJ={key:0,class:`claude-terminal__error`},UJ=`runeya:ai-terminal-font-size`,WJ=Je(B({__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;function E(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 D(e,t){if(p&&f)try{let n=await E(e),r=await J.chat.pty.pasteImage.mutate({agentId:p,sessionId:t,mimeType:e.type||`image/png`,base64:n});r.clipboardMethod?await J.chat.pty.write.mutate({agentId:p,spawnId:f,data:``}):await J.chat.pty.write.mutate({agentId:p,spawnId:f,data:`@${r.tmpPath} `})}catch(e){console.error(`[ClaudeTerminal] image paste failed:`,e)}}let{attachedContexts:O,clearAttachedContexts:k,contextServiceId:A,pendingDiffContext:j,pendingContext:M,pendingPopulateContext:F,autoSendPending:R,setDiffContext:z}=Ut(),te=Yt(),ne=Dt(),B=xe();function re(){let e=[];if(A.value){let t=te.getById(A.value);t&&e.push({label:`Service: ${t.name}`,icon:`ti-server`,text:`Service attached: ${t.name}\nID: ${t.id}\nCommands: ${t.commands.map(e=>e.command).join(` ; `)||`(none)`}\nCwd: ${t.cwd??`(none)`}`})}j.value&&e.push({label:`Diff`,icon:`ti-code`,text:j.value}),M.value&&e.push(M.value);for(let t of O.value)e.push(t);return e}function H(){l?.fit(),p&&f&&o&&J.chat.pty.resize.mutate({agentId:p,spawnId:f,cols:o.cols,rows:o.rows}).catch(()=>{})}async function ie(){if(!n.value)return;if(await ae(),a.value=null,o=new $q({cursorBlink:!0,fontFamily:`monospace`,fontSize:vJ(UJ,13),theme:{background:`#1a1b1e`,foreground:`#d4d4d4`,cursor:`#d4d4d4`},allowProposedApi:!1}),l=new nJ,o.loadAddon(l),o.open(n.value),c.value=o,y=bJ(o),_=gJ(o,n.value),v=yJ({terminal:o,container:n.value,storageKey:UJ,onResize:()=>H()}),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=re().map(e=>({label:e.label,text:e.text})),n=R.value&&F.value?F.value:void 0,r=await J.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,...B.activeProjectId?{projectId:B.activeProjectId,orgId:B.activeOrgId}:{},cols:o.cols,rows:o.rows,enableMcp:!0,environmentId:ne.currentProject?.activeEnvironmentId,attachedContexts:e.length>0?e:void 0,initialPrompt:n});f=r.spawnId,p=r.agentId,!r.reattached&&n&&(R.value=!1,F.value=null),e.length>0&&(k(),z(null),M.value=null)}catch(e){w=!0,a.value=e.message,o.dispose(),o=null,c.value=null;return}d=J.chat.pty.stream.subscribe({agentId:p,spawnId:f,fromOffset:0},{onData(e){if(e.offset<=S)return;S=e.offset;let{chunk:n}=e;n.type===`pty-data`?y?.write(n.data):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&&J.chat.pty.write.mutate({agentId:p,spawnId:f,data:e}).catch(()=>{})};o.onData(e),g=aJ(o,e),u=new ResizeObserver(()=>H()),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(),D(n,t.sessionId);return}}}},h.addEventListener(`paste`,m,!0)),r.value=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>o?.focus())})}function U(){o?.focus()}async function ae(){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,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],()=>{ie()}),I(()=>{ie(),T=vt(()=>{a.value=null,w&&ie()})}),ee(()=>{T?.(),T=null,ae()}),(e,t)=>(V(),P(`div`,{class:`claude-terminal`,onClick:U},[b(iJ),b(VJ,{terminal:c.value},null,8,[`terminal`]),a.value?(V(),P(`div`,HJ,[t[0]||=N(`i`,{class:`ti ti-alert-triangle`},null,-1),x(` `+W(a.value),1)])):K(``,!0),N(`div`,{ref_key:`terminalEl`,ref:n,class:L([`claude-terminal__xterm`,{"claude-terminal__xterm--hidden":!r.value}])},null,2)]))}}),[[`__scopeId`,`data-v-f2640e3e`]]),GJ={class:`secret-env__intro`},KJ={key:0,class:`secret-env__empty`},qJ={key:1,class:`secret-env__empty`},JJ={class:`secret-env__fields`},YJ={key:0,class:`secret-env__error`},XJ=Je(B({__name:`ConversationSecretEnvDialog`,props:_({conversationId:{}},{visible:{type:Boolean,required:!0},visibleModifiers:{}}),emits:_([`saved`],[`update:visible`]),setup(e,{emit:t}){let n=e,a=S(e,`visible`),o=t,{t:s}=ve(),c=Le(),l=i([]),u=i(!1),d=i(!1),f=i(!1),p=/^[A-Za-z_][A-Za-z0-9_]*$/;async function m(){u.value=!0,d.value=!1;try{let e=await J.chat.conversations.secretEnvKeys.query({id:n.conversationId});l.value=e.map(e=>({key:e,value:``,stored:!0})),d.value=!0}catch(e){c.add({severity:`error`,summary:s(`aiChat.secretEnv.loadFailed`),detail:e.message,life:4e3}),l.value=[]}finally{u.value=!1}}C(a,e=>{e&&m()});function h(){l.value=[...l.value,{key:``,value:``,stored:!1}]}function g(e){l.value=l.value.filter((t,n)=>n!==e)}function _(e,t){return p.test(e.key)?l.value.findIndex(t=>t.key===e.key)===t?!e.stored&&e.value===``?s(`aiChat.secretEnv.missingValue`):null:s(`aiChat.secretEnv.duplicateName`):s(`aiChat.secretEnv.invalidName`)}let v=()=>l.value.some((e,t)=>_(e,t)!==null);async function y(){if(d.value&&!v()){f.value=!0;try{await J.chat.conversations.setSecretEnv.mutate({id:n.conversationId,entries:l.value.map(e=>({key:e.key,...e.value===``?{}:{value:e.value}}))}),c.add({severity:`success`,summary:s(`aiChat.secretEnv.saved`),life:3e3}),a.value=!1,o(`saved`)}catch(e){c.add({severity:`error`,summary:s(`aiChat.secretEnv.saveFailed`),detail:e.message,life:5e3})}finally{f.value=!1}}}return(e,t)=>(V(),G(r(Ue),{visible:a.value,"onUpdate:visible":t[1]||=e=>a.value=e,modal:``,header:r(s)(`aiChat.secretEnv.title`),style:{width:`640px`,maxWidth:`95vw`}},{footer:U(()=>[b(r(q),{variant:`text`,label:r(s)(`actions.cancel`),onClick:t[0]||=e=>a.value=!1},null,8,[`label`]),b(r(q),{label:r(s)(`aiChat.secretEnv.save`),loading:f.value,disabled:f.value||!d.value||v(),onClick:y},null,8,[`label`,`loading`,`disabled`])]),default:U(()=>[N(`p`,GJ,W(r(s)(`aiChat.secretEnv.intro`)),1),b(r(Ve),{severity:`warn`,class:`secret-env__warn`},{default:U(()=>[x(W(r(s)(`aiChat.secretEnv.restartNotice`)),1)]),_:1}),u.value?(V(),P(`div`,KJ,W(r(s)(`aiChat.secretEnv.loading`)),1)):l.value.length===0?(V(),P(`div`,qJ,W(r(s)(`aiChat.secretEnv.empty`)),1)):K(``,!0),(V(!0),P(H,null,F(l.value,(e,t)=>(V(),P(`div`,{key:t,class:`secret-env__row`},[N(`div`,JJ,[b(r(Ne),{modelValue:e.key,"onUpdate:modelValue":t=>e.key=t,class:`secret-env__key`,placeholder:r(s)(`aiChat.secretEnv.namePlaceholder`),"aria-label":r(s)(`aiChat.secretEnv.name`),disabled:e.stored,spellcheck:`false`,autocomplete:`off`},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`,`aria-label`,`disabled`]),b(r(st),{modelValue:e.value,"onUpdate:modelValue":t=>e.value=t,class:`secret-env__value`,feedback:!1,"toggle-mask":``,autocomplete:`new-password`,placeholder:e.stored?r(s)(`aiChat.secretEnv.storedPlaceholder`):r(s)(`aiChat.secretEnv.valuePlaceholder`),"aria-label":r(s)(`aiChat.secretEnv.value`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`,`aria-label`]),b(r(q),{size:`small`,variant:`text`,icon:`ti ti-trash`,title:r(s)(`aiChat.secretEnv.remove`),"aria-label":r(s)(`aiChat.secretEnv.remove`),onClick:e=>g(t)},null,8,[`title`,`aria-label`,`onClick`])]),_(e,t)&&(e.key!==``||e.value!==``)?(V(),P(`small`,YJ,W(_(e,t)),1)):K(``,!0)]))),128)),b(r(q),{size:`small`,variant:`outlined`,disabled:!d.value,icon:`ti ti-plus`,label:r(s)(`aiChat.secretEnv.add`),onClick:h},null,8,[`disabled`,`label`])]),_:1},8,[`visible`,`header`]))}}),[[`__scopeId`,`data-v-ccb5fce5`]]);function ZJ(e){return p()?(u(e),!0):!1}function QJ(e){return typeof e==`function`?e():r(e)}var $J=typeof window<`u`&&typeof document<`u`,eY=e=>e!==void 0,tY=Object.prototype.toString,nY=e=>tY.call(e)===`[object Object]`,rY=()=>{};function iY(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 aY=e=>e();function oY(e=aY){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 sY(e,t=!1,n=`Timeout`){return new Promise((r,i)=>{setTimeout(t?()=>i(n):r,e)})}function cY(e,t,n={}){let{eventFilter:r=aY,...i}=n;return C(e,iY(r,t),i)}function lY(e,t,n={}){let{eventFilter:r,...i}=n,{eventFilter:a,pause:o,resume:s,isActive:c}=oY(r);return{stop:cY(e,t,{...i,eventFilter:a}),pause:o,resume:s,isActive:c}}function uY(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(QJ(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 dY(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(sY(a,o).then(()=>QJ(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(sY(s,c).then(()=>QJ(e)).finally(()=>(l?.(),QJ(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(QJ(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(QJ(e))?{toMatch:n,toContains:c,changed:l,changedTimes:u,get not(){return dY(e,!t)}}:{toMatch:n,toBe:r,toBeTruthy:i,toBeNull:a,toBeNaN:s,toBeUndefined:o,changed:l,changedTimes:u,get not(){return dY(e,!t)}}}function fY(e){return dY(e)}function pY(e){let t=QJ(e);return t?.$el??t}var mY=$J?window:void 0;function hY(...e){let t,n,r,i;if(typeof e[0]==`string`||Array.isArray(e[0])?([n,r,i]=e,t=mY):[t,n,r,i]=e,!t)return rY;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(()=>[pY(t),QJ(i)],([e,t])=>{if(o(),!e)return;let i=nY(t)?{...t}:t;a.push(...n.flatMap(t=>r.map(n=>s(e,t,n,i))))},{immediate:!0,flush:`post`}),l=()=>{c(),o()};return ZJ(l),l}function gY(e){return typeof e==`function`?e:typeof e==`string`?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function _Y(...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=mY,eventName:a=`keydown`,passive:o=!1,dedupe:s=!1}=r,c=gY(t);return hY(i,a,e=>{e.repeat&&QJ(s)||c(e)&&n(e)},o)}function vY(e){return JSON.parse(JSON.stringify(e))}function yY(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):vY(e):e,h=()=>eY(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),ce(()=>a=!1))}),C(r,n=>{!a&&(n!==e[t]||c)&&g(n)},{deep:c}),r}return z({get(){return h()},set(e){g(e)}})}var bY={value:()=>{}};function xY(){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 SY(n)}function SY(e){this._=e}function CY(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}})}SY.prototype=xY.prototype={constructor:SY,on:function(e,t){var n=this._,r=CY(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=wY(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]=TY(n[i],e.name,t);else if(t==null)for(i in n)n[i]=TY(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 SY(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 wY(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function TY(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=bY,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var EY=`http://www.w3.org/1999/xhtml`,DY={svg:`http://www.w3.org/2000/svg`,xhtml:EY,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function OY(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),DY.hasOwnProperty(t)?{space:DY[t],local:e}:e}function kY(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===EY&&t.documentElement.namespaceURI===EY?t.createElement(e):t.createElementNS(n,e)}}function AY(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function jY(e){var t=OY(e);return(t.local?AY:kY)(t)}function MY(){}function NY(e){return e==null?MY:function(){return this.querySelector(e)}}function PY(e){typeof e!=`function`&&(e=NY(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 SZ(r,this._parents)}function FY(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function IY(){return[]}function LY(e){return e==null?IY:function(){return this.querySelectorAll(e)}}function RY(e){return function(){return FY(e.apply(this,arguments))}}function zY(e){e=typeof e==`function`?RY(e):LY(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 SZ(r,i)}function BY(e){return function(){return this.matches(e)}}function VY(e){return function(t){return t.matches(e)}}var HY=Array.prototype.find;function UY(e){return function(){return HY.call(this.children,e)}}function WY(){return this.firstElementChild}function GY(e){return this.select(e==null?WY:UY(typeof e==`function`?e:VY(e)))}var KY=Array.prototype.filter;function qY(){return Array.from(this.children)}function JY(e){return function(){return KY.call(this.children,e)}}function YY(e){return this.selectAll(e==null?qY:JY(typeof e==`function`?e:VY(e)))}function XY(e){typeof e!=`function`&&(e=BY(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 SZ(r,this._parents)}function ZY(e){return Array(e.length)}function QY(){return new SZ(this._enter||this._groups.map(ZY),this._parents)}function $Y(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}$Y.prototype={constructor:$Y,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 eX(e){return function(){return e}}function tX(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 $Y(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function nX(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 $Y(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function rX(e){return e.__data__}function iX(e,t){if(!arguments.length)return Array.from(this,rX);var n=t?nX:tX,r=this._parents,i=this._groups;typeof e!=`function`&&(e=eX(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=aX(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 SZ(o,r),o._enter=s,o._exit=c,o}function aX(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function oX(){return new SZ(this._exit||this._groups.map(ZY),this._parents)}function sX(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 cX(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 SZ(s,this._parents)}function lX(){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 uX(e){e||=dX;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 SZ(i,this._parents).order()}function dX(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function fX(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function pX(){return Array.from(this)}function mX(){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 hX(){let e=0;for(let t of this)++e;return e}function gX(){return!this.node()}function _X(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 vX(e){return function(){this.removeAttribute(e)}}function yX(e){return function(){this.removeAttributeNS(e.space,e.local)}}function bX(e,t){return function(){this.setAttribute(e,t)}}function xX(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function SX(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function CX(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 wX(e,t){var n=OY(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?yX:vX:typeof t==`function`?n.local?CX:SX:n.local?xX:bX)(n,t))}function TX(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function EX(e){return function(){this.style.removeProperty(e)}}function DX(e,t,n){return function(){this.style.setProperty(e,t,n)}}function OX(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function kX(e,t,n){return arguments.length>1?this.each((t==null?EX:typeof t==`function`?OX:DX)(e,t,n??``)):AX(this.node(),e)}function AX(e,t){return e.style.getPropertyValue(t)||TX(e).getComputedStyle(e,null).getPropertyValue(t)}function jX(e){return function(){delete this[e]}}function MX(e,t){return function(){this[e]=t}}function NX(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function PX(e,t){return arguments.length>1?this.each((t==null?jX:typeof t==`function`?NX:MX)(e,t)):this.node()[e]}function FX(e){return e.trim().split(/^|\s+/)}function IX(e){return e.classList||new LX(e)}function LX(e){this._node=e,this._names=FX(e.getAttribute(`class`)||``)}LX.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 RX(e,t){for(var n=IX(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function zX(e,t){for(var n=IX(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function BX(e){return function(){RX(this,e)}}function VX(e){return function(){zX(this,e)}}function HX(e,t){return function(){(t.apply(this,arguments)?RX:zX)(this,e)}}function UX(e,t){var n=FX(e+``);if(arguments.length<2){for(var r=IX(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?HX:t?BX:VX)(n,t))}function WX(){this.textContent=``}function GX(e){return function(){this.textContent=e}}function KX(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function qX(e){return arguments.length?this.each(e==null?WX:(typeof e==`function`?KX:GX)(e)):this.node().textContent}function JX(){this.innerHTML=``}function YX(e){return function(){this.innerHTML=e}}function XX(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function ZX(e){return arguments.length?this.each(e==null?JX:(typeof e==`function`?XX:YX)(e)):this.node().innerHTML}function QX(){this.nextSibling&&this.parentNode.appendChild(this)}function $X(){return this.each(QX)}function eZ(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function tZ(){return this.each(eZ)}function nZ(e){var t=typeof e==`function`?e:jY(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function rZ(){return null}function iZ(e,t){var n=typeof e==`function`?e:jY(e),r=t==null?rZ:typeof t==`function`?t:NY(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function aZ(){var e=this.parentNode;e&&e.removeChild(this)}function oZ(){return this.each(aZ)}function sZ(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function cZ(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function lZ(e){return this.select(e?cZ:sZ)}function uZ(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function dZ(e){return function(t){e.call(this,t,this.__data__)}}function fZ(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 pZ(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 mZ(e,t,n){return function(){var r=this.__on,i,a=dZ(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 hZ(e,t,n){var r=fZ(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?mZ:pZ,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function gZ(e,t,n){var r=TX(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 _Z(e,t){return function(){return gZ(this,e,t)}}function vZ(e,t){return function(){return gZ(this,e,t.apply(this,arguments))}}function yZ(e,t){return this.each((typeof t==`function`?vZ:_Z)(e,t))}function*bZ(){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 xZ=[null];function SZ(e,t){this._groups=e,this._parents=t}function CZ(){return new SZ([[document.documentElement]],xZ)}function wZ(){return this}SZ.prototype=CZ.prototype={constructor:SZ,select:PY,selectAll:zY,selectChild:GY,selectChildren:YY,filter:XY,data:iX,enter:QY,exit:oX,join:sX,merge:cX,selection:wZ,order:lX,sort:uX,call:fX,nodes:pX,node:mX,size:hX,empty:gX,each:_X,attr:wX,style:kX,property:PX,classed:UX,text:qX,html:ZX,raise:$X,lower:tZ,append:nZ,insert:iZ,remove:oZ,clone:lZ,datum:uZ,on:hZ,dispatch:yZ,[Symbol.iterator]:bZ};function TZ(e){return typeof e==`string`?new SZ([[document.querySelector(e)]],[document.documentElement]):new SZ([[e]],xZ)}function EZ(e){let t;for(;t=e.sourceEvent;)e=t;return e}function DZ(e,t){if(e=EZ(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 OZ={passive:!1},kZ={capture:!0,passive:!1};function AZ(e){e.stopImmediatePropagation()}function jZ(e){e.preventDefault(),e.stopImmediatePropagation()}function MZ(e){var t=e.document.documentElement,n=TZ(e).on(`dragstart.drag`,jZ,kZ);`onselectstart`in t?n.on(`selectstart.drag`,jZ,kZ):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function NZ(e,t){var n=e.document.documentElement,r=TZ(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,jZ,kZ),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 PZ=e=>()=>e;function FZ(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}})}FZ.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function IZ(e){return!e.ctrlKey&&!e.button}function LZ(){return this.parentNode}function RZ(e,t){return t??{x:e.x,y:e.y}}function zZ(){return navigator.maxTouchPoints||`ontouchstart`in this}function BZ(){var e=IZ,t=LZ,n=RZ,r=zZ,i={},a=xY(`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`,_,OZ).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&&(TZ(n.view).on(`mousemove.drag`,m,kZ).on(`mouseup.drag`,h,kZ),MZ(n.view),AZ(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(jZ(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){TZ(e.view).on(`mousemove.drag mouseup.drag`,null),NZ(e.view,l),jZ(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]))&&(AZ(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])&&(jZ(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])&&(AZ(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=DZ(l||r,t),p,m,h;if((h=n.call(e,new FZ(`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=DZ(l||a,t),_=o}u.call(r,e,new FZ(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:PZ(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:PZ(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:PZ(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:PZ(!!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 VZ(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function HZ(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function UZ(){}var WZ=.7,GZ=1/WZ,KZ=`\\s*([+-]?\\d+)\\s*`,qZ=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,JZ=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,YZ=/^#([0-9a-f]{3,8})$/,XZ=RegExp(`^rgb\\(${KZ},${KZ},${KZ}\\)$`),ZZ=RegExp(`^rgb\\(${JZ},${JZ},${JZ}\\)$`),QZ=RegExp(`^rgba\\(${KZ},${KZ},${KZ},${qZ}\\)$`),$Z=RegExp(`^rgba\\(${JZ},${JZ},${JZ},${qZ}\\)$`),eQ=RegExp(`^hsl\\(${qZ},${JZ},${JZ}\\)$`),tQ=RegExp(`^hsla\\(${qZ},${JZ},${JZ},${qZ}\\)$`),nQ={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};VZ(UZ,sQ,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:rQ,formatHex:rQ,formatHex8:iQ,formatHsl:aQ,formatRgb:oQ,toString:oQ});function rQ(){return this.rgb().formatHex()}function iQ(){return this.rgb().formatHex8()}function aQ(){return bQ(this).formatHsl()}function oQ(){return this.rgb().formatRgb()}function sQ(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=YZ.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?cQ(t):n===3?new fQ(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?lQ(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?lQ(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=XZ.exec(e))?new fQ(t[1],t[2],t[3],1):(t=ZZ.exec(e))?new fQ(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=QZ.exec(e))?lQ(t[1],t[2],t[3],t[4]):(t=$Z.exec(e))?lQ(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=eQ.exec(e))?yQ(t[1],t[2]/100,t[3]/100,1):(t=tQ.exec(e))?yQ(t[1],t[2]/100,t[3]/100,t[4]):nQ.hasOwnProperty(e)?cQ(nQ[e]):e===`transparent`?new fQ(NaN,NaN,NaN,0):null}function cQ(e){return new fQ(e>>16&255,e>>8&255,e&255,1)}function lQ(e,t,n,r){return r<=0&&(e=t=n=NaN),new fQ(e,t,n,r)}function uQ(e){return e instanceof UZ||(e=sQ(e)),e?(e=e.rgb(),new fQ(e.r,e.g,e.b,e.opacity)):new fQ}function dQ(e,t,n,r){return arguments.length===1?uQ(e):new fQ(e,t,n,r??1)}function fQ(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}VZ(fQ,dQ,HZ(UZ,{brighter(e){return e=e==null?GZ:GZ**+e,new fQ(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?WZ:WZ**+e,new fQ(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new fQ(_Q(this.r),_Q(this.g),_Q(this.b),gQ(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:pQ,formatHex:pQ,formatHex8:mQ,formatRgb:hQ,toString:hQ}));function pQ(){return`#${vQ(this.r)}${vQ(this.g)}${vQ(this.b)}`}function mQ(){return`#${vQ(this.r)}${vQ(this.g)}${vQ(this.b)}${vQ((isNaN(this.opacity)?1:this.opacity)*255)}`}function hQ(){let e=gQ(this.opacity);return`${e===1?`rgb(`:`rgba(`}${_Q(this.r)}, ${_Q(this.g)}, ${_Q(this.b)}${e===1?`)`:`, ${e})`}`}function gQ(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function _Q(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function vQ(e){return e=_Q(e),(e<16?`0`:``)+e.toString(16)}function yQ(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new SQ(e,t,n,r)}function bQ(e){if(e instanceof SQ)return new SQ(e.h,e.s,e.l,e.opacity);if(e instanceof UZ||(e=sQ(e)),!e)return new SQ;if(e instanceof SQ)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 SQ(o,s,c,e.opacity)}function xQ(e,t,n,r){return arguments.length===1?bQ(e):new SQ(e,t,n,r??1)}function SQ(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}VZ(SQ,xQ,HZ(UZ,{brighter(e){return e=e==null?GZ:GZ**+e,new SQ(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?WZ:WZ**+e,new SQ(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 fQ(TQ(e>=240?e-240:e+120,i,r),TQ(e,i,r),TQ(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new SQ(CQ(this.h),wQ(this.s),wQ(this.l),gQ(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=gQ(this.opacity);return`${e===1?`hsl(`:`hsla(`}${CQ(this.h)}, ${wQ(this.s)*100}%, ${wQ(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function CQ(e){return e=(e||0)%360,e<0?e+360:e}function wQ(e){return Math.max(0,Math.min(1,e||0))}function TQ(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 EQ=e=>()=>e;function DQ(e,t){return function(n){return e+n*t}}function OQ(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function kQ(e){return(e=+e)==1?AQ:function(t,n){return n-t?OQ(t,n,e):EQ(isNaN(t)?n:t)}}function AQ(e,t){var n=t-e;return n?DQ(e,n):EQ(isNaN(e)?t:e)}var jQ=function e(t){var n=kQ(t);function r(e,t){var r=n((e=dQ(e)).r,(t=dQ(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=AQ(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 MQ(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 NQ(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function PQ(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]=UQ(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 FQ(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function IQ(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function LQ(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]=UQ(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var RQ=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,zQ=new RegExp(RQ.source,`g`);function BQ(e){return function(){return e}}function VQ(e){return function(t){return e(t)+``}}function HQ(e,t){var n=RQ.lastIndex=zQ.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=RQ.exec(e))&&(i=zQ.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:IQ(r,i)})),n=zQ.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?VQ(c[0].x):BQ(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 UQ(e,t){var n=typeof t,r;return t==null||n===`boolean`?EQ(t):(n===`number`?IQ:n===`string`?(r=sQ(t))?(t=r,jQ):HQ:t instanceof sQ?jQ:t instanceof Date?FQ:NQ(t)?MQ:Array.isArray(t)?PQ:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?LQ:IQ)(e,t)}var WQ=180/Math.PI,GQ={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function KQ(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)*WQ,skewX:Math.atan(c)*WQ,scaleX:o,scaleY:s}}var qQ;function JQ(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?GQ:KQ(t.a,t.b,t.c,t.d,t.e,t.f)}function YQ(e){return e==null||(qQ||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),qQ.setAttribute(`transform`,e),!(e=qQ.transform.baseVal.consolidate()))?GQ:(e=e.matrix,KQ(e.a,e.b,e.c,e.d,e.e,e.f))}function XQ(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:IQ(e,i)},{i:c-2,x:IQ(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:IQ(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:IQ(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:IQ(e,n)},{i:s-2,x:IQ(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 ZQ=XQ(JQ,`px, `,`px)`,`deg)`),QQ=XQ(YQ,`, `,`)`,`)`),$Q=1e-12;function e$(e){return((e=Math.exp(e))+1/e)/2}function t$(e){return((e=Math.exp(e))-1/e)/2}function n$(e){return((e=Math.exp(2*e))-1)/(e+1)}var r$=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<$Q)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=e$(y),c=s/(n*g)*(i*n$(t*r+y)-t$(y));return[a+c*d,o+c*f,s*i/e$(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),i$=0,a$=0,o$=0,s$=1e3,c$,l$,u$=0,d$=0,f$=0,p$=typeof performance==`object`&&performance.now?performance:Date,m$=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function h$(){return d$||=(m$(g$),p$.now()+f$)}function g$(){d$=0}function _$(){this._call=this._time=this._next=null}_$.prototype=v$.prototype={constructor:_$,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?h$():+n)+(t==null?0:+t),!this._next&&l$!==this&&(l$?l$._next=this:c$=this,l$=this),this._call=e,this._time=n,C$()},stop:function(){this._call&&(this._call=null,this._time=1/0,C$())}};function v$(e,t,n){var r=new _$;return r.restart(e,t,n),r}function y$(){h$(),++i$;for(var e=c$,t;e;)(t=d$-e._time)>=0&&e._call.call(void 0,t),e=e._next;--i$}function b$(){d$=(u$=p$.now())+f$,i$=a$=0;try{y$()}finally{i$=0,S$(),d$=0}}function x$(){var e=p$.now(),t=e-u$;t>s$&&(f$-=t,u$=e)}function S$(){for(var e,t=c$,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:c$=n);l$=e,C$(r)}function C$(e){i$||(a$&&=clearTimeout(a$),e-d$>24?(e<1/0&&(a$=setTimeout(b$,e-p$.now()-f$)),o$&&=clearInterval(o$)):(o$||=(u$=p$.now(),setInterval(x$,s$)),i$=1,m$(b$)))}function w$(e,t,n){var r=new _$;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var T$=xY(`start`,`end`,`cancel`,`interrupt`),E$=[],D$=0,O$=1,k$=2,A$=3,j$=4,M$=5,N$=6;function P$(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;R$(e,n,{name:t,index:r,group:i,on:T$,tween:E$,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:D$})}function F$(e,t){var n=L$(e,t);if(n.state>D$)throw Error(`too late; already scheduled`);return n}function I$(e,t){var n=L$(e,t);if(n.state>A$)throw Error(`too late; already running`);return n}function L$(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function R$(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=v$(a,0,n.time);function a(e){n.state=O$,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!==O$)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===A$)return w$(o);f.state===j$?(f.state=N$,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=N$,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(w$(function(){n.state===A$&&(n.state=j$,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=k$,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===k$){for(n.state=A$,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=M$,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===M$&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=N$,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function z$(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>k$&&r.state<M$,r.state=N$,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function B$(e){return this.each(function(){z$(this,e)})}function V$(e,t){var n,r;return function(){var i=I$(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 H$(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=I$(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 U$(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=L$(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?V$:H$)(n,e,t))}function W$(e,t,n){var r=e._id;return e.each(function(){var e=I$(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return L$(e,r).value[t]}}function G$(e,t){var n;return(typeof t==`number`?IQ:t instanceof sQ?jQ:(n=sQ(t))?(t=n,jQ):HQ)(e,t)}function K$(e){return function(){this.removeAttribute(e)}}function q$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function J$(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 Y$(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 X$(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 Z$(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 Q$(e,t){var n=OY(e),r=n===`transform`?QQ:G$;return this.attrTween(e,typeof t==`function`?(n.local?Z$:X$)(n,r,W$(this,`attr.`+e,t)):t==null?(n.local?q$:K$)(n):(n.local?Y$:J$)(n,r,t))}function $$(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function e1(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function t1(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&e1(e,i)),n}return i._value=t,i}function n1(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&$$(e,i)),n}return i._value=t,i}function r1(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=OY(e);return this.tween(n,(r.local?t1:n1)(r,t))}function i1(e,t){return function(){F$(this,e).delay=+t.apply(this,arguments)}}function a1(e,t){return t=+t,function(){F$(this,e).delay=t}}function o1(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?i1:a1)(t,e)):L$(this.node(),t).delay}function s1(e,t){return function(){I$(this,e).duration=+t.apply(this,arguments)}}function c1(e,t){return t=+t,function(){I$(this,e).duration=t}}function l1(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?s1:c1)(t,e)):L$(this.node(),t).duration}function u1(e,t){if(typeof t!=`function`)throw Error();return function(){I$(this,e).ease=t}}function d1(e){var t=this._id;return arguments.length?this.each(u1(t,e)):L$(this.node(),t).ease}function f1(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();I$(this,e).ease=n}}function p1(e){if(typeof e!=`function`)throw Error();return this.each(f1(this._id,e))}function m1(e){typeof e!=`function`&&(e=BY(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 U1(r,this._parents,this._name,this._id)}function h1(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 U1(o,this._parents,this._name,this._id)}function g1(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 _1(e,t,n){var r,i,a=g1(t)?F$:I$;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function v1(e,t){var n=this._id;return arguments.length<2?L$(this.node(),n).on.on(e):this.each(_1(n,e,t))}function y1(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function b1(){return this.on(`end.remove`,y1(this._id))}function x1(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=NY(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,P$(l[f],t,n,f,l,L$(u,n)));return new U1(a,this._parents,t,n)}function S1(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=LY(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=L$(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&P$(p,t,n,h,f,m);a.push(f),o.push(u)}return new U1(a,o,t,n)}var C1=CZ.prototype.constructor;function w1(){return new C1(this._groups,this._parents)}function T1(e,t){var n,r,i;return function(){var a=AX(this,e),o=(this.style.removeProperty(e),AX(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function E1(e){return function(){this.style.removeProperty(e)}}function D1(e,t,n){var r,i=n+``,a;return function(){var o=AX(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function O1(e,t,n){var r,i,a;return function(){var o=AX(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),AX(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function k1(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=I$(this,e),l=c.on,u=c.value[a]==null?s||=E1(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function A1(e,t,n){var r=(e+=``)==`transform`?ZQ:G$;return t==null?this.styleTween(e,T1(e,r)).on(`end.style.`+e,E1(e)):typeof t==`function`?this.styleTween(e,O1(e,r,W$(this,`style.`+e,t))).each(k1(this._id,e)):this.styleTween(e,D1(e,r,t),n).on(`end.style.`+e,null)}function j1(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function M1(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&j1(e,a,n)),r}return a._value=t,a}function N1(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,M1(e,t,n??``))}function P1(e){return function(){this.textContent=e}}function F1(e){return function(){var t=e(this);this.textContent=t??``}}function I1(e){return this.tween(`text`,typeof e==`function`?F1(W$(this,`text`,e)):P1(e==null?``:e+``))}function L1(e){return function(t){this.textContent=e.call(this,t)}}function R1(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&L1(r)),t}return r._value=e,r}function z1(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,R1(e))}function B1(){for(var e=this._name,t=this._id,n=W1(),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=L$(c,t);P$(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new U1(r,this._parents,e,n)}function V1(){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=I$(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 H1=0;function U1(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function W1(){return++H1}var G1=CZ.prototype;U1.prototype={constructor:U1,select:x1,selectAll:S1,selectChild:G1.selectChild,selectChildren:G1.selectChildren,filter:m1,merge:h1,selection:w1,transition:B1,call:G1.call,nodes:G1.nodes,node:G1.node,size:G1.size,empty:G1.empty,each:G1.each,on:v1,attr:Q$,attrTween:r1,style:A1,styleTween:N1,text:I1,textTween:z1,remove:b1,tween:U$,delay:o1,duration:l1,ease:d1,easeVarying:p1,end:V1,[Symbol.iterator]:G1[Symbol.iterator]};function K1(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var q1={time:null,delay:0,duration:250,ease:K1};function J1(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Y1(e){var t,n;e instanceof U1?(t=e._id,e=e._name):(t=W1(),(n=q1).time=h$(),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])&&P$(c,e,t,l,o,n||J1(c,t));return new U1(r,this._parents,e,t)}CZ.prototype.interrupt=B$,CZ.prototype.transition=Y1;var X1=e=>()=>e;function Z1(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 Q1(e,t,n){this.k=e,this.x=t,this.y=n}Q1.prototype={constructor:Q1,scale:function(e){return e===1?this:new Q1(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Q1(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 $1=new Q1(1,0,0);Q1.prototype;function e0(e){e.stopImmediatePropagation()}function t0(e){e.preventDefault(),e.stopImmediatePropagation()}function n0(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function r0(){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 i0(){return this.__zoom||$1}function a0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function o0(){return navigator.maxTouchPoints||`ontouchstart`in this}function s0(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 c0(){var e=n0,t=r0,n=s0,r=a0,i=o0,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=r$,l=xY(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,i0).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).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`,i0),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($1.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 Q1(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 Q1(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 Q1(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=TZ(this.that).datum();l.call(e,this.that,new Z1(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=DZ(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)],z$(this),s.start();t0(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=TZ(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=DZ(t,i),l=t.clientX,u=t.clientY;MZ(t.view),e0(t),a.mouse=[c,this.__zoom.invert(c)],z$(this),a.start();function d(e){if(t0(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]=DZ(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),NZ(e.view,a.moved),t0(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=DZ(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);t0(r),s>0?TZ(this).transition().duration(s).call(x,d,c,r):TZ(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(e0(t),s=0;s<i;++s)c=r[s],l=DZ(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)),z$(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(t0(e),s=0;s<a;++s)c=i[s],l=DZ(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 k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(e0(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=DZ(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=TZ(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:X1(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:X1(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:X1(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:X1([[+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 l0=(e=>(e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`,e))(l0||{}),u0=(e=>(e.Partial=`partial`,e.Full=`full`,e))(u0||{}),d0=(e=>(e.Bezier=`default`,e.SimpleBezier=`simple-bezier`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e))(d0||{}),f0=(e=>(e.Strict=`strict`,e.Loose=`loose`,e))(f0||{}),p0=(e=>(e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`,e))(p0||{}),m0=(e=>(e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`,e))(m0||{}),h0=(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))(h0||{}),g0=[`INPUT`,`SELECT`,`TEXTAREA`],_0=typeof document<`u`?document:null;function v0(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 g0.includes(t?.nodeName)||n||!!r}function y0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function b0(e,t,n,r){let i=t.replace(`+`,`
|
|
270
|
+
`,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 cB.get()},set promptLabel(e){cB.set(e)},get tooMuchOutput(){return uB.get()},set tooMuchOutput(e){uB.set(e)}}}_verifyIntegers(...e){for(Qq of e)if(Qq===1/0||isNaN(Qq)||Qq%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Qq of e)if(Qq&&(Qq===1/0||isNaN(Qq)||Qq%1!=0||Qq<0))throw Error(`This API only accepts positive integers`)}},eJ=2,tJ=1,nJ=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(eJ,Math.floor(u/e.css.cell.width)),rows:Math.max(tJ,Math.floor(l/e.css.cell.height))}}},rJ={key:0,class:`pty-context-bar`},iJ=Je(B({__name:`PtyContextBar`,setup(e){let{attachedContexts:t,removeAttachedContext:n}=Ut();return(e,i)=>r(t).length>0?(V(),P(`div`,rJ,[(V(!0),P(H,null,F(r(t),(e,t)=>(V(),G(Yz,{key:t,icon:e.icon,label:e.label,text:e.text,removable:``,onRemove:e=>r(n)(t)},null,8,[`icon`,`label`,`text`,`onRemove`]))),128))])):K(``,!0)}}),[[`__scopeId`,`data-v-cfcb3a01`]]);function aJ(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)}}var oJ=[`#2e3436`,`#cc0000`,`#4e9a06`,`#c4a000`,`#3465a4`,`#75507b`,`#06989a`,`#d3d7cf`,`#555753`,`#ef2929`,`#8ae234`,`#fce94f`,`#729fcf`,`#ad7fa8`,`#34e2e2`,`#eeeeec`],sJ=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`];function cJ(e){return e.toString(16).padStart(2,`0`)}function lJ(e,t={}){if(e<16)return t[sJ[e]]??oJ[e];if(e<232){let t=[0,95,135,175,215,255],n=e-16;return`#${cJ(t[Math.floor(n/36)])}${cJ(t[Math.floor(n/6)%6])}${cJ(t[n%6])}`}let n=8+(e-232)*10;return`#${cJ(n)}${cJ(n)}${cJ(n)}`}function uJ(e,t,n,r){let i=e===`fg`;if(i?t.isFgDefault():t.isBgDefault())return null;let a=i?t.getFgColor():t.getBgColor();return(i?t.isFgRGB():t.isBgRGB())?`#${a.toString(16).padStart(6,`0`)}`:lJ(i&&r&&a<8?a+8:a,n)}function dJ(e,t){let n=e.isBold()!==0,r=uJ(`fg`,e,t,n),i=uJ(`bg`,e,t,!1);e.isInverse()&&([r,i]=[i??t.background??`#000`,r??t.foreground??`#fff`]);let a=[];r&&a.push(`color:${r}`),i&&a.push(`background:${i}`),n&&a.push(`font-weight:bold`),e.isItalic()&&a.push(`font-style:italic`),e.isDim()&&a.push(`opacity:0.5`);let o=[e.isUnderline()?`underline`:``,e.isStrikethrough()?`line-through`:``,e.isOverline()?`overline`:``].filter(Boolean);return o.length&&a.push(`text-decoration:${o.join(` `)}`),e.isInvisible()&&a.push(`visibility:hidden`),a.join(`;`)}function fJ(e,t,n,r){let i=[],a=r;for(let r=0;r<t&&(a=e.getCell(r,a),a);r+=1){if(a.getWidth()===0)continue;let e=a.getChars()||` `,t=dJ(a,n),r=i[i.length-1];r&&r.style===t?r.text+=e:i.push({text:e,style:t})}for(;i.length;){let e=i[i.length-1];if(e.style.includes(`background`)||e.style.includes(`text-decoration`)||(e.text=e.text.trimEnd(),e.text))break;i.pop()}return i}function pJ(e,t,n,r,i){let a=(t.querySelector(`.xterm-screen`)??t).getBoundingClientRect(),o=t.getBoundingClientRect(),s=a.height/(e.rows||24),c=document.createElement(`div`);c.className=`terminal-native-selection`,c.contentEditable=`true`,c.spellcheck=!1,c.setAttribute(`inputmode`,`none`),c.setAttribute(`autocapitalize`,`off`),c.setAttribute(`autocorrect`,`off`),c.setAttribute(`aria-label`,Ce.global.t(`terminal.nativeSelection`)),Object.assign(c.style,{position:`absolute`,left:`${a.left-o.left}px`,top:`${a.top-o.top}px`,width:`${a.width}px`,height:`${a.height}px`,zIndex:`6`,margin:`0`,overflowX:`hidden`,overflowY:`auto`,overscrollBehavior:`contain`,whiteSpace:`pre`,outline:`none`,caretColor:`transparent`,fontFamily:e.options.fontFamily??`monospace`,fontSize:`${e.options.fontSize??14}px`,lineHeight:`${s}px`,background:e.options.theme?.background??`#000`,color:e.options.theme?.foreground??`#fff`,userSelect:`text`,webkitUserSelect:`text`,touchAction:`auto`});let l=e.options.theme??{},u=e.buffer.active,d=u.getNullCell();for(let t=0;t<u.length;t+=1){let n=document.createElement(`div`),r=u.getLine(t),i=r?fJ(r,e.cols,l,d):[];for(let e of i){let t=document.createElement(`span`);t.textContent=e.text,e.style&&(t.style.cssText=e.style),n.appendChild(t)}i.length||(n.textContent=`\xA0`),c.appendChild(n)}let f=document.createElement(`button`);f.type=`button`,f.textContent=Ce.global.t(`terminal.closeSelection`),Object.assign(f.style,{position:`absolute`,top:`8px`,right:`8px`,zIndex:`7`,padding:`6px 12px`,border:`0`,borderRadius:`6px`,font:`inherit`,fontSize:`14px`,background:`var(--r-primary)`,color:`var(--r-primary-contrast)`});let p=e=>e.stopPropagation(),m=e=>e.preventDefault(),h=t=>{t.preventDefault();let n=t.clipboardData?.getData(`text/plain`);y(),n&&(e.paste(n),e.focus())},g=()=>{setTimeout(y,0)},_=e=>{e.key===`Escape`&&y()},v=!1;function y(){v||(v=!0,c.remove(),f.remove(),i())}return c.addEventListener(`touchstart`,p,{passive:!0}),c.addEventListener(`touchmove`,p,{passive:!0}),c.addEventListener(`touchend`,p,{passive:!0}),c.addEventListener(`beforeinput`,m),c.addEventListener(`paste`,h),c.addEventListener(`copy`,g),c.addEventListener(`keydown`,_),f.addEventListener(`touchstart`,p,{passive:!0}),f.addEventListener(`click`,e=>{e.preventDefault(),y()}),getComputedStyle(t).position===`static`&&(t.style.position=`relative`),t.appendChild(c),t.appendChild(f),c.scrollTop=e.buffer.active.viewportY*s,c.focus({preventScroll:!0}),mJ(c,n,r),y}function mJ(e,t,n){let r=window.getSelection(),i=document.caretRangeFromPoint?.(t,n);if(!r||!i||!e.contains(i.startContainer))return;r.removeAllRanges(),r.addRange(i);let a=r;a.modify&&(a.modify(`move`,`backward`,`word`),a.modify(`extend`,`forward`,`word`))}var hJ=450;function gJ(e,t){let n=null,r=0,i=0,a=`none`,o=0,s=0,c=0,l=null,u=null,d=!1,f=null;function p(){u!==null&&(clearTimeout(u),u=null)}let m=()=>{let n=e.rows||24,r=t.querySelector(`.xterm-viewport`)?.clientHeight??t.clientHeight;return r>0?r/n:17},h=1,g=1;function _(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;h=Math.min(Math.max(o,1),e.cols),g=Math.min(Math.max(s,1),e.rows)}function v(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};${h};${g}M`;for(let t=0;t<r;t+=1)e.input(i,!0)}function y(){l!==null&&(cancelAnimationFrame(l),l=null)}function b(){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 x=l=>{if(y(),p(),d=!1,l.touches.length!==1){n=null;return}n=l.touches[0].clientY,r=l.touches[0].clientX,_(r,n),i=n,a=`none`,o=0,s=0,c=performance.now();let m=r,h=i;u=setTimeout(()=>{u=null,!(a!==`none`||f)&&(d=!0,n=null,f=pJ(e,t,m,h,()=>{f=null}),navigator.vibrate?.(10))},hJ)},S=t=>{if(n===null||t.touches.length!==1)return;t.preventDefault();let l=t.touches[0].clientY;if(a===`none`){let e=Math.abs(t.touches[0].clientX-r),n=Math.abs(l-i);if(Math.max(e,n)<8)return;if(p(),e>n){a=`horizontal`;return}a=`vertical`}if(a!==`vertical`)return;let u=n-l;n=l;let d=u/m(),f=performance.now(),h=f-c;c=f,h>0&&h<100&&(s=s*.7+d/h*.3),o+=d;let g=Math.trunc(o);g!==0&&(o-=g,e.buffer.active.type===`alternate`?v(g):e.scrollLines(g))},C=e=>{if(p(),d){d=!1,e.cancelable&&e.preventDefault();return}a===`vertical`&&b(),n=null,a=`none`};t.addEventListener(`touchstart`,x,{passive:!0}),t.addEventListener(`touchmove`,S,{passive:!1}),t.addEventListener(`touchend`,C,{passive:!1}),t.addEventListener(`touchcancel`,C,{passive:!0});let w=e=>{d&&e.preventDefault()};return t.addEventListener(`contextmenu`,w),()=>{y(),p(),f?.(),t.removeEventListener(`contextmenu`,w),t.removeEventListener(`touchstart`,x),t.removeEventListener(`touchmove`,S),t.removeEventListener(`touchend`,C),t.removeEventListener(`touchcancel`,C)}}function _J(e,t){let n=e+(t>0?-1:1);return Math.min(Math.max(n,8),32)}function vJ(e,t){try{let t=Number(localStorage.getItem(e));if(Number.isFinite(t)&&t>=8&&t<=32)return t}catch{}return t}function yJ(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=_J(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 bJ(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 xJ=150,SJ=1.01,CJ=i(!1),wJ=0,TJ=0;function EJ(){let e=document.activeElement;return e?e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable:!1}var DJ=0,OJ=null;function kJ(){return typeof window>`u`?!1:window.matchMedia?.(`(pointer: coarse)`).matches?!0:(navigator.maxTouchPoints??0)>0}function AJ(e){return!e.editing||e.scale>SJ?{visible:!1}:{visible:Math.max(e.maxHeight-e.innerHeight,e.innerHeight-e.viewportHeight)>=xJ}}function jJ(e=!1){let t=window.visualViewport;if(!t){CJ.value=!1;return}let n=EJ();(window.innerWidth!==TJ||e&&!n)&&(TJ=window.innerWidth,wJ=0),wJ=Math.max(wJ,window.innerHeight),CJ.value=AJ({innerHeight:window.innerHeight,viewportHeight:t.height,maxHeight:wJ,scale:t.scale,editing:n}).visible}function MJ(){if(!kJ()||(DJ+=1,OJ))return;let e=window.visualViewport;if(!e)return;let t=()=>jJ(!0),n=()=>jJ(!1);e.addEventListener(`resize`,t),e.addEventListener(`scroll`,n),window.addEventListener(`resize`,t),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),OJ=()=>{e.removeEventListener(`resize`,t),e.removeEventListener(`scroll`,n),window.removeEventListener(`resize`,t),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)},jJ()}function NJ(){DJ=Math.max(0,DJ-1),!(DJ>0||!OJ)&&(OJ(),OJ=null,CJ.value=!1)}function PJ(){return I(MJ),ee(NJ),{keyboardVisible:l(CJ)}}var FJ=`\x1B`,IJ={up:`A`,down:`B`,right:`C`,left:`D`};function LJ(e,t){switch(e){case`up`:case`down`:case`left`:case`right`:return`${FJ}${t?`O`:`[`}${IJ[e]}`;case`esc`:return FJ;case`tab`:return` `;case`enter`:return`\r`;case`ctrl-c`:return``}}var RJ=[`aria-label`],zJ=[`title`,`aria-label`,`onPointerdown`],BJ={class:`terminal-key-bar__cap`},VJ=Je(B({__name:`TerminalKeyBar`,props:{terminal:{}},setup(e){let t=e,{t:n}=ve(),{keyboardVisible:a}=PJ(),o=kJ(),s=typeof window<`u`&&(window.matchMedia?.(`(pointer: coarse)`).matches??!1),c=i(!1);function l(){let e=t.terminal?.element;c.value=e!=null&&e.contains(document.activeElement)}I(()=>{document.addEventListener(`focusin`,l),document.addEventListener(`focusout`,l),l()}),ee(()=>{document.removeEventListener(`focusin`,l),document.removeEventListener(`focusout`,l)});let u=z(()=>o&&c.value&&(a.value||s)),d=z(()=>a.value);function f(e){return LJ(e,t.terminal?.modes.applicationCursorKeysMode===!0)}let p=z(()=>[{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 m(e,n){n.preventDefault(),t.terminal?.input(f(e.id),!0),t.terminal?.focus()}return(e,t)=>(V(),G(le,{to:`body`,disabled:!d.value},[u.value?(V(),P(`div`,{key:0,class:L([`terminal-key-bar`,{"terminal-key-bar--inline":!d.value}]),role:`toolbar`,"aria-label":r(n)(`terminal.keyBar.label`)},[(V(!0),P(H,null,F(p.value,e=>(V(),P(`button`,{key:e.id,type:`button`,class:L([`terminal-key-bar__key`,{"terminal-key-bar__key--wide":e.wide}]),title:e.title,"aria-label":e.title,onPointerdown:t=>m(e,t)},[N(`kbd`,BJ,W(e.label),1)],42,zJ))),128))],10,RJ)):K(``,!0)],8,[`disabled`]))}}),[[`__scopeId`,`data-v-3b0a8150`]]),HJ={key:0,class:`claude-terminal__error`},UJ=`runeya:ai-terminal-font-size`,WJ=Je(B({__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;function E(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 D(e,t){if(p&&f)try{let n=await E(e),r=await J.chat.pty.pasteImage.mutate({agentId:p,sessionId:t,mimeType:e.type||`image/png`,base64:n});r.clipboardMethod?await J.chat.pty.write.mutate({agentId:p,spawnId:f,data:``}):await J.chat.pty.write.mutate({agentId:p,spawnId:f,data:`@${r.tmpPath} `})}catch(e){console.error(`[ClaudeTerminal] image paste failed:`,e)}}let{attachedContexts:O,clearAttachedContexts:k,contextServiceId:A,pendingDiffContext:j,pendingContext:M,pendingPopulateContext:F,autoSendPending:R,setDiffContext:z}=Ut(),te=Yt(),ne=Dt(),B=xe();function re(){let e=[];if(A.value){let t=te.getById(A.value);t&&e.push({label:`Service: ${t.name}`,icon:`ti-server`,text:`Service attached: ${t.name}\nID: ${t.id}\nCommands: ${t.commands.map(e=>e.command).join(` ; `)||`(none)`}\nCwd: ${t.cwd??`(none)`}`})}j.value&&e.push({label:`Diff`,icon:`ti-code`,text:j.value}),M.value&&e.push(M.value);for(let t of O.value)e.push(t);return e}function H(){l?.fit(),p&&f&&o&&J.chat.pty.resize.mutate({agentId:p,spawnId:f,cols:o.cols,rows:o.rows}).catch(()=>{})}async function ie(){if(!n.value)return;if(await ae(),a.value=null,o=new $q({cursorBlink:!0,fontFamily:`monospace`,fontSize:vJ(UJ,13),theme:{background:`#1a1b1e`,foreground:`#d4d4d4`,cursor:`#d4d4d4`},allowProposedApi:!1}),l=new nJ,o.loadAddon(l),o.open(n.value),c.value=o,y=bJ(o),_=gJ(o,n.value),v=yJ({terminal:o,container:n.value,storageKey:UJ,onResize:()=>H()}),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=re().map(e=>({label:e.label,text:e.text})),n=R.value&&F.value?F.value:void 0,r=await J.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,...B.activeProjectId?{projectId:B.activeProjectId,orgId:B.activeOrgId}:{},cols:o.cols,rows:o.rows,enableMcp:!0,environmentId:ne.currentProject?.activeEnvironmentId,attachedContexts:e.length>0?e:void 0,initialPrompt:n});f=r.spawnId,p=r.agentId,!r.reattached&&n&&(R.value=!1,F.value=null),e.length>0&&(k(),z(null),M.value=null)}catch(e){w=!0,a.value=e.message,o.dispose(),o=null,c.value=null;return}d=J.chat.pty.stream.subscribe({agentId:p,spawnId:f,fromOffset:0},{onData(e){if(e.offset<=S)return;S=e.offset;let{chunk:n}=e;n.type===`pty-data`?y?.write(n.data):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&&J.chat.pty.write.mutate({agentId:p,spawnId:f,data:e}).catch(()=>{})};o.onData(e),g=aJ(o,e),u=new ResizeObserver(()=>H()),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(),D(n,t.sessionId);return}}}},h.addEventListener(`paste`,m,!0)),r.value=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>o?.focus())})}function U(){o?.focus()}async function ae(){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,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],()=>{ie()}),I(()=>{ie(),T=vt(()=>{a.value=null,w&&ie()})}),ee(()=>{T?.(),T=null,ae()}),(e,t)=>(V(),P(`div`,{class:`claude-terminal`,onClick:U},[b(iJ),b(VJ,{terminal:c.value},null,8,[`terminal`]),a.value?(V(),P(`div`,HJ,[t[0]||=N(`i`,{class:`ti ti-alert-triangle`},null,-1),x(` `+W(a.value),1)])):K(``,!0),N(`div`,{ref_key:`terminalEl`,ref:n,class:L([`claude-terminal__xterm`,{"claude-terminal__xterm--hidden":!r.value}])},null,2)]))}}),[[`__scopeId`,`data-v-f2640e3e`]]),GJ={class:`secret-env__intro`},KJ={key:0,class:`secret-env__empty`},qJ={key:1,class:`secret-env__empty`},JJ={class:`secret-env__fields`},YJ={key:0,class:`secret-env__error`},XJ=Je(B({__name:`ConversationSecretEnvDialog`,props:_({conversationId:{}},{visible:{type:Boolean,required:!0},visibleModifiers:{}}),emits:_([`saved`],[`update:visible`]),setup(e,{emit:t}){let n=e,a=S(e,`visible`),o=t,{t:s}=ve(),c=Le(),l=i([]),u=i(!1),d=i(!1),f=i(!1),p=/^[A-Za-z_][A-Za-z0-9_]*$/;async function m(){u.value=!0,d.value=!1;try{let e=await J.chat.conversations.secretEnvKeys.query({id:n.conversationId});l.value=e.map(e=>({key:e,value:``,stored:!0})),d.value=!0}catch(e){c.add({severity:`error`,summary:s(`aiChat.secretEnv.loadFailed`),detail:e.message,life:4e3}),l.value=[]}finally{u.value=!1}}C(a,e=>{e&&m()});function h(){l.value=[...l.value,{key:``,value:``,stored:!1}]}function g(e){l.value=l.value.filter((t,n)=>n!==e)}function _(e,t){return p.test(e.key)?l.value.findIndex(t=>t.key===e.key)===t?!e.stored&&e.value===``?s(`aiChat.secretEnv.missingValue`):null:s(`aiChat.secretEnv.duplicateName`):s(`aiChat.secretEnv.invalidName`)}let v=()=>l.value.some((e,t)=>_(e,t)!==null);async function y(){if(d.value&&!v()){f.value=!0;try{await J.chat.conversations.setSecretEnv.mutate({id:n.conversationId,entries:l.value.map(e=>({key:e.key,...e.value===``?{}:{value:e.value}}))}),c.add({severity:`success`,summary:s(`aiChat.secretEnv.saved`),life:3e3}),a.value=!1,o(`saved`)}catch(e){c.add({severity:`error`,summary:s(`aiChat.secretEnv.saveFailed`),detail:e.message,life:5e3})}finally{f.value=!1}}}return(e,t)=>(V(),G(r(Ue),{visible:a.value,"onUpdate:visible":t[1]||=e=>a.value=e,modal:``,header:r(s)(`aiChat.secretEnv.title`),style:{width:`640px`,maxWidth:`95vw`}},{footer:U(()=>[b(r(q),{variant:`text`,label:r(s)(`actions.cancel`),onClick:t[0]||=e=>a.value=!1},null,8,[`label`]),b(r(q),{label:r(s)(`aiChat.secretEnv.save`),loading:f.value,disabled:f.value||!d.value||v(),onClick:y},null,8,[`label`,`loading`,`disabled`])]),default:U(()=>[N(`p`,GJ,W(r(s)(`aiChat.secretEnv.intro`)),1),b(r(Ve),{severity:`warn`,class:`secret-env__warn`},{default:U(()=>[x(W(r(s)(`aiChat.secretEnv.restartNotice`)),1)]),_:1}),u.value?(V(),P(`div`,KJ,W(r(s)(`aiChat.secretEnv.loading`)),1)):l.value.length===0?(V(),P(`div`,qJ,W(r(s)(`aiChat.secretEnv.empty`)),1)):K(``,!0),(V(!0),P(H,null,F(l.value,(e,t)=>(V(),P(`div`,{key:t,class:`secret-env__row`},[N(`div`,JJ,[b(r(Ne),{modelValue:e.key,"onUpdate:modelValue":t=>e.key=t,class:`secret-env__key`,placeholder:r(s)(`aiChat.secretEnv.namePlaceholder`),"aria-label":r(s)(`aiChat.secretEnv.name`),disabled:e.stored,spellcheck:`false`,autocomplete:`off`},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`,`aria-label`,`disabled`]),b(r(st),{modelValue:e.value,"onUpdate:modelValue":t=>e.value=t,class:`secret-env__value`,feedback:!1,"toggle-mask":``,autocomplete:`new-password`,placeholder:e.stored?r(s)(`aiChat.secretEnv.storedPlaceholder`):r(s)(`aiChat.secretEnv.valuePlaceholder`),"aria-label":r(s)(`aiChat.secretEnv.value`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`,`aria-label`]),b(r(q),{size:`small`,variant:`text`,icon:`ti ti-trash`,title:r(s)(`aiChat.secretEnv.remove`),"aria-label":r(s)(`aiChat.secretEnv.remove`),onClick:e=>g(t)},null,8,[`title`,`aria-label`,`onClick`])]),_(e,t)&&(e.key!==``||e.value!==``)?(V(),P(`small`,YJ,W(_(e,t)),1)):K(``,!0)]))),128)),b(r(q),{size:`small`,variant:`outlined`,disabled:!d.value,icon:`ti ti-plus`,label:r(s)(`aiChat.secretEnv.add`),onClick:h},null,8,[`disabled`,`label`])]),_:1},8,[`visible`,`header`]))}}),[[`__scopeId`,`data-v-ccb5fce5`]]);function ZJ(e){return p()?(u(e),!0):!1}function QJ(e){return typeof e==`function`?e():r(e)}var $J=typeof window<`u`&&typeof document<`u`,eY=e=>e!==void 0,tY=Object.prototype.toString,nY=e=>tY.call(e)===`[object Object]`,rY=()=>{};function iY(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 aY=e=>e();function oY(e=aY){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 sY(e,t=!1,n=`Timeout`){return new Promise((r,i)=>{setTimeout(t?()=>i(n):r,e)})}function cY(e,t,n={}){let{eventFilter:r=aY,...i}=n;return C(e,iY(r,t),i)}function lY(e,t,n={}){let{eventFilter:r,...i}=n,{eventFilter:a,pause:o,resume:s,isActive:c}=oY(r);return{stop:cY(e,t,{...i,eventFilter:a}),pause:o,resume:s,isActive:c}}function uY(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(QJ(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 dY(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(sY(a,o).then(()=>QJ(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(sY(s,c).then(()=>QJ(e)).finally(()=>(l?.(),QJ(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(QJ(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(QJ(e))?{toMatch:n,toContains:c,changed:l,changedTimes:u,get not(){return dY(e,!t)}}:{toMatch:n,toBe:r,toBeTruthy:i,toBeNull:a,toBeNaN:s,toBeUndefined:o,changed:l,changedTimes:u,get not(){return dY(e,!t)}}}function fY(e){return dY(e)}function pY(e){let t=QJ(e);return t?.$el??t}var mY=$J?window:void 0;function hY(...e){let t,n,r,i;if(typeof e[0]==`string`||Array.isArray(e[0])?([n,r,i]=e,t=mY):[t,n,r,i]=e,!t)return rY;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(()=>[pY(t),QJ(i)],([e,t])=>{if(o(),!e)return;let i=nY(t)?{...t}:t;a.push(...n.flatMap(t=>r.map(n=>s(e,t,n,i))))},{immediate:!0,flush:`post`}),l=()=>{c(),o()};return ZJ(l),l}function gY(e){return typeof e==`function`?e:typeof e==`string`?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function _Y(...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=mY,eventName:a=`keydown`,passive:o=!1,dedupe:s=!1}=r,c=gY(t);return hY(i,a,e=>{e.repeat&&QJ(s)||c(e)&&n(e)},o)}function vY(e){return JSON.parse(JSON.stringify(e))}function yY(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):vY(e):e,h=()=>eY(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),ce(()=>a=!1))}),C(r,n=>{!a&&(n!==e[t]||c)&&g(n)},{deep:c}),r}return z({get(){return h()},set(e){g(e)}})}var bY={value:()=>{}};function xY(){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 SY(n)}function SY(e){this._=e}function CY(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}})}SY.prototype=xY.prototype={constructor:SY,on:function(e,t){var n=this._,r=CY(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=wY(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]=TY(n[i],e.name,t);else if(t==null)for(i in n)n[i]=TY(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 SY(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 wY(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function TY(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=bY,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var EY=`http://www.w3.org/1999/xhtml`,DY={svg:`http://www.w3.org/2000/svg`,xhtml:EY,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function OY(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),DY.hasOwnProperty(t)?{space:DY[t],local:e}:e}function kY(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===EY&&t.documentElement.namespaceURI===EY?t.createElement(e):t.createElementNS(n,e)}}function AY(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function jY(e){var t=OY(e);return(t.local?AY:kY)(t)}function MY(){}function NY(e){return e==null?MY:function(){return this.querySelector(e)}}function PY(e){typeof e!=`function`&&(e=NY(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 SZ(r,this._parents)}function FY(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function IY(){return[]}function LY(e){return e==null?IY:function(){return this.querySelectorAll(e)}}function RY(e){return function(){return FY(e.apply(this,arguments))}}function zY(e){e=typeof e==`function`?RY(e):LY(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 SZ(r,i)}function BY(e){return function(){return this.matches(e)}}function VY(e){return function(t){return t.matches(e)}}var HY=Array.prototype.find;function UY(e){return function(){return HY.call(this.children,e)}}function WY(){return this.firstElementChild}function GY(e){return this.select(e==null?WY:UY(typeof e==`function`?e:VY(e)))}var KY=Array.prototype.filter;function qY(){return Array.from(this.children)}function JY(e){return function(){return KY.call(this.children,e)}}function YY(e){return this.selectAll(e==null?qY:JY(typeof e==`function`?e:VY(e)))}function XY(e){typeof e!=`function`&&(e=BY(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 SZ(r,this._parents)}function ZY(e){return Array(e.length)}function QY(){return new SZ(this._enter||this._groups.map(ZY),this._parents)}function $Y(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}$Y.prototype={constructor:$Y,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 eX(e){return function(){return e}}function tX(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 $Y(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function nX(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 $Y(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function rX(e){return e.__data__}function iX(e,t){if(!arguments.length)return Array.from(this,rX);var n=t?nX:tX,r=this._parents,i=this._groups;typeof e!=`function`&&(e=eX(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=aX(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 SZ(o,r),o._enter=s,o._exit=c,o}function aX(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function oX(){return new SZ(this._exit||this._groups.map(ZY),this._parents)}function sX(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 cX(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 SZ(s,this._parents)}function lX(){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 uX(e){e||=dX;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 SZ(i,this._parents).order()}function dX(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function fX(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function pX(){return Array.from(this)}function mX(){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 hX(){let e=0;for(let t of this)++e;return e}function gX(){return!this.node()}function _X(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 vX(e){return function(){this.removeAttribute(e)}}function yX(e){return function(){this.removeAttributeNS(e.space,e.local)}}function bX(e,t){return function(){this.setAttribute(e,t)}}function xX(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function SX(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function CX(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 wX(e,t){var n=OY(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?yX:vX:typeof t==`function`?n.local?CX:SX:n.local?xX:bX)(n,t))}function TX(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function EX(e){return function(){this.style.removeProperty(e)}}function DX(e,t,n){return function(){this.style.setProperty(e,t,n)}}function OX(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function kX(e,t,n){return arguments.length>1?this.each((t==null?EX:typeof t==`function`?OX:DX)(e,t,n??``)):AX(this.node(),e)}function AX(e,t){return e.style.getPropertyValue(t)||TX(e).getComputedStyle(e,null).getPropertyValue(t)}function jX(e){return function(){delete this[e]}}function MX(e,t){return function(){this[e]=t}}function NX(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function PX(e,t){return arguments.length>1?this.each((t==null?jX:typeof t==`function`?NX:MX)(e,t)):this.node()[e]}function FX(e){return e.trim().split(/^|\s+/)}function IX(e){return e.classList||new LX(e)}function LX(e){this._node=e,this._names=FX(e.getAttribute(`class`)||``)}LX.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 RX(e,t){for(var n=IX(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function zX(e,t){for(var n=IX(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function BX(e){return function(){RX(this,e)}}function VX(e){return function(){zX(this,e)}}function HX(e,t){return function(){(t.apply(this,arguments)?RX:zX)(this,e)}}function UX(e,t){var n=FX(e+``);if(arguments.length<2){for(var r=IX(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?HX:t?BX:VX)(n,t))}function WX(){this.textContent=``}function GX(e){return function(){this.textContent=e}}function KX(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function qX(e){return arguments.length?this.each(e==null?WX:(typeof e==`function`?KX:GX)(e)):this.node().textContent}function JX(){this.innerHTML=``}function YX(e){return function(){this.innerHTML=e}}function XX(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function ZX(e){return arguments.length?this.each(e==null?JX:(typeof e==`function`?XX:YX)(e)):this.node().innerHTML}function QX(){this.nextSibling&&this.parentNode.appendChild(this)}function $X(){return this.each(QX)}function eZ(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function tZ(){return this.each(eZ)}function nZ(e){var t=typeof e==`function`?e:jY(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function rZ(){return null}function iZ(e,t){var n=typeof e==`function`?e:jY(e),r=t==null?rZ:typeof t==`function`?t:NY(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function aZ(){var e=this.parentNode;e&&e.removeChild(this)}function oZ(){return this.each(aZ)}function sZ(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function cZ(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function lZ(e){return this.select(e?cZ:sZ)}function uZ(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function dZ(e){return function(t){e.call(this,t,this.__data__)}}function fZ(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 pZ(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 mZ(e,t,n){return function(){var r=this.__on,i,a=dZ(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 hZ(e,t,n){var r=fZ(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?mZ:pZ,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function gZ(e,t,n){var r=TX(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 _Z(e,t){return function(){return gZ(this,e,t)}}function vZ(e,t){return function(){return gZ(this,e,t.apply(this,arguments))}}function yZ(e,t){return this.each((typeof t==`function`?vZ:_Z)(e,t))}function*bZ(){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 xZ=[null];function SZ(e,t){this._groups=e,this._parents=t}function CZ(){return new SZ([[document.documentElement]],xZ)}function wZ(){return this}SZ.prototype=CZ.prototype={constructor:SZ,select:PY,selectAll:zY,selectChild:GY,selectChildren:YY,filter:XY,data:iX,enter:QY,exit:oX,join:sX,merge:cX,selection:wZ,order:lX,sort:uX,call:fX,nodes:pX,node:mX,size:hX,empty:gX,each:_X,attr:wX,style:kX,property:PX,classed:UX,text:qX,html:ZX,raise:$X,lower:tZ,append:nZ,insert:iZ,remove:oZ,clone:lZ,datum:uZ,on:hZ,dispatch:yZ,[Symbol.iterator]:bZ};function TZ(e){return typeof e==`string`?new SZ([[document.querySelector(e)]],[document.documentElement]):new SZ([[e]],xZ)}function EZ(e){let t;for(;t=e.sourceEvent;)e=t;return e}function DZ(e,t){if(e=EZ(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 OZ={passive:!1},kZ={capture:!0,passive:!1};function AZ(e){e.stopImmediatePropagation()}function jZ(e){e.preventDefault(),e.stopImmediatePropagation()}function MZ(e){var t=e.document.documentElement,n=TZ(e).on(`dragstart.drag`,jZ,kZ);`onselectstart`in t?n.on(`selectstart.drag`,jZ,kZ):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function NZ(e,t){var n=e.document.documentElement,r=TZ(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,jZ,kZ),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 PZ=e=>()=>e;function FZ(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}})}FZ.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function IZ(e){return!e.ctrlKey&&!e.button}function LZ(){return this.parentNode}function RZ(e,t){return t??{x:e.x,y:e.y}}function zZ(){return navigator.maxTouchPoints||`ontouchstart`in this}function BZ(){var e=IZ,t=LZ,n=RZ,r=zZ,i={},a=xY(`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`,_,OZ).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&&(TZ(n.view).on(`mousemove.drag`,m,kZ).on(`mouseup.drag`,h,kZ),MZ(n.view),AZ(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(jZ(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){TZ(e.view).on(`mousemove.drag mouseup.drag`,null),NZ(e.view,l),jZ(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]))&&(AZ(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])&&(jZ(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])&&(AZ(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=DZ(l||r,t),p,m,h;if((h=n.call(e,new FZ(`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=DZ(l||a,t),_=o}u.call(r,e,new FZ(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:PZ(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:PZ(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:PZ(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:PZ(!!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 VZ(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function HZ(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function UZ(){}var WZ=.7,GZ=1/WZ,KZ=`\\s*([+-]?\\d+)\\s*`,qZ=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,JZ=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,YZ=/^#([0-9a-f]{3,8})$/,XZ=RegExp(`^rgb\\(${KZ},${KZ},${KZ}\\)$`),ZZ=RegExp(`^rgb\\(${JZ},${JZ},${JZ}\\)$`),QZ=RegExp(`^rgba\\(${KZ},${KZ},${KZ},${qZ}\\)$`),$Z=RegExp(`^rgba\\(${JZ},${JZ},${JZ},${qZ}\\)$`),eQ=RegExp(`^hsl\\(${qZ},${JZ},${JZ}\\)$`),tQ=RegExp(`^hsla\\(${qZ},${JZ},${JZ},${qZ}\\)$`),nQ={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};VZ(UZ,sQ,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:rQ,formatHex:rQ,formatHex8:iQ,formatHsl:aQ,formatRgb:oQ,toString:oQ});function rQ(){return this.rgb().formatHex()}function iQ(){return this.rgb().formatHex8()}function aQ(){return bQ(this).formatHsl()}function oQ(){return this.rgb().formatRgb()}function sQ(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=YZ.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?cQ(t):n===3?new fQ(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?lQ(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?lQ(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=XZ.exec(e))?new fQ(t[1],t[2],t[3],1):(t=ZZ.exec(e))?new fQ(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=QZ.exec(e))?lQ(t[1],t[2],t[3],t[4]):(t=$Z.exec(e))?lQ(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=eQ.exec(e))?yQ(t[1],t[2]/100,t[3]/100,1):(t=tQ.exec(e))?yQ(t[1],t[2]/100,t[3]/100,t[4]):nQ.hasOwnProperty(e)?cQ(nQ[e]):e===`transparent`?new fQ(NaN,NaN,NaN,0):null}function cQ(e){return new fQ(e>>16&255,e>>8&255,e&255,1)}function lQ(e,t,n,r){return r<=0&&(e=t=n=NaN),new fQ(e,t,n,r)}function uQ(e){return e instanceof UZ||(e=sQ(e)),e?(e=e.rgb(),new fQ(e.r,e.g,e.b,e.opacity)):new fQ}function dQ(e,t,n,r){return arguments.length===1?uQ(e):new fQ(e,t,n,r??1)}function fQ(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}VZ(fQ,dQ,HZ(UZ,{brighter(e){return e=e==null?GZ:GZ**+e,new fQ(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?WZ:WZ**+e,new fQ(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new fQ(_Q(this.r),_Q(this.g),_Q(this.b),gQ(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:pQ,formatHex:pQ,formatHex8:mQ,formatRgb:hQ,toString:hQ}));function pQ(){return`#${vQ(this.r)}${vQ(this.g)}${vQ(this.b)}`}function mQ(){return`#${vQ(this.r)}${vQ(this.g)}${vQ(this.b)}${vQ((isNaN(this.opacity)?1:this.opacity)*255)}`}function hQ(){let e=gQ(this.opacity);return`${e===1?`rgb(`:`rgba(`}${_Q(this.r)}, ${_Q(this.g)}, ${_Q(this.b)}${e===1?`)`:`, ${e})`}`}function gQ(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function _Q(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function vQ(e){return e=_Q(e),(e<16?`0`:``)+e.toString(16)}function yQ(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new SQ(e,t,n,r)}function bQ(e){if(e instanceof SQ)return new SQ(e.h,e.s,e.l,e.opacity);if(e instanceof UZ||(e=sQ(e)),!e)return new SQ;if(e instanceof SQ)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 SQ(o,s,c,e.opacity)}function xQ(e,t,n,r){return arguments.length===1?bQ(e):new SQ(e,t,n,r??1)}function SQ(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}VZ(SQ,xQ,HZ(UZ,{brighter(e){return e=e==null?GZ:GZ**+e,new SQ(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?WZ:WZ**+e,new SQ(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 fQ(TQ(e>=240?e-240:e+120,i,r),TQ(e,i,r),TQ(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new SQ(CQ(this.h),wQ(this.s),wQ(this.l),gQ(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=gQ(this.opacity);return`${e===1?`hsl(`:`hsla(`}${CQ(this.h)}, ${wQ(this.s)*100}%, ${wQ(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function CQ(e){return e=(e||0)%360,e<0?e+360:e}function wQ(e){return Math.max(0,Math.min(1,e||0))}function TQ(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 EQ=e=>()=>e;function DQ(e,t){return function(n){return e+n*t}}function OQ(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function kQ(e){return(e=+e)==1?AQ:function(t,n){return n-t?OQ(t,n,e):EQ(isNaN(t)?n:t)}}function AQ(e,t){var n=t-e;return n?DQ(e,n):EQ(isNaN(e)?t:e)}var jQ=function e(t){var n=kQ(t);function r(e,t){var r=n((e=dQ(e)).r,(t=dQ(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=AQ(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 MQ(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 NQ(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function PQ(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]=UQ(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 FQ(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function IQ(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function LQ(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]=UQ(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var RQ=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,zQ=new RegExp(RQ.source,`g`);function BQ(e){return function(){return e}}function VQ(e){return function(t){return e(t)+``}}function HQ(e,t){var n=RQ.lastIndex=zQ.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=RQ.exec(e))&&(i=zQ.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:IQ(r,i)})),n=zQ.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?VQ(c[0].x):BQ(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 UQ(e,t){var n=typeof t,r;return t==null||n===`boolean`?EQ(t):(n===`number`?IQ:n===`string`?(r=sQ(t))?(t=r,jQ):HQ:t instanceof sQ?jQ:t instanceof Date?FQ:NQ(t)?MQ:Array.isArray(t)?PQ:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?LQ:IQ)(e,t)}var WQ=180/Math.PI,GQ={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function KQ(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)*WQ,skewX:Math.atan(c)*WQ,scaleX:o,scaleY:s}}var qQ;function JQ(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?GQ:KQ(t.a,t.b,t.c,t.d,t.e,t.f)}function YQ(e){return e==null||(qQ||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),qQ.setAttribute(`transform`,e),!(e=qQ.transform.baseVal.consolidate()))?GQ:(e=e.matrix,KQ(e.a,e.b,e.c,e.d,e.e,e.f))}function XQ(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:IQ(e,i)},{i:c-2,x:IQ(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:IQ(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:IQ(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:IQ(e,n)},{i:s-2,x:IQ(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 ZQ=XQ(JQ,`px, `,`px)`,`deg)`),QQ=XQ(YQ,`, `,`)`,`)`),$Q=1e-12;function e$(e){return((e=Math.exp(e))+1/e)/2}function t$(e){return((e=Math.exp(e))-1/e)/2}function n$(e){return((e=Math.exp(2*e))-1)/(e+1)}var r$=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<$Q)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=e$(y),c=s/(n*g)*(i*n$(t*r+y)-t$(y));return[a+c*d,o+c*f,s*i/e$(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),i$=0,a$=0,o$=0,s$=1e3,c$,l$,u$=0,d$=0,f$=0,p$=typeof performance==`object`&&performance.now?performance:Date,m$=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function h$(){return d$||=(m$(g$),p$.now()+f$)}function g$(){d$=0}function _$(){this._call=this._time=this._next=null}_$.prototype=v$.prototype={constructor:_$,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?h$():+n)+(t==null?0:+t),!this._next&&l$!==this&&(l$?l$._next=this:c$=this,l$=this),this._call=e,this._time=n,C$()},stop:function(){this._call&&(this._call=null,this._time=1/0,C$())}};function v$(e,t,n){var r=new _$;return r.restart(e,t,n),r}function y$(){h$(),++i$;for(var e=c$,t;e;)(t=d$-e._time)>=0&&e._call.call(void 0,t),e=e._next;--i$}function b$(){d$=(u$=p$.now())+f$,i$=a$=0;try{y$()}finally{i$=0,S$(),d$=0}}function x$(){var e=p$.now(),t=e-u$;t>s$&&(f$-=t,u$=e)}function S$(){for(var e,t=c$,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:c$=n);l$=e,C$(r)}function C$(e){i$||(a$&&=clearTimeout(a$),e-d$>24?(e<1/0&&(a$=setTimeout(b$,e-p$.now()-f$)),o$&&=clearInterval(o$)):(o$||=(u$=p$.now(),setInterval(x$,s$)),i$=1,m$(b$)))}function w$(e,t,n){var r=new _$;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var T$=xY(`start`,`end`,`cancel`,`interrupt`),E$=[],D$=0,O$=1,k$=2,A$=3,j$=4,M$=5,N$=6;function P$(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;R$(e,n,{name:t,index:r,group:i,on:T$,tween:E$,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:D$})}function F$(e,t){var n=L$(e,t);if(n.state>D$)throw Error(`too late; already scheduled`);return n}function I$(e,t){var n=L$(e,t);if(n.state>A$)throw Error(`too late; already running`);return n}function L$(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function R$(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=v$(a,0,n.time);function a(e){n.state=O$,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!==O$)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===A$)return w$(o);f.state===j$?(f.state=N$,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=N$,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(w$(function(){n.state===A$&&(n.state=j$,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=k$,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===k$){for(n.state=A$,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=M$,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===M$&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=N$,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function z$(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>k$&&r.state<M$,r.state=N$,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function B$(e){return this.each(function(){z$(this,e)})}function V$(e,t){var n,r;return function(){var i=I$(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 H$(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=I$(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 U$(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=L$(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?V$:H$)(n,e,t))}function W$(e,t,n){var r=e._id;return e.each(function(){var e=I$(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return L$(e,r).value[t]}}function G$(e,t){var n;return(typeof t==`number`?IQ:t instanceof sQ?jQ:(n=sQ(t))?(t=n,jQ):HQ)(e,t)}function K$(e){return function(){this.removeAttribute(e)}}function q$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function J$(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 Y$(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 X$(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 Z$(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 Q$(e,t){var n=OY(e),r=n===`transform`?QQ:G$;return this.attrTween(e,typeof t==`function`?(n.local?Z$:X$)(n,r,W$(this,`attr.`+e,t)):t==null?(n.local?q$:K$)(n):(n.local?Y$:J$)(n,r,t))}function $$(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function e1(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function t1(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&e1(e,i)),n}return i._value=t,i}function n1(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&$$(e,i)),n}return i._value=t,i}function r1(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=OY(e);return this.tween(n,(r.local?t1:n1)(r,t))}function i1(e,t){return function(){F$(this,e).delay=+t.apply(this,arguments)}}function a1(e,t){return t=+t,function(){F$(this,e).delay=t}}function o1(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?i1:a1)(t,e)):L$(this.node(),t).delay}function s1(e,t){return function(){I$(this,e).duration=+t.apply(this,arguments)}}function c1(e,t){return t=+t,function(){I$(this,e).duration=t}}function l1(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?s1:c1)(t,e)):L$(this.node(),t).duration}function u1(e,t){if(typeof t!=`function`)throw Error();return function(){I$(this,e).ease=t}}function d1(e){var t=this._id;return arguments.length?this.each(u1(t,e)):L$(this.node(),t).ease}function f1(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();I$(this,e).ease=n}}function p1(e){if(typeof e!=`function`)throw Error();return this.each(f1(this._id,e))}function m1(e){typeof e!=`function`&&(e=BY(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 U1(r,this._parents,this._name,this._id)}function h1(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 U1(o,this._parents,this._name,this._id)}function g1(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 _1(e,t,n){var r,i,a=g1(t)?F$:I$;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function v1(e,t){var n=this._id;return arguments.length<2?L$(this.node(),n).on.on(e):this.each(_1(n,e,t))}function y1(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function b1(){return this.on(`end.remove`,y1(this._id))}function x1(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=NY(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,P$(l[f],t,n,f,l,L$(u,n)));return new U1(a,this._parents,t,n)}function S1(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=LY(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=L$(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&P$(p,t,n,h,f,m);a.push(f),o.push(u)}return new U1(a,o,t,n)}var C1=CZ.prototype.constructor;function w1(){return new C1(this._groups,this._parents)}function T1(e,t){var n,r,i;return function(){var a=AX(this,e),o=(this.style.removeProperty(e),AX(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function E1(e){return function(){this.style.removeProperty(e)}}function D1(e,t,n){var r,i=n+``,a;return function(){var o=AX(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function O1(e,t,n){var r,i,a;return function(){var o=AX(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),AX(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function k1(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=I$(this,e),l=c.on,u=c.value[a]==null?s||=E1(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function A1(e,t,n){var r=(e+=``)==`transform`?ZQ:G$;return t==null?this.styleTween(e,T1(e,r)).on(`end.style.`+e,E1(e)):typeof t==`function`?this.styleTween(e,O1(e,r,W$(this,`style.`+e,t))).each(k1(this._id,e)):this.styleTween(e,D1(e,r,t),n).on(`end.style.`+e,null)}function j1(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function M1(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&j1(e,a,n)),r}return a._value=t,a}function N1(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,M1(e,t,n??``))}function P1(e){return function(){this.textContent=e}}function F1(e){return function(){var t=e(this);this.textContent=t??``}}function I1(e){return this.tween(`text`,typeof e==`function`?F1(W$(this,`text`,e)):P1(e==null?``:e+``))}function L1(e){return function(t){this.textContent=e.call(this,t)}}function R1(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&L1(r)),t}return r._value=e,r}function z1(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,R1(e))}function B1(){for(var e=this._name,t=this._id,n=W1(),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=L$(c,t);P$(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new U1(r,this._parents,e,n)}function V1(){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=I$(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 H1=0;function U1(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function W1(){return++H1}var G1=CZ.prototype;U1.prototype={constructor:U1,select:x1,selectAll:S1,selectChild:G1.selectChild,selectChildren:G1.selectChildren,filter:m1,merge:h1,selection:w1,transition:B1,call:G1.call,nodes:G1.nodes,node:G1.node,size:G1.size,empty:G1.empty,each:G1.each,on:v1,attr:Q$,attrTween:r1,style:A1,styleTween:N1,text:I1,textTween:z1,remove:b1,tween:U$,delay:o1,duration:l1,ease:d1,easeVarying:p1,end:V1,[Symbol.iterator]:G1[Symbol.iterator]};function K1(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var q1={time:null,delay:0,duration:250,ease:K1};function J1(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Y1(e){var t,n;e instanceof U1?(t=e._id,e=e._name):(t=W1(),(n=q1).time=h$(),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])&&P$(c,e,t,l,o,n||J1(c,t));return new U1(r,this._parents,e,t)}CZ.prototype.interrupt=B$,CZ.prototype.transition=Y1;var X1=e=>()=>e;function Z1(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 Q1(e,t,n){this.k=e,this.x=t,this.y=n}Q1.prototype={constructor:Q1,scale:function(e){return e===1?this:new Q1(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Q1(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 $1=new Q1(1,0,0);Q1.prototype;function e0(e){e.stopImmediatePropagation()}function t0(e){e.preventDefault(),e.stopImmediatePropagation()}function n0(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function r0(){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 i0(){return this.__zoom||$1}function a0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function o0(){return navigator.maxTouchPoints||`ontouchstart`in this}function s0(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 c0(){var e=n0,t=r0,n=s0,r=a0,i=o0,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=r$,l=xY(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,i0).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).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`,i0),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($1.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 Q1(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 Q1(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 Q1(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=TZ(this.that).datum();l.call(e,this.that,new Z1(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=DZ(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)],z$(this),s.start();t0(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=TZ(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=DZ(t,i),l=t.clientX,u=t.clientY;MZ(t.view),e0(t),a.mouse=[c,this.__zoom.invert(c)],z$(this),a.start();function d(e){if(t0(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]=DZ(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),NZ(e.view,a.moved),t0(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=DZ(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);t0(r),s>0?TZ(this).transition().duration(s).call(x,d,c,r):TZ(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(e0(t),s=0;s<i;++s)c=r[s],l=DZ(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)),z$(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(t0(e),s=0;s<a;++s)c=i[s],l=DZ(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 k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(e0(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=DZ(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=TZ(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:X1(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:X1(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:X1(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:X1([[+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 l0=(e=>(e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`,e))(l0||{}),u0=(e=>(e.Partial=`partial`,e.Full=`full`,e))(u0||{}),d0=(e=>(e.Bezier=`default`,e.SimpleBezier=`simple-bezier`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e))(d0||{}),f0=(e=>(e.Strict=`strict`,e.Loose=`loose`,e))(f0||{}),p0=(e=>(e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`,e))(p0||{}),m0=(e=>(e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`,e))(m0||{}),h0=(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))(h0||{}),g0=[`INPUT`,`SELECT`,`TEXTAREA`],_0=typeof document<`u`?document:null;function v0(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 g0.includes(t?.nodeName)||n||!!r}function y0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function b0(e,t,n,r){let i=t.replace(`+`,`
|
|
271
271
|
`).replace(`
|
|
272
272
|
|
|
273
273
|
`,`
|
|
@@ -294,4 +294,4 @@ Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or ta
|
|
|
294
294
|
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
|
|
295
295
|
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},F2=class extends Error{constructor(e,...t){super(P2[e]?.call(P2,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function I2(e){return`clientX`in e}function L2(e){return`sourceEvent`in e}function R2(e,t){let n=I2(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 z2=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function B2(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function V2(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var H2=()=>!0;function U2(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function W2(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())A0(i,k0(e))>0&&r.push(e);return r}var G2=250;function K2(e,t,n,r){let i=[],a=1/0,o=W2(e,n,t+G2);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}=k2(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 q2(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=H2},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:_}=R2(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=J2(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===f0.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=Z2(t,e,a,p,n,!0)}return b}function J2(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Y2(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function X2(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function Z2(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===f0.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,...k2(o,c,c.position,!0)}:c}var Q2={[l0.Left]:l0.Right,[l0.Right]:l0.Left,[l0.Top]:l0.Bottom,[l0.Bottom]:l0.Top},$2=[`production`,`prod`];function e4(e,...t){t4()&&console.warn(`[Vue Flow]: ${e}`,...t)}function t4(){return!$2.includes(`production`)}function n4(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,...j0(t)}}):null}function r4(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),ce(()=>{o.blur()})):n([e])}function i4(e){return r(e)!==void 0}function a4(e,t,n,r){if(!e||!e.source||!e.target)return n(new F2(N2.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=F0(e)?e:{...e,id:G0(e)},i=V0(i,void 0,r),!K0(i,t)&&i}function o4(e,t,n,r,i){if(!t.source||!t.target)return i(new F2(N2.EDGE_INVALID,e.id)),!1;if(!n)return i(new F2(N2.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?G0(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function s4(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!I0(o)){n(new F2(N2.NODE_INVALID,o?.id));continue}let s=B0(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 F2(N2.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 c4(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 l4(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}`;c4(`source`,o,`${r}-${a}--${n}-${i}`,e,n,i),c4(`target`,o,s,e,r,a)}}function u4(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function d4(e,t,n,r,i,a,o,s){let c=[];for(let l of e){let e=F0(l)?l:a4(l,s,i,a);if(!e)continue;let u=n(e.source),d=n(e.target);if(!u||!d){i(new F2(N2.EDGE_SOURCE_TARGET_MISSING,e.id,e.source,e.target));continue}if(!u){i(new F2(N2.EDGE_SOURCE_MISSING,e.id,e.source));continue}if(!d){i(new F2(N2.EDGE_TARGET_MISSING,e.id,e.target));continue}if(t&&!t(e,{edges:s,nodes:o,sourceNode:u,targetNode:d})){i(new F2(N2.EDGE_INVALID,e.id));continue}let f=r(e.id);c.push({...V0(e,f,a),sourceNode:u,targetNode:d})}return c}var f4=Symbol(`vueFlow`),p4=Symbol(`nodeId`),m4=Symbol(`nodeRef`),h4=Symbol(`edgeId`),g4=Symbol(`edgeRef`),_4=Symbol(`slots`);function v4(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}=E3(),{onStart:w,onDrag:T,onStop:E,onClick:D,el:O,disabled:k,id:A,selectable:j,dragHandle:M}=e,N=s(!1),P=[],F,I=null,L={x:void 0,y:void 0},R={x:0,y:0},ee=null,z=!1,te=!1,ne=0,B=!1,V=x4(),re=({x:e,y:t})=>{L={x:e,y:t};let i=!1;if(P=P.map(a=>{let o={x:e-a.distance.x,y:t-a.distance.y},{computedPosition:s}=O2(a,n.value?V2(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}),te||=i,i&&(x(P,!0,!0),N.value=!0,ee)){let[e,t]=C2({id:A,dragItems:P,findNode:h});T({event:ee,node:e,nodes:t})}},H=()=>{if(!I)return;let[e,t]=d2(R,I,f.value);if(e!==0||t!==0){let n={x:(L.x??0)-e/u.value.zoom,y:(L.y??0)-t/u.value.zoom};m({x:e,y:t})&&re(n)}ne=requestAnimationFrame(H)},ie=(e,t)=>{z=!0;let n=h(A);!v.value&&!g.value&&n&&(n.selected||y()),n&&a(j)&&v.value&&r4(n,g.value,b,y,_,!1,t);let r=V(e.sourceEvent);if(L=r,P=S2(o.value,p.value,r,A),P.length){let[t,n]=C2({id:A,dragItems:P,findNode:h});w({event:e.sourceEvent,node:t,nodes:n})}},U=(e,n)=>{e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||(te=!1,l.value===0&&ie(e,n),L=V(e.sourceEvent),I=t.value?.getBoundingClientRect()||null,R=R2(e.sourceEvent,I))},W=(e,t)=>{let n=V(e.sourceEvent);if(!B&&z&&d.value&&(B=!0,H()),!z){let r=n.xSnapped-(L.x??0),i=n.ySnapped-(L.y??0);Math.sqrt(r*r+i*i)>l.value&&ie(e,t)}(L.x!==n.xSnapped||L.y!==n.ySnapped)&&P.length&&z&&(ee=e.sourceEvent,R=R2(e.sourceEvent,I),re(n))},ae=e=>{let t=!1;if(!z&&!N.value&&!g.value){let n=e.sourceEvent,r=V(n),i=r.xSnapped-(L.x??0),a=r.ySnapped-(L.y??0),o=Math.sqrt(i*i+a*a);o!==0&&o<=l.value&&(D?.(n),t=!0)}if(P.length&&!t){te&&=(x(P,!1,!1),!1);let[t,n]=C2({id:A,dragItems:P,findNode:h});E({event:e.sourceEvent,node:t,nodes:n})}P=[],N.value=!1,B=!1,z=!1,L={x:void 0,y:void 0},cancelAnimationFrame(ne)};return C([()=>a(k),O],([e,t],n,r)=>{if(t){let n=TZ(t);e||(F=BZ().on(`start`,e=>U(e,t)).on(`drag`,e=>W(e,t)).on(`end`,e=>ae(e)).filter(e=>{let n=e.target,r=a(M);return!e.button&&(!i.value||!x2(n,`.${i.value}`,t)&&(!r||x2(n,r,t)))}),n.call(F)),r(()=>{n.on(`.drag`,null),F&&(F.on(`start`,null),F.on(`drag`,null),F.on(`end`,null))})}}),N}function y4(){return{doubleClick:b2(),click:b2(),mouseEnter:b2(),mouseMove:b2(),mouseLeave:b2(),contextMenu:b2(),updateStart:b2(),update:b2(),updateEnd:b2()}}function b4(e,t){let n=y4();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 x4(){let{viewport:e,snapGrid:t,snapToGrid:n,vueFlowRef:r}=E3();return i=>{let a=r.value?.getBoundingClientRect()??{left:0,top:0},{x:o,y:s}=R2(L2(i)?i.sourceEvent:i,a),c=J0({x:o,y:s},e.value),{x:l,y:u}=n.value?V2(c,t.value):c;return{xSnapped:l,ySnapped:u,...c}}}function S4(){return!0}function C4({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}=E3(),O=null,k=!1,A=null;function j(f){let p=a(n)===`target`,m=I2(f),j=P0(f.target),M=f.currentTarget;if(M&&(m&&f.button===0||!m)){let n=function(n){B=R2(n,z),F=K2(J0(B,C.value,!1,[1,1]),d.value,D.value,H),V||=(re(),!0);let r=q2(n,{handle:F,connectionMode:u.value,fromNodeId:a(t),fromHandleId:a(e),fromType:p?`target`:`source`,isValidConnection:P,doc:j,lib:`vue`,flowId:c,nodeLookup:D.value},w.value,T.value,_,D.value);A=r.handleDomNode,O=r.connection,k=X2(!!F,r.isValid);let i={...W,isValid:k,to:r.toHandle&&k?q0({x:r.toHandle.x,y:r.toHandle.y},C.value):B,toHandle:r.toHandle,toPosition:k&&r.toHandle?r.toHandle.position:Q2[H.position],toNode:r.toHandle?D.value.get(r.toHandle.nodeId):null};if(k&&F&&W?.toHandle&&i.toHandle&&W.toHandle.type===i.toHandle.type&&W.toHandle.nodeId===i.toHandle.nodeId&&W.toHandle.id===i.toHandle.id&&W.to.x===i.to.x&&W.to.y===i.to.y)return;let o=F??r.toHandle;if(b(o&&k?q0({x:o.x,y:o.y},C.value):B,o,Y2(!!o,k)),W=i,!F&&!k&&!A)return U2(ne);O&&O.source!==O.target&&A&&(U2(ne),ne=A,A.classList.add(`connecting`,`vue-flow__handle-connecting`),A.classList.toggle(`valid`,!!k),A.classList.toggle(`vue-flow__handle-valid`,!!k))},m=function(e){`touches`in e&&e.touches.length>0||((F||A)&&O&&k&&(o?o(e,O):S.connect(O)),S.connectEnd(e),i&&s?.(e),U2(ne),cancelAnimationFrame(I),x(e),V=!1,k=!1,O=null,A=null,j.removeEventListener(`mousemove`,n),j.removeEventListener(`mouseup`,m),j.removeEventListener(`touchmove`,n),j.removeEventListener(`touchend`,m))},N=_(a(t)),P=a(r)||E.value||S4;!P&&N&&(P=(p?N.isValidSourcePos:N.isValidTargetPos)||S4);let F,I=0,{x:L,y:R}=R2(f),ee=J2(a(i),M),z=l.value?.getBoundingClientRect();if(!z||!ee)return;let te=Z2(a(t),ee,a(e),D.value,u.value);if(!te)return;let ne,B=R2(f,z),V=!1,re=()=>{if(!h.value)return;let[e,t]=d2(B,z,g.value);v({x:e,y:t}),I=requestAnimationFrame(re)},H={...te,nodeId:a(t),type:ee,position:te.position},ie=D.value.get(a(t)),U={inProgress:!0,isValid:null,from:k2(ie,H,l0.Left,!0),fromHandle:H,fromPosition:H.position,fromNode:ie,to:B,toHandle:null,toPosition:Q2[H.position],toNode:null};y({nodeId:a(t),id:a(e),type:ee,position:M?.getAttribute(`data-handlepos`)||l0.Top,...B},{x:L-z.left,y:R-z.top}),S.connectStart({event:f,nodeId:a(t),handleId:a(e),handleType:ee});let W=U;j.addEventListener(`mousemove`,n),j.addEventListener(`mouseup`,m),j.addEventListener(`touchmove`,n),j.addEventListener(`touchend`,m)}}function M(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:l0.Top,...R2(i)},void 0,!0);return}let s=a(r)||E.value||S4,l=_(a(t));if(!s&&l&&(s=(o?l.isValidSourcePos:l.isValidTargetPos)||S4),l&&(l.connectable===void 0?m.value:l.connectable)===!1)return;let d=P0(i.target),h=q2(i,{handle:{nodeId:a(t),id:a(e),type:a(n),position:l0.Top,...R2(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:j,handleClick:M}}function w4(){return w(p4,``)}function T4(e){let t=e??w4()??``,n=w(m4,i(null)),{findNode:r,edges:a,emits:o}=E3(),s=r(t);return s||o.error(new F2(N2.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:s,parentNode:z(()=>r(s.parentNode)),connectedEdges:z(()=>t2([s],a.value))}}function E4(){return{doubleClick:b2(),click:b2(),mouseEnter:b2(),mouseMove:b2(),mouseLeave:b2(),contextMenu:b2(),dragStart:b2(),drag:b2(),dragStop:b2()}}function D4(e,t){let n=E4();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 O4(){let{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:r,snapGrid:i,snapToGrid:a,nodesDraggable:o,emits:s}=E3();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}=O2(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 k4=.1,A4=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function j4(){return e4(`Viewport not initialized yet.`),Promise.resolve(!1)}var M4={zoomIn:j4,zoomOut:j4,zoomTo:j4,fitView:j4,setCenter:j4,fitBounds:j4,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:j4,setTransform:j4,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function N4(e){function t(t,n){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(n?.interpolate===`linear`?UQ:r$).scaleBy(P4(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}=N0({x:-t,y:-n},e.translateExtent),l=$1.translate(-s,-c).scale(r);e.d3Selection&&e.d3Zoom?(o=e.d3Zoom)==null||o.interpolate(i?.interpolate===`linear`?UQ:r$).transform(P4(e.d3Selection,i?.duration,i?.ease,()=>{a(!0)}),l):a(!1)})}return z(()=>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`?UQ:r$).scaleTo(P4(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:k4,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}=a2($0(r),e.dimensions.width,e.dimensions.height,t.minZoom??e.minZoom,t.maxZoom??e.maxZoom,t.padding??k4);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:k4})=>{let{x:i,y:a,zoom:o}=a2(t,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??k4);return n(i,a,o,r)},project:t=>J0(t,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:t=>{if(e.vueFlowRef){let{x:n,y:r}=e.vueFlowRef.getBoundingClientRect();return J0({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 q0({x:t.x+n,y:t.y+r},e.viewport)}return{x:0,y:0}}}:M4)}function P4(e,t=0,n=A4,r=()=>{}){let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e}function F4(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=lY([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=lY([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],ce(()=>{t?.resume()}))},{immediate:i}),u(()=>{t?.stop(),r?.stop()})}),r.run(()=>{let t,r,i=!!n.nodes.value.length;t=lY([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=lY([n.nodes,()=>n.nodes.value.length],([n])=>{e.nodes?.value&&Array.isArray(e.nodes.value)&&(t?.pause(),e.nodes.value=[...n],ce(()=>{t?.resume()}))},{immediate:i}),u(()=>{t?.stop(),r?.stop()})}),r.run(()=>{let t,r,i=!!n.edges.value.length;t=lY([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=lY([n.edges,()=>n.edges.value.length],([n])=>{e.edges?.value&&Array.isArray(e.edges.value)&&(t?.pause(),e.edges.value=[...n],ce(()=>{t?.resume()}))},{immediate:i}),u(()=>{t?.stop(),r?.stop()})}),r.run(()=>{C(()=>t.minZoom,()=>{t.minZoom&&i4(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})}),r.run(()=>{C(()=>t.maxZoom,()=>{t.maxZoom&&i4(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})}),r.run(()=>{C(()=>t.translateExtent,()=>{t.translateExtent&&i4(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})}),r.run(()=>{C(()=>t.nodeExtent,()=>{t.nodeExtent&&i4(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})}),r.run(()=>{C(()=>t.applyDefault,()=>{i4(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,()=>{i4(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=>{i4(e)&&(i.value=e)},{immediate:!0})})}}})()}),()=>r.stop()}function I4(){return{edgesChange:b2(),nodesChange:b2(),nodeDoubleClick:b2(),nodeClick:b2(),nodeMouseEnter:b2(),nodeMouseMove:b2(),nodeMouseLeave:b2(),nodeContextMenu:b2(),nodeDragStart:b2(),nodeDrag:b2(),nodeDragStop:b2(),nodesInitialized:b2(),miniMapNodeClick:b2(),miniMapNodeDoubleClick:b2(),miniMapNodeMouseEnter:b2(),miniMapNodeMouseMove:b2(),miniMapNodeMouseLeave:b2(),connect:b2(),connectStart:b2(),connectEnd:b2(),clickConnectStart:b2(),clickConnectEnd:b2(),paneReady:b2(),init:b2(),move:b2(),moveStart:b2(),moveEnd:b2(),selectionDragStart:b2(),selectionDrag:b2(),selectionDragStop:b2(),selectionContextMenu:b2(),selectionStart:b2(),selectionEnd:b2(),viewportChangeStart:b2(),viewportChange:b2(),viewportChangeEnd:b2(),paneScroll:b2(),paneClick:b2(),paneContextMenu:b2(),paneMouseEnter:b2(),paneMouseMove:b2(),paneMouseLeave:b2(),edgeContextMenu:b2(),edgeMouseEnter:b2(),edgeMouseMove:b2(),edgeMouseLeave:b2(),edgeDoubleClick:b2(),edgeClick:b2(),edgeUpdateStart:b2(),edgeUpdate:b2(),edgeUpdateEnd:b2(),updateNodeInternals:b2(),error:b2(e=>e4(e.message))}}function L4(e,t){let n=T();ae(()=>{for(let[n,i]of Object.entries(t.value))i.setEmitter(t=>{e(n,t)}),ZJ(i.removeEmitter),i.setHasEmitListeners(()=>r(n)),ZJ(i.removeHasEmitListeners)});function r(e){let t=R4(e);return!!n?.vnode.props?.[t]}}function R4(e){let[t,...n]=e.split(`:`);return`on${t.replace(/(?:^|-)(\w)/g,(e,t)=>t.toUpperCase())}${n.length?`:${n.join(`:`)}`:``}`}function z4(){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:u0.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:m0.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:d0.Bezier,style:{}},connectionMode:f0.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:z2()?`Meta`:`Control`,zoomActivationKeyCode:z2()?`Meta`:`Control`,deleteKeyCode:`Backspace`,panActivationKeyCode:`Space`,hooks:I4(),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 B4=[`id`,`vueFlowRef`,`viewportRef`,`initialized`,`modelValue`,`nodes`,`edges`,`maxZoom`,`minZoom`,`translateExtent`,`hooks`,`defaultEdgeOptions`];function V4(e,t,n){let r=N4(e),i=t=>{let n=t??[];e.hooks.updateNodeInternals.trigger(n)},a=t=>W0(t,e.nodes,e.edges),o=t=>U0(t,e.nodes,e.edges),s=t=>t2(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=j0(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=n4(`source`,t.nodeElement,r,a,n.id),n.handleBounds.target=n4(`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)I0(e)?a.add(e.id):F0(e)&&o.add(e.id);let s=v2(t.value,a,!0),c=v2(n.value,o);if(e.multiSelectionActive){for(let e of a)s.push(m2(e,i));for(let e of o)c.push(m2(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=>m2(e.id,!0));e.hooks.nodesChange.trigger(t);return}e.hooks.nodesChange.trigger(v2(t.value,new Set(r.map(e=>e.id)),!0)),e.hooks.edgesChange.trigger(v2(n.value))},h=r=>{if(e.multiSelectionActive){let t=r.map(e=>m2(e.id,!0));e.hooks.edgesChange.trigger(t);return}e.hooks.edgesChange.trigger(v2(n.value,new Set(r.map(e=>e.id)))),e.hooks.nodesChange.trigger(v2(t.value,new Set,!0))},g=e=>{p(e,!0)},_=t=>{let n=(t||e.nodes).map(e=>(e.selected=!1,m2(e.id,!1)));e.hooks.nodesChange.trigger(n)},v=t=>{let n=(t||e.edges).map(e=>(e.selected=!1,m2(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=m2(t.id,!1);return I0(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=s4(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=d4(r,e.isValidConnection,l,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);l4(e.connectionLookup,n.value,i),e.edges=i},O=t=>{let n=t instanceof Function?t([...e.nodes,...e.edges]):t;(e.initialized||n.length)&&(E(n.filter(I0)),D(n.filter(F0)))},k=t=>{let n=t instanceof Function?t(e.nodes):t;n=Array.isArray(n)?n:[n];let r=s4(n,l,e.hooks.error.trigger),i=[];for(let e of r)i.push(h2(e));i.length&&e.hooks.nodesChange.trigger(i)},A=t=>{let n=t instanceof Function?t(e.edges):t;n=Array.isArray(n)?n:[n];let r=d4(n,e.isValidConnection,l,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),i=[];for(let e of r)i.push(h2(e));i.length&&e.hooks.edgesChange.trigger(i)},j=(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)(!i4(e.deletable)||e.deletable)&&c.push(_2(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(g2(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&&(!i4(t.deletable)||t.deletable)&&(o.push(g2(t.id)),n&&u([t]),r&&d(t.id))}c.length&&e.hooks.edgesChange.trigger(c),o.length&&e.hooks.nodesChange.trigger(o)},M=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&&(!i4(t.deletable)||t.deletable)&&i.push(_2(typeof e==`string`?e:e.id,t.source,t.target,t.sourceHandle,t.targetHandle))}e.hooks.edgesChange.trigger(i)},N=(t,r,i=!0)=>{let a=u(t.id);if(!a)return!1;let o=e.edges.indexOf(a),s=o4(t,r,a,i,e.hooks.error.trigger);if(s){let[t]=d4([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),l4(e.connectionLookup,n.value,[t]),t}return!1},P=(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}},F=t=>p2(t,e.nodes),I=t=>{let r=p2(t,e.edges);return l4(e.connectionLookup,n.value,r),r},L=(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)},R=(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}},ee=(t,n,r=!1)=>{r?e.connectionClickStartHandle=t:e.connectionStartHandle=t,e.connectionEndHandle=null,e.connectionStatus=null,n&&(e.connectionPosition=n)},z=(t,n=null,r=null)=>{e.connectionStartHandle&&(e.connectionPosition=t,e.connectionEndHandle=n,e.connectionStatus=r)},te=(t,n)=>{e.connectionPosition={x:NaN,y:NaN},e.connectionEndHandle=null,e.connectionStatus=null,n?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ne=e=>{let t=z0(e),n=t?null:L0(e)?e:l(e.id);return!t&&!n?[null,null,t]:[t?e:k0(n),n,t]},B=(t,n=!0,r=e.nodes)=>{let[i,a,o]=ne(t);if(!i)return[];let s=[];for(let t of r||e.nodes){if(!o&&(t.id===a.id||!t.computedPosition))continue;let e=k0(t),r=A0(e,i);(n&&r>0||r>=e.width*e.height||r>=Number(i.width)*Number(i.height))&&s.push(t)}return s},V=(e,t,n=!0)=>{let[r]=ne(e);if(!r)return!1;let i=A0(r,t);return n&&i>0||i>=Number(r.width)*Number(r.height)},re=t=>{let{viewport:n,dimensions:r,d3Zoom:i,d3Selection:a,translateExtent:o}=e;if(!i||!a||!t.x&&!t.y)return!1;let s=$1.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},H=t=>{let n=t instanceof Function?t(e):t,r=[`d3Zoom`,`d3Selection`,`d3ZoomHandler`,`viewportRef`,`vueFlowRef`,`dimensions`,`hooks`];i4(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),O(i));let a=()=>{i4(n.maxZoom)&&x(n.maxZoom),i4(n.minZoom)&&b(n.minZoom),i4(n.translateExtent)&&S(n.translateExtent)};for(let t of Object.keys(n)){let i=t,a=n[i];![...B4,...r].includes(i)&&i4(a)&&(e[i]=a)}fY(()=>e.d3Zoom).not.toBeNull().then(a),e.initialized||=!0};return{updateNodePositions:d,updateNodeDimensions:f,setElements:O,setNodes:E,setEdges:D,addNodes:k,addEdges:A,removeNodes:j,removeEdges:M,findNode:l,findEdge:u,updateEdge:N,updateEdgeData:P,updateNode:L,updateNodeData:R,applyEdgeChanges:I,applyNodeChanges:F,addSelectedElements:g,addSelectedNodes:m,addSelectedEdges:h,setMinZoom:b,setMaxZoom:x,setTranslateExtent:S,setNodeExtent:C,setPaneClickDistance:w,removeSelectedElements:y,removeSelectedNodes:_,removeSelectedEdges:v,startConnection:ee,updateConnection:z,endConnection:te,setInteractive:T,setState:H,getIntersectingNodes:B,getIncomers:a,getOutgoers:o,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:V,panBy:re,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 fY(()=>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=z4();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){let n=$1.translate(t.defaultViewport.x??0,t.defaultViewport.y??0).scale(M0(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)}H(t)},$destroy:()=>{}}}var H4=[`data-id`,`data-handleid`,`data-nodeid`,`data-handlepos`],U4=B({name:`Handle`,compatConfig:{MODE:3},props:{id:{default:null},type:{},position:{default:()=>l0.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=O(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}=E3(),{id:g,node:_,nodeEl:v,connectedEdges:y}=T4(),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}=C4({nodeId:g,handleId:e.id,isValidConnection:s,type:a}),D=z(()=>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):i4(e.connectable)?e.connectable:p.value);I(()=>{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,...j0(b.value)};_.handleBounds[a.value]=[..._.handleBounds[a.value]??[],c]});function k(e){let t=I2(e);D.value&&x.value&&(t&&e.button===0||!t)&&T(e)}function A(e){g&&(u.value||x.value)&&D.value&&E(e)}return t({handleClick:E,handlePointerDown:T,onClick:A,onPointerDown:k}),(t,n)=>(V(),P(`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:L([`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:k,onTouchstartPassive:k,onClick:A},[de(t.$slots,`default`,{id:t.id})],42,H4))}}),W4=function({sourcePosition:e=l0.Bottom,targetPosition:t=l0.Top,label:n,connectable:r=!0,isValidTargetPos:i,isValidSourcePos:a,data:o}){let s=o.label??n;return[v(U4,{type:`target`,position:t,connectable:r,isValidConnection:i}),typeof s!=`string`&&s?v(s):v(H,[s]),v(U4,{type:`source`,position:e,connectable:r,isValidConnection:a})]};W4.props=[`sourcePosition`,`targetPosition`,`label`,`isValidTargetPos`,`isValidSourcePos`,`connectable`,`data`],W4.inheritAttrs=!1,W4.compatConfig={MODE:3};var G4=W4,K4=function({targetPosition:e=l0.Top,label:t,connectable:n=!0,isValidTargetPos:r,data:i}){let a=i.label??t;return[v(U4,{type:`target`,position:e,connectable:n,isValidConnection:r}),typeof a!=`string`&&a?v(a):v(H,[a])]};K4.props=[`targetPosition`,`label`,`isValidTargetPos`,`connectable`,`data`],K4.inheritAttrs=!1,K4.compatConfig={MODE:3};var q4=K4,J4=function({sourcePosition:e=l0.Bottom,label:t,connectable:n=!0,isValidSourcePos:r,data:i}){let a=i.label??t;return[typeof a!=`string`&&a?v(a):v(H,[a]),v(U4,{type:`source`,position:e,connectable:n,isValidConnection:r})]};J4.props=[`sourcePosition`,`label`,`isValidSourcePos`,`connectable`,`data`],J4.inheritAttrs=!1,J4.compatConfig={MODE:3};var Y4=J4,X4=[`transform`],Z4=[`width`,`height`,`x`,`y`,`rx`,`ry`],Q4=[`y`],$4=B({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=z(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);I(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)=>(V(),P(`g`,{transform:r.value,class:`vue-flow__edge-textwrapper`},[e.labelShowBg?(V(),P(`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:re(e.labelBgStyle),rx:e.labelBgBorderRadius,ry:e.labelBgBorderRadius},null,12,Z4)):K(``,!0),N(`text`,R(e.$attrs,{ref_key:`el`,ref:n,class:`vue-flow__edge-text`,y:t.value.height/2,dy:`0.3em`,style:e.labelStyle}),[de(e.$slots,`default`,{},()=>[typeof e.label==`string`?(V(),P(H,{key:1},[x(W(e.label),1)],64)):(V(),G(ue(e.label),{key:0}))])],16,Q4)],8,X4))}}),e3=[`id`,`d`,`marker-end`,`marker-start`],t3=[`d`,`stroke-width`],n3=B({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)=>(V(),P(H,null,[N(`path`,R(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,e3),e.interactionWidth?(V(),P(`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,t3)):K(``,!0),e.label&&e.labelX&&e.labelY?(V(),G($4,{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`])):K(``,!0)],64))}});function r3({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 i3({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 a3(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function o3({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){let o,s;switch(e){case l0.Left:o=t-a3(t-r,a),s=n;break;case l0.Right:o=t+a3(r-t,a),s=n;break;case l0.Top:o=t,s=n-a3(n-i,a);break;case l0.Bottom:o=t,s=n+a3(i-n,a)}return[o,s]}function s3(e){let{sourceX:t,sourceY:n,sourcePosition:r=l0.Bottom,targetX:i,targetY:a,targetPosition:o=l0.Top,curvature:s=.25}=e,[c,l]=o3({pos:r,x1:t,y1:n,x2:i,y2:a,c:s}),[u,d]=o3({pos:o,x1:i,y1:a,x2:t,y2:n,c:s}),[f,p,m,h]=i3({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 c3({pos:e,x1:t,y1:n,x2:r,y2:i}){let a,o;switch(e){case l0.Left:case l0.Right:a=.5*(t+r),o=n;break;case l0.Top:case l0.Bottom:a=t,o=.5*(n+i)}return[a,o]}function l3(e){let{sourceX:t,sourceY:n,sourcePosition:r=l0.Bottom,targetX:i,targetY:a,targetPosition:o=l0.Top}=e,[s,c]=c3({pos:r,x1:t,y1:n,x2:i,y2:a}),[l,u]=c3({pos:o,x1:i,y1:a,x2:t,y2:n}),[d,f,p,m]=i3({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 u3={[l0.Left]:{x:-1,y:0},[l0.Right]:{x:1,y:0},[l0.Top]:{x:0,y:-1},[l0.Bottom]:{x:0,y:1}};function d3({source:e,sourcePosition:t=l0.Bottom,target:n}){return t===l0.Left||t===l0.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 f3(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function p3({source:e,sourcePosition:t=l0.Bottom,target:n,targetPosition:r=l0.Top,center:i,offset:a}){let o=u3[t],s=u3[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=d3({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]=r3({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 m3(e,t,n,r){let i=Math.min(f3(e,t)/2,f3(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 h3(e){let{sourceX:t,sourceY:n,sourcePosition:r=l0.Bottom,targetX:i,targetY:a,targetPosition:o=l0.Top,borderRadius:s=5,centerX:c,centerY:l,offset:u=20}=e,[d,f,p,m,h]=p3({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?m3(d[n-1],t,d[n+1],s):`${n===0?`M`:`L`}${t.x} ${t.y}`,e+=r,e},``),f,p,m,h]}function g3(e){let{sourceX:t,sourceY:n,targetX:r,targetY:i}=e,[a,o,s,c]=r3({sourceX:t,sourceY:n,targetX:r,targetY:i});return[`M ${t},${n}L ${r},${i}`,a,o,s,c]}var _3=B({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]=g3(e);return v(n3,{path:n,labelX:r,labelY:i,...t,...e})}}}),v3=B({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]=h3({...e,sourcePosition:e.sourcePosition??l0.Bottom,targetPosition:e.targetPosition??l0.Top});return v(n3,{path:n,labelX:r,labelY:i,...t,...e})}}}),y3=B({name:`StepEdge`,props:[`sourcePosition`,`targetPosition`,`label`,`labelStyle`,`labelShowBg`,`labelBgStyle`,`labelBgPadding`,`labelBgBorderRadius`,`sourceY`,`sourceX`,`targetX`,`targetY`,`markerEnd`,`markerStart`,`interactionWidth`],setup(e,{attrs:t}){return()=>v(v3,{...e,...t,borderRadius:0})}}),b3=B({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]=s3({...e,sourcePosition:e.sourcePosition??l0.Bottom,targetPosition:e.targetPosition??l0.Top});return v(n3,{path:n,labelX:r,labelY:i,...t,...e})}}}),x3=B({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]=l3({...e,sourcePosition:e.sourcePosition??l0.Bottom,targetPosition:e.targetPosition??l0.Top});return v(n3,{path:n,labelX:r,labelY:i,...t,...e})}}}),S3={input:Y4,default:G4,output:q4},C3={default:b3,straight:_3,step:y3,smoothstep:v3,simplebezier:x3};function w3(e,t,n){let r=z(()=>e=>t.value.get(e)),i=z(()=>e=>n.value.get(e)),a=z(()=>{let t={...C3,...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=z(()=>{let t={...S3,...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=z(()=>e.onlyRenderVisibleElements?e2(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=z(()=>{if(e.onlyRenderVisibleElements){let n=[];for(let r of e.edges){let i=t.value.get(r.source),a=t.value.get(r.target);j2({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=z(()=>[...s.value,...c.value]),u=z(()=>{let t=[];for(let n of e.nodes)n.selected&&t.push(n);return t}),d=z(()=>{let t=[];for(let n of e.edges)n.selected&&t.push(n);return t}),f=z(()=>[...u.value,...d.value]),p=z(()=>{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:z(()=>s.value.length>0&&p.value.length===s.value.length)}}var T3=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=z4(),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=z(()=>{let e=new Map;for(let t of r.nodes)e.set(t.id,t);return e}),s=z(()=>{let e=new Map;for(let t of r.edges)e.set(t.id,t);return e}),c=w3(r,o,s),l=V4(r,o,s);l.setState({...r,...t});let u={...i,...c,...l,...uY(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 E3(e){let t=T3.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(f4,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}),ZJ(()=>{if(s){let e=t.get(s.id);e?e.$destroy():e4(`No store instance found for id ${s.id} in storage.`)}})})}else r&&s.setState(i);return n&&(te(f4,s),n.vueFlowId=s.id),r&&T()?.type.name!==`VueFlow`&&s.emits.error(new F2(N2.USEVUEFLOW_OPTIONS)),s}function D3(e){let{emits:t,dimensions:n}=E3(),r;I(()=>{let i=()=>{var r;if(!e.value||!((r=e.value).checkVisibility?.call(r)??!0))return;let i=j0(e.value);(i.width===0||i.height===0)&&t.error(new F2(N2.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)),ne(()=>{window.removeEventListener(`resize`,i),r&&e.value&&r.unobserve(e.value)})})}var O3=B({name:`UserSelection`,compatConfig:{MODE:3},props:{userSelectionRect:{}},setup(e){return(e,t)=>(V(),P(`div`,{class:`vue-flow__selection vue-flow__container`,style:re({width:`${e.userSelectionRect.width}px`,height:`${e.userSelectionRect.height}px`,transform:`translate(${e.userSelectionRect.x}px, ${e.userSelectionRect.y}px)`})},null,4))}}),k3=[`tabIndex`],A3=B({name:`NodesSelection`,compatConfig:{MODE:3},setup(e){let{emits:t,viewport:n,getSelectedNodes:a,noPanClassName:o,disableKeyboardA11y:s,userSelectionActive:c}=E3(),l=O4(),u=i(null),d=v4({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)}});I(()=>{var e;s.value||(e=u.value)==null||e.focus({preventScroll:!0})});let f=z(()=>$0(a.value)),p=z(()=>({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||O0[e.key]&&(e.preventDefault(),l({x:O0[e.key].x,y:O0[e.key].y},e.shiftKey))}return(e,t)=>!r(c)&&f.value.width&&f.value.height?(V(),P(`div`,{key:0,class:L([`vue-flow__nodesselection vue-flow__container`,r(o)]),style:re({transform:`translate(${r(n).x}px,${r(n).y}px) scale(${r(n).zoom})`})},[N(`div`,{ref_key:`el`,ref:u,class:L([{dragging:r(d)},`vue-flow__nodesselection-rect`]),style:re(p.value),tabIndex:r(s)?void 0:-1,onContextmenu:m,onKeydown:h},null,46,k3)],6)):K(``,!0)}});function j3(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}var M3=B({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}=E3(),O=s(null),k=s(new Set),A=s(new Set),j=s(null),M=o(()=>d.value&&(e.isSelecting||c.value)),N=o(()=>E.value!==null),F=!1,I=!1,R=C0(v,{actInsideInputWithModifier:!1}),ee=C0(y);C(R,e=>{e&&(h(m.value),g(p.value),f.value=!1)}),C(ee,e=>{b.value=e});function z(e,t){return n=>{n.target===t&&e?.(n)}}function te(e){if(F||N.value){F=!1;return}a.paneClick(e),l(),f.value=!1}function ne(e){if(Array.isArray(D.value)&&D.value?.includes(2)){e.preventDefault();return}a.paneContextMenu(e)}function B(e){a.paneScroll(e)}function re(n){var r,i;if(j.value=t.value?.getBoundingClientRect()??null,!d.value||!e.isSelecting||n.button!==0||n.target!==O.value||!j.value)return;(i=(r=n.target)?.setPointerCapture)==null||i.call(r,n.pointerId);let{x:o,y:s}=j3(n,j.value);I=!0,F=!1,l(),u.value={width:0,height:0,startX:o,startY:s,x:o,y:s},a.selectionStart(n)}function H(e){if(!j.value||!u.value)return;F=!0;let{x:t,y:r}=R2(e,j.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=k.value,p=A.value;k.value=new Set(e2(n.value,l,i.value,_.value===u0.Partial,!0).map(e=>e.id)),A.value=new Set;let m=T.value?.selectable??!0;for(let e of k.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)&&A.value.add(e)}}if(!u4(d,k.value)){let e=v2(S.value,k.value,!0);a.nodesChange(e)}if(!u4(p,A.value)){let e=v2(x.value,A.value);a.edgesChange(e)}u.value=l,c.value=!0,f.value=!1}function ie(t){var n;t.button===0&&I&&((n=t.target)==null||n.releasePointerCapture(t.pointerId),!c.value&&u.value&&t.target===O.value&&te(t),c.value=!1,u.value=null,f.value=k.value.size>0,a.selectionEnd(t),e.selectionKeyPressed&&(F=!1),I=!1)}return(e,t)=>(V(),P(`div`,{ref_key:`container`,ref:O,class:L([`vue-flow__pane vue-flow__container`,{selection:e.isSelecting}]),onClick:t[0]||=e=>M.value?void 0:z(te,O.value)(e),onContextmenu:t[1]||=e=>z(ne,O.value)(e),onWheelPassive:t[2]||=e=>z(B,O.value)(e),onPointerenter:t[3]||=e=>M.value?void 0:r(a).paneMouseEnter(e),onPointerdown:t[4]||=e=>M.value?re(e):r(a).paneMouseMove(e),onPointermove:t[5]||=e=>M.value?H(e):r(a).paneMouseMove(e),onPointerup:t[6]||=e=>M.value?ie(e):void 0,onPointerleave:t[7]||=e=>r(a).paneMouseLeave(e)},[de(e.$slots,`default`),r(c)&&r(u)?(V(),G(O3,{key:0,"user-selection-rect":r(u)},null,8,[`user-selection-rect`])):K(``,!0),r(f)&&r(m).length?(V(),G(A3,{key:1})):K(``,!0)],34))}}),N3=B({name:`Transform`,compatConfig:{MODE:3},setup(e){let{viewport:t,fitViewOnInit:n,fitViewOnInitDone:r}=E3(),i=z(()=>n.value?!r.value:!1),a=z(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(e,t)=>(V(),P(`div`,{class:`vue-flow__transformationpane vue-flow__container`,style:re({transform:a.value,opacity:i.value?0:void 0})},[de(e.$slots,`default`)],4))}}),P3=B({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:O,d3ZoomHandler:k,viewport:A,viewportRef:j,paneClickDistance:M}=E3();D3(j);let N=s(!1),F=s(!1),R=null,ee=!1,z=0,te={x:0,y:0,zoom:0},ne=C0(u),B=C0(l),re=C0(c),H=o(()=>(!B.value||B.value&&l.value===!0)&&(ne.value||m.value)),ie=o(()=>ne.value||d.value),W=o(()=>l.value===!0&&H.value!==!0),ae=o(()=>B.value&&l.value!==!0||T.value||W.value),oe=o(()=>w.value!==null);I(()=>{if(!j.value){e4(`Viewport element is missing`);return}let e=j.value,r=e.getBoundingClientRect(),o=c0().clickDistance(M.value).scaleExtent([t.value,n.value]).translateExtent(a.value),s=TZ(e).call(o),c=s.on(`wheel.zoom`),u=$1.translate(i.value.x??0,i.value.y??0).scale(M0(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(l2),D.value=o,O.value=s,k.value=c,A.value={x:w.x,y:w.y,zoom:w.k},o.on(`start`,e=>{if(!e.sourceEvent)return null;z=e.sourceEvent.button,N.value=!0;let t=le(e.transform);e.sourceEvent?.type===`mousedown`&&(E.value=!0),te=t,S.viewportChangeStart(t),S.moveStart({event:e,flowTransform:t})}),o.on(`end`,e=>{if(!e.sourceEvent)return null;if(N.value=!1,E.value=!1,se(H.value,z??0)&&!ee&&S.paneContextMenu(e.sourceEvent),ee=!1,ce(te,e.transform)){let t=le(e.transform);te=t,S.viewportChangeEnd(t),S.moveEnd({event:e,flowTransform:t})}}),o.filter(e=>{let t=re.value||_.value,n=g.value&&e.ctrlKey,r=e.button,i=e.type===`wheel`;if(r===1&&e.type===`mousedown`&&(G(e,`vue-flow__node`)||G(e,`vue-flow__edge`)))return!0;if(!H.value&&!t&&!ie.value&&!h.value&&!g.value||T.value||oe.value&&!i||!h.value&&e.type===`dblclick`||G(e,y.value)&&i||G(e,x.value)&&(!i||ie.value&&i&&!re.value)||!g.value&&e.ctrlKey&&i||!t&&!ie.value&&!n&&i)return!1;if(!g&&e.type===`touchstart`&&e.touches?.length>1)return e.preventDefault(),!1;if(!H.value&&(e.type===`mousedown`||e.type===`touchstart`)||W.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||ne.value||i)&&a}),C([T,H],()=>{T.value&&!N.value?o.on(`zoom`,null):T.value||o.on(`zoom`,e=>{A.value={x:e.transform.x,y:e.transform.y,zoom:e.transform.k};let t=le(e.transform);ee=se(H.value,z??0),S.viewportChange(t),S.move({event:e,flowTransform:t})})},{immediate:!0}),C([T,ie,f,re,g,v,y],()=>{ie.value&&!re.value&&!T.value?s.on(`wheel.zoom`,e=>{if(G(e,y.value))return!1;let t=re.value||_.value,n=g.value&&e.ctrlKey;if(!(!v.value||ie.value||t||n))return!1;e.preventDefault(),e.stopImmediatePropagation();let r=s.property(`__zoom`).k||1,i=z2();if(!ne.value&&e.ctrlKey&&g.value&&i){let t=DZ(e),n=r*2**l2(e);o.scaleTo(s,n,t,e);return}let a=e.deltaMode===1?20:1,c=f.value===m0.Vertical?0:e.deltaX*a,l=f.value===m0.Horizontal?0:e.deltaY*a;!i&&e.shiftKey&&f.value!==m0.Vertical&&!c&&l&&(c=l,l=0),o.translateBy(s,-(c/r)*p.value,-(l/r)*p.value);let u=le(s.property(`__zoom`));R&&clearTimeout(R),F.value?(S.move({event:e,flowTransform:u}),S.viewportChange(u),R=setTimeout(()=>{S.moveEnd({event:e,flowTransform:u}),S.viewportChangeEnd(u),F.value=!1},150)):(F.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=re.value||_.value,i=g.value&&e.ctrlKey;if(!r&&!d.value&&!i&&e.type===`wheel`||n||G(e,y.value))return null;e.preventDefault(),c.call(this,e,t)},{passive:!1})},{immediate:!0})});function se(e,t){return t===2&&Array.isArray(e)&&e.includes(2)}function ce(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 le(e){return{x:e.x,y:e.y,zoom:e.k}}function G(e,t){return e.target.closest(`.${t}`)}return(e,t)=>(V(),P(`div`,{ref_key:`viewportRef`,ref:j,class:`vue-flow__viewport vue-flow__container`},[b(M3,{"is-selecting":ae.value,"selection-key-pressed":r(B),class:L({connecting:oe.value,dragging:r(E),draggable:r(m)===!0||Array.isArray(r(m))&&r(m).includes(0)})},{default:U(()=>[b(N3,null,{default:U(()=>[de(e.$slots,`default`)]),_:3})]),_:3},8,[`is-selecting`,`selection-key-pressed`,`class`])],512))}}),F3=[`id`],I3=[`id`],L3=[`id`],R3=B({name:`A11yDescriptions`,compatConfig:{MODE:3},setup(e){let{id:t,disableKeyboardA11y:n,ariaLiveMessage:i}=E3();return(e,a)=>(V(),P(H,null,[N(`div`,{id:`${r(w0)}-${r(t)}`,style:{display:`none`}},` Press enter or space to select a node. `+W(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,F3),N(`div`,{id:`${r(T0)}-${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,I3),r(n)?K(``,!0):(V(),P(`div`,{key:0,id:`${r(E0)}-${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%)`}},W(r(i)),9,L3))],64))}});function z3(){let e=E3();C(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function B3(e,t,n){return n===l0.Left?e-t:n===l0.Right?e+t:e}function V3(e,t,n){return n===l0.Top?e-t:n===l0.Bottom?e+t:e}var H3=function({radius:e=10,centerX:t=0,centerY:n=0,position:r=l0.Top,type:i}){return v(`circle`,{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:B3(t,e,r),cy:V3(n,e,r),r:e,stroke:`transparent`,fill:`transparent`})};H3.props=[`radius`,`centerX`,`centerY`,`position`,`type`],H3.compatConfig={MODE:3};var U3=H3,W3=B({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}=E3(),S=z(()=>f(e.id)),{emit:C,on:E}=b4(S.value,s),D=w(_4),O=T(),A=i(!1),j=i(!1),M=i(``),N=i(null),P=i(`source`),F=i(null),I=o(()=>S.value.selectable===void 0?_.value:S.value.selectable),L=o(()=>S.value.updatable===void 0?y.value:S.value.updatable),R=o(()=>S.value.focusable===void 0?b.value:S.value.focusable);te(h4,e.id),te(g4,F);let ee=z(()=>S.value.class instanceof Function?S.value.class(S.value):S.value.class),ne=z(()=>S.value.style instanceof Function?S.value.style(S.value):S.value.style),B=z(()=>{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`&&O){let t=Object.keys(O.appContext.components);t&&t.includes(e)&&(n=k(e,!1))}return n&&typeof n!=`string`?n:(s.error(new F2(N2.EDGE_TYPE_MISSING,n)),!1)}),{handlePointerDown:V}=C4({nodeId:M,handleId:N,type:P,isValidConnection:m,edgeUpdaterType:P,onEdgeUpdate:ie,onEdgeUpdateEnd:U});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 F2(N2.EDGE_SOURCE_TARGET_MISSING,S.value.id,S.value.source,S.value.target)),null;if(!n)return s.error(new F2(N2.EDGE_SOURCE_MISSING,S.value.id,S.value.source)),null;if(!i)return s.error(new F2(N2.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===f0.Strict?n.handleBounds.source:[...n.handleBounds.source||[],...n.handleBounds.target||[]];let d=A2(c,S.value.sourceHandle),f;f=r.value===f0.Strict?i.handleBounds.target:[...i.handleBounds.target||[],...i.handleBounds.source||[]];let m=A2(f,S.value.targetHandle),h=d?.position||l0.Bottom,g=m?.position||l0.Top,{x:_,y}=k2(n,d,h),{x:b,y:C}=k2(i,m,g);return S.value.sourceX=_,S.value.sourceY=y,S.value.targetX=b,S.value.targetY=C,v(`g`,{ref:F,key:e.id,"data-id":e.id,class:[`vue-flow__edge`,`vue-flow__edge-${B.value===!1?`default`:S.value.type||`default`}`,l.value,ee.value,{updating:A.value,selected:S.value.selected,animated:S.value.animated,inactive:!I.value&&!x.value.edgeClick.hasListeners()}],tabIndex:R.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":R.value?`${T0}-${t}`:void 0,"aria-roledescription":`edge`,role:R.value?`group`:`img`,...S.value.domAttributes,onClick:ae,onContextmenu:oe,onDblclick:se,onMouseenter:ce,onMousemove:le,onMouseleave:G,onKeyDown:R.value?K:void 0},[j.value?null:v(B.value===!1?u.value.default:B.value,{id:e.id,sourceNode:n,targetNode:i,source:S.value.source,target:S.value.target,type:S.value.type,updatable:L.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:ne.value,markerStart:`url('#${c2(S.value.markerStart,t)}')`,markerEnd:`url('#${c2(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}),[L.value===`source`||L.value===!0?[v(`g`,{onMousedown:ue,onMouseenter:re,onMouseout:H},v(U3,{position:h,centerX:_,centerY:y,radius:a.value,type:`source`,"data-type":`source`}))]:null,L.value===`target`||L.value===!0?[v(`g`,{onMousedown:de,onMouseenter:re,onMouseout:H},v(U3,{position:g,centerX:b,centerY:C,radius:a.value,type:`target`,"data-type":`target`}))]:null]])};function re(){A.value=!0}function H(){A.value=!1}function ie(e,t){C.update({event:e,edge:S.value,connection:t})}function U(e){C.updateEnd({event:e,edge:S.value}),j.value=!1}function W(e,t){e.button===0&&(j.value=!0,M.value=t?S.value.target:S.value.source,N.value=(t?S.value.targetHandle:S.value.sourceHandle)??null,P.value=t?`target`:`source`,C.updateStart({event:e,edge:S.value}),V(e))}function ae(e){var t;let r={event:e,edge:S.value};I.value&&(c.value=!1,S.value.selected&&h.value?(d([S.value]),(t=F.value)==null||t.blur()):n([S.value])),C.click(r)}function oe(e){C.contextMenu({event:e,edge:S.value})}function se(e){C.doubleClick({event:e,edge:S.value})}function ce(e){C.mouseEnter({event:e,edge:S.value})}function le(e){C.mouseMove({event:e,edge:S.value})}function G(e){C.mouseLeave({event:e,edge:S.value})}function ue(e){W(e,!0)}function de(e){W(e,!1)}function K(t){var r;!g.value&&D0.includes(t.key)&&I.value&&(t.key===`Escape`?((r=F.value)==null||r.blur(),d([f(e.id)])):n([f(e.id)]))}}}),G3=B({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}=E3(),d=w(_4)?.[`connection-line`],f=z(()=>u(n.value?.nodeId)),p=z(()=>u(r.value?.nodeId)??null),m=z(()=>({x:(i.value.x-l.value.x)/l.value.zoom,y:(i.value.y-l.value.y)/l.value.zoom})),h=z(()=>s.value.markerStart?`url(#${c2(s.value.markerStart,e)})`:``),g=z(()=>s.value.markerEnd?`url(#${c2(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===f0.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??l0.Top,{x:b,y:x}=k2(f.value,_,y),S=null;p.value&&(S=t.value===f0.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?Q2[y]:null);if(!y||!C)return null;let w=a.value??s.value.type??d0.Bezier,T=``,E={sourceX:b,sourceY:x,sourcePosition:y,targetX:m.value.x,targetY:m.value.y,targetPosition:C};return w===d0.Bezier?[T]=s3(E):w===d0.Step?[T]=h3({...E,borderRadius:0}):w===d0.SmoothStep?[T]=h3(E):w===d0.SimpleBezier?[T]=l3(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})))}}}),K3=[`id`,`markerWidth`,`markerHeight`,`markerUnits`,`orient`],q3=B({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)=>(V(),P(`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(p0).ArrowClosed?(V(),P(`polyline`,{key:0,style:re({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)):K(``,!0),e.type===r(p0).Arrow?(V(),P(`polyline`,{key:1,style:re({stroke:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":`round`,"stroke-linejoin":`round`,fill:`none`,points:`-5,-4 0,0 -5,4`},null,4)):K(``,!0)],8,K3))}}),J3={class:`vue-flow__marker vue-flow__container`,"aria-hidden":`true`},Y3=B({name:`MarkerDefinitions`,compatConfig:{MODE:3},setup(e){let{id:t,edges:n,connectionLineOptions:r,defaultMarkerColor:i}=E3(),a=z(()=>{let e=new Set,a=[],o=n=>{if(n){let r=c2(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)=>(V(),P(`svg`,J3,[N(`defs`,null,[(V(!0),P(H,null,F(a.value,e=>(V(),G(q3,{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))])]))}}),X3=B({name:`Edges`,compatConfig:{MODE:3},setup(e){let{findNode:t,getEdges:n,elevateEdgesOnSelect:i}=E3();return(e,a)=>(V(),P(H,null,[b(Y3),(V(!0),P(H,null,F(r(n),e=>(V(),P(`svg`,{key:e.id,class:`vue-flow__edges vue-flow__container`,style:re({zIndex:r(M2)(e,r(t),r(i))})},[b(r(W3),{id:e.id},null,8,[`id`])],4))),128)),b(r(G3))],64))}}),Z3=B({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:O,hooks:A}=E3(),j=i(null);te(m4,j),te(p4,e.id);let M=w(_4),N=T(),P=O4(),{node:F,parentNode:L}=T4(e.id),{emit:R,on:ee}=D4(F,c),ne=o(()=>F.draggable===void 0?S.value:F.draggable),B=o(()=>F.selectable===void 0?E.value:F.selectable),V=o(()=>F.connectable===void 0?D.value:F.connectable),re=o(()=>F.focusable===void 0?O.value:F.focusable),H=z(()=>B.value||ne.value||A.value.nodeClick.hasListeners()||A.value.nodeDoubleClick.hasListeners()||A.value.nodeMouseEnter.hasListeners()||A.value.nodeMouseMove.hasListeners()||A.value.nodeMouseLeave.hasListeners()),ie=o(()=>!!F.dimensions.width&&!!F.dimensions.height),U=z(()=>{let e=F.type||`default`,t=M?.[`node-${e}`];if(t)return t;let n=F.template||p.value[e];if(typeof n==`string`&&N){let t=Object.keys(N.appContext.components);t&&t.includes(e)&&(n=k(e,!1))}return n&&typeof n!=`string`?n:(c.error(new F2(N2.NODE_TYPE_MISSING,n)),!1)}),W=v4({id:e.id,el:j,disabled:()=>!ne.value,selectable:B,dragHandle:()=>F.dragHandle,onStart(e){R.dragStart(e)},onDrag(e){R.drag(e)},onStop(e){R.dragStop(e)},onClick(e){me(e)}}),ae=z(()=>F.class instanceof Function?F.class(F):F.class),oe=z(()=>{let e=(F.style instanceof Function?F.style(F):F.style)||{},t=F.width instanceof Function?F.width(F):F.width,n=F.height instanceof Function?F.height(F):F.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}),se=o(()=>Number(F.zIndex??oe.value.zIndex??0));return f(t=>{(t.includes(e.id)||!t.length)&&G()}),I(()=>{C(()=>F.hidden,(t=!1,n,r)=>{!t&&j.value&&(e.resizeObserver.observe(j.value),r(()=>{j.value&&e.resizeObserver.unobserve(j.value)}))},{immediate:!0,flush:`post`})}),C([()=>F.type,()=>F.sourcePosition,()=>F.targetPosition],()=>{ce(()=>{d([{id:e.id,nodeElement:j.value,forceUpdate:!0}])})}),C([()=>F.position.x,()=>F.position.y,()=>L.value?.computedPosition.x,()=>L.value?.computedPosition.y,()=>L.value?.computedPosition.z,se,()=>F.selected,()=>F.dimensions.height,()=>F.dimensions.width,()=>L.value?.dimensions.height,()=>L.value?.dimensions.width],([e,t,n,r,i,a])=>{let o={x:e,y:t,z:a+(h.value&&F.selected?1e3:0)};n!==void 0&&r!==void 0?F.computedPosition=o2({x:n,y:r,z:i},o):F.computedPosition=o},{flush:`post`,immediate:!0}),C([()=>F.extent,m],([e,t],[n,r])=>{(e!==n||t!==r)&&le()}),F.extent===`parent`||typeof F.extent==`object`&&`range`in F.extent&&F.extent.range===`parent`?fY(()=>ie).toBe(!0).then(le):le(),()=>F.hidden?null:v(`div`,{ref:j,"data-id":F.id,class:[`vue-flow__node`,`vue-flow__node-${U.value===!1?`default`:F.type||`default`}`,{[n.value]:ne.value,dragging:W?.value,draggable:ne.value,selected:F.selected,selectable:B.value,parent:F.isParent},ae.value],style:{visibility:ie.value?`visible`:`hidden`,zIndex:F.computedPosition.z??se.value,transform:`translate(${F.computedPosition.x}px,${F.computedPosition.y}px)`,pointerEvents:H.value?`all`:`none`,...oe.value},tabIndex:re.value?0:void 0,role:re.value?`group`:void 0,"aria-describedby":g.value?void 0:`${w0}-${t}`,"aria-label":F.ariaLabel,"aria-roledescription":`node`,...F.domAttributes,onMouseenter:ue,onMousemove:de,onMouseleave:K,onContextmenu:fe,onClick:me,onDblclick:pe,onKeydown:he},[v(U.value===!1?p.value.default:U.value,{id:F.id,type:F.type,data:F.data,events:{...F.events,...ee},selected:F.selected,resizing:F.resizing,dragging:W.value,connectable:V.value,position:F.computedPosition,dimensions:F.dimensions,isValidTargetPos:F.isValidTargetPos,isValidSourcePos:F.isValidSourcePos,parent:F.parentNode,parentNodeId:F.parentNode,zIndex:F.computedPosition.z??se.value,targetPosition:F.targetPosition,sourcePosition:F.sourcePosition,label:F.label,dragHandle:F.dragHandle,onUpdateNodeInternals:G})]);function le(){let e=F.computedPosition,{computedPosition:t,position:n}=O2(F,y.value?V2(e,b.value):e,c.error,m.value,L.value);(F.computedPosition.x!==t.x||F.computedPosition.y!==t.y)&&(F.computedPosition={...F.computedPosition,...t}),(F.position.x!==n.x||F.position.y!==n.y)&&(F.position=n)}function G(){j.value&&d([{id:e.id,nodeElement:j.value,forceUpdate:!0}])}function ue(e){W?.value||R.mouseEnter({event:e,node:F})}function de(e){W?.value||R.mouseMove({event:e,node:F})}function K(e){W?.value||R.mouseLeave({event:e,node:F})}function fe(e){return R.contextMenu({event:e,node:F})}function pe(e){return R.doubleClick({event:e,node:F})}function me(e){B.value&&(!r.value||!ne.value||x.value>0)&&r4(F,s.value,u,l,a,!1,j.value),R.click({event:e,node:F})}function he(e){if(!(v0(e)||g.value)){if(D0.includes(e.key)&&B.value){let t=e.key===`Escape`;r4(F,s.value,u,l,a,t,j.value)}else ne.value&&F.selected&&O0[e.key]&&(e.preventDefault(),_.value=`Moved selected node ${e.key.replace(`Arrow`,``).toLowerCase()}. New position, x: ${~~F.position.x}, y: ${~~F.position.y}`,P({x:O0[e.key].x,y:O0[e.key].y},e.shiftKey))}}}});function Q3(e={includeHiddenNodes:!1}){let{nodes:t}=E3();return z(()=>{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 $3={class:`vue-flow__nodes vue-flow__container`},e6=B({name:`Nodes`,compatConfig:{MODE:3},setup(e){let{getNodes:t,updateNodeDimensions:n,emits:a}=E3(),o=Q3(),s=i();return C(o,e=>{e&&ce(()=>{a.nodesInitialized(t.value)})},{immediate:!0}),I(()=>{s.value=new ResizeObserver(e=>{let t=e.map(e=>({id:e.target.getAttribute(`data-id`),nodeElement:e.target,forceUpdate:!0}));ce(()=>n(t))})}),ne(()=>s.value?.disconnect()),(e,n)=>(V(),P(`div`,$3,[s.value?(V(!0),P(H,{key:0},F(r(t),(e,t,n,i)=>{let a=[e.id];if(i&&i.key===e.id&&j(i,a))return i;let o=(V(),G(r(Z3),{id:e.id,key:e.id,"resize-observer":s.value},null,8,[`id`,`resize-observer`]));return o.memo=a,o},n,0),128)):K(``,!0)]))}});function t6(){let{emits:e}=E3();I(()=>{if(t4()){let t=document.querySelector(`.vue-flow__pane`);t&&window.getComputedStyle(t).zIndex!==`1`&&e.error(new F2(N2.MISSING_STYLES))}})}var n6=N(`div`,{class:`vue-flow__edge-labels`},null,-1),r6=B({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=yY(i,`modelValue`,n),s=yY(i,`nodes`,n),c=yY(i,`edges`,n),l=E3(i),u=F4({modelValue:o,nodes:s,edges:c},i,l);return L4(n,l.hooks),z3(),t6(),te(_4,a),ee(u),t(l),(e,t)=>(V(),P(`div`,{ref:r(l).vueFlowRef,class:`vue-flow`},[b(P3,null,{default:U(()=>[b(X3),n6,b(e6),de(e.$slots,`zoom-pane`)]),_:3}),de(e.$slots,`default`),b(R3)],512))}}),i6=B({name:`Panel`,compatConfig:{MODE:3},props:{position:{}},setup(e){let t=e,{userSelectionActive:n}=E3(),i=z(()=>`${t.position}`.split(`-`));return(e,t)=>(V(),P(`div`,{class:L([`vue-flow__panel`,i.value]),style:re({pointerEvents:r(n)?`none`:`all`})},[de(e.$slots,`default`)],6))}}),a6=`#818cf8`,o6=Je(B({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=z(()=>n.data.color??a6),f=z(()=>n.selected?d.value:`${d.value}90`),p=z(()=>n.selected?`color-mix(in srgb, ${d.value} 28%, transparent)`:`color-mix(in srgb, ${d.value} 14%, transparent)`),m=z(()=>n.selected?d.value:`${d.value}cc`),h=z(()=>`${d.value}55`),g=z(()=>({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`})),_=z(()=>({color:m.value}));return z(()=>({borderColor:d.value})),(t,n)=>(V(),P(`div`,{class:`group-node`,style:re(g.value)},[N(`div`,{class:`group-node__header`,onDblclick:n[3]||=t=>!e.readonly&&c(t)},[o.value?(V(),G(r(Ne),{key:0,modelValue:s.value,"onUpdate:modelValue":n[0]||=e=>s.value=e,class:`group-node__label-input`,style:re({color:d.value,outlineColor:d.value}),autofocus:``,onBlur:l,onKeydown:u,onClick:n[1]||=_e(()=>{},[`stop`])},null,8,[`modelValue`,`style`])):(V(),P(`span`,{key:1,class:`group-node__label`,style:re(_.value)},W(e.data.label||`Team`),5)),e.selected&&!e.readonly?(V(),G(r(q),{key:2,icon:`ti ti-trash`,variant:`text`,rounded:``,size:`small`,severity:`danger`,class:`group-node__remove`,onClick:n[2]||=_e(t=>a(`remove`,e.id),[`stop`])})):K(``,!0)],32)],4))}}),[[`__scopeId`,`data-v-81199534`]]),s6={class:`efn__inner`},c6={class:`efn__icon-wrap`},l6={class:`efn__content`},u6={class:`efn__label`},d6={class:`efn__meta`},f6={key:1,class:`efn__spinner`},p6={key:2,class:`efn__spinner efn__spinner--waiting-input`},m6={key:3,class:`efn__spinner efn__spinner--waiting`},h6=Je(B({inheritAttrs:!1,__name:`ScenarioFlowNode`,props:{id:{},data:{},selected:{type:Boolean}},emits:[`updateNodeInternals`],setup(e){let t=e,{updateNodeInternals:n}=E3();I(()=>n([t.id]));let a=w(`efn-selected-node-id`,i(void 0)),o=w(`efn-node-states`,i({})),s=z(()=>o.value[t.id]??t.data.state??`idle`),c=z(()=>t.selected||a.value===t.id),l=z(()=>t.data.label||t.id),u=z(()=>t.data.isLeader??!1),d=z(()=>u.value?`ti ti-crown`:t.data.type===`ask`?`ti ti-message`:`ti ti-brain`),f=z(()=>(t.data.aiCli??`claude-code`)===`codex`?`Codex`:`Claude`),p=z(()=>t.data.model?.trim()||``),m=z(()=>{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=z(()=>!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)=>(V(),P(H,null,[b(r(U4),{type:`target`,position:r(l0).Left,class:`efn-handle efn-handle--target`},null,8,[`position`]),N(`div`,{class:L([`efn`,u.value?`efn--leader`:`efn--node`,c.value&&`efn--selected`,s.value!==`idle`&&`efn--${s.value}`])},[n[6]||=N(`div`,{class:`efn__border`},null,-1),N(`div`,s6,[N(`div`,c6,[N(`i`,{class:L([d.value,`efn__icon`])},null,2)]),N(`div`,l6,[N(`span`,u6,W(l.value),1),N(`span`,d6,W(m.value),1)])]),g.value?(V(),P(`button`,{key:0,class:`efn__badge efn__badge--debug`,title:`Reprendre dans un terminal Claude (--resume)`,onClick:_,onMousedown:n[0]||=_e(()=>{},[`stop`]),onPointerdown:n[1]||=_e(()=>{},[`stop`])},[...n[2]||=[N(`i`,{class:`ti ti-device-desktop`},null,-1)]],32)):K(``,!0),s.value===`running`?(V(),P(`div`,f6,[...n[3]||=[N(`i`,{class:`ti ti-spin ti-loader-2`},null,-1)]])):s.value===`waiting_input`?(V(),P(`div`,p6,[...n[4]||=[N(`i`,{class:`ti ti-help-circle`},null,-1)]])):s.value===`waiting`?(V(),P(`div`,m6,[...n[5]||=[N(`i`,{class:`ti ti-clock`},null,-1)]])):K(``,!0)],2),e.data.showBottomHandle===!1?K(``,!0):(V(),G(r(U4),{key:0,id:`source-bottom`,type:`source`,position:r(l0).Bottom,class:`efn-handle efn-handle--source efn-handle--source-bottom`,style:{left:`10px`}},null,8,[`position`])),e.data.showTopHandle?(V(),G(r(U4),{key:1,id:`source-top`,type:`source`,position:r(l0).Top,class:`efn-handle efn-handle--source efn-handle--source-top`,style:{left:`10px`}},null,8,[`position`])):K(``,!0)],64))}}),[[`__scopeId`,`data-v-53195966`]]),g6={class:`scenario-run-view`},_6={key:0,class:`scenario-run-view__loading`},v6=`scenario-run-view`,y6=Je(B({__name:`ScenarioRunView`,props:{scenario:{},nodeStates:{},selectedNodeId:{},preset:{}},emits:[`node-click`],setup(e,{emit:t}){let n=e,i=t;te(`efn-selected-node-id`,o(n,`selectedNodeId`)),te(`efn-node-states`,o(n,`nodeStates`));let{getEdges:a}=E3(v6),s=z(()=>n.scenario),c=z(()=>{if(!s.value)return[];let e=(s.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=s.value.nodes.map(e=>({id:e.id,position:{...e.position},label:e.label,data:{label:e.label,isLeader:e.id===s.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]}),l=z(()=>{if(!s.value)return[];let e=[];for(let t of s.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 a.value)e.animated=t},{deep:!0}),(e,t)=>(V(),P(`div`,g6,[s.value?(V(),G(r(r6),{key:1,id:v6,nodes:c.value,edges:l.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":U(e=>[b(h6,se(fe(e)),null,16)]),"node-group":U(e=>[b(o6,R(e,{readonly:!0}),null,16)]),_:1},8,[`nodes`,`edges`])):(V(),P(`div`,_6,[...t[1]||=[N(`i`,{class:`ti ti-spin ti-loader-2`},null,-1)]]))]))}}),[[`__scopeId`,`data-v-0388d65e`]]),b6={class:`ai-chat-scenario-view`},x6={class:`ai-chat-scenario-view__graph`},S6={key:0,class:`ai-chat-scenario-view__synthesis-banner`},C6={class:`ai-chat-scenario-view__detail`},w6={key:0,class:`ai-chat-scenario-view__stop-bar`},T6={key:1,class:`ai-chat-scenario-view__stop-bar`},E6={style:{"font-size":`0.875rem`}},D6={class:`ai-chat-scenario-view__input-request-header`},O6={class:`ai-chat-scenario-view__input-request-name`},k6={class:`ai-chat-scenario-view__input-request-question`},A6={class:`ai-chat-scenario-view__input-request-form`},j6={class:`ai-chat-scenario-view__tabs`},M6={key:0,class:`ai-chat-scenario-view__tab-dot`},N6={key:0,class:L([`ai-chat-scenario-view__tab`,`ai-chat-scenario-view__tab--active`])},P6={key:0,class:`ai-chat-scenario-view__hint`},F6={key:1,class:`ai-chat-scenario-view__accordion`},I6={key:0,class:`ai-chat-scenario-view__accordion-item`},L6=[`innerHTML`],R6={key:1,class:`ai-chat-scenario-view__accordion-item`},z6=[`innerHTML`],B6={key:2,class:`ai-chat-scenario-view__cursor`},V6={key:0,class:`ai-chat-scenario-view__node-meta`},H6={class:`ai-chat-scenario-view__chip`},U6={key:0,class:`ai-chat-scenario-view__chip ai-chat-scenario-view__chip--model`},W6={key:1,class:`ai-chat-scenario-view__node-status`},G6={key:2,class:`ai-chat-scenario-view__thinking-block`},K6={key:0,class:`ai-chat-scenario-view__thinking-content`},q6={key:3,class:`ai-chat-scenario-view__tool-events`},J6={class:`ai-chat-scenario-view__tool-event-name`},Y6={key:0,class:`ai-chat-scenario-view__tool-event-args ai-chat-scenario-view__tool-event-args--streaming`},X6={key:1,class:`ai-chat-scenario-view__tool-event-args`},Z6={key:2,class:`ai-chat-scenario-view__tool-event-result`},Q6=[`innerHTML`],$6={key:5,class:`ai-chat-scenario-view__node-empty`},e8={key:6,class:`ai-chat-scenario-view__node-duration`},t8={key:0,style:{padding:`1rem`,color:`#d4d4d4`}},n8={key:1,style:{padding:`1rem`,color:`#f87171`}},r8=Je(B({__name:`AiChatScenarioView`,props:{availablePresets:{}},emits:[`click-resume`],setup(e,{expose:t,emit:n}){let a=e,o=n,{t:s}=ve(),c=Le(),l=dt(),u=ft(),{activeConversation:d}=ye(l),f=i(null);t({messagesEl:f,resetNodeSelection:we,syncScenarioAccordionState:ue});let p=i(null),m=i(!0),h=i(!1),g=i(null),_=i(null),v=i(!1),y=i(null);te(`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 J.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=z(()=>d.value?.scenarioNodeStates??{}),T=z(()=>d.value?.scenarioNodeOutputs??{}),E=z(()=>d.value?.scenarioRunning??!1),D=z(()=>d.value?.scenarioSynthesisRunning??!1),O=z(()=>{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`)}),k=z(()=>d.value?.scenarioReadme??``),A=z(()=>{let e=k.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()}}),j=z(()=>{let e=d.value;return!e||e.workflowType!==`scenario`?null:e.scenarioSnapshot??u.scenarios.find(t=>t.id===e.workflowId)??null}),M=z(()=>a.availablePresets.find(e=>e.id===j.value?.presetId)),I=z(()=>!p.value||!j.value?null:j.value.nodes.find(e=>e.id===p.value)??null),R=z(()=>(I.value?.aiCli??`claude-code`)===`codex`?`Codex`:`Claude Code`),ee=z(()=>{let e=I.value;return e&&e.model?.trim()||``}),ne=z(()=>d.value?.scenarioWaitingInputs??{}),B=z(()=>d.value?.scenarioNodeStatuses??{}),re=z(()=>d.value?.scenarioNodeThinking??{}),ie=z(()=>d.value?.scenarioNodeToolEvents??{}),ae=z(()=>d.value?.scenarioNodeDurations??{}),oe=i(new Set),se=z(()=>p.value),ce=i({});async function le(e){let t=d.value;if(!t)return;let n=ce.value[e]?.trim();if(n)try{await l.sendNodeInput(t.id,e,n);let{[e]:r,...i}=ce.value;ce.value=i}catch(e){c.add({severity:`error`,summary:s(`common.error`),detail:e.message,life:4e3})}}function ue(){let e=A.value.finalReport.length>0;m.value=!e,h.value=e}function de(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 fe=new Map;function me(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 he(e){let t=fe.get(e);return t===void 0&&(t=az.sanitize(IL.parse(me(e),{async:!1})),fe.set(e,t)),t}function ge(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function be(e){return e.name===`command_execution`&&typeof e.input?.command==`string`}function xe(e){return be(e)?`shell`:e.name}function Se(e){return!e.input||Object.keys(e.input).length===0?``:be(e)?String(e.input.command??``):Object.entries(e.input).map(([e,t])=>`${e}=${t}`).join(`, `)}function Ce(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(`
|
|
296
296
|
`).slice(-t).join(`
|
|
297
|
-
`)}function we(){p.value=null,ue()}return(e,t)=>(V(),P(`div`,b6,[b(r(Ke),{layout:`horizontal`,"gutter-size":6,class:`ai-chat-scenario-view__splitter`},{default:U(()=>[b(r(at),{size:45,"min-size":0},{default:U(()=>[N(`div`,x6,[D.value?(V(),P(`div`,S6,[t[8]||=N(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),N(`span`,null,W(r(s)(`aiChatPage.scenario.synthesisInProgress`)),1)])):K(``,!0),(V(),G(y6,{key:`scenario-graph-${r(d)?.id}`,scenario:j.value,"node-states":w.value,"selected-node-id":p.value??void 0,preset:M.value,onNodeClick:t[0]||=e=>p.value=p.value===e?null:e},null,8,[`scenario`,`node-states`,`selected-node-id`,`preset`]))])]),_:1}),b(r(at),{size:55,"min-size":35},{default:U(()=>[N(`div`,C6,[E.value?(V(),P(`div`,w6,[...t[9]||=[N(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),N(`span`,null,`Scenario running...`,-1)]])):O.value?(V(),P(`div`,T6,[t[10]||=N(`i`,{class:`ti ti-alert-triangle`,style:{color:`var(--r-orange-500, #f97316)`}},null,-1),N(`span`,E6,W(r(s)(`aiChatPage.scenario.interrupted`)),1),b(r(q),{label:r(s)(`aiChatPage.resume`),icon:`ti ti-player-play`,size:`small`,onClick:t[1]||=e=>o(`click-resume`)},null,8,[`label`])])):K(``,!0),(V(!0),P(H,null,F(ne.value,(e,n)=>(V(),P(`div`,{key:n,class:`ai-chat-scenario-view__input-request`},[N(`div`,D6,[t[11]||=N(`i`,{class:`ti ti-help-circle`},null,-1),N(`span`,O6,W(j.value?.nodes.find(e=>e.id===n)?.label||n)+` asks: `,1)]),N(`p`,k6,W(e),1),N(`div`,A6,[b(r(et),{modelValue:ce.value[n],"onUpdate:modelValue":e=>ce.value[n]=e,class:`ai-chat-scenario-view__input-request-field`,placeholder:`Your answer...`,disabled:!E.value,rows:3,"auto-resize":``,onKeydown:pe(_e(e=>E.value&&le(n),[`exact`,`prevent`]),[`enter`])},null,8,[`modelValue`,`onUpdate:modelValue`,`disabled`,`onKeydown`]),b(r(q),{icon:`ti ti-send`,size:`small`,disabled:!ce.value[n]?.trim()||!E.value,title:E.value?void 0:r(s)(`aiChatPage.scenario.resumeToAnswer`),onClick:e=>le(n)},null,8,[`disabled`,`title`,`onClick`])])]))),128)),N(`div`,j6,[N(`button`,{class:L([`ai-chat-scenario-view__tab`,{"ai-chat-scenario-view__tab--active":!p.value}]),onClick:t[2]||=e=>p.value=null},[t[12]||=N(`i`,{class:`ti ti-file`},null,-1),x(` `+W(r(s)(`aiChatPage.runLog`))+` `,1),E.value?(V(),P(`span`,M6)):K(``,!0)],2),p.value?(V(),P(`button`,N6,[t[13]||=N(`i`,{class:`ti ti-user`},null,-1),x(` `+W(I.value?.label||I.value?.id)+` `,1),N(`span`,{class:L([`ai-chat-scenario-view__node-state`,`ai-chat-scenario-view__node-state--${w.value[se.value]??`idle`}`])},W(w.value[se.value]??`idle`),3),N(`button`,{class:`ai-chat-scenario-view__tab-close`,onClick:t[3]||=_e(e=>p.value=null,[`stop`])},`x`)])):K(``,!0)]),p.value?(V(),P(`div`,{key:`scenario-node-${r(d)?.id}-${se.value}`,class:`ai-chat-scenario-view__node-output`},[I.value?(V(),P(`div`,V6,[N(`span`,H6,W(R.value),1),ee.value?(V(),P(`span`,U6,W(ee.value),1)):K(``,!0)])):K(``,!0),B.value[se.value]&&w.value[se.value]===`running`?(V(),P(`div`,W6,[t[17]||=N(`i`,{class:`ti ti-spin ti-settings`},null,-1),N(`span`,null,W(B.value[se.value]),1)])):K(``,!0),re.value[se.value]?.length?(V(),P(`div`,G6,[N(`div`,{class:`ai-chat-scenario-view__thinking-header`,onClick:t[6]||=e=>oe.value.has(se.value)?oe.value.delete(se.value):oe.value.add(se.value)},[t[18]||=N(`i`,{class:`ti ti-sparkles`},null,-1),N(`span`,null,W(r(s)(`aiChatPage.thinking`)),1),N(`i`,{class:L([`ti`,oe.value.has(se.value)?`ti-chevron-up`:`ti-chevron-down`])},null,2)]),oe.value.has(se.value)?(V(),P(`pre`,K6,W(re.value[se.value].join(``)),1)):K(``,!0)])):K(``,!0),ie.value[se.value]?.length?(V(),P(`div`,q6,[(V(!0),P(H,null,F(ie.value[se.value],e=>(V(),P(`div`,{key:e.id,class:L([`ai-chat-scenario-view__tool-event`,{"ai-chat-scenario-view__tool-event--pending":e.pending,"ai-chat-scenario-view__tool-event--error":e.isError}])},[N(`i`,{class:L(e.pending?`ti ti-spin ti-loader-2`:e.isError?`ti ti-circle-x`:`ti ti-circle-check`)},null,2),N(`span`,J6,W(xe(e)),1),e.pending&&e.rawInput?(V(),P(`span`,Y6,[x(W(e.rawInput),1),t[19]||=N(`span`,{class:`ai-chat-scenario-view__cursor`},null,-1)])):Se(e)?(V(),P(`span`,X6,W(Se(e)),1)):K(``,!0),!e.pending&&e.result?(V(),P(`pre`,Z6,W(Ce(e.result,20)),1)):K(``,!0)],2))),128))])):K(``,!0),T.value[se.value]?(V(),P(`div`,{key:4,class:`ai-chat-scenario-view__node-content ai-chat-scenario-view__markdown`,innerHTML:he(T.value[se.value])},null,8,Q6)):(V(),P(`div`,$6,[t[20]||=N(`i`,{class:`ti ti-clock`},null,-1),N(`span`,null,W(w.value[se.value]===`running`?`Running...`:`Waiting...`),1)])),ae.value[se.value]===void 0?K(``,!0):(V(),P(`div`,e8,[t[21]||=N(`i`,{class:`ti ti-clock`},null,-1),N(`span`,null,W(ge(ae.value[se.value])),1)]))])):(V(),P(`div`,{key:`scenario-readme-${r(d)?.id}`,ref_key:`messagesEl`,ref:f,class:`ai-chat-scenario-view__readme`},[k.value?(V(),P(`div`,F6,[A.value.runLog?(V(),P(`div`,I6,[N(`button`,{class:`ai-chat-scenario-view__accordion-header`,onClick:t[4]||=e=>de(`run`)},[N(`span`,null,[t[15]||=N(`i`,{class:`ti ti-file`},null,-1),x(` `+W(r(s)(`aiChatPage.runLog`)),1)]),N(`i`,{class:L([`ti`,m.value?`ti-chevron-up`:`ti-chevron-down`])},null,2)]),m.value?(V(),P(`div`,{key:0,class:`ai-chat-scenario-view__accordion-content ai-chat-scenario-view__readme-content ai-chat-scenario-view__markdown`,innerHTML:he(A.value.runLog)},null,8,L6)):K(``,!0)])):K(``,!0),A.value.finalReport?(V(),P(`div`,R6,[N(`button`,{class:`ai-chat-scenario-view__accordion-header`,onClick:t[5]||=e=>de(`final`)},[N(`span`,null,[t[16]||=N(`i`,{class:`ti ti-file-check`},null,-1),x(` `+W(r(s)(`aiChatPage.finalReport`)),1)]),N(`i`,{class:L([`ti`,h.value?`ti-chevron-up`:`ti-chevron-down`])},null,2)]),h.value?(V(),P(`div`,{key:0,class:`ai-chat-scenario-view__accordion-content ai-chat-scenario-view__final-report ai-chat-scenario-view__markdown`,innerHTML:he(A.value.finalReport)},null,8,z6)):K(``,!0)])):K(``,!0)])):(V(),P(`div`,P6,[t[14]||=N(`i`,{class:`ti ti-building`,style:{"font-size":`1.5rem`,opacity:`0.2`}},null,-1),N(`p`,null,W(r(s)(`aiChatPage.typeATask`)),1),N(`p`,null,W(r(s)(`aiChatPage.clickOrgChartHint`)),1)])),E.value?(V(),P(`span`,B6)):K(``,!0)]))])]),_:1})]),_:1}),b(r(Ue),{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:U(()=>[v.value?(V(),P(`div`,t8,`Chargement…`)):y.value?(V(),P(`div`,n8,[t[22]||=N(`i`,{class:`ti ti-alert-triangle`},null,-1),x(` `+W(y.value),1)])):_.value?(V(),G(WJ,{key:2,"session-id":_.value.sessionId,"agent-id":_.value.agentId,resume:!0},null,8,[`session-id`,`agent-id`])):K(``,!0)]),_:1},8,[`visible`,`header`])]))}}),[[`__scopeId`,`data-v-531a3e9c`]]),i8={"claude-code":`Claude Code`,codex:`Codex`};function a8(e,t,n){return Object.keys(i8).map(r=>{let i=i8[r],a=!e[r]&&t!==r;return{value:r,disabled:a,label:a?n(i):i}})}function o8(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 s8(e,t){return[{value:``,label:e},...Jt.map(e=>({value:e,label:t(e)}))]}function c8(e,t,n,r,i=1){return Math.max(n,Math.min(Math.max(n,r),e+t*i))}function l8(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=c8(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 u8={class:`companion-panel__header`},d8={class:`companion-panel__title`},f8={key:0,class:`companion-panel__state companion-panel__state--reading`},p8=[`title`],m8={key:2,class:`companion-panel__state`},h8={class:`companion-panel__header-actions`},g8={class:`companion-panel__menu`},_8=[`title`],v8=[`title`,`disabled`],y8=[`title`,`disabled`],b8={class:`companion-panel__hint`},x8={key:2,class:`companion-panel__empty`},S8=[`title`],C8=Je(B({__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}=ve(),s=dt(),{claudeCodeAvailable:c,codexAvailable:l,cliModels:u}=ye(s),d=z(()=>a8({"claude-code":c.value,codex:l.value},n.runner,e=>o(`aiChatPage.runnerNotInstalled`,{runner:e}))),f=z(()=>o8(o(`aiChat.companionModelDefault`),u.value[n.runner],n.model));C(()=>n.runner,e=>{s.loadCliModels(e)},{immediate:!0});let p=z(()=>s8(o(`aiChat.companionEffortDefault`),e=>o(`aiChat.companionEffort_${e}`))),m=z(()=>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=z(()=>n.enabled&&h.value),_=z(()=>(m.value?.messages??[]).filter(e=>e.role===`assistant`&&e.content.trim()).length),{size:v,isResizing:y,start:S}=l8({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=z(()=>m.value?.messages??[]),D=z(()=>s.isCompanionThinkingFor(n.mainConversationId)),O=z(()=>s.companionSkipFor(n.mainConversationId)),k=z(()=>D.value||!!n.companionConversationId&&s.isConversationStreaming(n.companionConversationId));function A(e){a(`update:runner`,e===`codex`?`codex`:`claude-code`)}let j=i(!1),M=i(null);async function F(){if(!n.mainConversationId||!g.value){M.value=null;return}try{let e=await J.chat.conversations.companionDelivery.query({id:n.mainConversationId});M.value=e.delivery}catch{M.value=null}}C(D,(e,t)=>{e&&!t&&s.refreshStreamingSessions()});let I=Rt(F,1500,`companion-delivery`);C(()=>[n.mainConversationId,g.value],([,e])=>{M.value=null,e?(I.start(),I.trigger()):I.stop()},{immediate:!0}),ee(()=>I.stop());async function R(){if(n.mainConversationId){j.value=!0;try{await J.chat.conversations.testCompanionBridge.mutate({id:n.mainConversationId})}catch{}finally{j.value=!1,await F()}}}let te=i(!1);async function ne(){if(n.mainConversationId){te.value=!0;try{await J.chat.conversations.runCompanionNow.mutate({id:n.mainConversationId})}catch{}finally{te.value=!1}}}return(t,n)=>(V(),P(`section`,{class:L([`companion-panel`,{"companion-panel--resizing":r(y),"companion-panel--collapsed":!g.value}]),style:re(g.value?{height:r(v)+`px`}:void 0)},[N(`header`,u8,[N(`span`,d8,[N(`i`,{class:L(e.enabled?`ti ti-eye`:`ti ti-eye-off`)},null,2),x(` `+W(r(o)(`aiChat.companionPanelTitle`)),1)]),e.enabled&&k.value?(V(),P(`span`,f8,[n[6]||=N(`i`,{class:`companion-panel__pulse`},null,-1),x(W(r(o)(`aiChat.companionReading`)),1)])):e.enabled&&O.value?(V(),P(`span`,{key:1,class:`companion-panel__state companion-panel__state--skipped`,title:O.value.detail},[n[7]||=N(`i`,{class:`ti ti-info-circle`},null,-1),x(W(r(o)(`aiChat.companionSkip_${O.value.reason}`)),1)],8,p8)):e.enabled?K(``,!0):(V(),P(`span`,m8,W(r(o)(`aiChat.companionPitchLead`)),1)),N(`div`,h8,[b(r(ze),{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":A},null,8,[`model-value`,`options`,`title`]),f.value.length>1?(V(),G(r(ze),{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`])):K(``,!0),b(r(ze),{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?(V(),P(H,{key:2},[b(r(q),{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(q),{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(je),{ref_key:`menu`,ref:w},{default:U(()=>[N(`div`,g8,[N(`button`,{type:`button`,class:`companion-panel__menu-item`,title:r(o)(`aiChat.companionRawHint`),onClick:n[4]||=e=>h.value=!h.value},[n[8]||=N(`i`,{class:`ti ti-code`},null,-1),x(` `+W(h.value?r(o)(`aiChat.companionRawOff`):r(o)(`aiChat.companionRaw`)),1)],8,_8),N(`button`,{type:`button`,class:`companion-panel__menu-item`,title:r(o)(`aiChat.companionRunNowHint`),disabled:te.value||k.value,onClick:ne},[N(`i`,{class:L(te.value||k.value?`ti ti-spin ti-loader-2`:`ti ti-player-play`)},null,2),x(` `+W(r(o)(`aiChat.companionRunNow`)),1)],8,v8),N(`button`,{type:`button`,class:`companion-panel__menu-item`,title:r(o)(`aiChat.companionTestBridgeHint`),disabled:j.value,onClick:R},[N(`i`,{class:L(j.value?`ti ti-spin ti-loader-2`:`ti ti-send`)},null,2),x(` `+W(r(o)(`aiChat.companionTestBridge`)),1)],8,y8)])]),_:1},512)],64)):(V(),G(r(q),{key:1,size:`small`,icon:`ti ti-eye`,label:r(o)(`aiChat.companionEnable`),onClick:n[2]||=e=>a(`enable`)},null,8,[`label`]))])]),g.value?(V(),P(H,{key:0},[N(`p`,b8,W(r(o)(`aiChat.companionRawNotice`,{n:_.value})),1),M.value?(V(),P(`p`,{key:0,class:L([`companion-panel__delivery`,`companion-panel__delivery--${M.value.route}`])},W(r(o)(`aiChat.companionDelivery_${M.value.route}`)),3)):K(``,!0),E.value.length?(V(),G(Bz,{key:1,class:`companion-panel__messages`,messages:E.value,"is-streaming":k.value},null,8,[`messages`,`is-streaming`])):(V(),P(`p`,x8,W(k.value?r(o)(`aiChat.companionReadingNow`):r(o)(`aiChat.companionNoRunYet`)),1)),N(`div`,{class:`companion-panel__grip`,role:`separator`,title:r(o)(`aiChat.companionResize`),onPointerdown:n[5]||=_e((...e)=>r(S)&&r(S)(...e),[`prevent`])},null,40,S8)],64)):K(``,!0)],6))}}),[[`__scopeId`,`data-v-25278c84`]]),w8=`runeya:terminal-font-size`;function T8(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 $q({cursorBlink:!0,fontFamily:`monospace`,fontSize:vJ(w8,14),theme:{background:`#1a1b1e`,foreground:`#d4d4d4`,cursor:`#d4d4d4`},allowProposedApi:!1}),s=new nJ;o.loadAddon(s),o.open(a);let c=e=>{J.terminal.write.mutate({agentId:n,sessionId:t,data:e}).catch(()=>{})};o.onData(c);let l=aJ(o,c),u=gJ(o,a),d=bJ(o),f={terminal:o,fitAddon:s,container:a,subscription:J.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=yJ({terminal:o,container:a,storageKey:w8,onResize:()=>O8(f,n,t)}),f}function E8(e){e.detachDeadKeyFix?.(),e.detachTouchScroll?.(),e.detachZoom?.(),e.writer.dispose(),e.subscription?.unsubscribe(),e.terminal.dispose(),e.container.remove()}function D8(e,t){e.container.parentElement!==t&&t.appendChild(e.container)}function O8(e,t,n){if(e.container.isConnected){try{e.fitAddon.fit()}catch{return}J.terminal.resize.mutate({agentId:t,sessionId:n,cols:e.terminal.cols,rows:e.terminal.rows}).catch(()=>{})}}var k8=`runeya.conversation-terminals`,A8=new Map;function j8(){try{let e=localStorage.getItem(k8);if(!e)return{};let t=JSON.parse(e);return t?.version!==1||typeof t.sessions!=`object`||!t.sessions?{}:t.sessions}catch{return{}}}function M8(e){try{let t={version:1,sessions:e};localStorage.setItem(k8,JSON.stringify(t))}catch{}}function N8(e,t){let n=j8();t?n[e]=t:delete n[e],M8(n)}var P8=i(null),F8=i(!1);function I8(){async function e(e,t,n){if(P8.value=null,A8.has(e))return!0;F8.value=!0;try{let r=j8()[e];if(r&&r.agentId===t){let{sessions:n}=await J.terminal.list.query({agentId:t});if(n.some(e=>e.sessionId===r.sessionId))return A8.set(e,T8({sessionId:r.sessionId,agentId:t,replay:!0,onError:e=>{P8.value=e}})),!0}let i=await J.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 N8(e,{agentId:t,sessionId:i.sessionId}),A8.set(e,T8({sessionId:i.sessionId,agentId:t,replay:!1,onError:e=>{P8.value=e}})),!0}catch(e){return P8.value=e.message,!1}finally{F8.value=!1}}function t(e,t){let n=A8.get(e);n&&(D8(n,t),r(e),n.terminal.focus())}function n(e){return A8.get(e)?.terminal??null}function r(e){let t=A8.get(e),n=j8()[e];t&&n&&O8(t,n.agentId,n.sessionId)}async function i(e){let t=A8.get(e);t&&(E8(t),A8.delete(e));let n=j8()[e];N8(e,null),n&&await J.terminal.destroy.mutate({agentId:n.agentId,sessionId:n.sessionId}).catch(()=>{})}return{open:e,attach:t,fit:r,destroy:i,getTerminal:n,errorMsg:P8,loading:F8}}var L8={class:`terminal-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},R8=Je(B({__name:`TerminalIcon`,setup(e){return(e,t)=>(V(),P(`svg`,L8,[...t[0]||=[N(`polyline`,{points:`4 17 10 11 4 5`},null,-1),N(`line`,{x1:`12`,y1:`19`,x2:`20`,y2:`19`},null,-1)]]))}}),[[`__scopeId`,`data-v-cb1db4b3`]]),z8={class:`conversation-terminal__header`},B8={class:`conversation-terminal__title`},V8={key:0,class:`conversation-terminal__error`},H8={key:1,class:`conversation-terminal__error`},U8=Je(B({__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}=ve(),o=xe(),{open:c,attach:l,fit:u,destroy:d,getTerminal:f,errorMsg:p,loading:m}=I8(),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()}),ne(y),(e,t)=>(V(),G(r(Ue),{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:U(()=>[N(`div`,z8,[N(`span`,B8,[b(R8),x(` `+W(r(a)(`aiChat.terminalTitle`)),1)]),b(r(q),{size:`small`,variant:`text`,severity:`danger`,icon:`ti ti-power`,title:r(a)(`aiChat.terminalKill`),onClick:w},null,8,[`title`])])]),default:U(()=>[r(p)?(V(),P(`div`,V8,[t[1]||=N(`i`,{class:`ti ti-alert-triangle`},null,-1),x(` `+W(r(p)),1)])):r(m)?(V(),P(`div`,H8,[...t[2]||=[N(`i`,{class:`ti ti-spin ti-loader-2`},null,-1)]])):K(``,!0),b(VJ,{terminal:g.value},null,8,[`terminal`]),N(`div`,{ref_key:`hostEl`,ref:h,class:`conversation-terminal__host`},null,512)]),_:1},8,[`visible`]))}}),[[`__scopeId`,`data-v-b1e2454e`]]);function W8(e,t){return`${e}:${t}`}function G8(e){let t=i({}),n=new Map,r=new Set,a=z(()=>{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[W8(r.boardId,r.cardId)]=i.title)}return n}),o=z(()=>{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 K8(e,t){let{columnTitles:n,boardNames:r}=G8(z(()=>e.value&&t.value?[{boardId:e.value,cardId:t.value}]:[]));return{columnTitle:z(()=>e.value&&t.value?n.value[W8(e.value,t.value)]??``:``),boardName:z(()=>e.value?r.value[e.value]??``:``)}}var q8=i(null),J8=i(null);function Y8(){function e(e){q8.value=e,J8.value=null}function t(e){J8.value=e}function n(){q8.value=null}function r(){J8.value=null}return{pendingConvId:q8,generatedCode:J8,setPendingConv:e,setGeneratedCode:t,clear:n,clearResult:r}}var X8={class:`ai-chat-page__main`},Z8={key:0,class:`ai-chat-page__empty`},Q8={class:`ai-chat-page__header`},$8={class:`ai-chat-page__header-left`},e5={class:`ai-chat-page__header-title`},t5=[`title`],n5={class:`ai-chat-page__title-text`},r5={class:`ai-chat-page__conv-meta`},i5={key:0,class:`ai-chat-page__runner-badge`},a5={key:1,class:`ai-chat-page__claude-thinking`,title:`Claude est en train de générer une réponse`},o5={key:2,class:`ai-chat-page__claude-idle`,title:`Le process Claude est actif (en attente de saisie)`},s5=[`title`],c5={class:`ai-chat-page__context-progress-bar`},l5={class:`ai-chat-page__context-progress-label`},u5={key:0,class:`ai-chat-page__kanban-column`},d5=[`title`],f5={class:`ai-chat-page__header-actions`},p5={class:`ai-chat-page__git-add`},m5={class:`ai-chat-page__git-del`},h5={key:1,class:`ti ti-code`},g5={class:`conv-menu`},_5=[`disabled`],v5={class:`ai-chat-page__git-notice`},y5={key:0,class:`ai-chat-page__pty-debug`},b5={class:`ai-chat-page__pty-debug-header`},x5=5e3,S5=B({__name:`AiChatPage`,setup(e){let{t}=ve(),n=we(),a=Te(),o=Le(),s=dt(),c=ft(),{activeId:l,activeConversation:u,isStreaming:d,streamingConvId:f,activeContextUsage:p,contextPercent:m}=ye(s),h=i(!1);async function g(){let e=u.value;if(e&&!h.value){h.value=!0;try{await J.chat.pty.syncTranscript.mutate({conversationId:e.id})}catch(e){o.add({severity:`warn`,summary:`Sync failed`,detail:e.message,life:4e3})}finally{h.value=!1}}}let _=z(()=>new URLSearchParams(window.location.search).has(`debugPty`)),v=i(!1),y=i(null),S=i(void 0),w=i(0);async function T(){let e=u.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 J.chat.pty.debugStress.mutate({sessionId:e.id,agentId:e.agentId,bytesPerSec:n,chunkSize:512,durationMs:3e4});y.value=t.spawnId,S.value=t.agentId,w.value=n,v.value=!0,o.add({severity:`info`,summary:`PTY stress started`,detail:`${n.toLocaleString()} B/s for 30s`,life:3e3})}catch(e){o.add({severity:`error`,summary:`Stress failed`,detail:e.message,life:4e3})}}function E(){v.value=!1,y.value=null}let D=z(()=>{let e=u.value;return e?e.runner??(e.isCli&&!e.providerId?`claude-code`:null):null}),O=z(()=>D.value===`claude-code`),k=z(()=>D.value===`codex`),A=z(()=>O.value||k.value),j=i(!1),M=i(null),F=i(Date.now()),R=null,te=z(()=>!j.value||!M.value?!1:F.value-M.value<1500);async function ne(){let e=u.value;if(!e||!O.value){j.value=!1,M.value=null;return}try{let t=await J.chat.pty.activity.query({sessionId:e.id,agentId:e.agentId});j.value=t.running,M.value=t.idleMs===null?null:Date.now()-t.idleMs}catch{j.value=!1}}let B=Rt(ne,1e3,`ai-chat-page:activity`);function ae(){B.stop(),R&&=(clearInterval(R),null),j.value=!1,M.value=null}function oe(){ae(),R||=setInterval(()=>{F.value=Date.now()},500),B.start(),B.trigger()}C([()=>u.value?.id,O],([e,t])=>{e&&t?oe():ae()},{immediate:!0}),ee(()=>ae());let se=z(()=>{let e=u.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=s.providers.find(t=>t.id===e.providerId);if(t)return t.label}return null}),le=i(``),ue=i(!1),de=i(!1),fe=i(!1),me=i(``),he=i(null),ge=z(()=>u.value?.companionRunner??D.value??`claude-code`);function be(){let e=u.value;e&&s.setCompanion(e.id,!0)}function Se(){let e=u.value;e&&s.setCompanion(e.id,!1)}function Ce(e){let t=u.value;if(!t)return;let n=e===`codex`?`codex`:`claude-code`,r=n===ge.value?void 0:``;s.setCompanion(t.id,!!t.companionEnabled,{runner:n,model:r})}function Ee(e){let t=u.value;if(!t)return;let n=e===`low`||e===`normal`||e===`high`?e:``;s.setCompanion(t.id,!!t.companionEnabled,{effort:n})}function De(e){let t=u.value;t&&s.setCompanion(t.id,!!t.companionEnabled,{model:typeof e==`string`?e:``})}function Oe(){u.value&&(me.value=u.value.title,fe.value=!0,ce(()=>he.value?.$el?.select()))}async function ke(){if(!u.value)return;let e=me.value.trim();e&&await s.renameConversation(u.value.id,e),fe.value=!1}function Ae(){fe.value=!1}function Me(e){return e.messagesOmitted?(e.messageCount??0)>0:(e.messages?.length??0)>0}function Pe(e){navigator.clipboard.writeText(e),o.add({severity:`success`,summary:t(`aiChat.conversationIdCopied`),life:2e3})}let Fe=i(null),Ie=i(null),Re=i(null),ze=i([]),Be=0,Ve=()=>new Date().toISOString(),He=Rt(async()=>{let e=s.refreshStreamingSessions;typeof e==`function`?await e():await s.init()},1500,`ai-chat-page:streaming-refresh`),We=z(()=>d.value&&f.value===l.value);function Ge(){return u.value?.workflowType===`scenario`?Ie.value?.messagesEl??null:Fe.value?.messagesEl??null}function Ke(){let e=Ge();if(!e)return!0;let{scrollTop:t,scrollHeight:n,clientHeight:r}=e;return n-t-r<80}async function qe(e=!1){if(!e&&!Ke())return;await ce();let t=Ge();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 Je(){l.value=null,ue.value=!0,s.pendingNewConversation=!0,de.value=!1}function Ye(e){s.pendingNewConversation=!1,s.selectConversation(e),de.value=!1,ue.value=!1,Ie.value?.resetNodeSelection()}async function Xe(e){s.deleteConversation(e)}async function Ze(e=`keep`,t,n,r){ue.value=!1,s.pendingNewConversation=!1,await s.createConversation({runner:e===`keep`?void 0:e,providerId:e===`keep`?t??void 0:void 0,agentId:n,cliModel:r}),le.value=``}function Qe(e,t,n,r){ue.value=!1,s.pendingNewConversation=!1,Re.value?.showScenarioDialog(e,void 0,t,n??void 0,r)}async function $e(e,n,r,i,a,c){try{let t=await s.createConversation({scenarioId:e,scenarioInput:n,title:n?`Scenario: ${n}`:`Scenario conversation`,providerId:a,agentId:c});if(await qe(!0),n&&t){let a=r===`codex`?``:i.trim(),o=r!==`keep`||a||c?{...r===`keep`?{}:{runnerOverride:r},...a?{modelOverride:a}:{},...c?{agentId:c}:{}}:void 0;s.startScenarioRun(t.id,e,n,()=>qe(!1),o)}}catch(e){o.add({severity:`error`,summary:t(`common.error`),detail:e.message,life:4e3})}}async function et(){let e=u.value;e&&e.workflowType===`scenario`&&await s.stopScenario(e.id)}function tt(){Re.value?.showResumeScenarioDialog()}async function nt(e,n){let r=u.value;if(!r)return;let i=e===`keep`?void 0:e;try{await s.resumeScenario(r.id,()=>qe(!1),{...i?{runnerOverride:i}:{},...n?{agentId:n}:{}})}catch(e){o.add({severity:`error`,summary:t(`common.error`),detail:e.message,life:4e3})}}async function rt(){let e=le.value,n=le.value.trim(),{pendingContext:r,pendingPopulateContext:i}=Ut();if(!n&&s.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),!u.value&&(await Ze(),!u.value)))return;let a=u.value;try{if(a.workflowType===`scenario`){if(a.scenarioRunning)return;le.value=``,s.startScenarioRun(a.id,a.workflowId,n,()=>qe(!1),a.scenarioRunOverrides),await qe(!0);return}le.value=``,i.value=null,await s.send(n,qe)}catch(n){le.value||=e,o.add({severity:`error`,summary:t(`common.error`),detail:n.message,life:3500})}}function it(e,t){let n=null;C(f,t=>{t&&e(t)&&(n=t)}),C(d,async e=>{if(e||!n)return;let r=n;n=null,await t(r),await s.deleteConversation(r),Ut().close()})}let{columnTitle:at}=K8(z(()=>u.value?.kanbanBoardId),z(()=>u.value?.kanbanCardId));function ot(e,t){n.push(t?{name:`kanban-card`,params:{id:e,cardId:t}}:{name:`kanban-board`,params:{id:e}})}it(e=>{let t=s.conversations.find(t=>t.id===e);return!(!t?.kanbanBoardId||t.kanbanCardId)},async()=>{});let st=Y8();it(e=>e===st.pendingConvId.value,async e=>{st.clear();let t=s.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(()=>u.value?.id,async e=>{if(Ie.value?.resetNodeSelection(),e&&u.value?.workflowType===`scenario`&&await c.fetchScenarios(),e&&O.value)try{await J.chat.pty.syncTranscript.mutate({conversationId:e})}catch{}}),C(l,e=>{e&&(ue.value=!1),ce(()=>qe(!0))},{flush:`sync`});let ct=!0;C(()=>{let e=u.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}`},()=>{ct=Ke()},{flush:`pre`}),C(()=>{let e=u.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(!ct)return;let e=Ge();e&&(e.scrollTop=e.scrollHeight)},{flush:`post`});let{autoSendPending:lt,hideSidebar:pt}=Ut(),mt=i(!1),ht=Zt(),gt=xe(),_t=i(!1),vt=i(!1),yt=i(0),{size:bt,isResizing:xt,start:St}=l8({axis:`x`,min:180,max:()=>Math.min(560,window.innerWidth-320),initial:280,storageKey:`runeya.ai-chat.sidebar-width`}),Ct=i(null);function wt(e){Ct.value?.hide(),e()}let Tt=z(()=>u.value?.agentId??ht.connectedAgents[0]?.config.id??null),Et=i(null),Dt=i(!1),Ot=z(()=>{let e=u.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}}),kt=z(()=>{let e=Ot.value?.agentId;return e?ht.getById(e)?.config.name??null:null}),At=z(()=>kt.value?`${t(`aiChat.viewGitChanges`)} — ${kt.value}`:t(`aiChat.viewGitChanges`));async function jt(){let e=Ot.value;if(!e){Et.value=null,Dt.value=!1;return}try{let t=await J.git.status.query(e);Et.value={additions:t.additions??0,deletions:t.deletions??0},Dt.value=!0}catch{Et.value=null,Dt.value=!1}}C(Ot,()=>jt(),{immediate:!0}),C(mt,e=>{e||jt()});let Mt=Rt(async()=>{document.hidden||mt.value||await jt()},x5,`ai-chat-page:git-stats`);function Nt(){Mt.stop()}function Pt(){Nt(),Mt.start()}C(()=>u.value?.messages?.length??0,()=>{mt.value||jt()}),I(()=>Pt()),ee(()=>Nt());async function Ft(){lt.value&&u.value&&(A.value||(lt.value=!1,await ce(),rt()))}C([lt,u],()=>Ft());function It(){let e=a.query.conversation;typeof e==`string`&&e&&s.conversations.some(t=>t.id===e)&&s.selectConversation(e)}return C(()=>a.query.conversation,()=>It()),I(async()=>{ut()&&console.time(`[ai-chat][page] mount`),ut()&&console.log(`[ai-chat][page]`,Ve(),`mounted`,{drawerHideSidebar:pt.value,activeId:l.value}),s.isChatPageVisible=!0,await s.init(),s.setScrollCallback(qe),c.fetchScenarios(),J.scenario.listPresets.query().then(e=>{ze.value=e}).catch(()=>{}),ce(()=>qe(!0)),Ft(),It(),He.start(),ut()&&console.timeEnd(`[ai-chat][page] mount`)}),ie(()=>{Be+=1,ut()&&console.log(`[ai-chat][page]`,Ve(),`updated`,{count:Be,activeId:l.value,hasConversation:!!u.value,isStreaming:d.value,drawerHideSidebar:pt.value})}),ee(()=>{ut()&&console.log(`[ai-chat][page]`,Ve(),`unmounted`,{updates:Be,activeId:l.value}),He.stop(),s.isChatPageVisible=!1,s.setScrollCallback(()=>{})}),(e,n)=>(V(),P(H,null,[N(`div`,{class:L([`ai-chat-page`,{"ai-chat-page--no-sidebar":r(pt)}]),style:re(r(pt)?void 0:{gridTemplateColumns:`${r(bt)}px 0 1fr`})},[r(pt)?K(``,!0):(V(),P(`div`,{key:0,class:L([`ai-chat-page__sidebar-wrap`,{"ai-chat-page__sidebar-wrap--open":de.value}])},[b(iI,{onStartNew:Je,onSelectConversation:Ye,onDeleteConversation:Xe})],2)),r(pt)?K(``,!0):(V(),P(`div`,{key:1,class:L([`ai-chat-page__resizer`,{"ai-chat-page__resizer--active":r(xt)}]),onPointerdown:n[0]||=_e((...e)=>r(St)&&r(St)(...e),[`prevent`])},null,34)),de.value&&!r(pt)?(V(),P(`div`,{key:2,class:`ai-chat-page__backdrop`,onClick:n[1]||=e=>de.value=!1})):K(``,!0),N(`section`,X8,[ue.value||!r(u)?(V(),P(`div`,Z8,[b(r(q),{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(Vt,{onSelectScenario:Qe,onSkip:Ze})])):(V(),P(H,{key:1},[N(`header`,Q8,[N(`div`,$8,[b(r(q),{class:`ai-chat-page__menu-btn`,icon:`ti ti-menu-2`,variant:`text`,rounded:``,size:`small`,onClick:n[3]||=e=>de.value=!de.value}),N(`div`,e5,[fe.value?(V(),G(r(Ne),{key:0,ref_key:`renameInputEl`,ref:he,modelValue:me.value,"onUpdate:modelValue":n[4]||=e=>me.value=e,class:`ai-chat-page__rename-input`,size:`small`,onKeydown:[pe(ke,[`enter`]),pe(Ae,[`escape`])],onBlur:ke},null,8,[`modelValue`])):(V(),P(`h2`,{key:1,class:`ai-chat-page__title`,role:`button`,tabindex:`0`,title:r(t)(`aiChat.rename`),onClick:Oe,onKeydown:pe(Oe,[`enter`])},[N(`span`,n5,W(r(u).title),1),n[22]||=N(`i`,{class:`ti ti-pencil ai-chat-page__title-pencil`},null,-1)],40,t5)),N(`div`,r5,[se.value?(V(),P(`span`,i5,W(se.value),1)):K(``,!0),O.value&&te.value?(V(),P(`span`,a5,[...n[23]||=[N(`i`,{class:`ti ti-spin ti-circle-filled`},null,-1),x(` Claude réfléchit… `,-1)]])):O.value&&j.value?(V(),P(`span`,o5,[...n[24]||=[N(`i`,{class:`ti ti-circle-filled`},null,-1),x(` Actif `,-1)]])):K(``,!0),r(p)&&r(m)!==null?(V(),P(`div`,{key:3,class:`ai-chat-page__context-progress`,title:`Context: ${r(p).inputTokens.toLocaleString()} / ${r(p).contextWindow.toLocaleString()} tokens`},[N(`div`,c5,[N(`div`,{class:L([`ai-chat-page__context-progress-fill`,{"ai-chat-page__context-progress-fill--warn":r(m)>=70,"ai-chat-page__context-progress-fill--danger":r(m)>=90}]),style:re({width:r(m)+`%`})},null,6)]),N(`span`,l5,W(r(m))+`%`,1)],8,s5)):K(``,!0),r(u).kanbanBoardId?(V(),P(`a`,{key:4,class:`ai-chat-page__kanban-link`,title:`Ouvrir le tableau Kanban`,onClick:n[5]||=e=>ot(r(u).kanbanBoardId,r(u).kanbanCardId)},[n[25]||=N(`i`,{class:`ti ti-table`,style:{"font-size":`0.7rem`}},null,-1),n[26]||=x(` Kanban `,-1),r(at)?(V(),P(`span`,u5,`· `+W(r(at)),1)):K(``,!0)])):K(``,!0),r(u).id?(V(),P(`span`,{key:5,class:`ai-chat-page__conv-id`,title:r(u).id,onClick:n[6]||=e=>Pe(r(u).id)},`ID: `+W(r(u).id.slice(0,8))+`…`,9,d5)):K(``,!0)])])]),N(`div`,f5,[Ot.value&&Dt.value?(V(),G(r(q),{key:0,class:`ai-chat-page__git-btn`,size:`small`,variant:`text`,title:At.value,onClick:n[7]||=e=>mt.value=!0},{default:U(()=>[Et.value&&(Et.value.additions||Et.value.deletions)?(V(),P(H,{key:0},[N(`span`,p5,`+`+W(Et.value.additions),1),N(`span`,m5,`-`+W(Et.value.deletions),1)],64)):(V(),P(`i`,h5))]),_:1},8,[`title`])):K(``,!0),r(u).workflowType===`scenario`&&r(u).scenarioRunning?(V(),G(r(q),{key:1,size:`small`,severity:`danger`,icon:`ti ti-player-stop`,label:`Stop`,onClick:et})):K(``,!0),_.value&&O.value?(V(),G(r(q),{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:T})):K(``,!0),Tt.value?(V(),G(r(q),{key:3,size:`small`,variant:`text`,title:r(t)(`aiChat.openTerminal`),onClick:n[8]||=e=>_t.value=!0},{default:U(()=>[b(R8)]),_:1},8,[`title`])):K(``,!0),b(r(q),{size:`small`,variant:`text`,icon:`ti ti-dots-vertical`,title:r(t)(`aiChat.menu`),"aria-label":r(t)(`aiChat.menu`),onClick:n[9]||=e=>Ct.value?.toggle(e)},null,8,[`title`,`aria-label`]),b(r(je),{ref_key:`convMenu`,ref:Ct},{default:U(()=>[N(`div`,g5,[O.value?(V(),P(`button`,{key:0,class:`conv-menu__item`,disabled:h.value,onClick:n[10]||=e=>wt(g)},[N(`i`,{class:L(h.value?`ti ti-spin ti-loader-2`:`ti ti-refresh`)},null,2),N(`span`,null,W(r(t)(`aiChat.syncTranscript`)),1)],8,_5)):K(``,!0),A.value&&!r(u).isCompanion?(V(),P(`button`,{key:1,class:`conv-menu__item`,onClick:n[11]||=e=>{wt(()=>{vt.value=!0})}},[n[27]||=N(`i`,{class:`ti ti-key`},null,-1),N(`span`,null,W(r(t)(`aiChat.secretEnv.menu`)),1)])):K(``,!0),N(`button`,{class:`conv-menu__item`,onClick:n[12]||=e=>wt(()=>r(s).pinConversation(r(u).id,r(u).pinOrder===void 0))},[N(`i`,{class:`ti ti-pin`,style:re(r(u).pinOrder===void 0?void 0:`opacity:0.5`)},null,4),N(`span`,null,W(r(u).pinOrder===void 0?r(t)(`aiChatPage.pin`):r(t)(`aiChatPage.unpin`)),1)]),N(`button`,{class:`conv-menu__item`,onClick:n[13]||=e=>wt(()=>r(s).archiveConversation(r(u).id,!r(u).archived))},[N(`i`,{class:`ti ti-inbox`,style:re(r(u).archived?`opacity:0.5`:void 0)},null,4),N(`span`,null,W(r(u).archived?r(t)(`aiChatPage.unarchive`):r(t)(`aiChatPage.archive`)),1)]),N(`button`,{class:`conv-menu__item conv-menu__item--danger`,onClick:n[14]||=e=>wt(()=>r(s).deleteConversation(r(u).id))},[n[28]||=N(`i`,{class:`ti ti-trash`},null,-1),N(`span`,null,W(r(t)(`aiChat.deleteConversation`)),1)])])]),_:1},512)])]),Tt.value?(V(),G(U8,{key:0,visible:_t.value,"onUpdate:visible":n[15]||=e=>_t.value=e,"conversation-id":r(u).id,"agent-id":Tt.value},null,8,[`visible`,`conversation-id`,`agent-id`])):K(``,!0),b(XJ,{visible:vt.value,"onUpdate:visible":n[16]||=e=>vt.value=e,"conversation-id":r(u).id,onSaved:n[17]||=e=>yt.value++},null,8,[`visible`,`conversation-id`]),!r(u).isCompanion&&r(u).workflowType!==`scenario`?(V(),G(C8,{key:1,enabled:!!r(u).companionEnabled,runner:ge.value,model:r(u).companionModel??``,effort:r(u).companionEffort??``,"companion-conversation-id":r(u).companionConversationId,"main-conversation-id":r(u).id,onEnable:be,onDisable:Se,"onUpdate:runner":Ce,"onUpdate:model":De,"onUpdate:effort":Ee},null,8,[`enabled`,`runner`,`model`,`effort`,`companion-conversation-id`,`main-conversation-id`])):K(``,!0),r(u).workflowType===`scenario`?(V(),G(r8,{key:2,ref_key:`scenarioViewRef`,ref:Ie,"available-presets":ze.value,onClickResume:tt},null,8,[`available-presets`])):A.value?(V(),G(WJ,{key:yt.value,"session-id":r(u).id,runner:D.value??`claude-code`,resume:Me(r(u)),"agent-id":r(u).agentId},null,8,[`session-id`,`runner`,`resume`,`agent-id`])):(V(),G(Bz,{key:4,ref_key:`messageListRef`,ref:Fe,messages:r(u).messages,"is-streaming":r(d),onOpenImagePreview:n[18]||=(e,t)=>Re.value?.openImagePreview(e,t)},null,8,[`messages`,`is-streaming`])),r(dj)(r(u),A.value)?(V(),G(tB,{key:5,input:le.value,"onUpdate:input":n[19]||=e=>le.value=e,"is-streaming":r(d),"is-streaming-current-conv":We.value,"active-conversation-id":r(u).id,onSubmit:rt,onOpenImagePreview:n[20]||=(e,t)=>Re.value?.openImagePreview(e,t)},null,8,[`input`,`is-streaming`,`is-streaming-current-conv`,`active-conversation-id`])):K(``,!0)],64))])],6),b(Ht,{ref_key:`modalsRef`,ref:Re,onConfirmScenarioStart:$e,onConfirmResumeScenario:nt},null,512),b(r(Ue),{visible:mt.value,"onUpdate:visible":n[21]||=e=>mt.value=e,header:At.value,modal:``,"dismissable-mask":``,maximizable:``,style:{width:`85vw`,height:`85vh`},"content-style":{padding:0,height:`100%`,display:`flex`,flexDirection:`column`,overflow:`hidden`}},{default:U(()=>[N(`div`,v5,[n[29]||=N(`i`,{class:`ti ti-info-circle`},null,-1),N(`span`,null,W(r(t)(`aiChat.gitChangesNotice`)),1)]),Ot.value&&mt.value?(V(),G(dM,{key:0,"agent-id":Ot.value.agentId,"project-id":Ot.value.projectId,"org-id":Ot.value.orgId},null,8,[`agent-id`,`project-id`,`org-id`])):K(``,!0)]),_:1},8,[`visible`,`header`]),v.value&&y.value?(V(),P(`div`,y5,[N(`div`,b5,[n[30]||=N(`i`,{class:`ti ti-bolt`},null,-1),N(`span`,null,`PTY stress · `+W(w.value.toLocaleString())+` B/s`,1),N(`button`,{type:`button`,class:`ai-chat-page__pty-debug-close`,onClick:E},`×`)]),(V(),G(WJ,{key:y.value,"attach-spawn-id":y.value,"agent-id":S.value,resume:!1},null,8,[`attach-spawn-id`,`agent-id`]))])):K(``,!0)],64))}}),C5=t({default:()=>w5}),w5=Je(S5,[[`__scopeId`,`data-v-e6306ae4`]]),T5=t({useProcessStore:()=>j5}),E5=5,D5=Kt,O5=`runeya:ws-debug`;function k5(){try{return localStorage.getItem(O5)===`1`}catch{return!1}}function A5(...e){k5()&&console.log(`[process.store][ws]`,new Date().toISOString(),...e)}var j5=be(`process`,()=>{let e=i([]),t=i(!1),n=i(null),r=i({}),a=null,o=0,s=null,c=null,l=new Map,u=z(()=>e.value.length),d=z(()=>e.value.filter(e=>e.state===`running`)),f=z(()=>(t,n)=>e.value.find(e=>e.agentId===t&&e.id===n)??null),p=z(()=>t=>e.value.filter(e=>e.serviceId===t));function m(e,t){return`${e}::${t}`}function h(e,t){return`/process/${e}/${t}`}function g(e){return Yt().getById(e)?.name??e}function _(e,t){if(e.state===t.state)return;let n=Xt(),r=g(t.serviceId),i=t.state===`errored`;n.add({type:i?`error`:`info`,category:`service_status_changed`,title:i?Ce.global.t(`notifications.serviceErrored`):Ce.global.t(`notifications.serviceStatusChanged`),message:`${r}: ${e.state} -> ${t.state}`,link:h(t.agentId,t.id),linkLabel:Ce.global.t(`notifications.openService`,{name:r}),serviceId:t.serviceId})}function v(e,t){if(e.healthStatus===t.healthStatus)return;let n=Xt(),r=g(t.serviceId),i=t.healthStatus===`unhealthy`?`warn`:t.healthStatus===`healthy`?`success`:`info`;n.add({type:i,category:`service_health_changed`,title:Ce.global.t(`notifications.serviceHealthChanged`),message:`${r}: ${e.healthStatus} -> ${t.healthStatus}`,link:h(t.agentId,t.id),linkLabel:Ce.global.t(`notifications.openService`,{name:r}),serviceId:t.serviceId})}function y(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,[m(t.agentId,t.id)]:Date.now()},n&&(_(n,t),v(n,t))}function b(e,t){let n=m(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&&y(e)},900);l.set(n,a)}function x(){A5(`subscribeStatus()`),a=J.process.onStatus.subscribe({},{onData(e){o=0,A5(`onStatus data`,{id:e.id,agentId:e.agentId,state:e.state}),y(e)},onError(e){a=null,console.error(`[process.store] Status subscription error:`,e.message),A5(`onStatus error`,e.message,{retryCount:o}),S()}})}function S(){if(o>=E5){console.warn(`[process.store] Max retries (${E5}) reached for status subscription`),A5(`scheduleRetry max reached`,{retryCount:o});return}let e=D5*2**o+Math.random()*300;A5(`scheduleRetry`,{retryCount:o,delay:e}),o++,s=setTimeout(()=>{s=null,A5(`retry timer fired`),x()},e)}function C(e=!1){A5(`startStatusStream()`,{force:e,hasSub:!!a,hasRetryTimer:!!s}),c||=vt(()=>{A5(`onWsReopen — forcing status stream restart`),o=0,C(!0)}),s&&(clearTimeout(s),s=null,A5(`cleared pending retry timer`)),e&&a&&(a.unsubscribe(),a=null,A5(`forced unsubscribe existing statusSub`)),!a&&(o=0,x())}function w(){A5(`stopStatusStream()`),c&&=(c(),null),l.forEach(e=>clearTimeout(e)),l.clear(),s&&=(clearTimeout(s),null),a&&=(a.unsubscribe(),null),o=0}async function T(){t.value=!0,n.value=null;try{e.value=await J.process.list.query()}catch(e){n.value=Pt(e)??`Failed to fetch processes`}finally{t.value=!1}}async function E(e,t){n.value=null;try{let n=Date.now(),r=await J.process.start.mutate({agentId:e,processId:t});b(r,n);let i=xe();return i.activeProjectId&&r.serviceId&&i.addServiceToSelection({id:i.activeProjectId,orgId:i.activeOrgId},r.serviceId),r}catch(e){throw uj().openFromError(e)||(n.value=Pt(e)??`Failed to start process`),e}}async function D(e,t){n.value=null;try{let n=Date.now(),r=await J.process.stop.mutate({agentId:e,processId:t});b(r,n);let i=xe();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 O(e,t){n.value=null;try{let n=Date.now(),r=await J.process.restart.mutate({agentId:e,processId:t});return b(r,n),r}catch(e){throw uj().openFromError(e)||(n.value=Pt(e)??`Failed to restart process`),e}}return{processes:e,loading:t,error:n,processCount:u,runningProcesses:d,getById:f,getByService:p,fetchAll:T,start:E,stop:D,restart:O,startStatusStream:C,stopStatusStream:w}});async function M5(e){e.initTrpcWs(),await e.loadPreferences().catch(()=>{}),e.startStatusStream(),e.startDataStream()}var N5=null;function P5(){N5||=J.project.onDataChanged.subscribe(void 0,{onData({collections:e}){if(e.includes(`projects`)&&Dt().fetchAll(),e.includes(`services`)&&Yt().fetchAll(),e.includes(`environments`)){let e=Ot(),t=e.currentProjectId;t&&e.fetchAll(t,!0)}},onError(){N5=null}})}function F5(){N5?.unsubscribe(),N5=null}var I5={class:`app-root`},L5={class:`app-root__view`},R5=[`title`],z5={key:0,class:`disconnected-overlay`},B5={class:`disconnected-box`},V5={class:`disconnected-title`},H5={class:`disconnected-subtitle`},U5=5e3,W5=Je(B({__name:`App`,setup(e){let{missing:t,visible:n,checkEnvironment:i}=uj(),a={"runeya:locale":Gt([`fr`,`en`]),"runeya-dark-mode":Gt([`0`,`1`]),"runeya-theme-color":Gt([`slate`,`orange`,`amber`,`emerald`,`teal`,`sky`,`blue`,`violet`,`pink`,`custom`]),"runeya-theme-gradient":Gt([`0`,`1`]),"runeya:mode":Gt([`local-simple`,`cloud`]),"runeya:cloudUrl":Wt().url().max(2048),"runeya:ai-chat-model":Wt().max(200),"runeya:ai-chat-effort":Gt([`low`,`medium`,`high`]),[Wn(`app`)]:Wt().max(32),[Wn(`cloud`)]:Wt().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}=ve(),l=Le(),u=we(),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=j5(),h=Xt(),{state:g}=yt(),{isOpen:_,isExpanded:v,toggle:y,close:x}=Ut(),S=()=>new Date().toISOString();function w(){ut()&&console.log(`[ai-chat][drawer]`,S(),`show`,{expanded:v.value,route:u.currentRoute.value.fullPath})}function T(){ut()&&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 O=new Set([`unlock`,`setup`]),k=z(()=>O.has(u.currentRoute.value.name)),{lockedProjectId:A}=pt(),j=z(()=>!A.value&&!k.value&&u.currentRoute.value.name!==`migrate-vault`),M=xe();function F(e){return e===`launch-services`?`launch-services:${M.activeOrgId??`local`}:${M.activeProjectId}`:void 0}let R=!1,te=null;C(g,(e,t)=>{if(e!==`connected`){te===null&&(te=Date.now());return}let n=te===null?0:Date.now()-te;if(te=null,!R){R=!0;return}t!==`connected`&&!k.value&&n>=U5&&window.location.reload()}),I(()=>{window.addEventListener(`keydown`,E),window.addEventListener(`keyup`,D),f(),!k.value&&Ct()&&M5({loadPreferences:()=>h.loadPreferences(),initTrpcWs:bt,startStatusStream:()=>p.startStatusStream(),startDataStream:()=>P5()})}),ee(()=>{p.stopStatusStream(),F5(),window.removeEventListener(`keydown`,E),window.removeEventListener(`keyup`,D)}),C(()=>u.currentRoute.value.name,(e,t)=>{let n=O.has(t??``),r=O.has(e??``);n&&!r&&Ct()&&M5({loadPreferences:()=>h.loadPreferences(),initTrpcWs:bt,startStatusStream:()=>p.startStatusStream(),startDataStream:()=>P5()})});let ne=Dt();return C(()=>ne.currentProject?.name,e=>{document.title=e?`${e} · Runeya`:`Runeya`},{immediate:!0}),C(()=>`${ne.currentProject?.id??``}::${ne.currentProject?.activeEnvironmentId??``}`,()=>{let e=ne.currentProject?.activeEnvironmentId;e&&i(e)},{immediate:!0}),(e,i)=>(V(),P(H,null,[b(r(Fe)),b(r(Ae)),b(UA,{visible:r(n),"onUpdate:visible":i[0]||=e=>m(n)?n.value=e:null,missing:r(t)},null,8,[`visible`,`missing`]),j.value?(V(),G(tj,{key:0})):K(``,!0),!k.value&&r(Ct)()?(V(),G(oj,{key:1})):K(``,!0),N(`div`,I5,[b(Hn),b(nr),N(`div`,L5,[b(bn,null,{default:U(()=>[b(r(De),null,{default:U(({Component:e,route:t})=>[(V(),G(ue(e),{key:F(t.name)}))]),_:1})]),_:1})])]),b(r(Qe),{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:re({width:r(v)?`calc(100vw - 70px)`:`560px`})},{default:U(()=>[N(`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)},[N(`i`,{class:L([`ti`,r(v)?`ti-chevron-right`:`ti-chevron-left`])},null,2)],8,R5),b(w5)]),_:1},8,[`visible`,`header`,`style`]),b(ge,{name:`overlay`},{default:U(()=>[r(g)!==`connected`&&!k.value?(V(),P(`div`,z5,[N(`div`,B5,[i[3]||=N(`i`,{class:`ti ti-cloud-off disconnected-icon`},null,-1),N(`h1`,V5,W(r(c)(`connection.unreachable`)),1),N(`p`,H5,W(r(c)(`connection.reconnecting`)),1),i[4]||=N(`i`,{class:`ti ti-spin ti-loader-2 disconnected-spinner`},null,-1)])])):K(``,!0)]),_:1})],64))}}),[[`__scopeId`,`data-v-52960071`]]),G5=t({router:()=>K5}),K5=Oe({history:Ee(),routes:[{path:`/unlock`,name:`unlock`,component:()=>xt(()=>import(`./UnlockPage-BBkZa-OK.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]))},{path:`/migrate-vault`,name:`migrate-vault`,component:()=>xt(()=>import(`./VaultMigrationPage-CaLuNVJP.js`),__vite__mapDeps([21,1,2,3,4,5,6,7,8,9,12,11,17,22]))},{path:`/launch/project`,name:`launch-project`,component:()=>xt(()=>import(`./LaunchProjectPage-B2DsNWz6.js`),__vite__mapDeps([23,1,2,4,5,3,14,10,11,12,6,7,8,9,16,17,24,25,26,27,28,29,30,31,32,33,34,18,19,35,36]))},{path:`/launch/services`,name:`launch-services`,component:()=>xt(()=>import(`./LaunchServicesPage-DIZOLOO_.js`),__vite__mapDeps([37,1,2,4,5,3,14,10,11,12,6,7,8,9,38,16,17,39,40,41,42,43,44,30,31,34,18,19,35,45]))},{path:`/`,component:()=>xt(()=>import(`./AppLayout-C-zC5Nq5.js`),__vite__mapDeps([46,1,2,3,4,5,14,10,11,12,6,47,48,7,8,9,38,16,17,25,24,26,27,49,50,51,41,42,39,13,15,40,43,52,53,54,55,56,57,58,59,60,61,62,63,28,29,32,30,31,33,64,65,44,66])),children:[{path:``,name:`dashboard`,component:()=>xt(()=>import(`./DashboardPage-C1_Lr5-g.js`),__vite__mapDeps([67,1,2,3,4,5,14,10,11,12,6,7,8,9,38,16,17,26,39,40,41,42,43,61,62,30,31,32,25,24,27,28,29,33,64,65,68])),meta:{titleKey:`dashboard.title`}},{path:`cloud`,name:`cloud-account`,component:()=>xt(()=>import(`./CloudAccountPage-C0SaUlEP.js`).then(e=>e.n),__vite__mapDeps([69,5,1,2,4,3,7,8,9,10,11,12,16,14,17,25,26,27,50,28,29,70]))},{path:`cloud/messaging`,name:`cloud-messaging`,component:()=>xt(()=>import(`./CloudMessagingPage-BbG6aW1i.js`),__vite__mapDeps([71,1,2,4,5,3,6,7,8,9,72,14,10,11,12,73,16,17,50,51,15,41,42,39,13,74,25,26,27,75,76,77,78,79,80,40,81,54,49,55,52,53,82,83,84,85])),meta:{titleKey:`cloudMessaging.title`}},{path:`agents`,name:`agents`,redirect:{path:`/settings`,query:{section:`agents`}}},{path:`knowledge`,name:`knowledge-list`,component:()=>xt(()=>import(`./KnowledgeListPage-BAxHAgMa.js`),__vite__mapDeps([86,1,2,4,5,3,7,8,9,87,6,48,72,14,10,11,12,73,16,17,50,51,15,41,42,39,13,74,88,27,75,76,77,78,79,80,40,81,82,83,84,26,89,90])),meta:{titleKey:`knowledge.title`}},{path:`knowledge/page/:pageId`,name:`knowledge-page`,component:()=>xt(()=>import(`./KnowledgePagePage-C-hLZet3.js`),__vite__mapDeps([91,1,2,4,5,3,6,7,8,9,87,48,72,14,10,11,12,73,16,17,50,51,15,41,42,39,13,74,88,27,75,76,77,78,79,80,40,81,82,83,84,26,89,92])),meta:{titleKey:`knowledge.title`}},{path:`kanban`,name:`kanban-list`,component:()=>xt(()=>import(`./KanbanListPage-DZmHgO6H.js`),__vite__mapDeps([93,1,2,3,4,5,6,7,8,9,16,14,10,11,12,17,25,27,49,53,56,83,84,26,94,88,95,96])),meta:{titleKey:`kanban.list.title`}},{path:`issues`,name:`issues-list`,component:()=>xt(()=>import(`./KanbanListPage-DZmHgO6H.js`),__vite__mapDeps([93,1,2,3,4,5,6,7,8,9,16,14,10,11,12,17,25,27,49,53,56,83,84,26,94,88,95,96])),props:{mode:`list`},meta:{titleKey:`kanban.issues.title`}},{path:`kanban/:id`,name:`kanban-board`,component:()=>xt(()=>import(`./KanbanBoardPage-BLnT_9si.js`),__vite__mapDeps([97,1,2,3,4,5,14,10,11,12,6,7,8,9,72,73,16,17,50,51,15,41,42,39,13,74,25,27,49,75,76,77,78,79,80,40,81,53,82,83,84,26,94,88,95,98,54,55,99])),props:!0,meta:{pageKey:`kanban-board`}},{path:`kanban/:id/card/:cardId`,name:`kanban-card`,component:()=>xt(()=>import(`./KanbanBoardPage-BLnT_9si.js`),__vite__mapDeps([97,1,2,3,4,5,14,10,11,12,6,7,8,9,72,73,16,17,50,51,15,41,42,39,13,74,25,27,49,75,76,77,78,79,80,40,81,53,82,83,84,26,94,88,95,98,54,55,99])),props:!0,meta:{pageKey:`kanban-board`}},{path:`issues/:id`,name:`issues-board`,component:()=>xt(()=>import(`./KanbanBoardPage-BLnT_9si.js`),__vite__mapDeps([97,1,2,3,4,5,14,10,11,12,6,7,8,9,72,73,16,17,50,51,15,41,42,39,13,74,25,27,49,75,76,77,78,79,80,40,81,53,82,83,84,26,94,88,95,98,54,55,99])),props:!0,meta:{pageKey:`kanban-board`}},{path:`issues/:id/card/:cardId`,name:`issues-card`,component:()=>xt(()=>import(`./KanbanBoardPage-BLnT_9si.js`),__vite__mapDeps([97,1,2,3,4,5,14,10,11,12,6,7,8,9,72,73,16,17,50,51,15,41,42,39,13,74,25,27,49,75,76,77,78,79,80,40,81,53,82,83,84,26,94,88,95,98,54,55,99])),props:!0,meta:{pageKey:`kanban-board`}},{path:`agent-terminal`,name:`agent-terminal`,component:()=>xt(()=>import(`./AgentTerminalPage-CWxJgIyT.js`),__vite__mapDeps([100,1,2,3,4,5,14,10,11,12,7,8,9,88,40,17,41,42,101,102]))},{path:`audit`,name:`audit`,component:()=>xt(()=>import(`./AuditPage-CG-iKGRS.js`),__vite__mapDeps([103,1,2,4,5,3,7,8,9,10,11,12,104]))},{path:`settings`,name:`settings`,component:()=>xt(()=>import(`./SettingsPage-BHYV-7ne.js`).then(e=>e.t),__vite__mapDeps([105,5,1,2,3,4,14,10,11,12,73,6,7,8,9,72,16,17,50,51,15,41,42,39,13,74,26,27,49,75,76,77,78,79,80,40,81,57,58,28,29,69,25,70,106,107,108,82,84,98,54,55,109,110,111,112,113,114])),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(()=>C5),void 0)},{path:`scenario/new`,name:`scenario-new`,component:()=>xt(()=>import(`./ScenarioEditorPage-CeeD0EYJ.js`),__vite__mapDeps([115,1,2,3,4,5,14,10,11,12,6,7,8,9,72,73,16,17,50,51,15,41,42,39,13,74,88,101,116]))},{path:`scenario/:id/edit`,name:`scenario-edit`,component:()=>xt(()=>import(`./ScenarioEditorPage-CeeD0EYJ.js`),__vite__mapDeps([115,1,2,3,4,5,14,10,11,12,6,7,8,9,72,73,16,17,50,51,15,41,42,39,13,74,88,101,116])),props:!0},{path:`services/new`,name:`service-create`,component:()=>xt(()=>import(`./ServiceFormPage-BDyi1Lvc.js`),__vite__mapDeps([117,1,2,3,4,5,14,10,11,12,6,7,8,9,16,17,39,40,41,42,118]))},{path:`services/:id/edit`,name:`service-edit`,component:()=>xt(()=>import(`./ServiceFormPage-BDyi1Lvc.js`),__vite__mapDeps([117,1,2,3,4,5,14,10,11,12,6,7,8,9,16,17,39,40,41,42,118])),props:!0},{path:`services/:id/:tab?`,name:`service-detail`,component:()=>xt(()=>import(`./ServiceDetailPage-CDSHAgOi.js`),__vite__mapDeps([119,1,2,3,4,5,14,10,11,12,6,47,48,7,8,9,88,16,17,75,72,73,50,51,15,41,42,39,13,74,76,77,78,79,80,40,81,43,60,61,62,63,101,120,59,106,107,121,122,123,108,82,84,26,98,27,54,49,55,109,110,124,125,126]))},{path:`projects`,name:`projects`,redirect:{name:`dashboard`}},{path:`projects/:projectId`,name:`project-detail`,component:()=>xt(()=>import(`./DashboardPage-C1_Lr5-g.js`),__vite__mapDeps([67,1,2,3,4,5,14,10,11,12,6,7,8,9,38,16,17,26,39,40,41,42,43,61,62,30,31,32,25,24,27,28,29,33,64,65,68])),beforeEnter:async e=>{let{useProjectLaunchStore:t}=await xt(async()=>{let{useProjectLaunchStore:e}=await import(`./project-launch.store-CEJebMgi.js`).then(e=>e.t);return{useProjectLaunchStore:e}},__vite__mapDeps([14,5,1,2,10,11,12])),{useProjectStore:n}=await xt(async()=>{let{useProjectStore:e}=await import(`./project.store-C88HetpW.js`).then(e=>e.t);return{useProjectStore:e}},__vite__mapDeps([16,5,1,2,14,10,11,12,17])),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-LAtCQh6k.js`),__vite__mapDeps([127,1,2,3,4,5,14,10,11,12,6,7,8,9,16,17,56,128,40,41,42,120,88,39,59,101,106,107,121,129,130])),meta:{titleKey:`environmentList.title`}},{path:`projects/:projectId/environments/:id/edit`,name:`environment-edit`,component:()=>xt(()=>import(`./EnvironmentFormPage-CyNvvWUf.js`),__vite__mapDeps([131,1,2,4,5,3,6,7,8,9,16,14,10,11,12,17,128,40,41,42,120,88,39,59,101,106,107,121,129,132])),meta:{titleKey:`environmentFormPage.editTitle`,backTo:`environments`}},{path:`process/:agentId/:processId`,name:`process-detail`,component:()=>xt(()=>import(`./ProcessDetailPage-GBZ6Ks3X.js`),__vite__mapDeps([133,1,2,4,5,3,6,7,8,9,10,11,12,40,14,17,41,42,61,62,122,123,108,72,73,16,50,51,15,39,13,74,75,76,77,78,79,80,81,82,84,26,98,27,54,49,55,109,134])),props:!0},{path:`wiki`,name:`wiki-global`,component:()=>xt(()=>import(`./WikiPage-DM5LpnlK.js`),__vite__mapDeps([135,2,1,124,3,6,7,4,5,8,9,10,11,12,125]))},{path:`dev/random-job-test`,name:`dev-random-job-test`,component:()=>xt(()=>import(`./RandomJobTestPage-y3jSAISj.js`),__vite__mapDeps([136,1,2,7,3,4,5,8,9,10,11,12,137]))}]}]}),q5=new Set([`launch-project`,`launch-services`]),J5=!1,Y5=!1,X5=!1;async function Z5(){if(X5)return!1;X5=!0;let e=xe();try{let t=await J.process.list.query(),n=Qt(t);if(n.size===0)return!1;let r=await J.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 Q5=null;async function $5(e){if(Q5!==null)return Q5;try{let t=(await J.project.list.query()).find(t=>t.id===e);Q5=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 Q5}async function e7(e){let t=ht();if(!t)return;let n=await $5(t);if(!n)return;let r=xe();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}}K5.beforeEach(async e=>{if(e.name===`unlock`)return;if(!J5){J5=!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 _t();let t=await e7(e);if(t)return t;if(q5.has(e.name))return;let n=xe();if(!n.launchCompleted&&!n.activeProjectId&&!await Z5())return{name:`launch-project`};if(!Y5&&n.activeProjectId){Y5=!0;try{if(!(await J.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 t7={class:`trigger-blob`},n7={class:`theme-layer`},r7={class:`theme-picker`},i7={class:`theme-section theme-section--row`},a7={class:`section-label`},o7={class:`theme-section theme-section--row`},s7={class:`section-label`},c7={class:`theme-section`},l7={class:`section-label`},u7={class:`swatches`},d7=[`title`,`aria-label`,`aria-pressed`,`onClick`],f7={class:`custom-hue-header`},p7={class:`section-label`},m7={class:`custom-hue-track-wrap`},h7=`#18181b`,g7=`#f8fafc`,_7=Je(B({__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}=ve(),g=z(()=>{if(u.value===`custom`)return d.value;let e=t.find(e=>e.id===u.value)??t[3];return tn[e.id][500]}),_=z(()=>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)=>(V(),G(r(Ze),null,{default:U(()=>[b(r(gn),{class:`theme-trigger`,title:r(h)(`themePicker.title`),"aria-label":r(h)(`themePicker.title`)},{default:U(()=>[N(`span`,t7,[(V(!0),P(H,null,F(_.value,(e,t)=>(V(),P(`span`,{key:t,class:`rad`,style:re({backgroundColor:e})},null,4))),128))])]),_:1},8,[`title`,`aria-label`]),(V(),G(le,{to:`body`},[N(`div`,n7,[b(r(it),{class:`theme-popover`,side:`bottom`,align:`end`,"side-offset":6,"collision-padding":8},{default:U(()=>[N(`div`,r7,[N(`div`,i7,[N(`span`,a7,W(r(h)(`themePicker.gradient`)),1),b(r(qe),{class:`gradient-toggle`,"model-value":m.value,"aria-label":m.value?r(h)(`themePicker.disableGradient`):r(h)(`themePicker.enableGradient`),"onUpdate:modelValue":v},{default:U(()=>[b(r(ke),{class:`gradient-toggle__thumb`})]),_:1},8,[`model-value`,`aria-label`])]),i[3]||=N(`div`,{class:`theme-divider`},null,-1),N(`div`,o7,[N(`span`,s7,W(r(h)(`themePicker.mode`)),1),b(r(Re),{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:U(()=>[b(r(He),{value:`dark`,class:`mode-btn`},{default:U(()=>[i[1]||=N(`i`,{class:`ti ti-moon`,"aria-hidden":`true`},null,-1),x(` `+W(r(h)(`themePicker.dark`)),1)]),_:1}),b(r(He),{value:`light`,class:`mode-btn`},{default:U(()=>[i[2]||=N(`i`,{class:`ti ti-sun`,"aria-hidden":`true`},null,-1),x(` `+W(r(h)(`themePicker.light`)),1)]),_:1})]),_:1},8,[`model-value`,`aria-label`])]),i[4]||=N(`div`,{class:`theme-divider`},null,-1),N(`div`,c7,[N(`span`,l7,W(r(h)(`themePicker.accentColor`)),1),N(`div`,u7,[(V(!0),P(H,null,F(r(t),e=>(V(),P(`button`,{key:e.id,type:`button`,class:L([`swatch`,{active:u.value===e.id}]),title:e.label,"aria-label":e.label,"aria-pressed":u.value===e.id,style:re({"--swatch-bg":p.value?h7:g7}),onClick:t=>y(e.id)},[N(`span`,{class:`viewwindow`,style:re({backgroundColor:p.value?h7:g7})},[(V(!0),P(H,null,F(n(r(tn)[e.id][500]),(e,t)=>(V(),P(`span`,{key:t,class:`rad`,style:re({backgroundColor:e})},null,4))),128))],4)],14,d7))),128))])]),N(`div`,{class:L([`theme-section custom-hue-section`,{"custom-hue-section--active":u.value===r(on)}])},[N(`div`,f7,[N(`span`,p7,W(r(h)(`themePicker.customColor`)),1),N(`span`,{class:`custom-hue-preview`,style:re({backgroundColor:d.value})},null,4)]),N(`div`,m7,[b(r($e),{class:`custom-hue-slider`,"model-value":[f.value],min:0,max:359,"aria-label":r(h)(`themePicker.customColor`),"onUpdate:modelValue":w},{default:U(()=>[b(r(Ye),{class:`custom-hue-slider__track`}),b(r(We),{class:`custom-hue-slider__thumb`})]),_:1},8,[`model-value`,`aria-label`])])],2)])]),_:1})])]))]),_:1}))}}),[[`__scopeId`,`data-v-53186dc2`]]),v7=[`width`,`height`],y7=[`rx`],b7=[`transform`],x7=[`d`,`stroke-width`],S7=[`cx`,`cy`,`r`],C7=Je(B({__name:`RuneyaLogo`,props:{size:{default:28}},setup(e){return(t,n)=>(V(),P(`svg`,{class:`runeya-logo`,viewBox:`0 0 100 100`,width:e.size,height:e.size,"aria-hidden":`true`},[N(`rect`,{class:`runeya-logo__bg`,width:`100`,height:`100`,rx:r(en).radius},null,8,y7),N(`g`,{transform:`translate(50 50) scale(${r(an)}) translate(-50 -50)`},[N(`path`,{class:`runeya-logo__stroke`,d:r(fn).path,fill:`none`,"stroke-width":r(fn).stroke,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,8,x7),(V(!0),P(H,null,F(r(fn).dots,([e,t],n)=>(V(),P(`circle`,{key:n,class:`runeya-logo__fill`,cx:e,cy:t,r:r(fn).dotRadius},null,8,S7))),128))],8,b7)],8,v7))}}),[[`__scopeId`,`data-v-85f26936`]]),w7=t({announceThemeToServer:()=>T7});async function T7(){try{await J.desktop.setTrayAccent.mutate({color:un()})}catch{}}globalThis.Buffer=hn.Buffer;async function E7(){try{let e=await J.config.cloud.query();kt(e)}catch(e){console.warn(`[cloud] Failed to fetch cloud config, using defaults:`,e)}}async function D7(){try{gt(await J.config.app.query())}catch(e){console.warn(`[app] Failed to fetch app mode:`,e)}finally{mt()}}var O7=he(W5);O7.use(Se()),O7.use(K5),O7.use(Ce),sn(()=>{T7()}),$t(),vt(()=>{T7()}),O7.directive(`tooltip`,rt),Ie(e=>{try{let t=Xt(),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{}}),O7.config.errorHandler=(e,t,n)=>{console.error(`[Vue Error]`,e,n);let r=e instanceof Error?e.message:`An unexpected error occurred`;Le().add({severity:`error`,summary:`Unexpected Error`,detail:r,life:5e3})};async function k7(){if(Tt()){Et(),bt();return}try{let e=await wt();St(e.ciMode===!0),e.state===`unlocked`&&e.ciMode&&bt()}catch{}}Promise.all([E7(),D7(),k7()]).finally(()=>{O7.mount(`#app`)});export{im as $,E3 as A,KA as B,h0 as C,t2 as D,Q0 as E,OF as F,yS as G,PA as H,kF as I,gS as J,vS as K,mF as L,VJ as M,az as N,$0 as O,IL as P,rm as Q,dM as R,o6 as S,r6 as T,NA as U,GA as V,nD as W,Lh as X,Ih as Y,dh as Z,l8 as _,P5 as a,Xa as at,a8 as b,j5 as c,mo as ct,G8 as d,Ji as dt,Ad as et,R8 as f,Y as ft,O8 as g,On as gt,E8 as h,Jn as ht,G5 as i,Uu as it,l2 as j,z2 as k,Y8 as l,Ha as lt,T8 as m,er as mt,C7 as n,jd as nt,M5 as o,Ja as ot,D8 as p,pr as pt,_S as q,_7 as r,Bu as rt,T5 as s,uo as st,w7 as t,Id as tt,W8 as u,Ka as ut,s8 as v,i6 as w,h6 as x,o8 as y,pj as z};
|
|
297
|
+
`)}function we(){p.value=null,ue()}return(e,t)=>(V(),P(`div`,b6,[b(r(Ke),{layout:`horizontal`,"gutter-size":6,class:`ai-chat-scenario-view__splitter`},{default:U(()=>[b(r(at),{size:45,"min-size":0},{default:U(()=>[N(`div`,x6,[D.value?(V(),P(`div`,S6,[t[8]||=N(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),N(`span`,null,W(r(s)(`aiChatPage.scenario.synthesisInProgress`)),1)])):K(``,!0),(V(),G(y6,{key:`scenario-graph-${r(d)?.id}`,scenario:j.value,"node-states":w.value,"selected-node-id":p.value??void 0,preset:M.value,onNodeClick:t[0]||=e=>p.value=p.value===e?null:e},null,8,[`scenario`,`node-states`,`selected-node-id`,`preset`]))])]),_:1}),b(r(at),{size:55,"min-size":35},{default:U(()=>[N(`div`,C6,[E.value?(V(),P(`div`,w6,[...t[9]||=[N(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),N(`span`,null,`Scenario running...`,-1)]])):O.value?(V(),P(`div`,T6,[t[10]||=N(`i`,{class:`ti ti-alert-triangle`,style:{color:`var(--r-orange-500, #f97316)`}},null,-1),N(`span`,E6,W(r(s)(`aiChatPage.scenario.interrupted`)),1),b(r(q),{label:r(s)(`aiChatPage.resume`),icon:`ti ti-player-play`,size:`small`,onClick:t[1]||=e=>o(`click-resume`)},null,8,[`label`])])):K(``,!0),(V(!0),P(H,null,F(ne.value,(e,n)=>(V(),P(`div`,{key:n,class:`ai-chat-scenario-view__input-request`},[N(`div`,D6,[t[11]||=N(`i`,{class:`ti ti-help-circle`},null,-1),N(`span`,O6,W(j.value?.nodes.find(e=>e.id===n)?.label||n)+` asks: `,1)]),N(`p`,k6,W(e),1),N(`div`,A6,[b(r(et),{modelValue:ce.value[n],"onUpdate:modelValue":e=>ce.value[n]=e,class:`ai-chat-scenario-view__input-request-field`,placeholder:`Your answer...`,disabled:!E.value,rows:3,"auto-resize":``,onKeydown:pe(_e(e=>E.value&&le(n),[`exact`,`prevent`]),[`enter`])},null,8,[`modelValue`,`onUpdate:modelValue`,`disabled`,`onKeydown`]),b(r(q),{icon:`ti ti-send`,size:`small`,disabled:!ce.value[n]?.trim()||!E.value,title:E.value?void 0:r(s)(`aiChatPage.scenario.resumeToAnswer`),onClick:e=>le(n)},null,8,[`disabled`,`title`,`onClick`])])]))),128)),N(`div`,j6,[N(`button`,{class:L([`ai-chat-scenario-view__tab`,{"ai-chat-scenario-view__tab--active":!p.value}]),onClick:t[2]||=e=>p.value=null},[t[12]||=N(`i`,{class:`ti ti-file`},null,-1),x(` `+W(r(s)(`aiChatPage.runLog`))+` `,1),E.value?(V(),P(`span`,M6)):K(``,!0)],2),p.value?(V(),P(`button`,N6,[t[13]||=N(`i`,{class:`ti ti-user`},null,-1),x(` `+W(I.value?.label||I.value?.id)+` `,1),N(`span`,{class:L([`ai-chat-scenario-view__node-state`,`ai-chat-scenario-view__node-state--${w.value[se.value]??`idle`}`])},W(w.value[se.value]??`idle`),3),N(`button`,{class:`ai-chat-scenario-view__tab-close`,onClick:t[3]||=_e(e=>p.value=null,[`stop`])},`x`)])):K(``,!0)]),p.value?(V(),P(`div`,{key:`scenario-node-${r(d)?.id}-${se.value}`,class:`ai-chat-scenario-view__node-output`},[I.value?(V(),P(`div`,V6,[N(`span`,H6,W(R.value),1),ee.value?(V(),P(`span`,U6,W(ee.value),1)):K(``,!0)])):K(``,!0),B.value[se.value]&&w.value[se.value]===`running`?(V(),P(`div`,W6,[t[17]||=N(`i`,{class:`ti ti-spin ti-settings`},null,-1),N(`span`,null,W(B.value[se.value]),1)])):K(``,!0),re.value[se.value]?.length?(V(),P(`div`,G6,[N(`div`,{class:`ai-chat-scenario-view__thinking-header`,onClick:t[6]||=e=>oe.value.has(se.value)?oe.value.delete(se.value):oe.value.add(se.value)},[t[18]||=N(`i`,{class:`ti ti-sparkles`},null,-1),N(`span`,null,W(r(s)(`aiChatPage.thinking`)),1),N(`i`,{class:L([`ti`,oe.value.has(se.value)?`ti-chevron-up`:`ti-chevron-down`])},null,2)]),oe.value.has(se.value)?(V(),P(`pre`,K6,W(re.value[se.value].join(``)),1)):K(``,!0)])):K(``,!0),ie.value[se.value]?.length?(V(),P(`div`,q6,[(V(!0),P(H,null,F(ie.value[se.value],e=>(V(),P(`div`,{key:e.id,class:L([`ai-chat-scenario-view__tool-event`,{"ai-chat-scenario-view__tool-event--pending":e.pending,"ai-chat-scenario-view__tool-event--error":e.isError}])},[N(`i`,{class:L(e.pending?`ti ti-spin ti-loader-2`:e.isError?`ti ti-circle-x`:`ti ti-circle-check`)},null,2),N(`span`,J6,W(xe(e)),1),e.pending&&e.rawInput?(V(),P(`span`,Y6,[x(W(e.rawInput),1),t[19]||=N(`span`,{class:`ai-chat-scenario-view__cursor`},null,-1)])):Se(e)?(V(),P(`span`,X6,W(Se(e)),1)):K(``,!0),!e.pending&&e.result?(V(),P(`pre`,Z6,W(Ce(e.result,20)),1)):K(``,!0)],2))),128))])):K(``,!0),T.value[se.value]?(V(),P(`div`,{key:4,class:`ai-chat-scenario-view__node-content ai-chat-scenario-view__markdown`,innerHTML:he(T.value[se.value])},null,8,Q6)):(V(),P(`div`,$6,[t[20]||=N(`i`,{class:`ti ti-clock`},null,-1),N(`span`,null,W(w.value[se.value]===`running`?`Running...`:`Waiting...`),1)])),ae.value[se.value]===void 0?K(``,!0):(V(),P(`div`,e8,[t[21]||=N(`i`,{class:`ti ti-clock`},null,-1),N(`span`,null,W(ge(ae.value[se.value])),1)]))])):(V(),P(`div`,{key:`scenario-readme-${r(d)?.id}`,ref_key:`messagesEl`,ref:f,class:`ai-chat-scenario-view__readme`},[k.value?(V(),P(`div`,F6,[A.value.runLog?(V(),P(`div`,I6,[N(`button`,{class:`ai-chat-scenario-view__accordion-header`,onClick:t[4]||=e=>de(`run`)},[N(`span`,null,[t[15]||=N(`i`,{class:`ti ti-file`},null,-1),x(` `+W(r(s)(`aiChatPage.runLog`)),1)]),N(`i`,{class:L([`ti`,m.value?`ti-chevron-up`:`ti-chevron-down`])},null,2)]),m.value?(V(),P(`div`,{key:0,class:`ai-chat-scenario-view__accordion-content ai-chat-scenario-view__readme-content ai-chat-scenario-view__markdown`,innerHTML:he(A.value.runLog)},null,8,L6)):K(``,!0)])):K(``,!0),A.value.finalReport?(V(),P(`div`,R6,[N(`button`,{class:`ai-chat-scenario-view__accordion-header`,onClick:t[5]||=e=>de(`final`)},[N(`span`,null,[t[16]||=N(`i`,{class:`ti ti-file-check`},null,-1),x(` `+W(r(s)(`aiChatPage.finalReport`)),1)]),N(`i`,{class:L([`ti`,h.value?`ti-chevron-up`:`ti-chevron-down`])},null,2)]),h.value?(V(),P(`div`,{key:0,class:`ai-chat-scenario-view__accordion-content ai-chat-scenario-view__final-report ai-chat-scenario-view__markdown`,innerHTML:he(A.value.finalReport)},null,8,z6)):K(``,!0)])):K(``,!0)])):(V(),P(`div`,P6,[t[14]||=N(`i`,{class:`ti ti-building`,style:{"font-size":`1.5rem`,opacity:`0.2`}},null,-1),N(`p`,null,W(r(s)(`aiChatPage.typeATask`)),1),N(`p`,null,W(r(s)(`aiChatPage.clickOrgChartHint`)),1)])),E.value?(V(),P(`span`,B6)):K(``,!0)]))])]),_:1})]),_:1}),b(r(Ue),{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:U(()=>[v.value?(V(),P(`div`,t8,`Chargement…`)):y.value?(V(),P(`div`,n8,[t[22]||=N(`i`,{class:`ti ti-alert-triangle`},null,-1),x(` `+W(y.value),1)])):_.value?(V(),G(WJ,{key:2,"session-id":_.value.sessionId,"agent-id":_.value.agentId,resume:!0},null,8,[`session-id`,`agent-id`])):K(``,!0)]),_:1},8,[`visible`,`header`])]))}}),[[`__scopeId`,`data-v-531a3e9c`]]),i8={"claude-code":`Claude Code`,codex:`Codex`};function a8(e,t,n){return Object.keys(i8).map(r=>{let i=i8[r],a=!e[r]&&t!==r;return{value:r,disabled:a,label:a?n(i):i}})}function o8(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 s8(e,t){return[{value:``,label:e},...Jt.map(e=>({value:e,label:t(e)}))]}function c8(e,t,n,r,i=1){return Math.max(n,Math.min(Math.max(n,r),e+t*i))}function l8(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=c8(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 u8={class:`companion-panel__header`},d8={class:`companion-panel__title`},f8={key:0,class:`companion-panel__state companion-panel__state--reading`},p8=[`title`],m8={key:2,class:`companion-panel__state`},h8={class:`companion-panel__header-actions`},g8={class:`companion-panel__menu`},_8=[`title`],v8=[`title`,`disabled`],y8=[`title`,`disabled`],b8={class:`companion-panel__hint`},x8={key:2,class:`companion-panel__empty`},S8=[`title`],C8=Je(B({__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}=ve(),s=dt(),{claudeCodeAvailable:c,codexAvailable:l,cliModels:u}=ye(s),d=z(()=>a8({"claude-code":c.value,codex:l.value},n.runner,e=>o(`aiChatPage.runnerNotInstalled`,{runner:e}))),f=z(()=>o8(o(`aiChat.companionModelDefault`),u.value[n.runner],n.model));C(()=>n.runner,e=>{s.loadCliModels(e)},{immediate:!0});let p=z(()=>s8(o(`aiChat.companionEffortDefault`),e=>o(`aiChat.companionEffort_${e}`))),m=z(()=>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=z(()=>n.enabled&&h.value),_=z(()=>(m.value?.messages??[]).filter(e=>e.role===`assistant`&&e.content.trim()).length),{size:v,isResizing:y,start:S}=l8({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=z(()=>m.value?.messages??[]),D=z(()=>s.isCompanionThinkingFor(n.mainConversationId)),O=z(()=>s.companionSkipFor(n.mainConversationId)),k=z(()=>D.value||!!n.companionConversationId&&s.isConversationStreaming(n.companionConversationId));function A(e){a(`update:runner`,e===`codex`?`codex`:`claude-code`)}let j=i(!1),M=i(null);async function F(){if(!n.mainConversationId||!g.value){M.value=null;return}try{let e=await J.chat.conversations.companionDelivery.query({id:n.mainConversationId});M.value=e.delivery}catch{M.value=null}}C(D,(e,t)=>{e&&!t&&s.refreshStreamingSessions()});let I=Rt(F,1500,`companion-delivery`);C(()=>[n.mainConversationId,g.value],([,e])=>{M.value=null,e?(I.start(),I.trigger()):I.stop()},{immediate:!0}),ee(()=>I.stop());async function R(){if(n.mainConversationId){j.value=!0;try{await J.chat.conversations.testCompanionBridge.mutate({id:n.mainConversationId})}catch{}finally{j.value=!1,await F()}}}let te=i(!1);async function ne(){if(n.mainConversationId){te.value=!0;try{await J.chat.conversations.runCompanionNow.mutate({id:n.mainConversationId})}catch{}finally{te.value=!1}}}return(t,n)=>(V(),P(`section`,{class:L([`companion-panel`,{"companion-panel--resizing":r(y),"companion-panel--collapsed":!g.value}]),style:re(g.value?{height:r(v)+`px`}:void 0)},[N(`header`,u8,[N(`span`,d8,[N(`i`,{class:L(e.enabled?`ti ti-eye`:`ti ti-eye-off`)},null,2),x(` `+W(r(o)(`aiChat.companionPanelTitle`)),1)]),e.enabled&&k.value?(V(),P(`span`,f8,[n[6]||=N(`i`,{class:`companion-panel__pulse`},null,-1),x(W(r(o)(`aiChat.companionReading`)),1)])):e.enabled&&O.value?(V(),P(`span`,{key:1,class:`companion-panel__state companion-panel__state--skipped`,title:O.value.detail},[n[7]||=N(`i`,{class:`ti ti-info-circle`},null,-1),x(W(r(o)(`aiChat.companionSkip_${O.value.reason}`)),1)],8,p8)):e.enabled?K(``,!0):(V(),P(`span`,m8,W(r(o)(`aiChat.companionPitchLead`)),1)),N(`div`,h8,[b(r(ze),{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":A},null,8,[`model-value`,`options`,`title`]),f.value.length>1?(V(),G(r(ze),{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`])):K(``,!0),b(r(ze),{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?(V(),P(H,{key:2},[b(r(q),{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(q),{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(je),{ref_key:`menu`,ref:w},{default:U(()=>[N(`div`,g8,[N(`button`,{type:`button`,class:`companion-panel__menu-item`,title:r(o)(`aiChat.companionRawHint`),onClick:n[4]||=e=>h.value=!h.value},[n[8]||=N(`i`,{class:`ti ti-code`},null,-1),x(` `+W(h.value?r(o)(`aiChat.companionRawOff`):r(o)(`aiChat.companionRaw`)),1)],8,_8),N(`button`,{type:`button`,class:`companion-panel__menu-item`,title:r(o)(`aiChat.companionRunNowHint`),disabled:te.value||k.value,onClick:ne},[N(`i`,{class:L(te.value||k.value?`ti ti-spin ti-loader-2`:`ti ti-player-play`)},null,2),x(` `+W(r(o)(`aiChat.companionRunNow`)),1)],8,v8),N(`button`,{type:`button`,class:`companion-panel__menu-item`,title:r(o)(`aiChat.companionTestBridgeHint`),disabled:j.value,onClick:R},[N(`i`,{class:L(j.value?`ti ti-spin ti-loader-2`:`ti ti-send`)},null,2),x(` `+W(r(o)(`aiChat.companionTestBridge`)),1)],8,y8)])]),_:1},512)],64)):(V(),G(r(q),{key:1,size:`small`,icon:`ti ti-eye`,label:r(o)(`aiChat.companionEnable`),onClick:n[2]||=e=>a(`enable`)},null,8,[`label`]))])]),g.value?(V(),P(H,{key:0},[N(`p`,b8,W(r(o)(`aiChat.companionRawNotice`,{n:_.value})),1),M.value?(V(),P(`p`,{key:0,class:L([`companion-panel__delivery`,`companion-panel__delivery--${M.value.route}`])},W(r(o)(`aiChat.companionDelivery_${M.value.route}`)),3)):K(``,!0),E.value.length?(V(),G(Bz,{key:1,class:`companion-panel__messages`,messages:E.value,"is-streaming":k.value},null,8,[`messages`,`is-streaming`])):(V(),P(`p`,x8,W(k.value?r(o)(`aiChat.companionReadingNow`):r(o)(`aiChat.companionNoRunYet`)),1)),N(`div`,{class:`companion-panel__grip`,role:`separator`,title:r(o)(`aiChat.companionResize`),onPointerdown:n[5]||=_e((...e)=>r(S)&&r(S)(...e),[`prevent`])},null,40,S8)],64)):K(``,!0)],6))}}),[[`__scopeId`,`data-v-25278c84`]]),w8=`runeya:terminal-font-size`;function T8(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 $q({cursorBlink:!0,fontFamily:`monospace`,fontSize:vJ(w8,14),theme:{background:`#1a1b1e`,foreground:`#d4d4d4`,cursor:`#d4d4d4`},allowProposedApi:!1}),s=new nJ;o.loadAddon(s),o.open(a);let c=e=>{J.terminal.write.mutate({agentId:n,sessionId:t,data:e}).catch(()=>{})};o.onData(c);let l=aJ(o,c),u=gJ(o,a),d=bJ(o),f={terminal:o,fitAddon:s,container:a,subscription:J.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=yJ({terminal:o,container:a,storageKey:w8,onResize:()=>O8(f,n,t)}),f}function E8(e){e.detachDeadKeyFix?.(),e.detachTouchScroll?.(),e.detachZoom?.(),e.writer.dispose(),e.subscription?.unsubscribe(),e.terminal.dispose(),e.container.remove()}function D8(e,t){e.container.parentElement!==t&&t.appendChild(e.container)}function O8(e,t,n){if(e.container.isConnected){try{e.fitAddon.fit()}catch{return}J.terminal.resize.mutate({agentId:t,sessionId:n,cols:e.terminal.cols,rows:e.terminal.rows}).catch(()=>{})}}var k8=`runeya.conversation-terminals`,A8=new Map;function j8(){try{let e=localStorage.getItem(k8);if(!e)return{};let t=JSON.parse(e);return t?.version!==1||typeof t.sessions!=`object`||!t.sessions?{}:t.sessions}catch{return{}}}function M8(e){try{let t={version:1,sessions:e};localStorage.setItem(k8,JSON.stringify(t))}catch{}}function N8(e,t){let n=j8();t?n[e]=t:delete n[e],M8(n)}var P8=i(null),F8=i(!1);function I8(){async function e(e,t,n){if(P8.value=null,A8.has(e))return!0;F8.value=!0;try{let r=j8()[e];if(r&&r.agentId===t){let{sessions:n}=await J.terminal.list.query({agentId:t});if(n.some(e=>e.sessionId===r.sessionId))return A8.set(e,T8({sessionId:r.sessionId,agentId:t,replay:!0,onError:e=>{P8.value=e}})),!0}let i=await J.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 N8(e,{agentId:t,sessionId:i.sessionId}),A8.set(e,T8({sessionId:i.sessionId,agentId:t,replay:!1,onError:e=>{P8.value=e}})),!0}catch(e){return P8.value=e.message,!1}finally{F8.value=!1}}function t(e,t){let n=A8.get(e);n&&(D8(n,t),r(e),n.terminal.focus())}function n(e){return A8.get(e)?.terminal??null}function r(e){let t=A8.get(e),n=j8()[e];t&&n&&O8(t,n.agentId,n.sessionId)}async function i(e){let t=A8.get(e);t&&(E8(t),A8.delete(e));let n=j8()[e];N8(e,null),n&&await J.terminal.destroy.mutate({agentId:n.agentId,sessionId:n.sessionId}).catch(()=>{})}return{open:e,attach:t,fit:r,destroy:i,getTerminal:n,errorMsg:P8,loading:F8}}var L8={class:`terminal-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},R8=Je(B({__name:`TerminalIcon`,setup(e){return(e,t)=>(V(),P(`svg`,L8,[...t[0]||=[N(`polyline`,{points:`4 17 10 11 4 5`},null,-1),N(`line`,{x1:`12`,y1:`19`,x2:`20`,y2:`19`},null,-1)]]))}}),[[`__scopeId`,`data-v-cb1db4b3`]]),z8={class:`conversation-terminal__header`},B8={class:`conversation-terminal__title`},V8={key:0,class:`conversation-terminal__error`},H8={key:1,class:`conversation-terminal__error`},U8=Je(B({__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}=ve(),o=xe(),{open:c,attach:l,fit:u,destroy:d,getTerminal:f,errorMsg:p,loading:m}=I8(),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()}),ne(y),(e,t)=>(V(),G(r(Ue),{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:U(()=>[N(`div`,z8,[N(`span`,B8,[b(R8),x(` `+W(r(a)(`aiChat.terminalTitle`)),1)]),b(r(q),{size:`small`,variant:`text`,severity:`danger`,icon:`ti ti-power`,title:r(a)(`aiChat.terminalKill`),onClick:w},null,8,[`title`])])]),default:U(()=>[r(p)?(V(),P(`div`,V8,[t[1]||=N(`i`,{class:`ti ti-alert-triangle`},null,-1),x(` `+W(r(p)),1)])):r(m)?(V(),P(`div`,H8,[...t[2]||=[N(`i`,{class:`ti ti-spin ti-loader-2`},null,-1)]])):K(``,!0),b(VJ,{terminal:g.value},null,8,[`terminal`]),N(`div`,{ref_key:`hostEl`,ref:h,class:`conversation-terminal__host`},null,512)]),_:1},8,[`visible`]))}}),[[`__scopeId`,`data-v-b1e2454e`]]);function W8(e,t){return`${e}:${t}`}function G8(e){let t=i({}),n=new Map,r=new Set,a=z(()=>{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[W8(r.boardId,r.cardId)]=i.title)}return n}),o=z(()=>{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 K8(e,t){let{columnTitles:n,boardNames:r}=G8(z(()=>e.value&&t.value?[{boardId:e.value,cardId:t.value}]:[]));return{columnTitle:z(()=>e.value&&t.value?n.value[W8(e.value,t.value)]??``:``),boardName:z(()=>e.value?r.value[e.value]??``:``)}}var q8=i(null),J8=i(null);function Y8(){function e(e){q8.value=e,J8.value=null}function t(e){J8.value=e}function n(){q8.value=null}function r(){J8.value=null}return{pendingConvId:q8,generatedCode:J8,setPendingConv:e,setGeneratedCode:t,clear:n,clearResult:r}}var X8={class:`ai-chat-page__main`},Z8={key:0,class:`ai-chat-page__empty`},Q8={class:`ai-chat-page__header`},$8={class:`ai-chat-page__header-left`},e5={class:`ai-chat-page__header-title`},t5=[`title`],n5={class:`ai-chat-page__title-text`},r5={class:`ai-chat-page__conv-meta`},i5={key:0,class:`ai-chat-page__runner-badge`},a5={key:1,class:`ai-chat-page__claude-thinking`,title:`Claude est en train de générer une réponse`},o5={key:2,class:`ai-chat-page__claude-idle`,title:`Le process Claude est actif (en attente de saisie)`},s5=[`title`],c5={class:`ai-chat-page__context-progress-bar`},l5={class:`ai-chat-page__context-progress-label`},u5={key:0,class:`ai-chat-page__kanban-column`},d5=[`title`],f5={class:`ai-chat-page__header-actions`},p5={class:`ai-chat-page__git-add`},m5={class:`ai-chat-page__git-del`},h5={key:1,class:`ti ti-code`},g5={class:`conv-menu`},_5=[`disabled`],v5={class:`ai-chat-page__git-notice`},y5={key:0,class:`ai-chat-page__pty-debug`},b5={class:`ai-chat-page__pty-debug-header`},x5=5e3,S5=B({__name:`AiChatPage`,setup(e){let{t}=ve(),n=we(),a=Te(),o=Le(),s=dt(),c=ft(),{activeId:l,activeConversation:u,isStreaming:d,streamingConvId:f,activeContextUsage:p,contextPercent:m}=ye(s),h=i(!1);async function g(){let e=u.value;if(e&&!h.value){h.value=!0;try{await J.chat.pty.syncTranscript.mutate({conversationId:e.id})}catch(e){o.add({severity:`warn`,summary:`Sync failed`,detail:e.message,life:4e3})}finally{h.value=!1}}}let _=z(()=>new URLSearchParams(window.location.search).has(`debugPty`)),v=i(!1),y=i(null),S=i(void 0),w=i(0);async function T(){let e=u.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 J.chat.pty.debugStress.mutate({sessionId:e.id,agentId:e.agentId,bytesPerSec:n,chunkSize:512,durationMs:3e4});y.value=t.spawnId,S.value=t.agentId,w.value=n,v.value=!0,o.add({severity:`info`,summary:`PTY stress started`,detail:`${n.toLocaleString()} B/s for 30s`,life:3e3})}catch(e){o.add({severity:`error`,summary:`Stress failed`,detail:e.message,life:4e3})}}function E(){v.value=!1,y.value=null}let D=z(()=>{let e=u.value;return e?e.runner??(e.isCli&&!e.providerId?`claude-code`:null):null}),O=z(()=>D.value===`claude-code`),k=z(()=>D.value===`codex`),A=z(()=>O.value||k.value),j=i(!1),M=i(null),F=i(Date.now()),R=null,te=z(()=>!j.value||!M.value?!1:F.value-M.value<1500);async function ne(){let e=u.value;if(!e||!O.value){j.value=!1,M.value=null;return}try{let t=await J.chat.pty.activity.query({sessionId:e.id,agentId:e.agentId});j.value=t.running,M.value=t.idleMs===null?null:Date.now()-t.idleMs}catch{j.value=!1}}let B=Rt(ne,1e3,`ai-chat-page:activity`);function ae(){B.stop(),R&&=(clearInterval(R),null),j.value=!1,M.value=null}function oe(){ae(),R||=setInterval(()=>{F.value=Date.now()},500),B.start(),B.trigger()}C([()=>u.value?.id,O],([e,t])=>{e&&t?oe():ae()},{immediate:!0}),ee(()=>ae());let se=z(()=>{let e=u.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=s.providers.find(t=>t.id===e.providerId);if(t)return t.label}return null}),le=i(``),ue=i(!1),de=i(!1),fe=i(!1),me=i(``),he=i(null),ge=z(()=>u.value?.companionRunner??D.value??`claude-code`);function be(){let e=u.value;e&&s.setCompanion(e.id,!0)}function Se(){let e=u.value;e&&s.setCompanion(e.id,!1)}function Ce(e){let t=u.value;if(!t)return;let n=e===`codex`?`codex`:`claude-code`,r=n===ge.value?void 0:``;s.setCompanion(t.id,!!t.companionEnabled,{runner:n,model:r})}function Ee(e){let t=u.value;if(!t)return;let n=e===`low`||e===`normal`||e===`high`?e:``;s.setCompanion(t.id,!!t.companionEnabled,{effort:n})}function De(e){let t=u.value;t&&s.setCompanion(t.id,!!t.companionEnabled,{model:typeof e==`string`?e:``})}function Oe(){u.value&&(me.value=u.value.title,fe.value=!0,ce(()=>he.value?.$el?.select()))}async function ke(){if(!u.value)return;let e=me.value.trim();e&&await s.renameConversation(u.value.id,e),fe.value=!1}function Ae(){fe.value=!1}function Me(e){return e.messagesOmitted?(e.messageCount??0)>0:(e.messages?.length??0)>0}function Pe(e){navigator.clipboard.writeText(e),o.add({severity:`success`,summary:t(`aiChat.conversationIdCopied`),life:2e3})}let Fe=i(null),Ie=i(null),Re=i(null),ze=i([]),Be=0,Ve=()=>new Date().toISOString(),He=Rt(async()=>{let e=s.refreshStreamingSessions;typeof e==`function`?await e():await s.init()},1500,`ai-chat-page:streaming-refresh`),We=z(()=>d.value&&f.value===l.value);function Ge(){return u.value?.workflowType===`scenario`?Ie.value?.messagesEl??null:Fe.value?.messagesEl??null}function Ke(){let e=Ge();if(!e)return!0;let{scrollTop:t,scrollHeight:n,clientHeight:r}=e;return n-t-r<80}async function qe(e=!1){if(!e&&!Ke())return;await ce();let t=Ge();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 Je(){l.value=null,ue.value=!0,s.pendingNewConversation=!0,de.value=!1}function Ye(e){s.pendingNewConversation=!1,s.selectConversation(e),de.value=!1,ue.value=!1,Ie.value?.resetNodeSelection()}async function Xe(e){s.deleteConversation(e)}async function Ze(e=`keep`,t,n,r){ue.value=!1,s.pendingNewConversation=!1,await s.createConversation({runner:e===`keep`?void 0:e,providerId:e===`keep`?t??void 0:void 0,agentId:n,cliModel:r}),le.value=``}function Qe(e,t,n,r){ue.value=!1,s.pendingNewConversation=!1,Re.value?.showScenarioDialog(e,void 0,t,n??void 0,r)}async function $e(e,n,r,i,a,c){try{let t=await s.createConversation({scenarioId:e,scenarioInput:n,title:n?`Scenario: ${n}`:`Scenario conversation`,providerId:a,agentId:c});if(await qe(!0),n&&t){let a=r===`codex`?``:i.trim(),o=r!==`keep`||a||c?{...r===`keep`?{}:{runnerOverride:r},...a?{modelOverride:a}:{},...c?{agentId:c}:{}}:void 0;s.startScenarioRun(t.id,e,n,()=>qe(!1),o)}}catch(e){o.add({severity:`error`,summary:t(`common.error`),detail:e.message,life:4e3})}}async function et(){let e=u.value;e&&e.workflowType===`scenario`&&await s.stopScenario(e.id)}function tt(){Re.value?.showResumeScenarioDialog()}async function nt(e,n){let r=u.value;if(!r)return;let i=e===`keep`?void 0:e;try{await s.resumeScenario(r.id,()=>qe(!1),{...i?{runnerOverride:i}:{},...n?{agentId:n}:{}})}catch(e){o.add({severity:`error`,summary:t(`common.error`),detail:e.message,life:4e3})}}async function rt(){let e=le.value,n=le.value.trim(),{pendingContext:r,pendingPopulateContext:i}=Ut();if(!n&&s.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),!u.value&&(await Ze(),!u.value)))return;let a=u.value;try{if(a.workflowType===`scenario`){if(a.scenarioRunning)return;le.value=``,s.startScenarioRun(a.id,a.workflowId,n,()=>qe(!1),a.scenarioRunOverrides),await qe(!0);return}le.value=``,i.value=null,await s.send(n,qe)}catch(n){le.value||=e,o.add({severity:`error`,summary:t(`common.error`),detail:n.message,life:3500})}}function it(e,t){let n=null;C(f,t=>{t&&e(t)&&(n=t)}),C(d,async e=>{if(e||!n)return;let r=n;n=null,await t(r),await s.deleteConversation(r),Ut().close()})}let{columnTitle:at}=K8(z(()=>u.value?.kanbanBoardId),z(()=>u.value?.kanbanCardId));function ot(e,t){n.push(t?{name:`kanban-card`,params:{id:e,cardId:t}}:{name:`kanban-board`,params:{id:e}})}it(e=>{let t=s.conversations.find(t=>t.id===e);return!(!t?.kanbanBoardId||t.kanbanCardId)},async()=>{});let st=Y8();it(e=>e===st.pendingConvId.value,async e=>{st.clear();let t=s.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(()=>u.value?.id,async e=>{if(Ie.value?.resetNodeSelection(),e&&u.value?.workflowType===`scenario`&&await c.fetchScenarios(),e&&O.value)try{await J.chat.pty.syncTranscript.mutate({conversationId:e})}catch{}}),C(l,e=>{e&&(ue.value=!1),ce(()=>qe(!0))},{flush:`sync`});let ct=!0;C(()=>{let e=u.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}`},()=>{ct=Ke()},{flush:`pre`}),C(()=>{let e=u.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(!ct)return;let e=Ge();e&&(e.scrollTop=e.scrollHeight)},{flush:`post`});let{autoSendPending:lt,hideSidebar:pt}=Ut(),mt=i(!1),ht=Zt(),gt=xe(),_t=i(!1),vt=i(!1),yt=i(0),{size:bt,isResizing:xt,start:St}=l8({axis:`x`,min:180,max:()=>Math.min(560,window.innerWidth-320),initial:280,storageKey:`runeya.ai-chat.sidebar-width`}),Ct=i(null);function wt(e){Ct.value?.hide(),e()}let Tt=z(()=>u.value?.agentId??ht.connectedAgents[0]?.config.id??null),Et=i(null),Dt=i(!1),Ot=z(()=>{let e=u.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}}),kt=z(()=>{let e=Ot.value?.agentId;return e?ht.getById(e)?.config.name??null:null}),At=z(()=>kt.value?`${t(`aiChat.viewGitChanges`)} — ${kt.value}`:t(`aiChat.viewGitChanges`));async function jt(){let e=Ot.value;if(!e){Et.value=null,Dt.value=!1;return}try{let t=await J.git.status.query(e);Et.value={additions:t.additions??0,deletions:t.deletions??0},Dt.value=!0}catch{Et.value=null,Dt.value=!1}}C(Ot,()=>jt(),{immediate:!0}),C(mt,e=>{e||jt()});let Mt=Rt(async()=>{document.hidden||mt.value||await jt()},x5,`ai-chat-page:git-stats`);function Nt(){Mt.stop()}function Pt(){Nt(),Mt.start()}C(()=>u.value?.messages?.length??0,()=>{mt.value||jt()}),I(()=>Pt()),ee(()=>Nt());async function Ft(){lt.value&&u.value&&(A.value||(lt.value=!1,await ce(),rt()))}C([lt,u],()=>Ft());function It(){let e=a.query.conversation;typeof e==`string`&&e&&s.conversations.some(t=>t.id===e)&&s.selectConversation(e)}return C(()=>a.query.conversation,()=>It()),I(async()=>{ut()&&console.time(`[ai-chat][page] mount`),ut()&&console.log(`[ai-chat][page]`,Ve(),`mounted`,{drawerHideSidebar:pt.value,activeId:l.value}),s.isChatPageVisible=!0,await s.init(),s.setScrollCallback(qe),c.fetchScenarios(),J.scenario.listPresets.query().then(e=>{ze.value=e}).catch(()=>{}),ce(()=>qe(!0)),Ft(),It(),He.start(),ut()&&console.timeEnd(`[ai-chat][page] mount`)}),ie(()=>{Be+=1,ut()&&console.log(`[ai-chat][page]`,Ve(),`updated`,{count:Be,activeId:l.value,hasConversation:!!u.value,isStreaming:d.value,drawerHideSidebar:pt.value})}),ee(()=>{ut()&&console.log(`[ai-chat][page]`,Ve(),`unmounted`,{updates:Be,activeId:l.value}),He.stop(),s.isChatPageVisible=!1,s.setScrollCallback(()=>{})}),(e,n)=>(V(),P(H,null,[N(`div`,{class:L([`ai-chat-page`,{"ai-chat-page--no-sidebar":r(pt)}]),style:re(r(pt)?void 0:{gridTemplateColumns:`${r(bt)}px 0 1fr`})},[r(pt)?K(``,!0):(V(),P(`div`,{key:0,class:L([`ai-chat-page__sidebar-wrap`,{"ai-chat-page__sidebar-wrap--open":de.value}])},[b(iI,{onStartNew:Je,onSelectConversation:Ye,onDeleteConversation:Xe})],2)),r(pt)?K(``,!0):(V(),P(`div`,{key:1,class:L([`ai-chat-page__resizer`,{"ai-chat-page__resizer--active":r(xt)}]),onPointerdown:n[0]||=_e((...e)=>r(St)&&r(St)(...e),[`prevent`])},null,34)),de.value&&!r(pt)?(V(),P(`div`,{key:2,class:`ai-chat-page__backdrop`,onClick:n[1]||=e=>de.value=!1})):K(``,!0),N(`section`,X8,[ue.value||!r(u)?(V(),P(`div`,Z8,[b(r(q),{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(Vt,{onSelectScenario:Qe,onSkip:Ze})])):(V(),P(H,{key:1},[N(`header`,Q8,[N(`div`,$8,[b(r(q),{class:`ai-chat-page__menu-btn`,icon:`ti ti-menu-2`,variant:`text`,rounded:``,size:`small`,onClick:n[3]||=e=>de.value=!de.value}),N(`div`,e5,[fe.value?(V(),G(r(Ne),{key:0,ref_key:`renameInputEl`,ref:he,modelValue:me.value,"onUpdate:modelValue":n[4]||=e=>me.value=e,class:`ai-chat-page__rename-input`,size:`small`,onKeydown:[pe(ke,[`enter`]),pe(Ae,[`escape`])],onBlur:ke},null,8,[`modelValue`])):(V(),P(`h2`,{key:1,class:`ai-chat-page__title`,role:`button`,tabindex:`0`,title:r(t)(`aiChat.rename`),onClick:Oe,onKeydown:pe(Oe,[`enter`])},[N(`span`,n5,W(r(u).title),1),n[22]||=N(`i`,{class:`ti ti-pencil ai-chat-page__title-pencil`},null,-1)],40,t5)),N(`div`,r5,[se.value?(V(),P(`span`,i5,W(se.value),1)):K(``,!0),O.value&&te.value?(V(),P(`span`,a5,[...n[23]||=[N(`i`,{class:`ti ti-spin ti-circle-filled`},null,-1),x(` Claude réfléchit… `,-1)]])):O.value&&j.value?(V(),P(`span`,o5,[...n[24]||=[N(`i`,{class:`ti ti-circle-filled`},null,-1),x(` Actif `,-1)]])):K(``,!0),r(p)&&r(m)!==null?(V(),P(`div`,{key:3,class:`ai-chat-page__context-progress`,title:`Context: ${r(p).inputTokens.toLocaleString()} / ${r(p).contextWindow.toLocaleString()} tokens`},[N(`div`,c5,[N(`div`,{class:L([`ai-chat-page__context-progress-fill`,{"ai-chat-page__context-progress-fill--warn":r(m)>=70,"ai-chat-page__context-progress-fill--danger":r(m)>=90}]),style:re({width:r(m)+`%`})},null,6)]),N(`span`,l5,W(r(m))+`%`,1)],8,s5)):K(``,!0),r(u).kanbanBoardId?(V(),P(`a`,{key:4,class:`ai-chat-page__kanban-link`,title:`Ouvrir le tableau Kanban`,onClick:n[5]||=e=>ot(r(u).kanbanBoardId,r(u).kanbanCardId)},[n[25]||=N(`i`,{class:`ti ti-table`,style:{"font-size":`0.7rem`}},null,-1),n[26]||=x(` Kanban `,-1),r(at)?(V(),P(`span`,u5,`· `+W(r(at)),1)):K(``,!0)])):K(``,!0),r(u).id?(V(),P(`span`,{key:5,class:`ai-chat-page__conv-id`,title:r(u).id,onClick:n[6]||=e=>Pe(r(u).id)},`ID: `+W(r(u).id.slice(0,8))+`…`,9,d5)):K(``,!0)])])]),N(`div`,f5,[Ot.value&&Dt.value?(V(),G(r(q),{key:0,class:`ai-chat-page__git-btn`,size:`small`,variant:`text`,title:At.value,onClick:n[7]||=e=>mt.value=!0},{default:U(()=>[Et.value&&(Et.value.additions||Et.value.deletions)?(V(),P(H,{key:0},[N(`span`,p5,`+`+W(Et.value.additions),1),N(`span`,m5,`-`+W(Et.value.deletions),1)],64)):(V(),P(`i`,h5))]),_:1},8,[`title`])):K(``,!0),r(u).workflowType===`scenario`&&r(u).scenarioRunning?(V(),G(r(q),{key:1,size:`small`,severity:`danger`,icon:`ti ti-player-stop`,label:`Stop`,onClick:et})):K(``,!0),_.value&&O.value?(V(),G(r(q),{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:T})):K(``,!0),Tt.value?(V(),G(r(q),{key:3,size:`small`,variant:`text`,title:r(t)(`aiChat.openTerminal`),onClick:n[8]||=e=>_t.value=!0},{default:U(()=>[b(R8)]),_:1},8,[`title`])):K(``,!0),b(r(q),{size:`small`,variant:`text`,icon:`ti ti-dots-vertical`,title:r(t)(`aiChat.menu`),"aria-label":r(t)(`aiChat.menu`),onClick:n[9]||=e=>Ct.value?.toggle(e)},null,8,[`title`,`aria-label`]),b(r(je),{ref_key:`convMenu`,ref:Ct},{default:U(()=>[N(`div`,g5,[O.value?(V(),P(`button`,{key:0,class:`conv-menu__item`,disabled:h.value,onClick:n[10]||=e=>wt(g)},[N(`i`,{class:L(h.value?`ti ti-spin ti-loader-2`:`ti ti-refresh`)},null,2),N(`span`,null,W(r(t)(`aiChat.syncTranscript`)),1)],8,_5)):K(``,!0),A.value&&!r(u).isCompanion?(V(),P(`button`,{key:1,class:`conv-menu__item`,onClick:n[11]||=e=>{wt(()=>{vt.value=!0})}},[n[27]||=N(`i`,{class:`ti ti-key`},null,-1),N(`span`,null,W(r(t)(`aiChat.secretEnv.menu`)),1)])):K(``,!0),N(`button`,{class:`conv-menu__item`,onClick:n[12]||=e=>wt(()=>r(s).pinConversation(r(u).id,r(u).pinOrder===void 0))},[N(`i`,{class:`ti ti-pin`,style:re(r(u).pinOrder===void 0?void 0:`opacity:0.5`)},null,4),N(`span`,null,W(r(u).pinOrder===void 0?r(t)(`aiChatPage.pin`):r(t)(`aiChatPage.unpin`)),1)]),N(`button`,{class:`conv-menu__item`,onClick:n[13]||=e=>wt(()=>r(s).archiveConversation(r(u).id,!r(u).archived))},[N(`i`,{class:`ti ti-inbox`,style:re(r(u).archived?`opacity:0.5`:void 0)},null,4),N(`span`,null,W(r(u).archived?r(t)(`aiChatPage.unarchive`):r(t)(`aiChatPage.archive`)),1)]),N(`button`,{class:`conv-menu__item conv-menu__item--danger`,onClick:n[14]||=e=>wt(()=>r(s).deleteConversation(r(u).id))},[n[28]||=N(`i`,{class:`ti ti-trash`},null,-1),N(`span`,null,W(r(t)(`aiChat.deleteConversation`)),1)])])]),_:1},512)])]),Tt.value?(V(),G(U8,{key:0,visible:_t.value,"onUpdate:visible":n[15]||=e=>_t.value=e,"conversation-id":r(u).id,"agent-id":Tt.value},null,8,[`visible`,`conversation-id`,`agent-id`])):K(``,!0),b(XJ,{visible:vt.value,"onUpdate:visible":n[16]||=e=>vt.value=e,"conversation-id":r(u).id,onSaved:n[17]||=e=>yt.value++},null,8,[`visible`,`conversation-id`]),!r(u).isCompanion&&r(u).workflowType!==`scenario`?(V(),G(C8,{key:1,enabled:!!r(u).companionEnabled,runner:ge.value,model:r(u).companionModel??``,effort:r(u).companionEffort??``,"companion-conversation-id":r(u).companionConversationId,"main-conversation-id":r(u).id,onEnable:be,onDisable:Se,"onUpdate:runner":Ce,"onUpdate:model":De,"onUpdate:effort":Ee},null,8,[`enabled`,`runner`,`model`,`effort`,`companion-conversation-id`,`main-conversation-id`])):K(``,!0),r(u).workflowType===`scenario`?(V(),G(r8,{key:2,ref_key:`scenarioViewRef`,ref:Ie,"available-presets":ze.value,onClickResume:tt},null,8,[`available-presets`])):A.value?(V(),G(WJ,{key:yt.value,"session-id":r(u).id,runner:D.value??`claude-code`,resume:Me(r(u)),"agent-id":r(u).agentId},null,8,[`session-id`,`runner`,`resume`,`agent-id`])):(V(),G(Bz,{key:4,ref_key:`messageListRef`,ref:Fe,messages:r(u).messages,"is-streaming":r(d),onOpenImagePreview:n[18]||=(e,t)=>Re.value?.openImagePreview(e,t)},null,8,[`messages`,`is-streaming`])),r(dj)(r(u),A.value)?(V(),G(tB,{key:5,input:le.value,"onUpdate:input":n[19]||=e=>le.value=e,"is-streaming":r(d),"is-streaming-current-conv":We.value,"active-conversation-id":r(u).id,onSubmit:rt,onOpenImagePreview:n[20]||=(e,t)=>Re.value?.openImagePreview(e,t)},null,8,[`input`,`is-streaming`,`is-streaming-current-conv`,`active-conversation-id`])):K(``,!0)],64))])],6),b(Ht,{ref_key:`modalsRef`,ref:Re,onConfirmScenarioStart:$e,onConfirmResumeScenario:nt},null,512),b(r(Ue),{visible:mt.value,"onUpdate:visible":n[21]||=e=>mt.value=e,header:At.value,modal:``,"dismissable-mask":``,maximizable:``,style:{width:`85vw`,height:`85vh`},"content-style":{padding:0,height:`100%`,display:`flex`,flexDirection:`column`,overflow:`hidden`}},{default:U(()=>[N(`div`,v5,[n[29]||=N(`i`,{class:`ti ti-info-circle`},null,-1),N(`span`,null,W(r(t)(`aiChat.gitChangesNotice`)),1)]),Ot.value&&mt.value?(V(),G(dM,{key:0,"agent-id":Ot.value.agentId,"project-id":Ot.value.projectId,"org-id":Ot.value.orgId},null,8,[`agent-id`,`project-id`,`org-id`])):K(``,!0)]),_:1},8,[`visible`,`header`]),v.value&&y.value?(V(),P(`div`,y5,[N(`div`,b5,[n[30]||=N(`i`,{class:`ti ti-bolt`},null,-1),N(`span`,null,`PTY stress · `+W(w.value.toLocaleString())+` B/s`,1),N(`button`,{type:`button`,class:`ai-chat-page__pty-debug-close`,onClick:E},`×`)]),(V(),G(WJ,{key:y.value,"attach-spawn-id":y.value,"agent-id":S.value,resume:!1},null,8,[`attach-spawn-id`,`agent-id`]))])):K(``,!0)],64))}}),C5=t({default:()=>w5}),w5=Je(S5,[[`__scopeId`,`data-v-e6306ae4`]]),T5=t({useProcessStore:()=>j5}),E5=5,D5=Kt,O5=`runeya:ws-debug`;function k5(){try{return localStorage.getItem(O5)===`1`}catch{return!1}}function A5(...e){k5()&&console.log(`[process.store][ws]`,new Date().toISOString(),...e)}var j5=be(`process`,()=>{let e=i([]),t=i(!1),n=i(null),r=i({}),a=null,o=0,s=null,c=null,l=new Map,u=z(()=>e.value.length),d=z(()=>e.value.filter(e=>e.state===`running`)),f=z(()=>(t,n)=>e.value.find(e=>e.agentId===t&&e.id===n)??null),p=z(()=>t=>e.value.filter(e=>e.serviceId===t));function m(e,t){return`${e}::${t}`}function h(e,t){return`/process/${e}/${t}`}function g(e){return Yt().getById(e)?.name??e}function _(e,t){if(e.state===t.state)return;let n=Xt(),r=g(t.serviceId),i=t.state===`errored`;n.add({type:i?`error`:`info`,category:`service_status_changed`,title:i?Ce.global.t(`notifications.serviceErrored`):Ce.global.t(`notifications.serviceStatusChanged`),message:`${r}: ${e.state} -> ${t.state}`,link:h(t.agentId,t.id),linkLabel:Ce.global.t(`notifications.openService`,{name:r}),serviceId:t.serviceId})}function v(e,t){if(e.healthStatus===t.healthStatus)return;let n=Xt(),r=g(t.serviceId),i=t.healthStatus===`unhealthy`?`warn`:t.healthStatus===`healthy`?`success`:`info`;n.add({type:i,category:`service_health_changed`,title:Ce.global.t(`notifications.serviceHealthChanged`),message:`${r}: ${e.healthStatus} -> ${t.healthStatus}`,link:h(t.agentId,t.id),linkLabel:Ce.global.t(`notifications.openService`,{name:r}),serviceId:t.serviceId})}function y(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,[m(t.agentId,t.id)]:Date.now()},n&&(_(n,t),v(n,t))}function b(e,t){let n=m(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&&y(e)},900);l.set(n,a)}function x(){A5(`subscribeStatus()`),a=J.process.onStatus.subscribe({},{onData(e){o=0,A5(`onStatus data`,{id:e.id,agentId:e.agentId,state:e.state}),y(e)},onError(e){a=null,console.error(`[process.store] Status subscription error:`,e.message),A5(`onStatus error`,e.message,{retryCount:o}),S()}})}function S(){if(o>=E5){console.warn(`[process.store] Max retries (${E5}) reached for status subscription`),A5(`scheduleRetry max reached`,{retryCount:o});return}let e=D5*2**o+Math.random()*300;A5(`scheduleRetry`,{retryCount:o,delay:e}),o++,s=setTimeout(()=>{s=null,A5(`retry timer fired`),x()},e)}function C(e=!1){A5(`startStatusStream()`,{force:e,hasSub:!!a,hasRetryTimer:!!s}),c||=vt(()=>{A5(`onWsReopen — forcing status stream restart`),o=0,C(!0)}),s&&(clearTimeout(s),s=null,A5(`cleared pending retry timer`)),e&&a&&(a.unsubscribe(),a=null,A5(`forced unsubscribe existing statusSub`)),!a&&(o=0,x())}function w(){A5(`stopStatusStream()`),c&&=(c(),null),l.forEach(e=>clearTimeout(e)),l.clear(),s&&=(clearTimeout(s),null),a&&=(a.unsubscribe(),null),o=0}async function T(){t.value=!0,n.value=null;try{e.value=await J.process.list.query()}catch(e){n.value=Pt(e)??`Failed to fetch processes`}finally{t.value=!1}}async function E(e,t){n.value=null;try{let n=Date.now(),r=await J.process.start.mutate({agentId:e,processId:t});b(r,n);let i=xe();return i.activeProjectId&&r.serviceId&&i.addServiceToSelection({id:i.activeProjectId,orgId:i.activeOrgId},r.serviceId),r}catch(e){throw uj().openFromError(e)||(n.value=Pt(e)??`Failed to start process`),e}}async function D(e,t){n.value=null;try{let n=Date.now(),r=await J.process.stop.mutate({agentId:e,processId:t});b(r,n);let i=xe();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 O(e,t){n.value=null;try{let n=Date.now(),r=await J.process.restart.mutate({agentId:e,processId:t});return b(r,n),r}catch(e){throw uj().openFromError(e)||(n.value=Pt(e)??`Failed to restart process`),e}}return{processes:e,loading:t,error:n,processCount:u,runningProcesses:d,getById:f,getByService:p,fetchAll:T,start:E,stop:D,restart:O,startStatusStream:C,stopStatusStream:w}});async function M5(e){e.initTrpcWs(),await e.loadPreferences().catch(()=>{}),e.startStatusStream(),e.startDataStream()}var N5=null;function P5(){N5||=J.project.onDataChanged.subscribe(void 0,{onData({collections:e}){if(e.includes(`projects`)&&Dt().fetchAll(),e.includes(`services`)&&Yt().fetchAll(),e.includes(`environments`)){let e=Ot(),t=e.currentProjectId;t&&e.fetchAll(t,!0)}},onError(){N5=null}})}function F5(){N5?.unsubscribe(),N5=null}var I5={class:`app-root`},L5={class:`app-root__view`},R5=[`title`],z5={key:0,class:`disconnected-overlay`},B5={class:`disconnected-box`},V5={class:`disconnected-title`},H5={class:`disconnected-subtitle`},U5=5e3,W5=Je(B({__name:`App`,setup(e){let{missing:t,visible:n,checkEnvironment:i}=uj(),a={"runeya:locale":Gt([`fr`,`en`]),"runeya-dark-mode":Gt([`0`,`1`]),"runeya-theme-color":Gt([`slate`,`orange`,`amber`,`emerald`,`teal`,`sky`,`blue`,`violet`,`pink`,`custom`]),"runeya-theme-gradient":Gt([`0`,`1`]),"runeya:mode":Gt([`local-simple`,`cloud`]),"runeya:cloudUrl":Wt().url().max(2048),"runeya:ai-chat-model":Wt().max(200),"runeya:ai-chat-effort":Gt([`low`,`medium`,`high`]),[Wn(`app`)]:Wt().max(32),[Wn(`cloud`)]:Wt().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}=ve(),l=Le(),u=we(),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=j5(),h=Xt(),{state:g}=yt(),{isOpen:_,isExpanded:v,toggle:y,close:x}=Ut(),S=()=>new Date().toISOString();function w(){ut()&&console.log(`[ai-chat][drawer]`,S(),`show`,{expanded:v.value,route:u.currentRoute.value.fullPath})}function T(){ut()&&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 O=new Set([`unlock`,`setup`]),k=z(()=>O.has(u.currentRoute.value.name)),{lockedProjectId:A}=pt(),j=z(()=>!A.value&&!k.value&&u.currentRoute.value.name!==`migrate-vault`),M=xe();function F(e){return e===`launch-services`?`launch-services:${M.activeOrgId??`local`}:${M.activeProjectId}`:void 0}let R=!1,te=null;C(g,(e,t)=>{if(e!==`connected`){te===null&&(te=Date.now());return}let n=te===null?0:Date.now()-te;if(te=null,!R){R=!0;return}t!==`connected`&&!k.value&&n>=U5&&window.location.reload()}),I(()=>{window.addEventListener(`keydown`,E),window.addEventListener(`keyup`,D),f(),!k.value&&Ct()&&M5({loadPreferences:()=>h.loadPreferences(),initTrpcWs:bt,startStatusStream:()=>p.startStatusStream(),startDataStream:()=>P5()})}),ee(()=>{p.stopStatusStream(),F5(),window.removeEventListener(`keydown`,E),window.removeEventListener(`keyup`,D)}),C(()=>u.currentRoute.value.name,(e,t)=>{let n=O.has(t??``),r=O.has(e??``);n&&!r&&Ct()&&M5({loadPreferences:()=>h.loadPreferences(),initTrpcWs:bt,startStatusStream:()=>p.startStatusStream(),startDataStream:()=>P5()})});let ne=Dt();return C(()=>ne.currentProject?.name,e=>{document.title=e?`${e} · Runeya`:`Runeya`},{immediate:!0}),C(()=>`${ne.currentProject?.id??``}::${ne.currentProject?.activeEnvironmentId??``}`,()=>{let e=ne.currentProject?.activeEnvironmentId;e&&i(e)},{immediate:!0}),(e,i)=>(V(),P(H,null,[b(r(Fe)),b(r(Ae)),b(UA,{visible:r(n),"onUpdate:visible":i[0]||=e=>m(n)?n.value=e:null,missing:r(t)},null,8,[`visible`,`missing`]),j.value?(V(),G(tj,{key:0})):K(``,!0),!k.value&&r(Ct)()?(V(),G(oj,{key:1})):K(``,!0),N(`div`,I5,[b(Hn),b(nr),N(`div`,L5,[b(bn,null,{default:U(()=>[b(r(De),null,{default:U(({Component:e,route:t})=>[(V(),G(ue(e),{key:F(t.name)}))]),_:1})]),_:1})])]),b(r(Qe),{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:re({width:r(v)?`calc(100vw - 70px)`:`560px`})},{default:U(()=>[N(`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)},[N(`i`,{class:L([`ti`,r(v)?`ti-chevron-right`:`ti-chevron-left`])},null,2)],8,R5),b(w5)]),_:1},8,[`visible`,`header`,`style`]),b(ge,{name:`overlay`},{default:U(()=>[r(g)!==`connected`&&!k.value?(V(),P(`div`,z5,[N(`div`,B5,[i[3]||=N(`i`,{class:`ti ti-cloud-off disconnected-icon`},null,-1),N(`h1`,V5,W(r(c)(`connection.unreachable`)),1),N(`p`,H5,W(r(c)(`connection.reconnecting`)),1),i[4]||=N(`i`,{class:`ti ti-spin ti-loader-2 disconnected-spinner`},null,-1)])])):K(``,!0)]),_:1})],64))}}),[[`__scopeId`,`data-v-52960071`]]),G5=t({router:()=>K5}),K5=Oe({history:Ee(),routes:[{path:`/unlock`,name:`unlock`,component:()=>xt(()=>import(`./UnlockPage-BIB0NtWF.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]))},{path:`/migrate-vault`,name:`migrate-vault`,component:()=>xt(()=>import(`./VaultMigrationPage-D27SeEVr.js`),__vite__mapDeps([21,1,2,3,4,5,6,7,8,9,12,11,17,22]))},{path:`/launch/project`,name:`launch-project`,component:()=>xt(()=>import(`./LaunchProjectPage-B0Lg5Kr5.js`),__vite__mapDeps([23,1,2,4,5,3,14,10,11,12,6,7,8,9,16,17,24,25,26,27,28,29,30,31,32,33,34,18,19,35,36]))},{path:`/launch/services`,name:`launch-services`,component:()=>xt(()=>import(`./LaunchServicesPage-D_pqkdXt.js`),__vite__mapDeps([37,1,2,4,5,3,14,10,11,12,6,7,8,9,38,16,17,39,40,41,42,43,44,30,31,34,18,19,35,45]))},{path:`/`,component:()=>xt(()=>import(`./AppLayout-DIAQvecQ.js`),__vite__mapDeps([46,1,2,3,4,5,14,10,11,12,6,47,48,7,8,9,38,16,17,25,24,26,27,49,50,51,41,42,39,13,15,40,43,52,53,54,55,56,57,58,59,60,61,62,63,28,29,32,30,31,33,64,65,44,66])),children:[{path:``,name:`dashboard`,component:()=>xt(()=>import(`./DashboardPage-DFiL6A-k.js`),__vite__mapDeps([67,1,2,3,4,5,14,10,11,12,6,7,8,9,38,16,17,26,39,40,41,42,43,61,62,30,31,32,25,24,27,28,29,33,64,65,68])),meta:{titleKey:`dashboard.title`}},{path:`cloud`,name:`cloud-account`,component:()=>xt(()=>import(`./CloudAccountPage-BGijgepw.js`).then(e=>e.n),__vite__mapDeps([69,5,1,2,4,3,7,8,9,10,11,12,16,14,17,25,26,27,50,28,29,70]))},{path:`cloud/messaging`,name:`cloud-messaging`,component:()=>xt(()=>import(`./CloudMessagingPage-C9uWAT8S.js`),__vite__mapDeps([71,1,2,4,5,3,6,7,8,9,72,14,10,11,12,73,16,17,50,51,15,41,42,39,13,74,25,26,27,75,76,77,78,79,80,40,81,54,49,55,52,53,82,83,84,85])),meta:{titleKey:`cloudMessaging.title`}},{path:`agents`,name:`agents`,redirect:{path:`/settings`,query:{section:`agents`}}},{path:`knowledge`,name:`knowledge-list`,component:()=>xt(()=>import(`./KnowledgeListPage-BoaV9hBg.js`),__vite__mapDeps([86,1,2,4,5,3,7,8,9,87,6,48,72,14,10,11,12,73,16,17,50,51,15,41,42,39,13,74,88,27,75,76,77,78,79,80,40,81,82,83,84,26,89,90])),meta:{titleKey:`knowledge.title`}},{path:`knowledge/page/:pageId`,name:`knowledge-page`,component:()=>xt(()=>import(`./KnowledgePagePage-UGJGJY4d.js`),__vite__mapDeps([91,1,2,4,5,3,6,7,8,9,87,48,72,14,10,11,12,73,16,17,50,51,15,41,42,39,13,74,88,27,75,76,77,78,79,80,40,81,82,83,84,26,89,92])),meta:{titleKey:`knowledge.title`}},{path:`kanban`,name:`kanban-list`,component:()=>xt(()=>import(`./KanbanListPage-D_ZpIbT2.js`),__vite__mapDeps([93,1,2,3,4,5,6,7,8,9,16,14,10,11,12,17,25,27,49,53,56,83,84,26,94,88,95,96])),meta:{titleKey:`kanban.list.title`}},{path:`issues`,name:`issues-list`,component:()=>xt(()=>import(`./KanbanListPage-D_ZpIbT2.js`),__vite__mapDeps([93,1,2,3,4,5,6,7,8,9,16,14,10,11,12,17,25,27,49,53,56,83,84,26,94,88,95,96])),props:{mode:`list`},meta:{titleKey:`kanban.issues.title`}},{path:`kanban/:id`,name:`kanban-board`,component:()=>xt(()=>import(`./KanbanBoardPage-C9NqOqdD.js`),__vite__mapDeps([97,1,2,3,4,5,14,10,11,12,6,7,8,9,72,73,16,17,50,51,15,41,42,39,13,74,25,27,49,75,76,77,78,79,80,40,81,53,82,83,84,26,94,88,95,98,54,55,99])),props:!0,meta:{pageKey:`kanban-board`}},{path:`kanban/:id/card/:cardId`,name:`kanban-card`,component:()=>xt(()=>import(`./KanbanBoardPage-C9NqOqdD.js`),__vite__mapDeps([97,1,2,3,4,5,14,10,11,12,6,7,8,9,72,73,16,17,50,51,15,41,42,39,13,74,25,27,49,75,76,77,78,79,80,40,81,53,82,83,84,26,94,88,95,98,54,55,99])),props:!0,meta:{pageKey:`kanban-board`}},{path:`issues/:id`,name:`issues-board`,component:()=>xt(()=>import(`./KanbanBoardPage-C9NqOqdD.js`),__vite__mapDeps([97,1,2,3,4,5,14,10,11,12,6,7,8,9,72,73,16,17,50,51,15,41,42,39,13,74,25,27,49,75,76,77,78,79,80,40,81,53,82,83,84,26,94,88,95,98,54,55,99])),props:!0,meta:{pageKey:`kanban-board`}},{path:`issues/:id/card/:cardId`,name:`issues-card`,component:()=>xt(()=>import(`./KanbanBoardPage-C9NqOqdD.js`),__vite__mapDeps([97,1,2,3,4,5,14,10,11,12,6,7,8,9,72,73,16,17,50,51,15,41,42,39,13,74,25,27,49,75,76,77,78,79,80,40,81,53,82,83,84,26,94,88,95,98,54,55,99])),props:!0,meta:{pageKey:`kanban-board`}},{path:`agent-terminal`,name:`agent-terminal`,component:()=>xt(()=>import(`./AgentTerminalPage-Dt9S2kZX.js`),__vite__mapDeps([100,1,2,3,4,5,14,10,11,12,7,8,9,88,40,17,41,42,101,102]))},{path:`audit`,name:`audit`,component:()=>xt(()=>import(`./AuditPage-BEt0m-rM.js`),__vite__mapDeps([103,1,2,4,5,3,7,8,9,10,11,12,104]))},{path:`settings`,name:`settings`,component:()=>xt(()=>import(`./SettingsPage-C3PnwdxZ.js`).then(e=>e.t),__vite__mapDeps([105,5,1,2,3,4,14,10,11,12,73,6,7,8,9,72,16,17,50,51,15,41,42,39,13,74,26,27,49,75,76,77,78,79,80,40,81,57,58,28,29,69,25,70,106,107,108,82,84,98,54,55,109,110,111,112,113,114])),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(()=>C5),void 0)},{path:`scenario/new`,name:`scenario-new`,component:()=>xt(()=>import(`./ScenarioEditorPage-Cjkkz3JB.js`),__vite__mapDeps([115,1,2,3,4,5,14,10,11,12,6,7,8,9,72,73,16,17,50,51,15,41,42,39,13,74,88,101,116]))},{path:`scenario/:id/edit`,name:`scenario-edit`,component:()=>xt(()=>import(`./ScenarioEditorPage-Cjkkz3JB.js`),__vite__mapDeps([115,1,2,3,4,5,14,10,11,12,6,7,8,9,72,73,16,17,50,51,15,41,42,39,13,74,88,101,116])),props:!0},{path:`services/new`,name:`service-create`,component:()=>xt(()=>import(`./ServiceFormPage-B4n8scwP.js`),__vite__mapDeps([117,1,2,3,4,5,14,10,11,12,6,7,8,9,16,17,39,40,41,42,118]))},{path:`services/:id/edit`,name:`service-edit`,component:()=>xt(()=>import(`./ServiceFormPage-B4n8scwP.js`),__vite__mapDeps([117,1,2,3,4,5,14,10,11,12,6,7,8,9,16,17,39,40,41,42,118])),props:!0},{path:`services/:id/:tab?`,name:`service-detail`,component:()=>xt(()=>import(`./ServiceDetailPage-COHMUw51.js`),__vite__mapDeps([119,1,2,3,4,5,14,10,11,12,6,47,48,7,8,9,88,16,17,75,72,73,50,51,15,41,42,39,13,74,76,77,78,79,80,40,81,43,60,61,62,63,101,120,59,106,107,121,122,123,108,82,84,26,98,27,54,49,55,109,110,124,125,126]))},{path:`projects`,name:`projects`,redirect:{name:`dashboard`}},{path:`projects/:projectId`,name:`project-detail`,component:()=>xt(()=>import(`./DashboardPage-DFiL6A-k.js`),__vite__mapDeps([67,1,2,3,4,5,14,10,11,12,6,7,8,9,38,16,17,26,39,40,41,42,43,61,62,30,31,32,25,24,27,28,29,33,64,65,68])),beforeEnter:async e=>{let{useProjectLaunchStore:t}=await xt(async()=>{let{useProjectLaunchStore:e}=await import(`./project-launch.store-DkD7Q9jW.js`).then(e=>e.t);return{useProjectLaunchStore:e}},__vite__mapDeps([14,5,1,2,10,11,12])),{useProjectStore:n}=await xt(async()=>{let{useProjectStore:e}=await import(`./project.store-CnflI3la.js`).then(e=>e.t);return{useProjectStore:e}},__vite__mapDeps([16,5,1,2,14,10,11,12,17])),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-CPs1uuvs.js`),__vite__mapDeps([127,1,2,3,4,5,14,10,11,12,6,7,8,9,16,17,56,128,40,41,42,120,88,39,59,101,106,107,121,129,130])),meta:{titleKey:`environmentList.title`}},{path:`projects/:projectId/environments/:id/edit`,name:`environment-edit`,component:()=>xt(()=>import(`./EnvironmentFormPage-ubP8cX3l.js`),__vite__mapDeps([131,1,2,4,5,3,6,7,8,9,16,14,10,11,12,17,128,40,41,42,120,88,39,59,101,106,107,121,129,132])),meta:{titleKey:`environmentFormPage.editTitle`,backTo:`environments`}},{path:`process/:agentId/:processId`,name:`process-detail`,component:()=>xt(()=>import(`./ProcessDetailPage-Bxwv0984.js`),__vite__mapDeps([133,1,2,4,5,3,6,7,8,9,10,11,12,40,14,17,41,42,61,62,122,123,108,72,73,16,50,51,15,39,13,74,75,76,77,78,79,80,81,82,84,26,98,27,54,49,55,109,134])),props:!0},{path:`wiki`,name:`wiki-global`,component:()=>xt(()=>import(`./WikiPage-A8C0dEDX.js`),__vite__mapDeps([135,2,1,124,3,6,7,4,5,8,9,10,11,12,125]))},{path:`dev/random-job-test`,name:`dev-random-job-test`,component:()=>xt(()=>import(`./RandomJobTestPage-Bp9qone4.js`),__vite__mapDeps([136,1,2,7,3,4,5,8,9,10,11,12,137]))}]}]}),q5=new Set([`launch-project`,`launch-services`]),J5=!1,Y5=!1,X5=!1;async function Z5(){if(X5)return!1;X5=!0;let e=xe();try{let t=await J.process.list.query(),n=Qt(t);if(n.size===0)return!1;let r=await J.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 Q5=null;async function $5(e){if(Q5!==null)return Q5;try{let t=(await J.project.list.query()).find(t=>t.id===e);Q5=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 Q5}async function e7(e){let t=ht();if(!t)return;let n=await $5(t);if(!n)return;let r=xe();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}}K5.beforeEach(async e=>{if(e.name===`unlock`)return;if(!J5){J5=!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 _t();let t=await e7(e);if(t)return t;if(q5.has(e.name))return;let n=xe();if(!n.launchCompleted&&!n.activeProjectId&&!await Z5())return{name:`launch-project`};if(!Y5&&n.activeProjectId){Y5=!0;try{if(!(await J.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 t7={class:`trigger-blob`},n7={class:`theme-layer`},r7={class:`theme-picker`},i7={class:`theme-section theme-section--row`},a7={class:`section-label`},o7={class:`theme-section theme-section--row`},s7={class:`section-label`},c7={class:`theme-section`},l7={class:`section-label`},u7={class:`swatches`},d7=[`title`,`aria-label`,`aria-pressed`,`onClick`],f7={class:`custom-hue-header`},p7={class:`section-label`},m7={class:`custom-hue-track-wrap`},h7=`#18181b`,g7=`#f8fafc`,_7=Je(B({__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}=ve(),g=z(()=>{if(u.value===`custom`)return d.value;let e=t.find(e=>e.id===u.value)??t[3];return tn[e.id][500]}),_=z(()=>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)=>(V(),G(r(Ze),null,{default:U(()=>[b(r(gn),{class:`theme-trigger`,title:r(h)(`themePicker.title`),"aria-label":r(h)(`themePicker.title`)},{default:U(()=>[N(`span`,t7,[(V(!0),P(H,null,F(_.value,(e,t)=>(V(),P(`span`,{key:t,class:`rad`,style:re({backgroundColor:e})},null,4))),128))])]),_:1},8,[`title`,`aria-label`]),(V(),G(le,{to:`body`},[N(`div`,n7,[b(r(it),{class:`theme-popover`,side:`bottom`,align:`end`,"side-offset":6,"collision-padding":8},{default:U(()=>[N(`div`,r7,[N(`div`,i7,[N(`span`,a7,W(r(h)(`themePicker.gradient`)),1),b(r(qe),{class:`gradient-toggle`,"model-value":m.value,"aria-label":m.value?r(h)(`themePicker.disableGradient`):r(h)(`themePicker.enableGradient`),"onUpdate:modelValue":v},{default:U(()=>[b(r(ke),{class:`gradient-toggle__thumb`})]),_:1},8,[`model-value`,`aria-label`])]),i[3]||=N(`div`,{class:`theme-divider`},null,-1),N(`div`,o7,[N(`span`,s7,W(r(h)(`themePicker.mode`)),1),b(r(Re),{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:U(()=>[b(r(He),{value:`dark`,class:`mode-btn`},{default:U(()=>[i[1]||=N(`i`,{class:`ti ti-moon`,"aria-hidden":`true`},null,-1),x(` `+W(r(h)(`themePicker.dark`)),1)]),_:1}),b(r(He),{value:`light`,class:`mode-btn`},{default:U(()=>[i[2]||=N(`i`,{class:`ti ti-sun`,"aria-hidden":`true`},null,-1),x(` `+W(r(h)(`themePicker.light`)),1)]),_:1})]),_:1},8,[`model-value`,`aria-label`])]),i[4]||=N(`div`,{class:`theme-divider`},null,-1),N(`div`,c7,[N(`span`,l7,W(r(h)(`themePicker.accentColor`)),1),N(`div`,u7,[(V(!0),P(H,null,F(r(t),e=>(V(),P(`button`,{key:e.id,type:`button`,class:L([`swatch`,{active:u.value===e.id}]),title:e.label,"aria-label":e.label,"aria-pressed":u.value===e.id,style:re({"--swatch-bg":p.value?h7:g7}),onClick:t=>y(e.id)},[N(`span`,{class:`viewwindow`,style:re({backgroundColor:p.value?h7:g7})},[(V(!0),P(H,null,F(n(r(tn)[e.id][500]),(e,t)=>(V(),P(`span`,{key:t,class:`rad`,style:re({backgroundColor:e})},null,4))),128))],4)],14,d7))),128))])]),N(`div`,{class:L([`theme-section custom-hue-section`,{"custom-hue-section--active":u.value===r(on)}])},[N(`div`,f7,[N(`span`,p7,W(r(h)(`themePicker.customColor`)),1),N(`span`,{class:`custom-hue-preview`,style:re({backgroundColor:d.value})},null,4)]),N(`div`,m7,[b(r($e),{class:`custom-hue-slider`,"model-value":[f.value],min:0,max:359,"aria-label":r(h)(`themePicker.customColor`),"onUpdate:modelValue":w},{default:U(()=>[b(r(Ye),{class:`custom-hue-slider__track`}),b(r(We),{class:`custom-hue-slider__thumb`})]),_:1},8,[`model-value`,`aria-label`])])],2)])]),_:1})])]))]),_:1}))}}),[[`__scopeId`,`data-v-53186dc2`]]),v7=[`width`,`height`],y7=[`rx`],b7=[`transform`],x7=[`d`,`stroke-width`],S7=[`cx`,`cy`,`r`],C7=Je(B({__name:`RuneyaLogo`,props:{size:{default:28}},setup(e){return(t,n)=>(V(),P(`svg`,{class:`runeya-logo`,viewBox:`0 0 100 100`,width:e.size,height:e.size,"aria-hidden":`true`},[N(`rect`,{class:`runeya-logo__bg`,width:`100`,height:`100`,rx:r(en).radius},null,8,y7),N(`g`,{transform:`translate(50 50) scale(${r(an)}) translate(-50 -50)`},[N(`path`,{class:`runeya-logo__stroke`,d:r(fn).path,fill:`none`,"stroke-width":r(fn).stroke,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,8,x7),(V(!0),P(H,null,F(r(fn).dots,([e,t],n)=>(V(),P(`circle`,{key:n,class:`runeya-logo__fill`,cx:e,cy:t,r:r(fn).dotRadius},null,8,S7))),128))],8,b7)],8,v7))}}),[[`__scopeId`,`data-v-85f26936`]]),w7=t({announceThemeToServer:()=>T7});async function T7(){try{await J.desktop.setTrayAccent.mutate({color:un()})}catch{}}globalThis.Buffer=hn.Buffer;async function E7(){try{let e=await J.config.cloud.query();kt(e)}catch(e){console.warn(`[cloud] Failed to fetch cloud config, using defaults:`,e)}}async function D7(){try{gt(await J.config.app.query())}catch(e){console.warn(`[app] Failed to fetch app mode:`,e)}finally{mt()}}var O7=he(W5);O7.use(Se()),O7.use(K5),O7.use(Ce),sn(()=>{T7()}),$t(),vt(()=>{T7()}),O7.directive(`tooltip`,rt),Ie(e=>{try{let t=Xt(),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{}}),O7.config.errorHandler=(e,t,n)=>{console.error(`[Vue Error]`,e,n);let r=e instanceof Error?e.message:`An unexpected error occurred`;Le().add({severity:`error`,summary:`Unexpected Error`,detail:r,life:5e3})};async function k7(){if(Tt()){Et(),bt();return}try{let e=await wt();St(e.ciMode===!0),e.state===`unlocked`&&e.ciMode&&bt()}catch{}}Promise.all([E7(),D7(),k7()]).finally(()=>{O7.mount(`#app`)});export{im as $,E3 as A,KA as B,h0 as C,t2 as D,Q0 as E,OF as F,yS as G,PA as H,kF as I,gS as J,vS as K,mF as L,VJ as M,az as N,$0 as O,IL as P,rm as Q,dM as R,o6 as S,r6 as T,NA as U,GA as V,nD as W,Lh as X,Ih as Y,dh as Z,l8 as _,P5 as a,Xa as at,a8 as b,j5 as c,mo as ct,G8 as d,Ji as dt,Ad as et,R8 as f,Y as ft,O8 as g,On as gt,E8 as h,Jn as ht,G5 as i,Uu as it,l2 as j,z2 as k,Y8 as l,Ha as lt,T8 as m,er as mt,C7 as n,jd as nt,M5 as o,Ja as ot,D8 as p,pr as pt,_S as q,_7 as r,Bu as rt,T5 as s,uo as st,w7 as t,Id as tt,W8 as u,Ka as ut,s8 as v,i6 as w,h6 as x,o8 as y,pj as z};
|