@engenty/wizards-runtime 0.12.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/runtime/dist/agents/studio-assistant.js +42 -5
- package/apps/runtime/dist/app.js +15 -4
- package/apps/runtime/dist/credits/estimate.js +3 -3
- package/apps/runtime/dist/db/live-triggers.js +13 -3
- package/apps/runtime/dist/db/migrations/tenant/0027_space_skill.sql +48 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0027_snapshot.json +4120 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +7 -0
- package/apps/runtime/dist/db/schema.js +31 -0
- package/apps/runtime/dist/docs/dev/skills.md +116 -0
- package/apps/runtime/dist/docs/dev/wizard-format/agent-steps.md +20 -2
- package/apps/runtime/dist/docs/user-guide/models.md +105 -30
- package/apps/runtime/dist/docs/user-guide/skills.md +85 -0
- package/apps/runtime/dist/docs/user-guide/together.md +15 -2
- package/apps/runtime/dist/engine/decide.js +1 -1
- package/apps/runtime/dist/engine/requirements.js +139 -11
- package/apps/runtime/dist/engine/runner.js +47 -5
- package/apps/runtime/dist/engine/steps.js +23 -6
- package/apps/runtime/dist/engine/template.js +17 -0
- package/apps/runtime/dist/harness/model.js +4 -0
- package/apps/runtime/dist/link-preview.js +9 -0
- package/apps/runtime/dist/live/views.js +2 -0
- package/apps/runtime/dist/manage.js +25 -0
- package/apps/runtime/dist/mcp/handler.js +55 -1
- package/apps/runtime/dist/mcp/seen.js +47 -0
- package/apps/runtime/dist/models.js +206 -11
- package/apps/runtime/dist/motion-graphics/step.js +2 -2
- package/apps/runtime/dist/prompts/goose.md +15 -7
- package/apps/runtime/dist/prompts/safety.md +18 -0
- package/apps/runtime/dist/prompts/step.md +20 -2
- package/apps/runtime/dist/prompts/tools.md +33 -0
- package/apps/runtime/dist/routes/marketplace.js +3 -3
- package/apps/runtime/dist/routes/runs.js +5 -0
- package/apps/runtime/dist/routes/skills.js +84 -0
- package/apps/runtime/dist/routes/studio.js +103 -4
- package/apps/runtime/dist/safety.js +60 -18
- package/apps/runtime/dist/services/manage-reports.js +3 -0
- package/apps/runtime/dist/services/marketplace.js +7 -31
- package/apps/runtime/dist/services/pages.js +6 -2
- package/apps/runtime/dist/services/shares.js +5 -0
- package/apps/runtime/dist/services/skills-registry.js +209 -0
- package/apps/runtime/dist/services/skills.js +478 -0
- package/apps/runtime/dist/services/spaces.js +15 -1
- package/apps/runtime/dist/sync/records.js +81 -1
- package/apps/runtime/dist/texts.js +45 -0
- package/apps/runtime/dist/tools/index.js +7 -4
- package/apps/runtime/dist/tools/net-guard.js +8 -4
- package/apps/runtime/dist/tools/skills.js +197 -0
- package/apps/web/dist/assets/AboutDialog-B-JxkELB.js +1 -0
- package/apps/web/dist/assets/{ChangelogDialog-BWaEdlt3.js → ChangelogDialog-SwyId00t.js} +1 -1
- package/apps/web/dist/assets/CodeEditor-BwZsk5Al.js +2 -0
- package/apps/web/dist/assets/EditorPage-DQ_2FOzI.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-DXpzFBRj.js → FlowPreview-DtSpjVTl.js} +1 -1
- package/apps/web/dist/assets/Marketplace-DoH4YO3D.js +2 -0
- package/apps/web/dist/assets/{NewWizardChannels-B5wuTm7J.js → NewWizardChannels-Tgoexgj4.js} +1 -1
- package/apps/web/dist/assets/NewWizardPage-B24AF482.js +7 -0
- package/apps/web/dist/assets/OnboardingPage-BEvq4slJ.js +1 -0
- package/apps/web/dist/assets/PreviewPane-B_v7Y8R7.js +10 -0
- package/apps/web/dist/assets/ProjectPage-ClRuhFJo.js +10 -0
- package/apps/web/dist/assets/PublicRunner-MicrpVsv.js +1 -0
- package/apps/web/dist/assets/{ReadOnly-Cap_e5ke.js → ReadOnly-BXjv-MSv.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-DY8O1r43.js +2 -0
- package/apps/web/dist/assets/SetupPage-BOVkVpMu.js +1 -0
- package/apps/web/dist/assets/{SharePage-DEeVGatD.js → SharePage-DXGzJSnR.js} +1 -1
- package/apps/web/dist/assets/SkillEditor-BzzTDeaU.js +1 -0
- package/apps/web/dist/assets/changelog-BLdS-0Bj.js +1 -0
- package/apps/web/dist/assets/code-xml-TwKzzMtA.js +1 -0
- package/apps/web/dist/assets/{dist-BwhPmMDu.js → dist-BdDd1FxP.js} +1 -1
- package/apps/web/dist/assets/dist-EBVTpvRr.js +10 -0
- package/apps/web/dist/assets/dist-GlRRx9Xl.js +1 -0
- package/apps/web/dist/assets/dist-H1UN89OA.js +1 -0
- package/apps/web/dist/assets/eye-Brd-xPUJ.js +1 -0
- package/apps/web/dist/assets/i18n-8-Sw11tB.js +55 -0
- package/apps/web/dist/assets/index-OsdQFHmh.js +49 -0
- package/apps/web/dist/assets/index-QPipX5Fi.css +1 -0
- package/apps/web/dist/assets/json-CEsfHdlZ.js +1 -0
- package/apps/web/dist/assets/{lock-D-CjMpqn.js → lock-C0uxcOlq.js} +1 -1
- package/apps/web/dist/assets/markdown-5-I9_izp.js +29 -0
- package/apps/web/dist/assets/{oss-credits-CUpVhKSr.js → oss-credits-DpRWUPjD.js} +1 -1
- package/apps/web/dist/assets/{phone-CXSrxw3H.js → phone-DhkHteoJ.js} +1 -1
- package/apps/web/dist/assets/{runners-D71NjXtA.js → runners-G-XYaDgR.js} +1 -1
- package/apps/web/dist/assets/{session-B2LtqeDq.js → session-BWI-KENJ.js} +1 -1
- package/apps/web/dist/assets/theme-D7krsx0_.js +11 -0
- package/apps/web/dist/assets/ui-DSXG3f49.js +83 -0
- package/apps/web/dist/assets/{upload-hLkuT3Q6.js → upload-BYZTwJTD.js} +1 -1
- package/apps/web/dist/assets/{useMutation-C3XBoSVf.js → useMutation-D0QP_k2-.js} +1 -1
- package/apps/web/dist/assets/{volume-2-DIxdTlaA.js → volume-2-CVHoxdGM.js} +1 -1
- package/apps/web/dist/index.html +9 -8
- package/apps/web/dist/mcp/flow.html +66 -66
- package/node_modules/@engenty/wizards/dist/plugin/studio.d.ts +3 -2
- package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +1 -0
- package/node_modules/@engenty/wizards-shared/dist/assistant.js +5 -0
- package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +107 -0
- package/node_modules/@engenty/wizards-shared/dist/definition.js +67 -4
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +18 -0
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +18 -0
- package/node_modules/@engenty/wizards-shared/dist/live.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/marketplace.d.ts +0 -5
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +62 -0
- package/node_modules/@engenty/wizards-shared/dist/run.js +52 -0
- package/node_modules/@engenty/wizards-shared/dist/skills.d.ts +165 -0
- package/node_modules/@engenty/wizards-shared/dist/skills.js +346 -0
- package/node_modules/@engenty/wizards-shared/dist/sync.d.ts +4 -2
- package/node_modules/@engenty/wizards-shared/dist/sync.js +2 -1
- package/node_modules/@engenty/wizards-shared/dist/tiers.d.ts +195 -0
- package/node_modules/@engenty/wizards-shared/dist/tiers.js +98 -0
- package/package.json +7 -7
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/web/dist/assets/AboutDialog-uGYGy2R2.js +0 -1
- package/apps/web/dist/assets/CodeEditor-B5hV1IvK.js +0 -2
- package/apps/web/dist/assets/EditorPage-j9BOx5-V.js +0 -3
- package/apps/web/dist/assets/Marketplace-DSo6uZF6.js +0 -2
- package/apps/web/dist/assets/NewWizardPage-Ci1ZsTJk.js +0 -7
- package/apps/web/dist/assets/OnboardingPage-QkdluEZk.js +0 -1
- package/apps/web/dist/assets/PreviewPane-swAH89un.js +0 -10
- package/apps/web/dist/assets/ProjectPage-Djv5EOYU.js +0 -1
- package/apps/web/dist/assets/PublicRunner-Bt8gMxit.js +0 -1
- package/apps/web/dist/assets/SettingsPage-C2rmXm_Q.js +0 -2
- package/apps/web/dist/assets/SetupPage-CbqGgFPZ.js +0 -1
- package/apps/web/dist/assets/changelog-DAY6ZEyy.js +0 -1
- package/apps/web/dist/assets/dist-DVpDdhG9.js +0 -1
- package/apps/web/dist/assets/dist-DzdNG7Sf.js +0 -10
- package/apps/web/dist/assets/i18n-B3J2ypKu.js +0 -55
- package/apps/web/dist/assets/index-Dxwbli0m.css +0 -1
- package/apps/web/dist/assets/index-WY5lJ_-h.js +0 -49
- package/apps/web/dist/assets/json-D2GVvTXK.js +0 -1
- package/apps/web/dist/assets/markdown-DwdMW7q0.js +0 -29
- package/apps/web/dist/assets/theme-Dab079EV.js +0 -11
- package/apps/web/dist/assets/ui-DQX_CQ7c.js +0 -83
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AboutDialog-B-JxkELB.js","assets/rolldown-runtime-hePW80VL.js","assets/jsx-runtime-BNakU3Ej.js","assets/ui-DSXG3f49.js","assets/preload-helper-DpV6A1kQ.js","assets/i18n-8-Sw11tB.js","assets/logo-CGNoptDg.js","assets/engenty-CNjaZCVM.js","assets/ChangelogDialog-SwyId00t.js","assets/Marketplace-DoH4YO3D.js","assets/useMutation-D0QP_k2-.js","assets/volume-2-CVHoxdGM.js","assets/eye-Brd-xPUJ.js","assets/session-BWI-KENJ.js","assets/PublicRunner-MicrpVsv.js","assets/theme-D7krsx0_.js","assets/react-dom-hf6EcyAr.js","assets/phone-DhkHteoJ.js","assets/theme-CbR9-ayl.css","assets/SharePage-DXGzJSnR.js","assets/EditorPage-DQ_2FOzI.js","assets/PreviewPane-B_v7Y8R7.js","assets/upload-BYZTwJTD.js","assets/runners-G-XYaDgR.js","assets/lock-C0uxcOlq.js","assets/code-xml-TwKzzMtA.js","assets/media-Cej-H610.js","assets/esm-BdxDT9Km.js","assets/NewWizardChannels-Tgoexgj4.js","assets/OnboardingPage-BEvq4slJ.js","assets/NewWizardPage-B24AF482.js","assets/SettingsPage-DY8O1r43.js","assets/ReadOnly-BXjv-MSv.js","assets/ProjectPage-ClRuhFJo.js","assets/SetupPage-BOVkVpMu.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{n as r,t as i}from"./jsx-runtime-BNakU3Ej.js";import{$ as a,$n as o,B as s,Bn as c,Dr as l,En as u,Er as d,Fn as f,G as p,Gt as m,Hn as h,In as g,It as _,J as v,Jn as y,Jt as b,K as ee,Kn as te,Kt as x,Ln as ne,Lt as S,Mr as re,Nn as C,Nr as w,On as ie,Or as ae,Pn as oe,Pt as se,Q as T,Qn as ce,Rn as le,Sn as ue,Sr as de,Tr as fe,Un as pe,Vn as me,W as E,Wn as he,Wt as D,X as ge,Xt as _e,Y as ve,Yn as ye,Yt as be,Z as O,Zn as k,Zt as xe,_r as Se,_t as Ce,a as we,an as Te,ar as A,at as Ee,bn as De,br as Oe,cn as ke,cr as Ae,ct as je,dr as Me,en as Ne,er as Pe,et as Fe,fn as Ie,ft as Le,gn as Re,gr as ze,hn as Be,i as Ve,in as He,ir as Ue,it as We,jn as Ge,jr as Ke,l as qe,ln as Je,lt as Ye,nr as Xe,nt as Ze,on as j,or as Qe,ot as $e,pn as et,q as tt,qt as nt,r as rt,rn as it,rr as at,rt as ot,s as st,sn as ct,sr as lt,t as ut,tn as dt,tr as ft,tt as pt,un as mt,ut as ht,vn as gt,vr as _t,wn as vt,wr as yt,wt as bt,xn as xt,xr as St,y as Ct,yr as wt,yt as Tt,zn as Et}from"./ui-DSXG3f49.js";import{A as Dt,D as Ot,E as kt,S as At,T as jt,_ as Mt,i as Nt,k as Pt,n as Ft,v as It,x as Lt}from"./Marketplace-DoH4YO3D.js";import{n as Rt,t as zt}from"./useMutation-D0QP_k2-.js";import{t as Bt}from"./react-dom-hf6EcyAr.js";import{t as Vt}from"./preload-helper-DpV6A1kQ.js";import{i as Ht,n as Ut,r as Wt,t as Gt}from"./volume-2-CVHoxdGM.js";import{A as Kt,E as qt,M as Jt,S as Yt,b as Xt,c as Zt,d as M,g as Qt,h as $t,i as en,j as tn,k as nn,m as rn,n as an,o as on,p as sn,r as cn,s as ln,u as un,y as dn}from"./session-BWI-KENJ.js";import{n as fn,t as pn}from"./logo-CGNoptDg.js";import{A as mn,D as hn,O as gn,St as _n,T as vn,W as yn,Y as bn,_t as xn,bt as Sn,c as Cn,g as wn,gt as Tn,k as En,n as N,r as Dn,rt as On,s as P,vt as kn,w as An,wt as jn,xt as Mn,y as Nn}from"./i18n-8-Sw11tB.js";import{t as Pn}from"./media-Cej-H610.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 Fn=class extends wt{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Rt({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=In(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=In(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=In(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=In(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Se.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>yt(t,e))}findAll(e={}){return this.getAll().filter(t=>yt(e,t))}notify(e){Se.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Se.batch(()=>Promise.all(e.map(e=>e.continue().catch(d))))}};function In(e){return e.options.scope?.id}var Ln=class extends wt{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??de(r,t),a=this.get(i);return a||(a=new Me({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Se.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>fe(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>fe(e,t)):t}notify(e){Se.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Se.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Se.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Rn=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ln,this.#t=e.mutationCache||new Fn,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=_t.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ze.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ae(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Oe(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Se.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Se.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Se.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=Se.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(d).catch(d)}invalidateQueries(e,t={}){return Se.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Se.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(d)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(d)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(ae(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(ae(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(d).catch(d)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(d).catch(d)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ze.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(St(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{l(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(St(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{l(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=de(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Ke&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},zn=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function ee(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,te||(te=!0,w());else{var t=n(l);t!==null&&oe(ee,t.startTime-e)}}}var te=!1,x=-1,ne=5,S=-1;function re(){return g?!0:!(e.unstable_now()-S<ne)}function C(){if(g=!1,te){var t=e.unstable_now();S=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(x),x=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&re());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&oe(ee,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?w():te=!1}}}var w;if(typeof y==`function`)w=function(){y(C)};else if(typeof MessageChannel<`u`){var ie=new MessageChannel,ae=ie.port2;ie.port1.onmessage=C,w=function(){ae.postMessage(null)}}else w=function(){_(C,0)};function oe(t,n){x=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ne=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(x),x=-1):h=!0,oe(ee,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,te||(te=!0,w()))),r},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Bn=n(((e,t)=>{t.exports=zn()})),Vn=n((e=>{var t=Bn(),n=r(),i=Bt();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}function p(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&p(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function m(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function h(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function g(e){var t=[null,null],n=m(e);return n===null||_(t,e,n.child,{foundSelf:!1}),t}function _(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&_(e,t,n.child,r))return!0;n=n.sibling}return!1}function v(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(a(559))}}var y=null,b=null;function ee(e,t,n){return e===n||e===t&&(y=e,!0)}function te(e,t,n){return e===n?(b=e,!1):e===t&&(b!==null&&(y=e),!0)}function x(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function ne(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var S=Object.assign,re=Symbol.for(`react.element`),C=Symbol.for(`react.transitional.element`),w=Symbol.for(`react.portal`),ie=Symbol.for(`react.fragment`),ae=Symbol.for(`react.strict_mode`),oe=Symbol.for(`react.profiler`),se=Symbol.for(`react.consumer`),T=Symbol.for(`react.context`),ce=Symbol.for(`react.forward_ref`),le=Symbol.for(`react.suspense`),ue=Symbol.for(`react.suspense_list`),de=Symbol.for(`react.memo`),fe=Symbol.for(`react.lazy`),pe=Symbol.for(`react.activity`),me=Symbol.for(`react.legacy_hidden`),E=Symbol.for(`react.memo_cache_sentinel`),he=Symbol.for(`react.view_transition`),D=Symbol.for(`react.recoverable`),ge=Symbol.iterator;function _e(e){return typeof e!=`object`||!e?null:(e=ge&&e[ge]||e[`@@iterator`],typeof e==`function`?e:null)}var ve=Symbol.for(`react.client.reference`);function ye(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ve?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case ie:return`Fragment`;case oe:return`Profiler`;case ae:return`StrictMode`;case le:return`Suspense`;case ue:return`SuspenseList`;case pe:return`Activity`;case he:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case w:return`Portal`;case T:return e.displayName||`Context`;case se:return(e._context.displayName||`Context`)+`.Consumer`;case ce:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case de:return t=e.displayName||null,t===null?ye(e.type)||`Memo`:t;case fe:t=e._payload,e=e._init;try{return ye(e(t))}catch{}}return null}var be=Array.isArray,O=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,k=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,xe={pending:!1,data:null,method:null,action:null},Se=[],Ce=-1;function we(e){return{current:e}}function Te(e){0>Ce||(e.current=Se[Ce],Se[Ce]=null,Ce--)}function A(e,t){Ce++,Se[Ce]=e.current,e.current=t}var Ee=we(null),De=we(null),Oe=we(null),ke=we(null);function Ae(e,t){switch(A(Oe,t),A(De,e),A(Ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?mp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=mp(t),e=hp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}Te(Ee),A(Ee,e)}function je(){Te(Ee),Te(De),Te(Oe)}function Me(e){var t=e.memoizedState;t!==null&&(lh._currentValue=t.memoizedState,A(ke,e)),t=Ee.current;var n=hp(t,e.type);t!==n&&(A(De,e),A(Ee,n))}function Ne(e){De.current===e&&(Te(Ee),Te(De)),ke.current===e&&(Te(ke),lh._currentValue=xe)}var Pe,Fe;function Ie(e){if(Pe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Pe=t&&t[1]||``,Fe=-1<e.stack.indexOf(`
|
|
3
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
+
`+Pe+e+Fe}var Le=!1;function Re(e,t){if(!e||Le)return``;Le=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
|
+
`),l=s.split(`
|
|
6
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
7
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Le=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ie(n):``}function ze(e,t){switch(e.tag){case 26:case 27:case 5:return Ie(e.type);case 16:return Ie(`Lazy`);case 13:return e.child!==t&&t!==null?Ie(`Suspense Fallback`):Ie(`Suspense`);case 19:return Ie(`SuspenseList`);case 0:case 15:return Re(e.type,!1);case 11:return Re(e.type.render,!1);case 1:return Re(e.type,!0);case 31:return Ie(`Activity`);case 30:return Ie(`ViewTransition`);default:return``}}function Be(e){try{var t=``,n=null;do t+=ze(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
+
Error generating stack: `+e.message+`
|
|
9
|
+
`+e.stack}}var Ve=Object.prototype.hasOwnProperty,He=t.unstable_scheduleCallback,Ue=t.unstable_cancelCallback,We=t.unstable_shouldYield,Ge=t.unstable_requestPaint,Ke=t.unstable_now,qe=t.unstable_getCurrentPriorityLevel,Je=t.unstable_ImmediatePriority,Ye=t.unstable_UserBlockingPriority,Xe=t.unstable_NormalPriority,Ze=t.unstable_LowPriority,j=t.unstable_IdlePriority,Qe=t.log,$e=t.unstable_setDisableYieldValue,et=null,tt=null;function nt(e){if(typeof Qe==`function`&&$e(e),tt&&typeof tt.setStrictMode==`function`)try{tt.setStrictMode(et,e)}catch{}}var rt=Math.clz32?Math.clz32:ot,it=Math.log,at=Math.LN2;function ot(e){return e>>>=0,e===0?32:31-(it(e)/at|0)|0}var st=256,ct=262144,lt=4194304;function ut(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function dt(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=ut(n))):i=ut(o):i=ut(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=ut(n))):i=ut(o)):i=ut(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function ft(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function pt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-rt(n),i=1<<r;t|=e[r],n&=~i}return t}function mt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ht(){var e=lt;return lt<<=1,!(lt&62914560)&&(lt=4194304),e}function gt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function _t(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function vt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-rt(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&yt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function yt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-rt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function bt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-rt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function xt(e,t){var n=t&-t;return n=n&42?1:St(n),(n&(e.suspendedLanes|t))===0?n:0}function St(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ct(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function wt(){var e=k.p;return e===0?(e=window.event,e===void 0?32:Th(e.type)):e}function Tt(e,t){var n=k.p;try{return k.p=e,t()}finally{k.p=n}}var Et=Math.random().toString(36).slice(2),Dt=`__reactFiber$`+Et,Ot=`__reactProps$`+Et,kt=`__reactContainer$`+Et,At=`__reactEvents$`+Et,jt=`__reactListeners$`+Et,Mt=`__reactHandles$`+Et,Nt=`__reactResources$`+Et,Pt=`__reactMarker$`+Et,Ft=`__reactLoad$`+Et;function It(e){delete e[Dt],delete e[Ot],delete e[jt],delete e[Mt]}function Lt(e){var t;if(t=e[Dt])return t;for(var n=e.parentNode;n;){if(t=n[kt]||n[Dt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=hm(e);e!==null;){if(n=e[Dt])return n;e=hm(e)}return t}e=n,n=e.parentNode}return null}function Rt(e){if(e=e[Dt]||e[kt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function zt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function Vt(e){var t=e[Nt];return t||=e[Nt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Ht(e){e[Pt]=!0}function Ut(e){e[Ft]=void 0}var Wt=new Set,Gt={};function Kt(e,t){qt(e,t),qt(e+`Capture`,t)}function qt(e,t){for(Gt[e]=t,e=0;e<t.length;e++)Wt.add(t[e])}var Jt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Yt={},Xt={};function Zt(e){return Ve.call(Xt,e)?!0:Ve.call(Yt,e)?!1:Jt.test(e)?Xt[e]=!0:(Yt[e]=!0,!1)}var M=!1;function Qt(){var e=M;return M=!1,e}function $t(e,t,n){if(Zt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function en(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function tn(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function nn(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function rn(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function an(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function on(e){if(!e._valueTracker){var t=rn(e)?`checked`:`value`;e._valueTracker=an(e,t,``+e[t])}}function sn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=rn(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var cn=/[\n"\\]/g;function ln(e){return e.replace(cn,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function un(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+nn(t)):e.value!==``+nn(t)&&(e.value=``+nn(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):fn(e,nn(n)):o===`number`&&e.value==t?fn(e,nn(e.value)):fn(e,nn(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+nn(s):e.removeAttribute(`name`)}function dn(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){on(e);return}n=n==null?``:``+nn(n),t=t==null?n:``+nn(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),on(e)}function fn(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function pn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+nn(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function mn(e,t,n){if(t!=null&&(t=``+nn(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+nn(n)}function hn(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(a(92));if(be(r)){if(1<r.length)throw Error(a(93));r=r[0]}n=r}n??=``,t=n}n=nn(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),on(e)}function gn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var _n=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function vn(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||_n.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function yn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(a(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,M=!0);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&(vn(e,i,r),M=!0)}else for(var o in t)t.hasOwnProperty(o)&&vn(e,o,t[o])}function bn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var xn=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`maskType`,`mask-type`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Sn=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Cn(e){return Sn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function wn(){}var Tn=null;function En(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var N=null,Dn=null;function On(e){var t=Rt(e);if(t&&(e=t.stateNode)){var n=e[Ot]||null;a:switch(e=t.stateNode,t.type){case`input`:if(un(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+ln(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[Ot]||null;if(!i)throw Error(a(90));un(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&sn(r)}break a;case`textarea`:mn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&pn(e,!!n.multiple,t,!1)}}}var P=!1;function kn(e,t,n){if(P)return e(t,n);P=!0;try{return e(t)}finally{if(P=!1,(N!==null||Dn!==null)&&(Gd(),N&&(t=N,e=Dn,Dn=N=null,On(t),e)))for(t=0;t<e.length;t++)On(e[t])}}function An(e,t){var n=e.stateNode;if(n===null)return null;var r=n[Ot]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(a(231,t,typeof n));return n}var jn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Mn=!1;if(jn)try{var Nn={};Object.defineProperty(Nn,"passive",{get:function(){Mn=!0}}),window.addEventListener(`test`,Nn,Nn),window.removeEventListener(`test`,Nn,Nn)}catch{Mn=!1}var Pn=null,Fn=null,In=null;function Ln(){if(In)return In;var e,t=Fn,n=t.length,r,i=`value`in Pn?Pn.value:Pn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return In=i.slice(e,1<r?1-r:void 0)}function Rn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function zn(){return!0}function Vn(){return!1}function Hn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?zn:Vn,this.isPropagationStopped=Vn,this}return S(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=zn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=zn)},persist:function(){},isPersistent:zn}),t}var Un={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wn=Hn(Un),Gn=S({},Un,{view:0,detail:0}),Kn=Hn(Gn),qn,Jn,Yn,Xn=S({},Gn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:sr,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Yn&&(Yn&&e.type===`mousemove`?(qn=e.screenX-Yn.screenX,Jn=e.screenY-Yn.screenY):Jn=qn=0,Yn=e),qn)},movementY:function(e){return`movementY`in e?e.movementY:Jn}}),Zn=Hn(Xn),Qn=Hn(S({},Xn,{dataTransfer:0})),$n=Hn(S({},Gn,{relatedTarget:0})),er=Hn(S({},Un,{animationName:0,elapsedTime:0,pseudoElement:0})),tr=Hn(S({},Un,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),nr=Hn(S({},Un,{data:0})),rr={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},ir={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},ar={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function or(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ar[e])?!!t[e]:!1}function sr(){return or}var cr=Hn(S({},Gn,{key:function(e){if(e.key){var t=rr[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Rn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?ir[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:sr,charCode:function(e){return e.type===`keypress`?Rn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Rn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),lr=Hn(S({},Xn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),ur=Hn(S({},Un,{submitter:0})),dr=Hn(S({},Gn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:sr})),fr=Hn(S({},Un,{propertyName:0,elapsedTime:0,pseudoElement:0})),pr=Hn(S({},Xn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),mr=Hn(S({},Un,{newState:0,oldState:0,source:0})),hr=[9,13,27,32],gr=jn&&`CompositionEvent`in window,_r=null;jn&&`documentMode`in document&&(_r=document.documentMode);var vr=jn&&`TextEvent`in window&&!_r,yr=jn&&(!gr||_r&&8<_r&&11>=_r),br=` `,xr=!1;function Sr(e,t){switch(e){case`keyup`:return hr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Cr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var wr=!1;function Tr(e,t){switch(e){case`compositionend`:return Cr(t);case`keypress`:return t.which===32?(xr=!0,br):null;case`textInput`:return e=t.data,e===br&&xr?null:e;default:return null}}function Er(e,t){if(wr)return e===`compositionend`||!gr&&Sr(e,t)?(e=Ln(),In=Fn=Pn=null,wr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return yr&&t.locale!==`ko`?null:t.data;default:return null}}var Dr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Or(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Dr[e.type]:t===`textarea`}function kr(e,t,n,r){N?Dn?Dn.push(r):Dn=[r]:N=r,t=Qf(t,`onChange`),0<t.length&&(n=new Wn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Ar=null,jr=null;function Mr(e){Gf(e,0)}function Nr(e){if(sn(zt(e)))return e}function Pr(e,t){if(e===`change`)return t}var Fr=!1;if(jn){var Ir;if(jn){var Lr=`oninput`in document;if(!Lr){var Rr=document.createElement(`div`);Rr.setAttribute(`oninput`,`return;`),Lr=typeof Rr.oninput==`function`}Ir=Lr}else Ir=!1;Fr=Ir&&(!document.documentMode||9<document.documentMode)}function zr(){Ar&&(Ar.detachEvent(`onpropertychange`,Br),jr=Ar=null)}function Br(e){if(e.propertyName===`value`&&Nr(jr)){var t=[];kr(t,jr,e,En(e)),kn(Mr,t)}}function Vr(e,t,n){e===`focusin`?(zr(),Ar=t,jr=n,Ar.attachEvent(`onpropertychange`,Br)):e===`focusout`&&zr()}function Hr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Nr(jr)}function Ur(e,t){if(e===`click`)return Nr(t)}function Wr(e,t){if(e===`input`||e===`change`)return Nr(t)}function Gr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Kr=typeof Object.is==`function`?Object.is:Gr;function qr(e,t){if(Kr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Ve.call(t,i)||!Kr(e[i],t[i]))return!1}return!0}function Jr(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Yr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xr(e,t){var n=Yr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Yr(n)}}function Zr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Zr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Jr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Jr(e.document)}return t}function $r(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var ei=jn&&`documentMode`in document&&11>=document.documentMode,ti=null,ni=null,ri=null,ii=!1;function ai(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ii||ti==null||ti!==Jr(r)||(r=ti,`selectionStart`in r&&$r(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ri&&qr(ri,r)||(ri=r,r=Qf(ni,`onSelect`),0<r.length&&(t=new Wn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=ti)))}function oi(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var si={animationend:oi(`Animation`,`AnimationEnd`),animationiteration:oi(`Animation`,`AnimationIteration`),animationstart:oi(`Animation`,`AnimationStart`),transitionrun:oi(`Transition`,`TransitionRun`),transitionstart:oi(`Transition`,`TransitionStart`),transitioncancel:oi(`Transition`,`TransitionCancel`),transitionend:oi(`Transition`,`TransitionEnd`)},ci={},li={};jn&&(li=document.createElement(`div`).style,`AnimationEvent`in window||(delete si.animationend.animation,delete si.animationiteration.animation,delete si.animationstart.animation),`TransitionEvent`in window||delete si.transitionend.transition);function ui(e){if(ci[e])return ci[e];if(!si[e])return e;var t=si[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in li)return ci[e]=t[n];return e}var di=ui(`animationend`),fi=ui(`animationiteration`),pi=ui(`animationstart`),mi=ui(`transitionrun`),hi=ui(`transitionstart`),gi=ui(`transitioncancel`),_i=ui(`transitionend`),vi=new Map,yi=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);yi.push(`scrollEnd`);function bi(e,t){vi.set(e,t),Kt(t,[e])}var xi=0;function Si(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=Ed.identifierPrefix;var n=xi++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function Ci(e){if(e==null||typeof e==`string`)return e;var t=null,n=Pd;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function wi(e,t){return e=Ci(e),t=Ci(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var Ti=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Ei=[],Di=0,Oi=0;function ki(){for(var e=Di,t=Oi=Di=0;t<e;){var n=Ei[t];Ei[t++]=null;var r=Ei[t];Ei[t++]=null;var i=Ei[t];Ei[t++]=null;var a=Ei[t];if(Ei[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Ni(n,i,a)}}function Ai(e,t,n,r){Ei[Di++]=e,Ei[Di++]=t,Ei[Di++]=n,Ei[Di++]=r,Oi|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ji(e,t,n,r){return Ai(e,t,n,r),Pi(e)}function Mi(e,t){return Ai(e,null,null,t),Pi(e)}function Ni(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-rt(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Pi(e){if(50<Fd)throw Fd=0,Id=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Fi={};function Ii(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Li(e,t,n,r){return new Ii(e,t,n,r)}function Ri(e){return e=e.prototype,!(!e||!e.isReactComponent)}function zi(e,t){var n=e.alternate;return n===null?(n=Li(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Bi(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Vi(e,t,n,r,i,o){var s=0;if(r=e,typeof r==`function`)Ri(r)&&(s=1);else if(typeof r==`string`)s=Xm(e,n,Ee.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case pe:return e=Li(31,n,t,i),e.elementType=pe,e.lanes=o,e;case ie:return Hi(n.children,i,o,t);case ae:s=8,i|=24;break;case oe:return e=Li(12,n,t,i|2),e.elementType=oe,e.lanes=o,e;case le:return e=Li(13,n,t,i),e.elementType=le,e.lanes=o,e;case ue:return e=Li(19,n,t,i),e.elementType=ue,e.lanes=o,e;case me:case he:return e=i|32,e=Li(30,n,t,e),e.elementType=he,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case T:s=10;break a;case se:s=9;break a;case ce:s=11;break a;case de:s=14;break a;case fe:s=16,r=null;break a}s=29,n=Error(a(130,e===null?`null`:typeof e,``)),r=null}return t=Li(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function Hi(e,t,n,r){return e=Li(7,e,r,t),e.lanes=n,e}function Ui(e,t,n){return e=Li(6,e,null,t),e.lanes=n,e}function Wi(e){var t=Li(18,null,null,0);return t.stateNode=e,t}function Gi(e,t,n){return t=Li(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ki=new WeakMap;function qi(e,t){if(typeof e==`object`&&e){var n=Ki.get(e);return n===void 0?(t={value:e,source:t,stack:Be(t)},Ki.set(e,t),t):n}return{value:e,source:t,stack:Be(t)}}var Ji=[],Yi=0,Xi=null,Zi=0,Qi=[],$i=0,ea=null,ta=1,na=``;function ra(e,t){Ji[Yi++]=Zi,Ji[Yi++]=Xi,Xi=e,Zi=t}function ia(e,t,n){Qi[$i++]=ta,Qi[$i++]=na,Qi[$i++]=ea,ea=e;var r=ta;e=na;var i=32-rt(r)-1;r&=~(1<<i),n+=1;var a=32-rt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ta=1<<32-rt(t)+i|n<<i|r,na=a+e}else ta=1<<a|n<<i|r,na=e}function aa(e){e.return!==null&&(ra(e,1),ia(e,1,0))}function oa(e){for(;e===Xi;)Xi=Ji[--Yi],Ji[Yi]=null,Zi=Ji[--Yi],Ji[Yi]=null;for(;e===ea;)ea=Qi[--$i],Qi[$i]=null,na=Qi[--$i],Qi[$i]=null,ta=Qi[--$i],Qi[$i]=null}function sa(e,t){Qi[$i++]=ta,Qi[$i++]=na,Qi[$i++]=ea,ta=t.id,na=t.overflow,ea=e}var ca=null,la=null,F=!1,ua=null,da=!1,I=Error(a(519));function fa(e){throw _a(qi(Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),I}function L(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Dt]=e,t[Ot]=r,n){case`dialog`:J(`cancel`,t),J(`close`,t);break;case`iframe`:case`object`:case`embed`:J(`load`,t);break;case`video`:case`audio`:for(n=0;n<Uf.length;n++)J(Uf[n],t);break;case`source`:J(`error`,t);break;case`img`:case`image`:case`link`:J(`error`,t),J(`load`,t);break;case`details`:J(`toggle`,t);break;case`input`:J(`invalid`,t),dn(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:J(`invalid`,t);break;case`textarea`:J(`invalid`,t),hn(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||ip(t.textContent,n)?(r.popover!=null&&(J(`beforetoggle`,t),J(`toggle`,t)),r.onScroll!=null&&J(`scroll`,t),r.onScrollEnd!=null&&J(`scrollend`,t),r.onClick!=null&&(t.onclick=wn),t=!0):t=!1,t||fa(e,!0)}function pa(e){for(ca=e.return;ca;)switch(ca.tag){case 5:case 31:case 13:da=!1;return;case 27:case 3:da=!0;return;default:ca=ca.return}}function ma(e){if(e!==ca)return!1;if(!F)return pa(e),F=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||_p(e.type,e.memoizedProps)),n=!n),n&&la&&fa(e),pa(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(317));la=mm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(317));la=mm(e)}else t===27?(t=la,Ep(e.type)?(e=pm,pm=null,la=e):la=t):la=ca?fm(e.stateNode.nextSibling):null;return!0}function ha(){la=ca=null,F=!1}function ga(){var e=ua;return e!==null&&(vd===null?vd=e:vd.push.apply(vd,e),ua=null),e}function _a(e){ua===null?ua=[e]:ua.push(e)}var va=we(null),ya=null,ba=null;function xa(e,t,n){A(va,t._currentValue),t._currentValue=n}function Sa(e){e._currentValue=va.current,Te(va)}function Ca(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function wa(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var o=i.dependencies;if(o!==null){var s=i.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Ca(o.return,n,e),r||(s=null);break a}o=c.next}}else if(i.tag===18){if(s=i.return,s===null)throw Error(a(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Ca(s,n,e),s=null}else i.tag===13&&i.memoizedState!==null&&i.memoizedState.dehydrated===null?(i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),Ca(i.return,n,e),s=i.child,s=s===null?null:s.sibling):s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}}function Ta(e,t,n,r){e=null;for(var i=t,o=!1;i!==null;){if(!o){if(i.flags&524288)o=!0;else if(i.flags&262144)break}if(i.tag===10){var s=i.alternate;if(s===null)throw Error(a(387));if(s=s.memoizedProps,s!==null){var c=i.type;Kr(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===ke.current){if(s=i.alternate,s===null)throw Error(a(387));s.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[lh]:e.push(lh))}i=i.return}return e!==null&&wa(t,e,n,r),t.flags|=262144,e!==null}function Ea(e){for(e=e.firstContext;e!==null;){if(!Kr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Da(e){ya=e,ba=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Oa(e){return Aa(ya,e)}function ka(e,t){return ya===null&&Da(e),Aa(e,t)}function Aa(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ba===null){if(e===null)throw Error(a(308));ba=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ba=ba.next=t;return n}var ja=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Ma=t.unstable_scheduleCallback,Na=t.unstable_NormalPriority,Pa={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Fa(){return{controller:new ja,data:new Map,refCount:0}}function Ia(e){e.refCount--,e.refCount===0&&Ma(Na,function(){e.controller.abort()})}function La(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Ra=null;function za(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Ba=null,Va=0,Ha=0,Ua=null;function Wa(e,t){if(Ba===null){var n=Ba=[];Va=0,Ha=q(),Ua={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Va++,t.then(Ga,Ga),t}function Ga(){if(--Va===0&&(Ra=null,Ba!==null)){Ua!==null&&(Ua.status=`fulfilled`);var e=Ba;Ba=null,Ha=0,Ua=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ka(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var qa=O.S;O.S=function(e,t){if(xd=Ke(),typeof t==`object`&&t&&typeof t.then==`function`&&Wa(e,t),Ra!==null)for(var n=Tf;n!==null;)La(n,Ra),n=n.next;if(n=e.types,n!==null){for(var r=Tf;r!==null;)La(r,n),r=r.next;if(Ha!==0){r=Ra,r===null&&(r=Ra=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}qa!==null&&qa(e,t)};var Ja=we(null);function Ya(){var e=Ja.current;return e===null?ad.pooledCache:e}function Xa(e,t){t===null?A(Ja,Ja.current):A(Ja,t.pool)}function Za(){var e=Ya();return e===null?null:{parent:Pa._currentValue,pool:e}}var Qa=Error(a(460)),$a=Error(a(474)),eo=Error(a(542)),to={then:function(){}};function no(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ro(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(wn,wn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,so(e),e===void 0&&!(`reason`in t)?Error(a(600)):e;default:if(typeof t.status==`string`)t.then(wn,wn);else{if(e=ad,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,so(e),e}throw ao=t,Qa}}function io(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ao=e,Qa):e}}var ao=null;function oo(){if(ao===null)throw Error(a(459));var e=ao;return ao=null,e}function so(e){if(e===Qa||e===eo)throw Error(a(483))}var co=null,lo=0;function uo(e){var t=lo;return lo+=1,co===null&&(co=[]),ro(co,e,t)}function fo(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function po(e,t){throw t.$$typeof===re?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function mo(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=zi(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Ui(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===ie?(e=d(e,t,n.props.children,r,n.key),fo(e,n),e):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===fe&&io(a)===t.type)?(t=i(t,n.props),fo(t,n),t.return=e,t):(t=Vi(n.type,n.key,n.props,null,e.mode,r),fo(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Gi(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=Hi(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Ui(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case C:return n=Vi(t.type,t.key,t.props,null,e.mode,n),fo(n,t),n.return=e,n;case w:return t=Gi(t,e.mode,n),t.return=e,t;case fe:return t=io(t),f(e,t,n)}if(be(t)||_e(t))return t=Hi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,uo(t),n);if(t.$$typeof===T)return f(e,ka(e,t),n);po(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case C:return n.key===i?l(e,t,n,r):null;case w:return n.key===i?u(e,t,n,r):null;case fe:return n=io(n),p(e,t,n,r)}if(be(n)||_e(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,uo(n),r);if(n.$$typeof===T)return p(e,t,ka(e,n),r);po(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case C:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case w:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case fe:return r=io(r),m(e,t,n,r,i)}if(be(r)||_e(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,uo(r),i);if(r.$$typeof===T)return m(e,t,n,ka(t,r),i);po(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),F&&ra(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return F&&ra(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),F&&ra(i,h),l}function g(i,s,c,l){if(c==null)throw Error(a(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),F&&ra(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return F&&ra(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),F&&ra(i,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===ie&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case C:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===ie){if(r.tag===7){n(e,r.sibling),c=i(r,o.props.children),fo(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===fe&&io(l)===r.type){n(e,r.sibling),c=i(r,o.props),fo(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===ie?(c=Hi(o.props.children,e.mode,c,o.key),fo(c,o),c.return=e,e=c):(c=Vi(o.type,o.key,o.props,null,e.mode,c),fo(c,o),c.return=e,e=c)}return s(e);case w:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=i(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Gi(o,e.mode,c),c.return=e,e=c}return s(e);case fe:return o=io(o),_(e,r,o,c)}if(be(o))return h(e,r,o,c);if(_e(o)){if(l=_e(o),typeof l!=`function`)throw Error(a(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,uo(o),c);if(o.$$typeof===T)return _(e,r,ka(e,o),c);po(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,o),c.return=e,e=c):(n(e,r),c=Ui(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{lo=0;var i=_(e,t,n,r);return co=null,i}catch(t){if(t===Qa||t===eo)throw t;var a=Li(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ho=mo(!0),go=mo(!1),_o=!1;function vo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function bo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function xo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,V&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Pi(e),Ni(e,null,n),t}return Ai(e,r,t,n),Pi(e)}function So(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,bt(e,n)}}function Co(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var wo=!1;function To(){if(wo){var e=Ua;if(e!==null)throw e}}function Eo(e,t,n,r){wo=!1;var i=e.updateQueue;_o=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(U&f)===f:(r&f)===f){f!==0&&f===Ha&&(wo=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=S({},d,f);break a;case 2:_o=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),fd|=o,e.lanes=o,e.memoizedState=d}}function Do(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function Oo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Do(n[e],t)}var ko=we(null),Ao=we(0);function jo(e,t){e=ud,A(Ao,e),A(ko,t),ud=e|t.baseLanes}function Mo(){A(Ao,ud),A(ko,ko.current)}function No(){ud=Ao.current,Te(ko),Te(Ao)}var Po=we(null),Fo=null;function Io(e){var t=e.alternate;A(Vo,Vo.current&1),A(Po,e),Fo===null&&(t===null||ko.current!==null||t.memoizedState!==null)&&(Fo=e)}function Lo(e){A(Vo,Vo.current),A(Po,e),Fo===null&&(Fo=e)}function Ro(e){e.tag===22?(A(Vo,Vo.current),A(Po,e),Fo===null&&(Fo=e)):zo()}function zo(){A(Vo,Vo.current),A(Po,Po.current)}function Bo(e){Te(Po),Fo===e&&(Fo=null),Te(Vo)}var Vo=we(0);function Ho(e,t){A(Po,Po.current),A(Vo,t)}function Uo(e){Te(Vo),Te(Po),Fo===e&&(Fo=null)}function Wo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||lm(n)||um(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Go=0,R=null,z=null,Ko=null,qo=!1,Jo=!1,Yo=!1,Xo=0,Zo=0,Qo=null,$o=0;function es(){throw Error(a(321))}function ts(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Kr(e[n],t[n]))return!1;return!0}function ns(e,t,n,r,i,a){return Go=a,R=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,O.H=e===null||e.memoizedState===null?yc:bc,Yo=!1,a=n(r,i),Yo=!1,Jo&&(a=is(t,n,r,i)),rs(e),a}function rs(e){O.H=vc;var t=z!==null&&z.next!==null;if(Go=0,Ko=z=R=null,qo=!1,Zo=0,Qo=null,t)throw Error(a(300));e===null||Lc||(e=e.dependencies,e!==null&&Ea(e)&&(Lc=!0))}function is(e,t,n,r){R=e;var i=0;do{if(Jo&&(Qo=null),Zo=0,Jo=!1,25<=i)throw Error(a(301));if(i+=1,Ko=z=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}O.H=xc,o=t(n,r)}while(Jo);return o}function as(){var e=O.H,t=e.useState()[0];return t=typeof t.then==`function`?fs(t):t,e=e.useState()[0],(z===null?null:z.memoizedState)!==e&&(R.flags|=1024),t}function os(){var e=Xo!==0;return Xo=0,e}function ss(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function cs(e){if(qo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}qo=!1}Go=0,Ko=z=R=null,Jo=!1,Zo=Xo=0,Qo=null}function ls(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ko===null?R.memoizedState=Ko=e:Ko=Ko.next=e,Ko}function us(){if(z===null){var e=R.alternate;e=e===null?null:e.memoizedState}else e=z.next;var t=Ko===null?R.memoizedState:Ko.next;if(t!==null)Ko=t,z=e;else{if(e===null)throw R.alternate===null?Error(a(467)):Error(a(310));z=e,e={memoizedState:z.memoizedState,baseState:z.baseState,baseQueue:z.baseQueue,queue:z.queue,next:null},Ko===null?R.memoizedState=Ko=e:Ko=Ko.next=e}return Ko}function ds(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function fs(e){var t=Zo;return Zo+=1,Qo===null&&(Qo=[]),e=ro(Qo,e,t),t=R,(Ko===null?t.memoizedState:Ko.next)===null&&(t=t.alternate,O.H=t===null||t.memoizedState===null?yc:bc),e}function ps(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return fs(e);if(e.$$typeof===D)return;if(e.$$typeof===T)return Oa(e)}throw Error(a(438,String(e)))}function ms(e){var t=null,n=R.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=R.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=ds(),R.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=E;return t.index++,n}function hs(e,t){return typeof t==`function`?t(e):t}function gs(e){return _s(us(),z,e)}function _s(e,t,n){var r=e.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=n;var i=e.baseQueue,o=r.pending;if(o!==null){if(i!==null){var s=i.next;i.next=o.next,o.next=s}t.baseQueue=i=o,r.pending=null}if(o=e.baseState,i===null)e.memoizedState=o;else{t=i.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Go&f)===f:(U&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===Ha&&(d=!0);else if((Go&p)===p){u=u.next,p===Ha&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,R.lanes|=p,fd|=p;f=u.action,Yo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,R.lanes|=f,fd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Kr(o,e.memoizedState)&&(Lc=!0,d&&(n=Ua,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function vs(e){var t=us(),n=t.queue;if(n===null)throw Error(a(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do o=e(o,s.action),s=s.next;while(s!==i);Kr(o,t.memoizedState)||(Lc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function ys(e,t,n){var r=R,i=us(),o=F;if(o){if(n===void 0)throw Error(a(407));n=n()}else n=t();var s=!Kr((z||i).memoizedState,n);if(s&&(i.memoizedState=n,Lc=!0),i=i.queue,Ws(Ss.bind(null,r,i,e),[e]),e=i.getSnapshot!==t||s||Ko!==null&&!!(Ko.memoizedState.tag&1),zs(e?9:8,{destroy:void 0},xs.bind(null,r,i,n,t),null),e){if(r.flags|=2048,ad===null)throw Error(a(349));o||Go&127||bs(r,t,n)}return n}function bs(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=R.updateQueue,t===null?(t=ds(),R.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function xs(e,t,n,r){t.value=n,t.getSnapshot=r,Cs(t)&&ws(e)}function Ss(e,t,n){return n(function(){Cs(t)&&ws(e)})}function Cs(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Kr(e,n)}catch{return!0}}function ws(e){var t=Mi(e,2);t!==null&&Bd(t,e,2)}function Ts(e){var t=ls();if(typeof e==`function`){var n=e;if(e=n(),Yo){nt(!0);try{n()}finally{nt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:e},t}function Es(e,t,n,r){return e.baseState=n,_s(e,z,typeof r==`function`?r:hs)}function Ds(e,t,n,r,i){if(hc(e))throw Error(a(485));if(e=t.action,e!==null){var o={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};O.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Os(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Os(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=O.T,o={};o.types=a===null?null:a.types,O.T=o;try{var s=n(i,r),c=O.S;c!==null&&c(o,s),ks(e,t,s)}catch(n){js(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),O.T=a}}else try{a=n(i,r),ks(e,t,a)}catch(n){js(e,t,n)}}function ks(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){As(e,t,n)},function(n){return js(e,t,n)}):As(e,t,n)}function As(e,t,n){t.status=`fulfilled`,t.value=n,Ms(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Os(e,n)))}function js(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Ms(t),t=t.next;while(t!==r)}e.action=null}function Ms(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ns(e,t){return t}function Ps(e,t){if(F){var n=ad.formState;if(n!==null){a:{var r=R;if(F){if(la){b:{for(var i=la,a=da;i.nodeType!==8;){if(!a){i=null;break b}if(i=fm(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){la=fm(i.nextSibling),r=i.data===`F!`;break a}}fa(r)}r=!1}r&&(t=n[0])}}return n=ls(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ns,lastRenderedState:t},n.queue=r,n=fc.bind(null,R,r),r.dispatch=n,r=Ts(!1),a=mc.bind(null,R,!1,r.queue),r=ls(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Ds.bind(null,R,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Fs(e){return Is(us(),z,e)}function Is(e,t,n){if(t=_s(e,t,Ns)[0],e=gs(hs)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=fs(t)}catch(e){throw e===Qa?eo:e}else r=t;t=us();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(R.flags|=2048,zs(9,{destroy:void 0},Ls.bind(null,i,n),null)),[r,a,e]}function Ls(e,t){e.action=t}function Rs(e){var t=us(),n=z;if(n!==null)return Is(t,n,e);us(),t=t.memoizedState,n=us();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function zs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=R.updateQueue,t===null&&(t=ds(),R.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Bs(){return us().memoizedState}function Vs(e,t,n,r){var i=ls();R.flags|=e,i.memoizedState=zs(1|t,{destroy:void 0},n,r===void 0?null:r)}function Hs(e,t,n,r){var i=us();r=r===void 0?null:r;var a=i.memoizedState.inst;z!==null&&r!==null&&ts(r,z.memoizedState.deps)?i.memoizedState=zs(t,a,n,r):(R.flags|=e,i.memoizedState=zs(1|t,a,n,r))}function Us(e,t){Vs(8390656,8,e,t)}function Ws(e,t){Hs(2048,8,e,t)}function Gs(e){R.flags|=4;var t=R.updateQueue;if(t===null)t=ds(),R.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ks(e){var t=us().memoizedState;return Gs({ref:t,nextImpl:e}),function(){if(V&2)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function qs(e,t){return Hs(4,2,e,t)}function Js(e,t){return Hs(4,4,e,t)}function Ys(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Xs(e,t,n){n=n==null?null:n.concat([e]),Hs(4,4,Ys.bind(null,t,e),n)}function Zs(){}function Qs(e,t){var n=us();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&ts(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function $s(e,t){var n=us();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&ts(t,r[1]))return r[0];if(r=e(),Yo){nt(!0);try{e()}finally{nt(!1)}}return n.memoizedState=[r,t],r}function ec(e,t,n){return n===void 0||Go&1073741824&&!(U&261930)?e.memoizedState=t:(e.memoizedState=n,e=Rd(),R.lanes|=e,fd|=e,n)}function tc(e,t,n,r){return Kr(n,t)?n:ko.current===null?!(Go&106)||Go&1073741824&&!(U&261930)?(Lc=!0,e.memoizedState=n):(e=Rd(),R.lanes|=e,fd|=e,t):(e=ec(e,n,r),Kr(e,t)||(Lc=!0),e)}function nc(e,t,n,r,i){var a=k.p;k.p=a!==0&&8>a?a:8;var o=O.T,s={};s.types=o===null?null:o.types,O.T=s,mc(e,!1,t,n);try{var c=i(),l=O.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?pc(e,t,Ka(c,r),Ld(e)):pc(e,t,r,Ld(e))}catch(n){pc(e,t,{then:function(){},status:`rejected`,reason:n},Ld())}finally{k.p=a,o!==null&&s.types!==null&&(o.types=s.types),O.T=o}}function rc(){}function ic(e,t,n,r){if(e.tag!==5)throw Error(a(476));var i=ac(e).queue;nc(e,i,t,xe,n===null?rc:function(){return oc(e),n(r)})}function ac(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:xe,baseState:xe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:xe},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function oc(e){var t=ac(e);t.next===null&&(t=e.alternate.memoizedState),pc(e,t.next.queue,{},Ld())}function sc(){return Oa(lh)}function cc(){return us().memoizedState}function lc(){return us().memoizedState}function uc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Ld();e=bo(n);var r=xo(t,e,n);r!==null&&(Bd(r,t,n),So(r,t,n)),t={cache:Fa()},e.payload=t;return}t=t.return}}function dc(e,t,n){var r=Ld();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},hc(e)?gc(t,n):(n=ji(e,t,n,r),n!==null&&(Bd(n,e,r),_c(n,t,r)))}function fc(e,t,n){pc(e,t,n,Ld())}function pc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(hc(e))gc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Kr(s,o))return Ai(e,t,i,0),ad===null&&ki(),!1}catch{}if(n=ji(e,t,i,r),n!==null)return Bd(n,e,r),_c(n,t,r),!0}return!1}function mc(e,t,n,r){if(r={lane:2,revertLane:q(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},hc(e)){if(t)throw Error(a(479))}else t=ji(e,n,r,2),t!==null&&Bd(t,e,2)}function hc(e){var t=e.alternate;return e===R||t!==null&&t===R}function gc(e,t){Jo=qo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function _c(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,bt(e,n)}}var vc={readContext:Oa,use:ps,useCallback:es,useContext:es,useEffect:es,useImperativeHandle:es,useLayoutEffect:es,useInsertionEffect:es,useMemo:es,useReducer:es,useRef:es,useState:es,useDebugValue:es,useDeferredValue:es,useTransition:es,useSyncExternalStore:es,useId:es,useHostTransitionStatus:es,useFormState:es,useActionState:es,useOptimistic:es,useMemoCache:es,useCacheRefresh:es,useEffectEvent:es},yc={readContext:Oa,use:ps,useCallback:function(e,t){return ls().memoizedState=[e,t===void 0?null:t],e},useContext:Oa,useEffect:Us,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Vs(4194308,4,Ys.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Vs(4194308,4,e,t)},useInsertionEffect:function(e,t){Vs(4,2,e,t)},useMemo:function(e,t){var n=ls();t=t===void 0?null:t;var r=e();if(Yo){nt(!0);try{e()}finally{nt(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ls();if(n!==void 0){var i=n(t);if(Yo){nt(!0);try{n(t)}finally{nt(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=dc.bind(null,R,e),[r.memoizedState,e]},useRef:function(e){var t=ls();return e={current:e},t.memoizedState=e},useState:function(e){e=Ts(e);var t=e.queue,n=fc.bind(null,R,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Zs,useDeferredValue:function(e,t){return ec(ls(),e,t)},useTransition:function(){var e=Ts(!1);return e=nc.bind(null,R,e.queue,!0,!1),ls().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=R,i=ls();if(F){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),ad===null)throw Error(a(349));U&127||bs(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,Us(Ss.bind(null,r,o,e),[e]),r.flags|=2048,zs(9,{destroy:void 0},xs.bind(null,r,o,n,t),null),n},useId:function(){var e=ls(),t=ad.identifierPrefix;if(F){var n=na,r=ta;n=(r&~(1<<32-rt(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Xo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=$o++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:sc,useFormState:Ps,useActionState:Ps,useOptimistic:function(e){var t=ls();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=mc.bind(null,R,!0,n),n.dispatch=t,[e,t]},useMemoCache:ms,useCacheRefresh:function(){return ls().memoizedState=uc.bind(null,R)},useEffectEvent:function(e){var t=ls(),n={impl:e};return t.memoizedState=n,function(){if(V&2)throw Error(a(440));return n.impl.apply(void 0,arguments)}}},bc={readContext:Oa,use:ps,useCallback:Qs,useContext:Oa,useEffect:Ws,useImperativeHandle:Xs,useInsertionEffect:qs,useLayoutEffect:Js,useMemo:$s,useReducer:gs,useRef:Bs,useState:function(){return gs(hs)},useDebugValue:Zs,useDeferredValue:function(e,t){return tc(us(),z.memoizedState,e,t)},useTransition:function(){var e=gs(hs)[0],t=us().memoizedState;return[typeof e==`boolean`?e:fs(e),t]},useSyncExternalStore:ys,useId:cc,useHostTransitionStatus:sc,useFormState:Fs,useActionState:Fs,useOptimistic:function(e,t){return Es(us(),z,e,t)},useMemoCache:ms,useCacheRefresh:lc,useEffectEvent:Ks},xc={readContext:Oa,use:ps,useCallback:Qs,useContext:Oa,useEffect:Ws,useImperativeHandle:Xs,useInsertionEffect:qs,useLayoutEffect:Js,useMemo:$s,useReducer:vs,useRef:Bs,useState:function(){return vs(hs)},useDebugValue:Zs,useDeferredValue:function(e,t){var n=us();return z===null?ec(n,e,t):tc(n,z.memoizedState,e,t)},useTransition:function(){var e=vs(hs)[0],t=us().memoizedState;return[typeof e==`boolean`?e:fs(e),t]},useSyncExternalStore:ys,useId:cc,useHostTransitionStatus:sc,useFormState:Rs,useActionState:Rs,useOptimistic:function(e,t){var n=us();return z===null?(n.baseState=e,[e,n.queue.dispatch]):Es(n,z,e,t)},useMemoCache:ms,useCacheRefresh:lc,useEffectEvent:Ks};function Sc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:S({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Cc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ld(),i=bo(r);i.payload=t,n!=null&&(i.callback=n),t=xo(e,i,r),t!==null&&(Bd(t,e,r),So(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ld(),i=bo(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=xo(e,i,r),t!==null&&(Bd(t,e,r),So(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ld(),r=bo(n);r.tag=2,t!=null&&(r.callback=t),t=xo(e,r,n),t!==null&&(Bd(t,e,n),So(t,e,n))}};function wc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!qr(n,r)||!qr(i,a):!0}function Tc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Cc.enqueueReplaceState(t,t.state,null)}function Ec(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=S({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Dc(e){Ti(e)}function Oc(e){console.error(e)}function kc(e){Ti(e)}function Ac(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function jc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Mc(e,t,n){return n=bo(n),n.tag=3,n.payload={element:null},n.callback=function(){Ac(e,t)},n}function Nc(e){return e=bo(e),e.tag=3,e}function Pc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){jc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){jc(t,n,r),typeof i!=`function`&&(wd===null?wd=new Set([this]):wd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Fc(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ta(t,n,i,!0),n=Po.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Fo===null?Qd():n.alternate===null&&dd===0&&(dd=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===to?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),K(e,r,i)),!1;case 22:return n.flags|=65536,r===to?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),K(e,r,i)),!1}throw Error(a(435,n.tag))}return K(e,r,i),Qd(),!1}if(F)return t=Po.current,t===null?(r!==I&&(t=Error(a(423),{cause:r}),_a(qi(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=qi(r,n),i=Mc(e.stateNode,r,i),Co(e,i),dd!==4&&(dd=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==I&&(e=Error(a(422),{cause:r}),_a(qi(e,n)))),!1;var o=Error(a(520),{cause:r});if(o=qi(o,n),_d===null?_d=[o]:_d.push(o),dd!==4&&(dd=2),t===null)return!0;r=qi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=Mc(n.stateNode,r,e),Co(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(wd===null||!wd.has(o))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Nc(i),Pc(i,e,n,r),Co(n,i),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Ic=Error(a(461)),Lc=!1;function Rc(e,t,n,r){t.child=e===null?go(t,null,n,r):ho(t,e.child,n,r)}function zc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Da(t),r=ns(e,t,n,o,a,i),s=os(),e!==null&&!Lc?(ss(e,t,i),pl(e,t,i)):(F&&s&&aa(t),t.flags|=1,Rc(e,t,r,i),t.child)}function Bc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Ri(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Vc(e,t,a,r,i)):(e=Vi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!ml(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?qr:n,n(o,r)&&e.ref===t.ref)return pl(e,t,i)}return t.flags|=1,e=zi(a,r),e.ref=t.ref,e.return=t,t.child=e}function Vc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(qr(a,r)&&e.ref===t.ref){if(Lc=!1,t.pendingProps=r=a,ml(e,i))e.flags&131072&&(Lc=!0);else return t.lanes=e.lanes,pl(e,t,i)}}return Yc(e,t,n,r,i)}function Hc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Wc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Xa(t,a===null?null:a.cachePool),a===null?Mo():jo(t,a),Ro(t);else return r=t.lanes=536870912,Wc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Xa(t,null),Mo(),zo()):(Xa(t,a.cachePool),jo(t,a),zo(),t.memoizedState=null);return Rc(e,t,i,n),t.child}function Uc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Wc(e,t,n,r,i){var a=Ya();return a=a===null?null:{parent:Pa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Xa(t,null),Mo(),Ro(t),e!==null&&Ta(e,t,r,!0),t.childLanes=i,null}function Gc(e,t){return t=il({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Kc(e,t,n){return ho(t,e.child,null,n),e=Gc(t,t.pendingProps),e.flags|=2,Bo(t),t.memoizedState=null,e}function qc(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(F){if(r.mode===`hidden`)return e=Gc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Uc(null,e);if(Lo(t),(e=la)?(e=cm(e,da),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ea===null?null:{id:ta,overflow:na},retryLane:536870912,hydrationErrors:null},n=Wi(e),n.return=t,t.child=n,ca=t,la=null)):e=null,e===null)throw fa(t);return t.lanes=536870912,null}return Gc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Lo(t),i){if(t.flags&256)t.flags&=-257,t=Kc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558))}else if(Lc||Ta(e,t,n,!1),i=(n&e.childLanes)!==0,Lc||i){if(ko.current===null){if(r=ad,r!==null&&(s=xt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Mi(e,s),Bd(r,e,s),Ic;Qd()}t=Kc(e,t,n)}else e=o.treeContext,la=fm(s.nextSibling),ca=t,F=!0,ua=null,da=!1,e!==null&&sa(t,e),t=Gc(t,r),t.flags|=134221824;return t}return e=zi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Jc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(a(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Yc(e,t,n,r,i){return Da(t),n=ns(e,t,n,r,void 0,i),r=os(),e!==null&&!Lc?(ss(e,t,i),pl(e,t,i)):(F&&r&&aa(t),t.flags|=1,Rc(e,t,n,i),t.child)}function Xc(e,t,n,r,i,a){return Da(t),t.updateQueue=null,n=is(t,r,n,i),rs(e),r=os(),e!==null&&!Lc?(ss(e,t,a),pl(e,t,a)):(F&&r&&aa(t),t.flags|=1,Rc(e,t,n,a),t.child)}function Zc(e,t,n,r,i){if(Da(t),t.stateNode===null){var a=Fi,o=n.contextType;typeof o==`object`&&o&&(a=Oa(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Cc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},vo(t),o=n.contextType,a.context=typeof o==`object`&&o?Oa(o):Fi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Sc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Cc.enqueueReplaceState(a,a.state,null),Eo(t,r,a,i),To(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Ec(n,s);a.props=c;var l=a.context,u=n.contextType;o=Fi,typeof u==`object`&&u&&(o=Oa(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Tc(t,a,r,o),_o=!1;var f=t.memoizedState;a.state=f,Eo(t,r,a,i),To(),l=t.memoizedState,s||f!==l||_o?(typeof d==`function`&&(Sc(t,n,d,r),l=t.memoizedState),(c=_o||wc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,yo(e,t),o=t.memoizedProps,u=Ec(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Fi,typeof l==`object`&&l&&(c=Oa(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Tc(t,a,r,c),_o=!1,f=t.memoizedState,a.state=f,Eo(t,r,a,i),To();var p=t.memoizedState;o!==d||f!==p||_o||e!==null&&e.dependencies!==null&&Ea(e.dependencies)?(typeof s==`function`&&(Sc(t,n,s,r),p=t.memoizedState),(u=_o||wc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ea(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Jc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=ho(t,e.child,null,i),t.child=ho(t,null,n,i)):Rc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=pl(e,t,i),e}function Qc(e,t,n,r){return ha(),t.flags|=256,Rc(e,t,n,r),t.child}var $c={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function el(e){return{baseLanes:e,cachePool:Za()}}function tl(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=hd),e}function nl(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Vo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(F){if(i?Io(t):zo(),(e=la)?(e=cm(e,da),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ea===null?null:{id:ta,overflow:na},retryLane:536870912,hydrationErrors:null},n=Wi(e),n.return=t,t.child=n,ca=t,la=null)):e=null,e===null)throw fa(t);return t.lanes=um(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(zo(),i=t.mode,a=il({mode:`hidden`,children:a},i),r=Hi(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=el(n),r.childLanes=tl(e,o,n),t.memoizedState=$c,Uc(null,r)):(Io(t),rl(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return ol(e,t,a,o,r,c,s,n)}return i?(zo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=zi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=Hi(i,a,n,null),i.flags|=2):i=zi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Uc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=el(n):(a=i.cachePool,a===null?a=Za():(s=Pa._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=tl(e,o,n),t.memoizedState=$c,Uc(e.child,r)):(Io(t),n=e.child,e=n.sibling,n=zi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function rl(e,t){return t=il({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function il(e,t){return e=Li(22,e,null,t),e.lanes=0,e}function al(e,t,n){return ho(t,e.child,null,n),e=rl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ol(e,t,n,r,i,o,s,c){if(n)return t.flags&256?(Io(t),t.flags&=-257,al(e,t,c)):t.memoizedState===null?(zo(),o=i.fallback,s=t.mode,i=il({mode:`visible`,children:i.children},s),o=Hi(o,s,c,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,ho(t,e.child,null,c),i=t.child,i.memoizedState=el(c),i.childLanes=tl(e,r,c),t.memoizedState=$c,Uc(null,i)):(zo(),t.child=e.child,t.flags|=128,null);if(Io(t),um(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(i=Error(a(419)),i.stack=``,i.digest=r,_a({value:i,source:null,stack:null})),al(e,t,c)}if(Lc||Ta(e,t,c,!1),r=(c&e.childLanes)!==0,Lc||r){if(ko.current!==null)return al(e,t,c);if(r=ad,r!==null&&(i=xt(r,c),i!==0&&i!==s.retryLane))throw s.retryLane=i,Mi(e,i),Bd(r,e,i),Ic;return lm(o)||Qd(),al(e,t,c)}return lm(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,la=fm(o.nextSibling),ca=t,F=!0,ua=null,da=!1,e!==null&&sa(t,e),t=rl(t,i.children),t.flags|=134221824,t)}function sl(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ca(e.return,t,n)}function cl(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Wo(n)===null&&(t=e),e=e.sibling}return t}function ll(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function ul(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function dl(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Vo.current;if(t.flags&128)return Ho(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Ho(t,o),i===`backwards`&&e!==null?(ul(e),Rc(e,t,r,n),ul(e)):Rc(e,t,r,n),r=F?Zi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&sl(e,n,t);else if(e.tag===19)sl(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=cl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,ul(t)),ll(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Wo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ll(t,!0,n,null,a,r);break;case`together`:ll(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=cl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ll(t,!1,i,n,a,r)}return t.child}function fl(e,t,n){var r=t.pendingProps;return xa(t,t.type,r.value),Rc(e,t,r.children,n),t.child}function pl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),fd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Ta(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,n=zi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=zi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ml(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Ea(e)))}function hl(e,t,n){switch(t.tag){case 3:Ae(t,t.stateNode.containerInfo),xa(t,Pa,e.memoizedState.cache),ha();break;case 27:case 5:Me(t);break;case 4:Ae(t,t.stateNode.containerInfo);break;case 10:xa(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Lo(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Io(t),t.flags|=128,null;r=Ta(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?nl(e,t,n):(Io(t),e=pl(e,t,n),e===null?null:e.sibling)}Io(t);break;case 19:if(t.flags&128)return dl(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(Ta(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return dl(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ho(t,Vo.current),r)break;return null;case 22:return t.lanes=0,Hc(e,t,n,t.pendingProps);case 24:xa(t,Pa,e.memoizedState.cache)}return pl(e,t,n)}function gl(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Lc=!0;else{if(!ml(e,n)&&!(t.flags&128))return Lc=!1,hl(e,t,n);Lc=!!(e.flags&131072)}}else Lc=!1,F&&t.flags&1048576&&ia(t,Zi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=io(t.elementType),t.type=e,typeof e==`function`)Ri(e)?(r=Ec(e,r),t.tag=1,t=Zc(null,t,e,r,n)):(t.tag=0,t=Yc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===ce){t.tag=11,t=zc(null,t,e,r,n);break a}if(i===de){t.tag=14,t=Bc(null,t,e,r,n);break a}if(i===T){t.tag=10,t.type=e,t=fl(null,t,n);break a}}throw t=ye(e)||e,Error(a(306,t,``))}}return t;case 0:return Yc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Ec(r,t.pendingProps),Zc(e,t,r,i,n);case 3:a:{if(Ae(t,t.stateNode.containerInfo),e===null)throw Error(a(387));r=t.pendingProps;var o=t.memoizedState;i=o.element,yo(e,t),Eo(t,r,null,n);var s=t.memoizedState;if(r=s.cache,xa(t,Pa,r),r!==o.cache&&wa(t,[Pa],n,!0),To(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Qc(e,t,r,n);break a}if(r!==i){i=qi(Error(a(424)),t),_a(i),t=Qc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(la=fm(e.firstChild),ca=t,F=!0,ua=null,da=!0,n=go(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(ha(),r===i){t=pl(e,t,n);break a}Rc(e,t,r,n)}t=t.child}return t;case 26:return Jc(e,t),e===null?(n=Im(t.type,null,t.pendingProps,null))?t.memoizedState=n:F||(t.stateNode=gp(t.type,t.pendingProps,Oe.current,t)):t.memoizedState=Im(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Me(t),e===null&&F&&(r=t.stateNode=vm(t.type,t.pendingProps,Oe.current),ca=t,da=!0,i=la,Ep(t.type)?(pm=i,la=fm(r.firstChild)):la=i),Rc(e,t,t.pendingProps.children,n),Jc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&F&&((i=r=la)&&(r=X(r,t.type,t.pendingProps,da),r===null?i=!1:(t.stateNode=r,ca=t,la=fm(r.firstChild),da=!1,i=!0)),i||fa(t)),Me(t),i=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,_p(i,o)?r=null:s!==null&&_p(i,s)&&(t.flags|=32),t.memoizedState!==null&&(i=ns(e,t,as,null,null,n),lh._currentValue=i),Jc(e,t),Rc(e,t,r,n),t.child;case 6:return e===null&&F&&((e=n=la)&&(n=sm(n,t.pendingProps,da),n===null?e=!1:(t.stateNode=n,ca=t,la=null,e=!0)),e||fa(t)),null;case 13:return nl(e,t,n);case 4:return Ae(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ho(t,null,r,n):Rc(e,t,r,n),t.child;case 11:return zc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Jc(e,t),Rc(e,t,r,n),t.child;case 8:return Rc(e,t,t.pendingProps.children,n),t.child;case 12:return Rc(e,t,t.pendingProps.children,n),t.child;case 10:return fl(e,t,n);case 9:return i=t.type._context,r=t.pendingProps.children,Da(t),i=Oa(i),r=r(i),t.flags|=1,Rc(e,t,r,n),t.child;case 14:return Bc(e,t,t.type,t.pendingProps,n);case 15:return Vc(e,t,t.type,t.pendingProps,n);case 19:return dl(e,t,n);case 31:return qc(e,t,n);case 22:return Hc(e,t,n,t.pendingProps);case 24:return Da(t),r=Oa(Pa),e===null?(i=Ya(),i===null&&(i=ad,o=Fa(),i.pooledCache=o,o.refCount++,o!==null&&(i.pooledCacheLanes|=n),i=o),t.memoizedState={parent:r,cache:i},vo(t),xa(t,Pa,i)):((e.lanes&n)!==0&&(yo(e,t),Eo(t,null,null,n),To()),i=e.memoizedState,o=t.memoizedState,i.parent===r?(r=o.cache,xa(t,Pa,r),r!==i.cache&&wa(t,[Pa],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),xa(t,Pa,r))),Rc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:F&&aa(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Jc(e,t),Rc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function _l(e){e.flags|=4}function vl(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Zm(t,r):Zm(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Yd())e.flags|=8192;else throw ao=to,$a}}else e.flags&=-16777217}function yl(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Qm(t)){if(Yd())e.flags|=8192;else throw ao=to,$a}}function bl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:ht(),e.lanes|=t,gd|=t)}function xl(e,t){if(!F)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function Sl(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Cl(e,t,n){var r=t.pendingProps;switch(oa(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Sl(t),null;case 1:return Sl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Sa(Pa),je(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ma(t)?_l(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ga())),Sl(t),null;case 26:var i=t.type,o=t.memoizedState;return e===null?(_l(t),o===null?(Sl(t),vl(t,i,null,r,n)):(Sl(t),yl(t,o))):o?o===e.memoizedState?(Sl(t),t.flags&=-16777217):(_l(t),Sl(t),yl(t,o)):(e=e.memoizedProps,e!==r&&_l(t),Sl(t),vl(t,i,e,r,n)),null;case 27:if(Ne(t),n=Oe.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&_l(t);else{if(!r){if(t.stateNode===null)throw Error(a(166));return Sl(t),t.subtreeFlags&=-33554433,null}e=Ee.current,ma(t)?L(t,e):(e=vm(i,r,n),t.stateNode=e,_l(t))}return Sl(t),t.subtreeFlags&=-33554433,null;case 5:if(Ne(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&_l(t);else{if(!r){if(t.stateNode===null)throw Error(a(166));return Sl(t),t.subtreeFlags&=-33554433,null}if(o=Ee.current,ma(t))L(t,o);else{var s=pp(Oe.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}o[Dt]=t,o[Ot]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(op(o,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&_l(t)}}return Sl(t),t.subtreeFlags&=-33554433,vl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&_l(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=Oe.current,ma(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=ca,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Dt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||ip(e.nodeValue,n)),e||fa(t,!0)}else e=pp(e).createTextNode(r),e[Dt]=t,t.stateNode=e}return Sl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ma(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[Dt]=t}else ha(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Sl(t),e=!1}else n=ga(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Bo(t),t):(Bo(t),null);if(t.flags&128)throw Error(a(558))}return Sl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=ma(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));i[Dt]=t}else ha(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Sl(t),i=!1}else i=ga(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Bo(t),t):(Bo(t),null)}return Bo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),bl(t,t.updateQueue),Sl(t),null);case 4:return je(),e===null&&Jf(t.stateNode.containerInfo),t.flags|=67108864,Sl(t),null;case 10:return Sa(t.type),Sl(t),null;case 19:if(Uo(t),r=t.memoizedState,r===null)return Sl(t),null;if(i=!!(t.flags&128),o=r.rendering,o===null){if(i)xl(r,!1);else{if(dd!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Wo(e),o!==null){for(t.flags|=128,xl(r,!1),e=o.updateQueue,t.updateQueue=e,bl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Bi(n,e),n=n.sibling;return Ho(t,Vo.current&1|2),F&&ra(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ke()>Sd&&(t.flags|=128,i=!0,xl(r,!1),t.lanes=4194304)}}else{if(!i){if(e=Wo(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,bl(t,e),xl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!F)return Sl(t),null}else 2*Ke()-r.renderingStartTime>Sd&&n!==536870912&&(t.flags|=128,i=!0,xl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ke(),e.sibling=null,o=Vo.current,o=i?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||F?Ho(t,o):(n=o,A(Po,t),A(Vo,n),Fo===null&&(Fo=t)),F&&ra(t,r.treeForkCount),e}return Sl(t),null;case 22:case 23:return Bo(t),No(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Sl(t),t.subtreeFlags&6&&(t.flags|=8192)):Sl(t),n=t.updateQueue,n!==null&&bl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&Te(Ja),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Sa(Pa),Sl(t),null;case 25:return null;case 30:return t.flags|=33554432,Sl(t),null}throw Error(a(156,t.tag))}function wl(e,t){switch(oa(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Sa(Pa),je(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ne(t),null;case 31:if(t.memoizedState!==null){if(Bo(t),t.alternate===null)throw Error(a(340));ha()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Bo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));ha()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Uo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return je(),null;case 10:return Sa(t.type),null;case 22:case 23:return Bo(t),No(),e!==null&&Te(Ja),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Sa(Pa),null;case 25:return null;default:return null}}function Tl(e,t){switch(oa(t),t.tag){case 3:Sa(Pa),je();break;case 26:case 27:case 5:Ne(t);break;case 4:je();break;case 31:t.memoizedState!==null&&Bo(t);break;case 13:Bo(t);break;case 19:Uo(t);break;case 10:Sa(t.type);break;case 22:case 23:Bo(t),No(),e!==null&&Te(Ja);break;case 24:Sa(Pa)}}function El(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){G(t,t.return,e)}}function Dl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){G(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){G(t,t.return,e)}}function Ol(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Oo(t,n)}catch(t){G(e,e.return,t)}}}function kl(e,t,n){n.props=Ec(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){G(e,t,n)}}function Al(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=Si(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Rp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new zp(e);p(e.child,!1,nm,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){G(e,t,n)}}function jl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){G(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){G(e,t,n)}else n.current=null}}function Ml(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)im(e.stateNode,t[n])}function Nl(e){for(var t=e.return;t!==null&&(Il(t)&&im(e.stateNode,t.stateNode),!Fl(t));)t=t.return}function Pl(e){for(var t=e.return;t!==null&&(Il(t)&&am(e.stateNode,t.stateNode),!Fl(t));)t=t.return}function Fl(e){return e.tag===5||e.tag===3||e.tag===27}function Il(e){return e&&e.tag===7&&e.stateNode!==null}function Ll(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){G(e,e.return,t)}}function Rl(e,t,n){try{var r=e.stateNode;cp(r,e.type,n,t),r[Ot]=t}catch(t){G(e,e.return,t)}}function zl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ep(e.type)||e.tag===4}function Bl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||zl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ep(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Vl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=wn)),Ml(e,r),M=!0;else if(i!==4&&(i===27&&(Ml(e,r),r=null,Ep(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Vl(e,t,n,r),e=e.sibling;e!==null;)Vl(e,t,n,r),e=e.sibling}function Hl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Ml(e,r),M=!0;else if(i!==4&&(i===27&&(Ml(e,r),r=null,Ep(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Hl(e,t,n,r),e=e.sibling;e!==null;)Hl(e,t,n,r),e=e.sibling}function Ul(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);op(t,r,n),t[Dt]=e,t[Ot]=n}catch(t){G(e,e.return,t)}}var Wl=!1,Gl=null;function Kl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Wl=!0)}var ql=null;function Jl(){var e=ql;return ql=null,e}var Yl=0;function Xl(e,t,n,r,i){return Yl=0,Zl(e.child,t,n,r,i)}function Zl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Mp(o);r.push(s),s.view&&(a=!0)}else a||Mp(o).view&&(a=!0);Wl=!0,kp(o,Yl===0?t:t+`_`+Yl,n),Yl++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||Zl(e.child,t,n,r,i)&&(a=!0));e=e.sibling}return a}function Ql(e,t){for(;e!==null;)e.tag===5?Ap(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Ql(e.child,t)),e=e.sibling}function $l(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&($l(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(a(544));var n=t.name;t=wi(t.default,t.share),t!==`none`&&(Xl(e,n,t,null,!1)||Ql(e.child,!1))}e=e.sibling}}function eu(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=Si(r,n),a=wi(r.default,n.paired?r.share:r.enter);a===`none`?$l(e):Xl(e,i,a,null,!1)?($l(e),n.paired||t||zd(e,r.onEnter)):Ql(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)eu(e,t),e=e.sibling;else $l(e)}function tu(e){if(Gl!==null&&Gl.size!==0){var t=Gl;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=wi(n.default,n.share);if(a!==`none`&&(Xl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,zd(e,n.onShare)):Ql(e.child,!1)),t.delete(r),t.size===0)break}}}tu(e)}e=e.sibling}}}function nu(e){if(e.tag===30){var t=e.memoizedProps,n=Si(t,e.stateNode),r=Gl===null?void 0:Gl.get(n),i=wi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Xl(e,n,i,null,!1)?r===void 0?zd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Gl.delete(n),zd(e,t.onShare)):Ql(e.child,!1)),Gl!==null&&tu(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)nu(e),e=e.sibling;else Gl!==null&&tu(e)}function ru(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=Si(t,e.stateNode);t=wi(t.default,t.update),e.flags&=-5,t!==`none`&&Xl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&ru(e);e=e.sibling}}function iu(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Ql(e.child,!1))}iu(e)}e=e.sibling}}function au(e){if(e.tag===30)e.stateNode.paired=null,Ql(e.child,!1),iu(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)au(e),e=e.sibling;else iu(e)}function ou(e){for(e=e.child;e!==null;)e.tag===30?Ql(e.child,!1):e.subtreeFlags&33554432&&ou(e),e=e.sibling}function su(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Yl<a.length){var l=a[Yl],u=Mp(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&kp(c,Yl===0?n:n+`_`+Yl,i),s&&e.flags&4||(ql===null&&(ql=[]),ql.push(c,Yl===0?r:r+`_`+Yl,t.memoizedProps)),Yl++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:su(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function cu(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=Si(n,r),a=wi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(Np)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Yl=0,i=su(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||zd(e,n.onUpdate))}else e.subtreeFlags&33554432&&cu(e,t);e=e.sibling}}var lu=!1,B=!1,uu=!1,du=!1,fu=typeof WeakSet==`function`?WeakSet:Set,pu=null,mu=!1,hu=!1,gu=!1,_u=!1;function vu(e,t,n){if(e=e.containerInfo,dp=vh,e=Qr(e),$r(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(fp={focusedElem:e,selectionRange:r},vh=!1,n=(n&335544064)===n,pu=t,t=n?9270:1024;pu!==null;){if(e=pu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&nu(r[a]);if(e.alternate===null&&e.flags&2)n&&Kl(e),yu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&nu(r),yu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Kl(e),yu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,pu=r):(n&&ru(e),yu(n))}}Gl=null}function yu(e){for(;pu!==null;){var t=pu,n=e,r=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(i&1024&&r!==null){n=void 0,i=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=Ec(t.type,i);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){G(t,t.return,e)}}break;case 3:if(i&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)om(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:om(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=Si(r.memoizedProps,r.stateNode),i=t.memoizedProps,i=wi(i.default,i.update),i!==`none`&&Xl(r,n,i,r.memoizedState=[],!0));break;default:if(i&1024)throw Error(a(163))}if(r=t.sibling,r!==null){r.return=t.return,pu=r;break}pu=t.return}}function bu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Bu(e,n),r&4&&El(5,n);break;case 1:if(Bu(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){G(n,n.return,e)}else{var i=Ec(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){G(n,n.return,e)}}}r&64&&Ol(n),r&512&&Al(n,n.return);break;case 3:if(Bu(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Oo(e,t)}catch(e){G(n,n.return,e)}}break;case 27:t===null&&r&4&&Ul(n);case 26:case 5:Bu(e,n),t===null&&r&4&&Ll(n),r&512&&Al(n,n.return);break;case 12:Bu(e,n);break;case 31:Bu(e,n),r&4&&ku(e,n);break;case 13:Bu(e,n),r&4&&Au(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Sf.bind(null,n),dm(e,n))));break;case 22:if(r=n.memoizedState!==null||lu,!r){var a=t!==null&&t.memoizedState!==null||B;t=lu,i=B,lu=r,(B=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Hu(e,n,r)):Bu(e,n),lu=t,B=i}break;case 30:Bu(e,n),r&512&&Al(n,n.return);break;case 7:r&512&&Al(n,n.return);default:Bu(e,n)}}function xu(e,t){for(e=e.child;e!==null;)Su(e,t),e=e.sibling}function Su(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){G(e,e.return,t)}Cu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,M=!0}catch(t){G(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?Op(s,!0):Op(e.stateNode,!1)}catch(t){G(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&xu(e,t);break;default:xu(e,t)}}function Cu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:Su(n,r);break a;case 22:n.memoizedState===null&&Cu(n,r);break a;default:Cu(n,r)}}e=e.sibling}}function wu(e){var t=e.alternate;t!==null&&(e.alternate=null,wu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&It(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Tu=null,Eu=!1;function Du(e,t,n){for(n=n.child;n!==null;)Ou(e,t,n),n=n.sibling}function Ou(e,t,n){if(tt&&typeof tt.onCommitFiberUnmount==`function`)try{tt.onCommitFiberUnmount(et,n)}catch{}switch(n.tag){case 26:B||jl(n,t),Du(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!B&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:B||jl(n,t),Pl(n);var r=Tu,i=Eu;Ep(n.type)&&(Tu=n.stateNode,Eu=!1),Du(e,t,n),ym(n.stateNode,n.type,n.memoizedProps),Tu=r,Eu=i;break;case 5:B||jl(n,t),Pl(n);case 6:if(n.tag===6&&Pl(n),r=Tu,i=Eu,Tu=null,Du(e,t,n),Tu=r,Eu=i,Tu!==null){if(Eu)try{(Tu.nodeType===9?Tu.body:Tu.nodeName===`HTML`?Tu.ownerDocument.body:Tu).removeChild(n.stateNode),M=!0}catch(e){G(n,t,e)}else try{Tu.removeChild(n.stateNode),M=!0}catch(e){G(n,t,e)}}break;case 18:Tu!==null&&(Eu?(e=Tu,Dp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Wh(e)):Dp(Tu,n.stateNode));break;case 4:r=Tu,i=Eu,Tu=n.stateNode.containerInfo,Eu=!0,Du(e,t,n),Tu=r,Eu=i;break;case 0:case 11:case 14:case 15:Dl(2,n,t),B||Dl(4,n,t),Du(e,t,n);break;case 1:B||(jl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&kl(n,t,r)),Du(e,t,n);break;case 21:Du(e,t,n);break;case 22:B=(r=B)||n.memoizedState!==null,Du(e,t,n),B=r;break;case 30:jl(n,t),Du(e,t,n);break;case 7:B||jl(n,t),Du(e,t,n);break;default:Du(e,t,n)}}function ku(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Wh(e)}catch(e){G(t,t.return,e)}}}function Au(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Wh(e)}catch(e){G(t,t.return,e)}}function ju(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new fu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new fu),t;default:throw Error(a(435,e.tag))}}function Mu(e,t){var n=ju(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Cf.bind(null,e,t);t.then(r,r)}})}function Nu(e,t,n){var r=t.deletions;if(r!==null)for(var i=0;i<r.length;i++){var o=r[i],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Ep(l.type)){Tu=l.stateNode,Eu=!1;break a}break;case 5:Tu=l.stateNode,Eu=!1;break a;case 3:case 4:Tu=l.stateNode.containerInfo,Eu=!0;break a}l=l.return}if(Tu===null)throw Error(a(160));Ou(s,c,o),Tu=null,Eu=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Fu(t,e,n),t=t.sibling}var Pu=null;function Fu(e,t,n){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(i&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}Nu(t,e,n),Iu(e),i&4&&(Dl(3,e,e.return),El(3,e),Dl(5,e,e.return));break;case 1:Nu(t,e,n),Iu(e),i&512&&(B||r===null||jl(r,r.return)),i&64&&lu&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=Pu,Nu(t,e,n),Iu(e),i&512&&(B||r===null||jl(r,r.return)),i&4){if(i=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(lu)e.stateNode=gp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,i=o.ownerDocument||o;b:switch(t){case`title`:r=i.getElementsByTagName(`title`)[0],(!r||r[Pt]||r[Dt]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=i.createElement(t),i.head.insertBefore(r,i.querySelector(`head > title`))),op(r,t,n),r[Dt]=e,Ht(r),t=r;break a;case`link`:if(o=Jm(`link`,`href`,i).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=i.createElement(t),op(r,t,n),i.head.appendChild(r);break;case`meta`:if(o=Jm(`meta`,`content`,i).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=i.createElement(t),op(r,t,n),i.head.appendChild(r);break;default:throw Error(a(468,t))}r[Dt]=e,Ht(r),t=r}e.stateNode=t}}else lu||Ym(o,e.type,e.stateNode)}else e.stateNode=Um(o,n,e.memoizedProps)}else i===n?n===null&&e.stateNode!==null&&Rl(e,e.memoizedProps,r.memoizedProps):(i===null?(t=r.stateNode,t===null||B||t.parentNode.removeChild(t)):i.count--,n===null?lu||Ym(o,e.type,e.stateNode):Um(o,n,e.memoizedProps))}break;case 27:Nu(t,e,n),Iu(e),i&512&&(B||r===null||jl(r,r.return)),r!==null&&i&4&&Rl(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=uu,uu=!1,Nu(t,e,n),uu=o,Iu(e),i&512&&(B||r===null||jl(r,r.return)),e.flags&32){t=e.stateNode;try{gn(t,``),M=!0}catch(t){G(e,e.return,t)}}i&4&&e.stateNode!=null&&(t=e.memoizedProps,Rl(e,t,r===null?t:r.memoizedProps)),i&1024&&(du=!0);break;case 6:if(Nu(t,e,n),Iu(e),i&4){if(e.stateNode===null)throw Error(a(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,M=!0}catch(t){G(e,e.return,t)}}break;case 3:if(M=!1,qm=null,o=Pu,Pu=Cm(t.containerInfo),Nu(t,e,n),Pu=o,Iu(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{Wh(t.containerInfo)}catch(t){G(e,e.return,t)}du&&(du=!1,Lu(e)),M=!1;break;case 4:i=uu,uu=lu,r=Qt(),o=Pu,Pu=Cm(e.stateNode.containerInfo),Nu(t,e,n),Iu(e),Pu=o,M&&hu&&(gu=!0),M=r,uu=i;break;case 12:Nu(t,e,n),Iu(e);break;case 31:Nu(t,e,n),Iu(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Mu(e,t)));break;case 13:Nu(t,e,n),Iu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(bd=Ke()),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Mu(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=lu,l=B,u=uu;lu=c||o,uu=u||o,B=l||s,Nu(t,e,n),B=l,uu=u,lu=c,Iu(e),i&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||lu||B||(t=s||B,n=lu,r=B,lu=o||lu,B=t,Vu(e,2),lu=n,B=r),!o&&uu||xu(e,o)),i&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Mu(e,n))));break;case 19:Nu(t,e,n),Iu(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Mu(e,t)));break;case 30:i&512&&(B||r===null||jl(r,r.return)),i=Qt(),o=hu,s=(n&335544064)===n,c=e.memoizedProps,hu=s&&wi(c.default,c.update)!==`none`,Nu(t,e,n),Iu(e),s&&r!==null&&M&&(e.flags|=4),hu=o,M=i;break;case 21:break;case 7:i&512&&(B||r===null||jl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Nu(t,e,n),Iu(e)}}function Iu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(zl(r)){n=r;break}r=r.return}r=null;for(var i=e.return;i!==null;){if(Il(i)){var o=i.stateNode;r===null?r=[o]:r.push(o)}if(Fl(i))break;i=i.return}var s=r;if(n==null)throw Error(a(160));switch(n.tag){case 27:var c=n.stateNode;Hl(e,Bl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(gn(l,``),n.flags&=-33),Hl(e,Bl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;Vl(e,Bl(e),u,s);break;default:throw Error(a(161))}}catch(t){G(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Lu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Lu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,vh=!0,t.reset(),vh=!1),e=e.sibling}}function Ru(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)zu(t,e),t=t.sibling;else cu(t,!1)}function zu(e,t){var n=e.alternate;if(n===null)eu(e,!1);else switch(e.tag){case 3:if(_u=mu=!1,Jl(),Ru(t,e),!mu&&!gu){if(e=ql,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Ap(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),_u=!0}ql=null;break;case 5:Ru(t,e);break;case 4:r=mu,mu=!1,Ru(t,e),mu&&(gu=!0),mu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Ru(t,e):eu(e,!1));break;case 30:r=mu,i=Jl(),mu=!1,Ru(t,e),mu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=Si(a,o),o=Si(n.memoizedProps,o);var s=wi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Yl=0,t=su(e,n,t,o,s,a,!0),Yl!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(zd(e,e.memoizedProps.onUpdate),ql=i):i!==null&&(i.push.apply(i,ql),ql=i),mu=e.flags&32?!0:r;break;default:Ru(t,e)}}function Bu(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)bu(e,t.alternate,t),t=t.sibling}function Vu(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:Dl(4,n,n.return),Vu(n,r);break;case 1:jl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&kl(n,n.return,i),Vu(n,r);break;case 27:r&2&&ym(n.stateNode,n.type,n.memoizedProps);case 5:jl(n,n.return),n.tag!==5&&n.tag!==27||Pl(n),Vu(n,r);break;case 6:Pl(n);break;case 26:jl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||B||i.parentNode.removeChild(i),Vu(n,r);break;case 22:n.memoizedState===null&&Vu(n,r);break;case 30:jl(n,n.return),Vu(n,r);break;case 7:jl(n,n.return);default:Vu(n,r)}e=e.sibling}}function Hu(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Hu(i,a,n),El(4,a);break;case 1:if(Hu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){G(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)Do(l[i],c)}catch(e){G(r,r.return,e)}}s&&o&64&&Ol(a),Al(a,a.return);break;case 27:n&2&&Ul(a);case 5:a.tag!==5&&a.tag!==27||Nl(a),Hu(i,a,n),s&&r===null&&o&4&&Ll(a),Al(a,a.return);break;case 6:Nl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||lu||Ym(Cm(c.ownerDocument),a.type,c),Hu(i,a,n),s&&r===null&&o&4&&Ll(a),Al(a,a.return);break;case 12:Hu(i,a,n);break;case 31:Hu(i,a,n),s&&o&4&&ku(i,a);break;case 13:Hu(i,a,n),s&&o&4&&Au(i,a);break;case 22:a.memoizedState===null&&Hu(i,a,n),Al(a,a.return);break;case 30:Hu(i,a,n),Al(a,a.return);break;case 7:Al(a,a.return);default:Hu(i,a,n)}t=t.sibling}}function Uu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Ia(n))}function Wu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ia(e))}function Gu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Ku(e,t,n,r),t=t.sibling;else i&&ou(t)}function Ku(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&au(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Gu(e,t,n,r),a&2048&&El(9,t);break;case 1:Gu(e,t,n,r);break;case 3:Gu(e,t,n,r),i&&_u&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Ia(a)));break;case 12:if(a&2048){Gu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){G(t,t.return,e)}}else Gu(e,t,n,r);break;case 31:Gu(e,t,n,r);break;case 13:Gu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&au(t),o._visibility&2?Gu(e,t,n,r):(o._visibility|=2,qu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&au(s),o._visibility&2?Gu(e,t,n,r):Ju(e,t)),a&2048&&Uu(s,t);break;case 24:Gu(e,t,n,r),a&2048&&Wu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Ql(a.child,!0),Ql(t.child,!0))),Gu(e,t,n,r);break;default:Gu(e,t,n,r)}}function qu(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:qu(a,o,s,c,i),El(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,qu(a,o,s,c,i)):u._visibility&2?qu(a,o,s,c,i):Ju(a,o),i&&l&2048&&Uu(o.alternate,o);break;case 24:qu(a,o,s,c,i),i&&l&2048&&Wu(o.alternate,o);break;default:qu(a,o,s,c,i)}t=t.sibling}}function Ju(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Ju(n,r),i&2048&&Uu(r.alternate,r);break;case 24:Ju(n,r),i&2048&&Wu(r.alternate,r);break;default:Ju(n,r)}t=t.sibling}}var Yu=8192;function Xu(e,t,n){if(e.subtreeFlags&Yu)for(e=e.child;e!==null;)Zu(e,t,n),e=e.sibling}function Zu(e,t,n){switch(e.tag){case 26:Xu(e,t,n),e.flags&Yu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&eh(n,e)):th(n,Pu,e.memoizedState,e.memoizedProps));break;case 5:Xu(e,t,n),e.flags&Yu&&(e=e.stateNode,(t&335544128)===t&&eh(n,e));break;case 3:case 4:var r=Pu;Pu=Cm(e.stateNode.containerInfo),Xu(e,t,n),Pu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Yu,Yu=16777216,Xu(e,t,n),Yu=r):Xu(e,t,n));break;case 30:if((e.flags&Yu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Gl===null&&(Gl=new Map),Gl.set(r,i)}Xu(e,t,n);break;default:Xu(e,t,n)}}function Qu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function $u(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];pu=r,nd(r,e)}Qu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)ed(e),e=e.sibling}function ed(e){switch(e.tag){case 0:case 11:case 15:$u(e),e.flags&2048&&Dl(9,e,e.return);break;case 3:$u(e);break;case 12:$u(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,td(e)):$u(e);break;default:$u(e)}}function td(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];pu=r,nd(r,e)}Qu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Dl(8,t,t.return),td(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,td(t));break;default:td(t)}e=e.sibling}}function nd(e,t){for(;pu!==null;){var n=pu;switch(n.tag){case 0:case 11:case 15:Dl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Ia(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,pu=r;else a:for(n=e;pu!==null;){r=pu;var i=r.sibling,a=r.return;if(wu(r),r===n){pu=null;break a}if(i!==null){i.return=a,pu=i;break a}pu=a}}}var rd={getCacheForType:function(e){var t=Oa(Pa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Oa(Pa).controller.signal}},id=typeof WeakMap==`function`?WeakMap:Map,V=0,ad=null,H=null,U=0,W=0,od=null,sd=!1,cd=!1,ld=!1,ud=0,dd=0,fd=0,pd=0,md=0,hd=0,gd=0,_d=null,vd=null,yd=!1,bd=0,xd=0,Sd=1/0,Cd=null,wd=null,Td=0,Ed=null,Dd=null,Od=0,kd=0,Ad=null,jd=null,Md=null,Nd=null,Pd=null,Fd=0,Id=null;function Ld(){return V&2&&U!==0?U&-U:O.T===null?wt():q()}function Rd(){if(hd===0){if(!(U&536870912)||F){var e=ct;ct<<=1,!(ct&3932160)&&(ct=262144),hd=e}else hd=536870912}return e=Po.current,e!==null&&(e.flags|=32),hd}function zd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Rp(Si(e.memoizedProps,n))),Nd===null&&(Nd=[]),Nd.push(t.bind(null,r))}}function Bd(e,t,n){(e===ad&&(W===2||W===9)||e.cancelPendingCommit!==null)&&(qd(e,0),Wd(e,U,hd,!1)),_t(e,n),(!(V&2)||e!==ad)&&(e===ad&&(!(V&2)&&(pd|=n),dd===4&&Wd(e,U,hd,!1)),jf(e))}function Vd(e,t,n){if(V&6)throw Error(a(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||ft(e,t),i=r?tf(e,t):$d(e,t,!0),o=r;do{if(i===0){cd&&!r&&Wd(e,t,0,!1);break}if(n=e.current.alternate,o&&!Ud(n)){i=$d(e,t,!1),o=!1;continue}if(i===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;i=_d;var l=c.current.memoizedState.isDehydrated;if(l&&(qd(c,s).flags|=256),s=$d(c,s,!1),s!==2&&s!==6){if(ld&&!l){c.errorRecoveryDisabledLanes|=o,pd|=o,i=4;break a}o=vd,vd=i,o!==null&&(vd===null?vd=o:vd.push.apply(vd,o))}i=s}if(o=!1,i!==2)continue}}if(i===1){qd(e,0),Wd(e,t,0,!0);break}a:{switch(r=e,o=i,o){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Wd(r,t,hd,!sd);break a;case 2:vd=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(i=bd+300-Ke(),10<i)){if(Wd(r,t,hd,!sd),dt(r,0,!0)!==0)break a;Od=t,r.timeoutHandle=bp(Hd.bind(null,r,n,vd,Cd,yd,t,hd,pd,gd,sd,o,`Throttled`,-0,0),i);break a}Hd(r,n,vd,Cd,yd,t,hd,pd,gd,sd,o,null,-0,0)}break}while(1);jf(e)}function Hd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;if(d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:wn},Gl=null,Zu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=ih.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?bd-Ke():(a&4194048)===a?xd-Ke():0,m=Z(d,m),m!==null)){Od=a,e.cancelPendingCommit=m(lf.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Wd(e,a,o,!l);return}lf(e,t,a,n,r,i,o,s,c,l,u,d)}function Ud(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Kr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Wd(e,t,n,r){t=pt(e,t),t&=~md,t&=~pd,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-rt(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&yt(e,n,t)}function Gd(){return V&6?!0:(Mf(0,!1),!1)}function Kd(){if(H!==null){if(W===0)var e=H.return;else e=H,ba=ya=null,cs(e),co=null,lo=0,e=H;for(;e!==null;)Tl(e.alternate,e),e=e.return;H=null}}function qd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,xp(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Od=0,Kd(),ad=e,H=n=zi(e.current,null),U=t,W=0,od=null,sd=!1,cd=ft(e,t),ld=!1,gd=hd=md=pd=fd=dd=0,vd=_d=null,yd=!1,ud=pt(e,t),ki(),n}function Jd(e,t){R=null,O.H=vc,t===Qa||t===eo?(t=oo(),W=3):t===$a?(t=oo(),W=4):W=t===Ic?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,od=t,H===null&&(dd=1,Ac(e,qi(t,e.current)))}function Yd(){var e=Po.current;return e===null?!0:(U&4194048)===U?Fo===null:(U&62914560)===U||U&536870912?e===Fo:!1}function Xd(){var e=O.H;return O.H=vc,e===null?vc:e}function Zd(){var e=O.A;return O.A=rd,e}function Qd(){dd=4,sd||(U&4194048)!==U&&Po.current!==null||(cd=!0),!(fd&134217727)&&!(pd&134217727)||ad===null||Wd(ad,U,hd,!1)}function $d(e,t,n){var r=V;V|=2;var i=Xd(),a=Zd();(ad!==e||U!==t)&&(Cd=null,qd(e,t)),t=!1;var o=dd;a:do try{if(W!==0&&H!==null){var s=H,c=od;switch(W){case 8:Kd(),o=6;break a;case 3:case 2:case 9:case 6:Po.current===null&&(t=!0);var l=W;if(W=0,od=null,of(e,s,c,l),n&&cd){o=0;break a}break;default:l=W,W=0,od=null,of(e,s,c,l)}}ef(),o=dd;break}catch(t){Jd(e,t)}while(1);return t&&e.shellSuspendCounter++,ba=ya=null,V=r,O.H=i,O.A=a,H===null&&(ad=null,U=0,ki()),o}function ef(){for(;H!==null;)rf(H)}function tf(e,t){var n=V;V|=2;var r=Xd(),i=Zd();ad!==e||U!==t?(Cd=null,Sd=Ke()+500,qd(e,t)):cd=ft(e,t);a:do try{if(W!==0&&H!==null){t=H;var o=od;b:switch(W){case 1:W=0,od=null,of(e,t,o,1);break;case 2:case 9:if(no(o)){W=0,od=null,af(t);break}t=function(){W!==2&&W!==9||ad!==e||(W=7),jf(e)},o.then(t,t);break a;case 3:W=7;break a;case 4:W=5;break a;case 7:no(o)?(W=0,od=null,af(t)):(W=0,od=null,of(e,t,o,7));break;case 5:var s=null;switch(H.tag){case 26:s=H.memoizedState;case 5:case 27:var c=H;if(s?Qm(s):c.stateNode.complete){W=0,od=null;var l=c.sibling;if(l!==null)H=l;else{var u=c.return;u===null?H=null:(H=u,sf(u))}break b}}W=0,od=null,of(e,t,o,5);break;case 6:W=0,od=null,of(e,t,o,6);break;case 8:Kd(),dd=6;break a;default:throw Error(a(462))}}nf();break}catch(t){Jd(e,t)}while(1);return ba=ya=null,O.H=r,O.A=i,V=n,H===null?(ad=null,U=0,ki(),dd):0}function nf(){for(;H!==null&&!We();)rf(H)}function rf(e){var t=gl(e.alternate,e,ud);e.memoizedProps=e.pendingProps,t===null?sf(e):H=t}function af(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Xc(n,t,t.pendingProps,t.type,void 0,U);break;case 11:t=Xc(n,t,t.pendingProps,t.type.render,t.ref,U);break;case 5:cs(t);var r=t;r===ca&&(F?(pa(r),r.tag===5&&r.stateNode!=null&&(la=r.stateNode)):(pa(r),F=!0));default:Tl(n,t),t=H=Bi(t,ud),t=gl(n,t,ud)}e.memoizedProps=e.pendingProps,t===null?sf(e):H=t}function of(e,t,n,r){ba=ya=null,cs(t),co=null,lo=0;var i=t.return;try{if(Fc(e,i,t,n,U)){dd=1,Ac(e,qi(n,e.current)),H=null;return}}catch(t){if(i!==null)throw H=i,t;dd=1,Ac(e,qi(n,e.current)),H=null;return}t.flags&32768?(F||r===1?e=!0:cd||U&536870912?e=!1:(sd=e=!0,(r===2||r===9||r===3||r===6)&&(r=Po.current,r!==null&&r.tag===13&&(r.flags|=16384))),cf(t,e)):sf(t)}function sf(e){var t=e;do{if(t.flags&32768){cf(t,sd);return}e=t.return;var n=Cl(t.alternate,t,ud);if(n!==null){H=n;return}if(t=t.sibling,t!==null){H=t;return}H=t=e}while(t!==null);dd===0&&(dd=5)}function cf(e,t){do{var n=wl(e.alternate,e);if(n!==null){n.flags&=32767,H=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){H=e;return}H=e=n}while(e!==null);dd=6,H=null}function lf(e,t,n,r,i,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do _f();while(Td!==0);if(V&6)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));e===ad&&(H=ad=null,U=0),Dd=t,Ed=e,Od=n,Ad=i,jd=r,uf(e,t,n,s,c,l,f)}}function uf(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(kd=s,s|=Oi,vt(e,n,s,r,i,a),Nd=null,(n&335544064)===n?(Pd=za(e),r=10262):(Pd=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,wf(Xe,function(){return vf(),null})):(e.callbackNode=null,e.callbackPriority=0),Wl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=O.T,O.T=null,i=k.p,k.p=2,a=V,V|=4;try{vu(e,t,n)}finally{V=a,k.p=i,O.T=r}}Td=1,Wl?Md=Ip(o,e.containerInfo,Pd,pf,mf,ff,hf,vf,df,null,null):(pf(),mf(),hf())}function df(e){if(Td!==0){var t=Ed.onRecoverableError;t(e,{componentStack:null})}}function ff(){Td===3&&(Td=0,zu(Dd,Ed),Td=4)}function pf(){if(Td===1){Td=0;var e=Ed,t=Dd,n=Od,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=O.T,O.T=null;var i=k.p;k.p=2;var a=V;V|=4;try{hu=gu=!1,Fu(t,e,n),n=fp;var o=Qr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Zr(s.ownerDocument.documentElement,s)){if(c!==null&&$r(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Xr(s,h),v=Xr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}vh=!!dp,fp=dp=null}finally{V=a,k.p=i,O.T=r}}e.current=t,Td=2}}function mf(){if(Td===2){Td=0;var e=Ed,t=Dd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=O.T,O.T=null;var r=k.p;k.p=2;var i=V;V|=4;try{bu(e,t.alternate,t)}finally{V=i,k.p=r,O.T=n}}Td=3}}function hf(){if(Td===4||Td===3){Td=0;var e=Md;Md=null,Ge();var t=Ed,n=Dd,r=Od,i=jd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?Td=5:(Td=0,Dd=Ed=null,gf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(wd=null),Ct(r),n=n.stateNode,tt&&typeof tt.onCommitFiberRoot==`function`)try{tt.onCommitFiberRoot(et,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=O.T,a=k.p,k.p=2,O.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{O.T=n,k.p=a}}if(i=Nd,o=Pd,Pd=null,i!==null&&(Nd=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);Od&3&&_f(),jf(t),a=t.pendingLanes,r&261930&&a&42?t===Id?Fd++:(Fd=0,Id=t):(Fd=0,Id=null),Mf(0,!1)}}function gf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ia(t)))}function _f(){return Md!==null&&(Md.skipTransition(),Md=null),pf(),mf(),hf(),vf()}function vf(){if(Td!==5)return!1;var e=Ed,t=kd;kd=0;var n=Ct(Od),r=O.T,i=k.p;try{k.p=32>n?32:n,O.T=null,n=Ad,Ad=null;var o=Ed,s=Od;if(Td=0,Dd=Ed=null,Od=0,V&6)throw Error(a(331));var c=V;if(V|=4,ed(o.current),Ku(o,o.current,s,n),V=c,Mf(0,!1),tt&&typeof tt.onPostCommitFiberRoot==`function`)try{tt.onPostCommitFiberRoot(et,o)}catch{}return!0}finally{k.p=i,O.T=r,gf(e,t)}}function yf(e,t,n){t=qi(n,t),t=Mc(e.stateNode,t,2),e=xo(e,t,2),e!==null&&(_t(e,2),jf(e))}function G(e,t,n){if(e.tag===3)yf(e,e,n);else for(;t!==null;){if(t.tag===3){yf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(wd===null||!wd.has(r))){e=qi(n,e),n=Nc(2),r=xo(t,n,2),r!==null&&(Pc(n,r,t,e),_t(r,2),jf(r));break}}t=t.return}}function K(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new id;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(ld=!0,i.add(n),e=bf.bind(null,e,t,n),t.then(e,e))}function bf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ad===e&&(U&n)===n&&(dd===4||dd===3&&(U&62914560)===U&&300>Ke()-bd?V&2?md|=n:qd(e,0):md|=n,gd===U&&(gd=0)),jf(e)}function xf(e,t){t===0&&(t=ht()),e=Mi(e,t),e!==null&&(_t(e,t),jf(e))}function Sf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),xf(e,n)}function Cf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),xf(e,n)}function wf(e,t){return He(e,t)}var Tf=null,Ef=null,Df=!1,Of=!1,kf=!1,Af=0;function jf(e){e!==Ef&&e.next===null&&(Ef===null?Tf=Ef=e:Ef=Ef.next=e),Of=!0,Df||(Df=!0,Rf())}function Mf(e,t){if(!kf&&Of){kf=!0;do for(var n=!1,r=Tf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-rt(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Lf(r,a))}else a=U,a=dt(r,r===ad?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||ft(r,a)||(n=!0,Lf(r,a))}r=r.next}while(n);kf=!1}}function Nf(){Pf()}function Pf(){Of=Df=!1;var e=0;Af!==0&&yp()&&(e=Af);for(var t=Ke(),n=null,r=Tf;r!==null;){var i=r.next,a=Ff(r,t);a===0?(r.next=null,n===null?Tf=i:n.next=i,i===null&&(Ef=n)):(n=r,(e!==0||a&3)&&(Of=!0)),r=i}Td!==0&&Td!==5||Mf(e,!1),Af!==0&&(Af=0)}function Ff(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-rt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=mt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=ad,n=U,n=dt(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(W===2||W===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ue(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||ft(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ue(r),Ct(n)){case 2:case 8:n=Ye;break;case 32:n=Xe;break;case 268435456:n=j;break;default:n=Xe}return r=If.bind(null,e),n=He(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ue(r),e.callbackPriority=2,e.callbackNode=null,2}function If(e,t){if(Td!==0&&Td!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(_f()&&e.callbackNode!==n)return null;var r=U;return r=dt(e,e===ad?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Vd(e,r,t),Ff(e,Ke()),e.callbackNode!=null&&e.callbackNode===n?If.bind(null,e):null)}function Lf(e,t){if(_f())return null;Vd(e,t,!0)}function Rf(){wp(function(){V&6?He(Je,Nf):Pf()})}function q(){if(Af===0){var e=Ha;e===0&&(e=st,st<<=1,!(st&261888)&&(st=256)),Af=e}return Af}function zf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Cn(e)}function Bf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=zf((i[Ot]||null).action),o=r.submitter;o&&(t=(t=o[Ot]||null)?zf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Wn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Af!==0){var e=new FormData(i,o);ic(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),ic(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Vf=0;Vf<yi.length;Vf++){var Hf=yi[Vf];bi(Hf.toLowerCase(),`on`+(Hf[0].toUpperCase()+Hf.slice(1)))}bi(di,`onAnimationEnd`),bi(fi,`onAnimationIteration`),bi(pi,`onAnimationStart`),bi(`dblclick`,`onDoubleClick`),bi(`focusin`,`onFocus`),bi(`focusout`,`onBlur`),bi(mi,`onTransitionRun`),bi(hi,`onTransitionStart`),bi(gi,`onTransitionCancel`),bi(_i,`onTransitionEnd`),qt(`onMouseEnter`,[`mouseout`,`mouseover`]),qt(`onMouseLeave`,[`mouseout`,`mouseover`]),qt(`onPointerEnter`,[`pointerout`,`pointerover`]),qt(`onPointerLeave`,[`pointerout`,`pointerover`]),Kt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Kt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Kt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Kt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Kt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Kt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Uf=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),Wf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Uf));function Gf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ti(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ti(e)}i.currentTarget=null,a=c}}}}function J(e,t){var n=t[At];n===void 0&&(n=t[At]=new Set);var r=e+`__bubble`;n.has(r)||(Yf(t,e,2,!1),n.add(r))}function Kf(e,t,n){var r=0;t&&(r|=4),Yf(n,e,r,t)}var qf=`_reactListening`+Math.random().toString(36).slice(2);function Jf(e){if(!e[qf]){e[qf]=!0,Wt.forEach(function(t){t!==`selectionchange`&&(Wf.has(t)||Kf(t,!1,e),Kf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[qf]||(t[qf]=!0,Kf(`selectionchange`,!1,t))}}function Yf(e,t,n,r){switch(Th(t)){case 2:var i=yh;break;case 8:i=bh;break;default:i=xh}n=i.bind(null,t,n,e),i=void 0,!Mn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Xf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var c=r.stateNode.containerInfo;if(c===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;c!==null;){if(o=Lt(c),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){r=a=o;continue a}c=c.parentNode}}r=r.return}kn(function(){var r=a,i=En(n),o=[];a:{var c=vi.get(e);if(c!==void 0){var l=Wn,u=e;switch(e){case`keypress`:if(Rn(n)===0)break a;case`keydown`:case`keyup`:l=cr;break;case`focusin`:u=`focus`,l=$n;break;case`focusout`:u=`blur`,l=$n;break;case`beforeblur`:case`afterblur`:l=$n;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Zn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Qn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=dr;break;case di:case fi:case pi:l=er;break;case _i:l=fr;break;case`scroll`:case`scrollend`:l=Kn;break;case`wheel`:l=pr;break;case`copy`:case`cut`:case`paste`:l=tr;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=lr;break;case`submit`:l=ur;break;case`toggle`:case`beforetoggle`:l=mr}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=An(m,p),g!=null&&d.push(Zf(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),o.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==Tn&&(u=n.relatedTarget||n.fromElement)&&(Lt(u)||u[kt]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Lt(l):null,l!==null&&(f=s(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Zn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=lr,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:zt(c),h=l==null?u:zt(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,Lt(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?ne(c,l,$f):null,c!==null&&ep(o,u,c,d,!1),l!==null&&f!==null&&ep(o,f,l,d,!0)))}a:{if(c=r?zt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=Pr;else if(Or(c)){if(Fr)_=Wr;else{_=Hr;var v=Vr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&bn(r.elementType)&&(_=Pr):_=Ur;if(_&&=_(e,r)){kr(o,_,n,i);break a}v&&v(e,c,r)}switch(v=r?zt(r):window,e){case`focusin`:(Or(v)||v.contentEditable===`true`)&&(ti=v,ni=r,ri=null);break;case`focusout`:ri=ni=ti=null;break;case`mousedown`:ii=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:ii=!1,ai(o,n,i);break;case`selectionchange`:if(ei)break;case`keydown`:case`keyup`:ai(o,n,i)}var y;if(gr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else wr?Sr(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(yr&&n.locale!==`ko`&&(wr||b!==`onCompositionStart`?b===`onCompositionEnd`&&wr&&(y=Ln()):(Pn=i,Fn=`value`in Pn?Pn.value:Pn.textContent,wr=!0)),v=Qf(r,b),0<v.length&&(b=new nr(b,e,null,n,i),o.push({event:b,listeners:v}),y?b.data=y:(y=Cr(n),y!==null&&(b.data=y)))),(y=vr?Tr(e,n):Er(e,n))&&(b=Qf(r,`onBeforeInput`),0<b.length&&(v=new nr(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:v,listeners:b}),v.data=y)),Bf(o,e,r,n,i)}Gf(o,t)})}function Zf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Qf(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=An(e,n),i!=null&&r.unshift(Zf(e,i,a)),i=An(e,t),i!=null&&r.push(Zf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function $f(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ep(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=An(n,a),l!=null&&o.unshift(Zf(n,l,c))):i||(l=An(n,a),l!=null&&o.push(Zf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var tp=/\r\n?/g,np=/\u0000|\uFFFD/g;function rp(e){return(typeof e==`string`?e:``+e).replace(tp,`
|
|
10
|
+
`).replace(np,``)}function ip(e,t){return t=rp(t),rp(e)===t}function Y(e,t,n,r,i,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||gn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&gn(e,``+r);else return;break;case`className`:en(e,`class`,r);break;case`tabIndex`:en(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:en(e,n,r);break;case`style`:yn(e,r,o);return;case`data`:if(t!==`object`){en(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Cn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Y(e,t,`name`,i.name,i,null),Y(e,t,`formEncType`,i.formEncType,i,null),Y(e,t,`formMethod`,i.formMethod,i,null),Y(e,t,`formTarget`,i.formTarget,i,null)):(Y(e,t,`encType`,i.encType,i,null),Y(e,t,`method`,i.method,i,null),Y(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Cn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=wn);return;case`onScroll`:r!=null&&J(`scroll`,e);return;case`onScrollEnd`:r!=null&&J(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Cn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:J(`beforetoggle`,e),J(`toggle`,e),$t(e,`popover`,r);break;case`xlinkActuate`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:tn(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:tn(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:tn(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:$t(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=xn.get(n)||n,$t(e,n,r);else return}M=!0}function ap(e,t,n,r,i,o){switch(n){case`style`:yn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)gn(e,r);else if(typeof r==`number`||typeof r==`bigint`)gn(e,``+r);else return;break;case`onScroll`:r!=null&&J(`scroll`,e);return;case`onScrollEnd`:r!=null&&J(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=wn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Gt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),o=n.slice(2,i?n.length-7:void 0),t=e[Ot]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,i),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,i);break a}M=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):$t(e,n,r)}return}M=!0}function op(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:J(`error`,e),J(`load`,e);var r=!1,i=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:Y(e,t,o,s,n,null)}}i&&Y(e,t,`srcSet`,n.srcSet,n,null),r&&Y(e,t,`src`,n.src,n,null);return;case`input`:J(`invalid`,e);var c=o=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(a(137,t));break;default:Y(e,t,r,d,n,null)}}dn(e,o,c,l,u,s,i,!1);return;case`select`:for(i in J(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Y(e,t,i,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&pn(e,!!r,n,!0):pn(e,!!r,t,!1);return;case`textarea`:for(s in J(`invalid`,e),o=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(a(91));break;default:Y(e,t,s,c,n,null)}hn(e,r,i,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Y(e,t,l,r,n,null)}return;case`dialog`:J(`beforetoggle`,e),J(`toggle`,e),J(`cancel`,e),J(`close`,e);break;case`iframe`:case`object`:J(`load`,e);break;case`video`:case`audio`:for(r=0;r<Uf.length;r++)J(Uf[r],e);break;case`image`:J(`error`,e),J(`load`,e);break;case`details`:J(`toggle`,e);break;case`embed`:case`source`:case`link`:J(`error`,e),J(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:Y(e,t,u,r,n,null)}return;default:if(bn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&ap(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Y(e,t,c,r,n,null))}var sp={};function cp(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Y(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(M=!0),o=m;break;case`name`:m!==f&&(M=!0),i=m;break;case`checked`:m!==f&&(M=!0),u=m;break;case`defaultChecked`:m!==f&&(M=!0),d=m;break;case`value`:m!==f&&(M=!0),s=m;break;case`defaultValue`:m!==f&&(M=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(a(137,t));break;default:m!==f&&Y(e,t,p,m,r,f)}}un(e,s,c,l,u,d,o,i);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Y(e,t,o,null,r,l)}for(i in r)if(o=r[i],l=n[i],r.hasOwnProperty(i)&&(o!=null||l!=null))switch(i){case`value`:o!==l&&(M=!0),p=o;break;case`defaultValue`:o!==l&&(M=!0),c=o;break;case`multiple`:o!==l&&(M=!0),s=o;default:o!==l&&Y(e,t,i,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?pn(e,!!n,n?[]:``,!1):pn(e,!!n,t,!0)):pn(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Y(e,t,c,null,r,i)}for(s in r)if(i=r[s],o=n[s],r.hasOwnProperty(s)&&(i!=null||o!=null))switch(s){case`value`:i!==o&&(M=!0),p=i;break;case`defaultValue`:i!==o&&(M=!0),m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(a(91));break;default:i!==o&&Y(e,t,s,i,r,o)}mn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Y(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(M=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Y(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Y(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(a(137,t));break;default:Y(e,t,u,p,r,m)}return;default:if(bn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&ap(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||ap(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Y(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Y(e,t,f,p,r,m)}function lp(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function up(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&lp(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&lp(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var dp=null,fp=null;function pp(e){return e.nodeType===9?e:e.ownerDocument}function mp(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function hp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function gp(e,t,n,r){return n=pp(n).createElement(e),n[Dt]=r,n[Ot]=t,op(n,e,t),Ht(n),n}function _p(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var vp=null;function yp(){var e=window.event;return e&&e.type===`popstate`?e!==vp&&(vp=e,!0):(vp=null,!1)}var bp=typeof setTimeout==`function`?setTimeout:void 0,xp=typeof clearTimeout==`function`?clearTimeout:void 0,Sp=typeof Promise==`function`?Promise:void 0,Cp=typeof requestAnimationFrame==`function`?requestAnimationFrame:bp,wp=typeof queueMicrotask==`function`?queueMicrotask:Sp===void 0?bp:function(e){return Sp.resolve(null).then(e).catch(Tp)};function Tp(e){setTimeout(function(){throw e})}function Ep(e){return e===`head`}function Dp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Wh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)bm(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,bm(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Pt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&bm(e.ownerDocument.body)}n=i}while(n);Wh(t)}function Op(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function kp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ap(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function jp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Mp(e){return jp(e.getBoundingClientRect(),getComputedStyle(e),e)}function Np(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return jp(t,n,e)}function Pp(e){return e.documentElement.clientHeight}function Fp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Ip(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Pp(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=$m(f),u>nh){s.length=o;break}f=new Promise(Fp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Lp(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Lp.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:S({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Lp.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Lp.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Rp(e){return{name:e,group:new Lp(`group`,e),imagePair:new Lp(`image-pair`,e),old:new Lp(`old`,e),new:new Lp(`new`,e)}}function zp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}zp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Wp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Hp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),p(this._fragmentFiber.child,!1,Bp,e,s,r)}this._eventListeners=a}};function Bp(e,t,n,r){return v(e).addEventListener(t,n,r),!1}zp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Wp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Hp(i.optionsOrUseCapture),p(this._fragmentFiber.child,!1,Vp,e,n,i),r.splice(t,1),a!==null&&a()}};function Vp(e,t,n,r){return v(e).removeEventListener(t,n,r),!1}function Hp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Up(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Wp(e,t,n,r){if(e.length===0)return-1;r=Up(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Up(a.optionsOrUseCapture)===r)return i}return-1}zp.prototype.dispatchEvent=function(e){var t=m(this._fragmentFiber);if(t===null)return!0;t=v(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Hp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Hp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},zp.prototype.focus=function(e){p(this._fragmentFiber.child,!0,Gp,e,void 0,void 0)};function Gp(e,t){return e.tag!==6&&(e=v(e),gm(e,t))}zp.prototype.focusLast=function(e){var t=[];p(this._fragmentFiber.child,!0,Kp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Gp(t[n],e);n--);};function Kp(e,t){return t.push(e),!1}zp.prototype.blur=function(){var e=m(this._fragmentFiber);e!==null&&(e=v(e),e=pp(e).activeElement,e!==null&&p(this._fragmentFiber.child,!1,qp,e,void 0,void 0))};function qp(e,t){return e.tag!==6&&(e=v(e),e===t||e.contains(t)?(t.blur(),!0):!1)}zp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),p(this._fragmentFiber.child,!1,Jp,e,void 0,void 0)};function Jp(e,t){return e.tag!==6&&(e=v(e),t.observe(e),!1)}zp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),p(this._fragmentFiber.child,!1,Yp,e,void 0,void 0);for(var n=t=0;n<Xp.length;n++){var r=Xp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Xp[t++]=r}Xp.length=t}};function Yp(e,t){return e.tag!==6&&(e=v(e),t.unobserve(e),!1)}var Xp=[],Zp=!1;function Qp(e,t,n){Xp.push({fragmentInstance:e,observer:t,instance:n}),Zp||(Zp=!0,_m(function(){Zp=!1;var e=Xp;Xp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}zp.prototype.getClientRects=function(){var e=[];return p(this._fragmentFiber.child,!1,$p,e,void 0,void 0),e};function $p(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=v(e),t.push.apply(t,e.getClientRects());return!1}zp.prototype.getRootNode=function(e){var t=m(this._fragmentFiber);return t===null?this:v(t).getRootNode(e)},zp.prototype.compareDocumentPosition=function(e){var t=m(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];p(this._fragmentFiber.child,!1,Kp,n,void 0,void 0);var r=v(t);if(n.length===0){if(n=r,h(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=g(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=v(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=v(n[0]),i=v(n[n.length-1]);var a=h(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||em(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function em(e,t,n,r,i){var a=Lt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=m(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=ne(n,a,x),t===null?t=!1:(p(t,!0,ee,a,n),a=y,y=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=ne(r,a,x),t===null?t=!1:(p(t,!0,te,a,r),a=y,b=y=null,t=a!==null)),t):!1}function tm(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}zp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(a(566));var t=[];p(this._fragmentFiber.child,!1,Kp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=g(this._fragmentFiber);if(r=n?r[1]||r[0]||m(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=v(r),tm(e,n);return}if(r=v(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var i=t[r];i.tag===6?(i=v(i),tm(i,n)):v(i).scrollIntoView(e),r+=n?-1:1}};function nm(e,t){return e=v(e),rm(e,t),!1}function rm(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function im(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Hp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Xp.length;i++){var a=Xp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Xp[r++]=a)}Xp.length=r,n.observe(e)}),rm(e,t))}function am(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Hp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Qp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function om(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:om(n),It(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function X(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[Pt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=fm(e.nextSibling),e===null)break}return null}function sm(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=fm(e.nextSibling),e===null))return null;return e}function cm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=fm(e.nextSibling),e===null))return null;return e}function lm(e){return e.data===`$?`||e.data===`$~`}function um(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function dm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function fm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var pm=null;function mm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return fm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function hm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function gm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function _m(e){Cp(function(){Cp(function(t){return e(t)})})}function vm(e,t,n){switch(t=pp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(a(452));return e;case`head`:if(e=t.head,!e)throw Error(a(453));return e;case`body`:if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function ym(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&Y(e,t,r,null,sp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===wn&&(e.onclick=null),It(e)}function bm(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);It(e)}var xm=new Map,Sm=new Set;function Cm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var wm=k.d;k.d={f:Tm,r:Em,D:km,C:Am,L:jm,m:Mm,X:Pm,S:Nm,M:Fm};function Tm(){var e=wm.f(),t=Gd();return e||t}function Em(e){var t=Rt(e);t!==null&&t.tag===5&&t.type===`form`?oc(t):wm.r(e)}var Dm=typeof document>`u`?null:document;function Om(e,t,n){var r=Dm;if(r&&typeof t==`string`&&t){var i=ln(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Sm.has(i)||(Sm.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),op(t,`link`,e),Ht(t),r.head.appendChild(t)))}}function km(e){wm.D(e),Om(`dns-prefetch`,e,null)}function Am(e,t){wm.C(e,t),Om(`preconnect`,e,t)}function jm(e,t,n){wm.L(e,t,n);var r=Dm;if(r&&e&&t){var i=`link[rel="preload"][as="`+ln(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+ln(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+ln(n.imageSizes)+`"]`)):i+=`[href="`+ln(e)+`"]`;var a=i;switch(t){case`style`:a=Lm(e);break;case`script`:a=Vm(e)}if(!(xm.has(a)||(e=S({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),xm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Rm(a))||t===`script`&&r.querySelector(Hm(a))))){var o=r.createElement(`link`);op(o,`link`,e),t===`style`&&(o[Ft]=!0,o.onload=o.onerror=function(){Ut(o)}),Ht(o),r.head.appendChild(o)}}}function Mm(e,t){wm.m(e,t);var n=Dm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+ln(r)+`"][href="`+ln(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Vm(e)}if(!xm.has(a)&&(e=S({rel:`modulepreload`,href:e},t),xm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Hm(a)))return}r=n.createElement(`link`),op(r,`link`,e),Ht(r),n.head.appendChild(r)}}}function Nm(e,t,n){wm.S(e,t,n);var r=Dm;if(r&&e){var i=Vt(r).hoistableStyles,a=Lm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Rm(a)))s.loading=5;else{e=S({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=xm.get(a))&&Gm(e,n);var c=o=r.createElement(`link`);Ht(c),op(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Wm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Pm(e,t){wm.X(e,t);var n=Dm;if(n&&e){var r=Vt(n).hoistableScripts,i=Vm(e),a=r.get(i);a||(a=n.querySelector(Hm(i)),a||(e=S({src:e,async:!0},t),(t=xm.get(i))&&Km(e,t),a=n.createElement(`script`),Ht(a),op(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Fm(e,t){wm.M(e,t);var n=Dm;if(n&&e){var r=Vt(n).hoistableScripts,i=Vm(e),a=r.get(i);a||(a=n.querySelector(Hm(i)),a||(e=S({src:e,async:!0,type:`module`},t),(t=xm.get(i))&&Km(e,t),a=n.createElement(`script`),Ht(a),op(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Im(e,t,n,r){var i=(i=Oe.current)?Cm(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Lm(n.href),t=Vt(i).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Lm(n.href);var o=Vt(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(Rm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=xm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},xm.set(e,o)),Bm(i,e,o,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Vm(n),t=Vt(i).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Lm(e){return`href="`+ln(e)+`"`}function Rm(e){return`link[rel="stylesheet"][`+e+`]`}function zm(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function Bm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[Ft]){r.loading=1;return}}else t=e.createElement(`link`),t[Ft]=!0,t.onload=t.onerror=Ut.bind(null,t),op(t,`link`,n),Ht(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Vm(e){return`[src="`+ln(e)+`"]`}function Hm(e){return`script[async]`+e}function Um(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+ln(n.href)+`"]`);if(r)return t.instance=r,Ht(r),r;var i=S({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ht(r),op(r,`style`,i),Wm(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Lm(n.href);var o=e.querySelector(Rm(i));if(o)return t.state.loading|=4,t.instance=o,Ht(o),o;r=zm(n),(i=xm.get(i))&&Gm(r,i),o=(e.ownerDocument||e).createElement(`link`),Ht(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),op(o,`link`,r),t.state.loading|=4,Wm(o,n.precedence,e),t.instance=o;case`script`:return o=Vm(n.src),(i=e.querySelector(Hm(o)))?(t.instance=i,Ht(i),i):(r=n,(i=xm.get(o))&&(r=S({},n),Km(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Ht(i),op(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Wm(r,n.precedence,e));return t.instance}function Wm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Gm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Km(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var qm=null;function Jm(e,t,n){if(qm===null){var r=new Map,i=qm=new Map;i.set(n,r)}else i=qm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[Pt]||a[Dt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Ym(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Xm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Zm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Qm(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function $m(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function eh(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=$m(t),e.suspenseyImages.push(t)),e=ah.bind(e),t.decode().then(e,e))}function th(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Lm(r.href),a=t.querySelector(Rm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ih.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ht(a);return}a=t.ownerDocument||t,r=zm(r),(i=xm.get(i))&&Gm(r,i),a=a.createElement(`link`),Ht(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),op(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ih.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var nh=0;function Z(e,t){return e.stylesheets&&e.count===0&&sh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&sh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&nh===0&&(nh=62500*up());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&sh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>nh?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function rh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)sh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function ih(){this.count--,rh(this)}function ah(){this.imgCount--,rh(this)}var oh=null;function sh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,oh=new Map,t.forEach(ch,e),oh=null,ih.call(e))}function ch(e,t){if(!(t.state.loading&4)){var n=oh.get(e);if(n)var r=n.get(null);else{n=new Map,oh.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=ih.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var lh={$$typeof:T,Provider:null,Consumer:null,_currentValue:xe,_currentValue2:xe,_threadCount:0};function uh(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=gt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gt(0),this.hiddenUpdates=gt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function dh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new uh(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Li(3,null,null,t),e.current=a,a.stateNode=e,t=Fa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},vo(a),e}function fh(e){return e?(e=Fi,e):Fi}function ph(e,t,n,r,i,a){i=fh(i),r.context===null?r.context=i:r.pendingContext=i,r=bo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=xo(e,r,t),n!==null&&(Bd(n,e,t),So(n,e,t))}function mh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function hh(e,t){mh(e,t),(e=e.alternate)&&mh(e,t)}function gh(e){if(e.tag===13||e.tag===31){var t=Mi(e,67108864);t!==null&&Bd(t,e,67108864),hh(e,67108864)}}function _h(e){if(e.tag===13||e.tag===31){var t=Ld();t=St(t);var n=Mi(e,t);n!==null&&Bd(n,e,t),hh(e,t)}}var vh=!0;function yh(e,t,n,r){var i=O.T;O.T=null;var a=k.p;try{k.p=2,xh(e,t,n,r)}finally{k.p=a,O.T=i}}function bh(e,t,n,r){var i=O.T;O.T=null;var a=k.p;try{k.p=8,xh(e,t,n,r)}finally{k.p=a,O.T=i}}function xh(e,t,n,r){if(vh){var i=Sh(r);if(i===null)Xf(e,t,r,Ch,n),Ph(e,r);else if(Ih(i,e,t,n,r))r.stopPropagation();else if(Ph(e,r),t&4&&-1<Nh.indexOf(e)){for(;i!==null;){var a=Rt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=ut(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-rt(o);s.entanglements[1]|=c,o&=~c}jf(a),!(V&6)&&(Sd=Ke()+500,Mf(0,!1))}}break;case 31:case 13:s=Mi(a,2),s!==null&&Bd(s,a,2),Gd(),hh(a,2)}if(a=Sh(r),a===null&&Xf(e,t,r,Ch,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Xf(e,t,r,null,n)}}function Sh(e){return e=En(e),wh(e)}var Ch=null;function wh(e){if(Ch=null,e=Lt(e),e!==null){var t=s(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=c(t),e!==null)return e;e=null}else if(n===31){if(e=l(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ch=e,null}function Th(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(qe()){case Je:return 2;case Ye:return 8;case Xe:case Ze:return 32;case j:return 268435456;default:return 32}default:return 32}}var Eh=!1,Dh=null,Oh=null,kh=null,Ah=new Map,jh=new Map,Mh=[],Nh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Ph(e,t){switch(e){case`focusin`:case`focusout`:Dh=null;break;case`dragenter`:case`dragleave`:Oh=null;break;case`mouseover`:case`mouseout`:kh=null;break;case`pointerover`:case`pointerout`:Ah.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:jh.delete(t.pointerId)}}function Fh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Rt(t),t!==null&&gh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ih(e,t,n,r,i){switch(t){case`focusin`:return Dh=Fh(Dh,e,t,n,r,i),!0;case`dragenter`:return Oh=Fh(Oh,e,t,n,r,i),!0;case`mouseover`:return kh=Fh(kh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Ah.set(a,Fh(Ah.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,jh.set(a,Fh(jh.get(a)||null,e,t,n,r,i)),!0}return!1}function Lh(e){var t=Lt(e.target);if(t!==null){var n=s(t);if(n!==null){if(t=n.tag,t===13){if(t=c(n),t!==null){e.blockedOn=t,Tt(e.priority,function(){_h(n)});return}}else if(t===31){if(t=l(n),t!==null){e.blockedOn=t,Tt(e.priority,function(){_h(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Rh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Sh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Tn=r,n.target.dispatchEvent(r),Tn=null}else return t=Rt(n),t!==null&&gh(t),e.blockedOn=n,!1;t.shift()}return!0}function zh(e,t,n){Rh(e)&&n.delete(t)}function Bh(){Eh=!1,Dh!==null&&Rh(Dh)&&(Dh=null),Oh!==null&&Rh(Oh)&&(Oh=null),kh!==null&&Rh(kh)&&(kh=null),Ah.forEach(zh),jh.forEach(zh)}function Vh(e,n){e.blockedOn===n&&(e.blockedOn=null,Eh||(Eh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Bh)))}var Hh=null;function Uh(e){Hh!==e&&(Hh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Hh===e&&(Hh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(wh(r||n)===null)continue;break}var a=Rt(n);a!==null&&(e.splice(t,3),t-=3,ic(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Wh(e){function t(t){return Vh(t,e)}Dh!==null&&Vh(Dh,e),Oh!==null&&Vh(Oh,e),kh!==null&&Vh(kh,e),Ah.forEach(t),jh.forEach(t);for(var n=0;n<Mh.length;n++){var r=Mh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Mh.length&&(n=Mh[0],n.blockedOn===null);)Lh(n),n.blockedOn===null&&Mh.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[Ot]||null;if(typeof a==`function`)o||Uh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Ot]||null)s=o.formAction;else if(wh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Uh(n)}}}function Gh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Kh(e){this._internalRoot=e}qh.prototype.render=Kh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var n=t.current;ph(n,Ld(),e,t,null,null)},qh.prototype.unmount=Kh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ph(e.current,2,null,e,null,null),Gd(),t[kt]=null}};function qh(e){this._internalRoot=e}qh.prototype.unstable_scheduleHydration=function(e){if(e){var t=wt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Mh.length&&t!==0&&t<Mh[n].priority;n++);Mh.splice(n,0,e),n===0&&Lh(e)}};var Jh=n.version;if(Jh!==`19.3.0`)throw Error(a(527,Jh,`19.3.0`));k.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(a(188)):(e=Object.keys(e).join(`,`),Error(a(268,e)));return e=d(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Yh={bundleType:0,version:`19.3.0`,rendererPackageName:`react-dom`,currentDispatcherRef:O,reconcilerVersion:`19.3.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Xh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xh.isDisabled&&Xh.supportsFiber)try{et=Xh.inject(Yh),tt=Xh}catch{}}e.createRoot=function(e,t){if(!o(e))throw Error(a(299));var n=!1,r=``,i=Dc,s=Oc,c=kc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=dh(e,1,!1,null,null,n,r,null,i,s,c,Gh),e[kt]=t.current,Jf(e),new Kh(t)}})),Hn=n(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Vn()})),Un={name:`a-large-small`,size:24,node:[[`path`,{d:`m15 16 2.536-7.328a1.02 1.02 1 0 1 1.928 0L22 16`,key:`xik6mr`}],[`path`,{d:`M15.697 14h5.606`,key:`1stdlc`}],[`path`,{d:`m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16`,key:`d5nyq2`}],[`path`,{d:`M3.304 13h6.392`,key:`1q3zxz`}]]};Un.node;var Wn=k(Un),Gn={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};Gn.node;var Kn=k(Gn),qn={name:`arrow-left-right`,size:24,node:[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]};qn.node;var Jn=k(qn),Yn={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};Yn.node;var Xn=k(Yn),Zn={name:`blocks`,size:24,node:[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]};Zn.node;var Qn=k(Zn),$n={name:`book-open`,size:24,node:[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]};$n.node;var er=k($n),tr={name:`building-complex`,size:24,node:[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]],aliases:[`building-2`]};tr.node;var nr=k(tr),rr={name:`cable`,size:24,node:[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]};rr.node;var ir=k(rr),ar={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};ar.node;var or=k(ar),sr={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};sr.node;var cr=k(sr),lr={name:`cloud-alert`,size:24,node:[[`path`,{d:`M12 12v4`,key:`tww15h`}],[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.128 16.949A7 7 0 1 1 15.71 8h1.79a1 1 0 0 1 0 9h-1.642`,key:`1namsd`}]]};lr.node;var ur=k(lr),dr={name:`cloud-cog`,size:24,node:[[`path`,{d:`m10.852 19.772-.383.924`,key:`r7sl7d`}],[`path`,{d:`m13.148 14.228.383-.923`,key:`1d5zpm`}],[`path`,{d:`M13.148 19.772a3 3 0 1 0-2.296-5.544l-.383-.923`,key:`1ydik7`}],[`path`,{d:`m13.53 20.696-.382-.924a3 3 0 1 1-2.296-5.544`,key:`1m1vsf`}],[`path`,{d:`m14.772 15.852.923-.383`,key:`660p6e`}],[`path`,{d:`m14.772 18.148.923.383`,key:`hrcpis`}],[`path`,{d:`M4.2 15.1a7 7 0 1 1 9.93-9.858A7 7 0 0 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.2`,key:`j2q98n`}],[`path`,{d:`m9.228 15.852-.923-.383`,key:`1p9ong`}],[`path`,{d:`m9.228 18.148-.923.383`,key:`6558rz`}]]};dr.node;var fr=k(dr),pr={name:`cloud`,size:24,node:[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]};pr.node;var mr=k(pr),hr={name:`cpu`,size:24,node:[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]};hr.node;var gr=k(hr),_r={name:`credit-card`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}],[`path`,{d:`M6 14h2`,key:`mk7k0u`}]]};_r.node;var vr=k(_r),yr={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};yr.node;var br=k(yr),xr={name:`fingerprint-pattern`,size:24,node:[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]],aliases:[`fingerprint`]};xr.node;var Sr=k(xr),Cr={name:`folder-up`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`m9 13 3-3 3 3`,key:`1pxg3c`}]]};Cr.node;var wr=k(Cr),Tr={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};Tr.node;var Er=k(Tr),Dr={name:`git-merge`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]};Dr.node;var Or=k(Dr),kr={name:`hard-drive`,size:24,node:[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]};kr.node;var Ar=k(kr),jr={name:`highlighter`,size:24,node:[[`path`,{d:`m9 11-6 6v3h9l3-3`,key:`1a3l36`}],[`path`,{d:`m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4`,key:`14a9rk`}]]};jr.node;var Mr=k(jr),Nr={name:`house`,size:24,node:[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]],aliases:[`home`]};Nr.node;var Pr=k(Nr),Fr={name:`images`,size:24,node:[[`path`,{d:`m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16`,key:`9kzy35`}],[`path`,{d:`M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2`,key:`1t0f0t`}],[`circle`,{cx:`13`,cy:`7`,r:`1`,fill:`currentColor`,key:`1obus6`}],[`rect`,{x:`8`,y:`2`,width:`14`,height:`14`,rx:`2`,key:`1gvhby`}]]};Fr.node;var Ir=k(Fr),Lr={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};Lr.node;var Rr=k(Lr),zr={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};zr.node;var Br=k(zr),Vr={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};Vr.node;var Hr=k(Vr),Ur={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};Ur.node;var Wr=k(Ur),Gr={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};Gr.node;var Kr=k(Gr),qr={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};qr.node;var Jr=k(qr),Yr={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};Yr.node;var Xr=k(Yr),Zr={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};Zr.node;var Qr=k(Zr),$r={name:`mail`,size:24,node:[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]};$r.node;var ei=k($r),ti={name:`message-circle-more`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]};ti.node;var ni=k(ti),ri={name:`message-circle`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]};ri.node;var ii=k(ri),ai={name:`message-square-text`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]};ai.node;var oi=k(ai),si={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};si.node;var ci=k(si),li={name:`mic-off`,size:24,node:[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]};li.node;var ui=k(li),di={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};di.node;var fi=k(di),pi={name:`palette`,size:24,node:[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]};pi.node;var mi=k(pi),hi={name:`panel-bottom`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]};hi.node;var gi=k(hi),_i={name:`panel-left-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]],aliases:[`sidebar-open`]};_i.node;var vi=k(_i),yi={name:`panel-left`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]],aliases:[`sidebar`]};yi.node;var bi=k(yi),xi={name:`panel-right`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]};xi.node;var Si=k(xi),Ci={name:`panel-top`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};Ci.node;var wi=k(Ci),Ti={name:`phone-call`,size:24,node:[[`path`,{d:`M13 2a9 9 0 0 1 9 9`,key:`1itnx2`}],[`path`,{d:`M13 6a5 5 0 0 1 5 5`,key:`11nki7`}],[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]};Ti.node;var Ei=k(Ti),Di={name:`phone-off`,size:24,node:[[`path`,{d:`M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272`,key:`1wngk7`}],[`path`,{d:`M22 2 2 22`,key:`y4kqgn`}],[`path`,{d:`M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473`,key:`10hv5p`}]]};Di.node;var Oi=k(Di),ki={name:`radio`,size:24,node:[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]};ki.node;var Ai=k(ki),ji={name:`receipt`,size:24,node:[[`path`,{d:`M12 17V7`,key:`pyj7ub`}],[`path`,{d:`M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8`,key:`1elt7d`}],[`path`,{d:`M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z`,key:`ycz6yz`}]]};ji.node;var Mi=k(ji),Ni={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};Ni.node;var Pi=k(Ni),Fi={name:`rotate-cw`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]};Fi.node;var Ii=k(Fi),Li={name:`rows-3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]],aliases:[`panels-top-bottom`]};Li.node;var Ri=k(Li),zi={name:`scroll-text`,size:24,node:[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]};zi.node;var Bi=k(zi),Vi={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};Vi.node;var Hi=k(Vi),Ui={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};Ui.node;var Wi=k(Ui),Gi={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Gi.node;var Ki=k(Gi),qi={name:`shapes`,size:24,node:[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]};qi.node;var Ji=k(qi),Yi={name:`square-pen`,size:24,node:[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]],aliases:[`pen-box`,`edit`,`pen-square`]};Yi.node;var Xi=k(Yi),Zi={name:`swatch-book`,size:24,node:[[`path`,{d:`M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z`,key:`1ldrpk`}],[`path`,{d:`M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7`,key:`11i5po`}],[`path`,{d:`M 7 17h.01`,key:`1euzgo`}],[`path`,{d:`m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8`,key:`o2gii7`}]]};Zi.node;var Qi=k(Zi),$i={name:`thumbs-down`,size:24,node:[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]};$i.node;var ea=k($i),ta={name:`thumbs-up`,size:24,node:[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]};ta.node;var na=k(ta),ra={name:`toggle-right`,size:24,node:[[`circle`,{cx:`15`,cy:`12`,r:`3`,key:`1afu0r`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]};ra.node;var ia=k(ra),aa={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]};aa.node;var oa=k(aa),sa={name:`user-round`,size:24,node:[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]],aliases:[`user-2`]};sa.node;var ca=k(sa),la={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};la.node;var F=k(la),ua={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};ua.node;var da=k(ua),I=t(r(),1),fa=Hn(),L=t(i(),1);async function pa(){let{account:e}=await(await fetch($e(`/api/auth/sign-out`),{method:`POST`,credentials:`include`,headers:{"content-type":`application/json`},body:`{}`})).json().catch(()=>({}));if(!e){window.location.reload();return}let t=document.createElement(`form`);t.method=`POST`,t.action=e,document.body.append(t),t.submit()}function ma({name:e,until:t}){let n=new Intl.DateTimeFormat(N,{timeStyle:`short`}).format(new Date(t));return(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-x-3 gap-y-1 bg-amber-tint px-4 py-2 text-center text-[0.8125rem] text-ink`,children:[(0,L.jsx)(`span`,{children:P(`impersonation.banner`,{name:e,time:n})}),(0,L.jsx)(`button`,{type:`button`,className:`font-medium underline underline-offset-2 hover:text-ink-2`,onClick:()=>void pa(),children:P(`impersonation.back`)})]})}function ha(){let e=Ae({queryKey:[`impersonation`],queryFn:()=>p.get(`/api/public/impersonation`),staleTime:6e4,retry:!1});return e.data?(0,L.jsx)(ma,{name:e.data.name,until:e.data.until}):null}var ga=e({defineStudioPlugin:()=>_a});function _a(e){return e}var va=Bt(),ya={account:{kind:`release`,default:!0,label:`Account in a local install`,hint:`Linking, Settings → Account, the offer to sign in.`},twoWaySync:{kind:`release`,default:!0,label:`Two-way sync with the cloud`,hint:`A local install with an account keeps its spaces in step with the organization in the cloud, both ways: wizards, knowledge, data and files.`},liveChanges:{kind:`release`,default:!0,label:`Live changes in the studio`,hint:`An open studio shows what changed elsewhere (another member, a run, the AI, the sync) without a reload.`},unsetConnectors:{kind:`release`,default:!1,label:`Connectors without an OAuth client`,hint:`Built-in connectors are shown although their client is not set up.`},site:{kind:`release`,default:!1,label:`Link to the website in the setup`,hint:`The local install's setup links the product's site.`},teamPlans:{kind:`release`,default:!1,label:`Organization plans`,hint:`The organization page in the cloud studio, and plans that carry this switch on the account pages.`},organizationSettings:{kind:`release`,default:!1,label:`Organization settings in the studio`,hint:`Settings › Organisation in the cloud studio: the organization's name, its members and invitations, changed there instead of on the account pages.`},brandSections:{kind:`release`,default:!1,label:`Sections in Brand`,hint:`Sections of logos and of colours, gradients and patterns among them.`},brandRules:{kind:`release`,default:!1,label:`Rules in Brand`,hint:`Rules for how the logos, the colours and the type may be used.`},typography:{kind:`release`,default:!1,label:`Typography in Brand`,hint:`The brand's fonts, their licences and a type scale.`},channelVoice:{kind:`release`,default:!1,label:`Live voice`,hint:`Wizards run as a spoken conversation in the browser: offered when building and sharing.`},channelVideo:{kind:`release`,default:!1,label:`Video call`,hint:`Wizards run as a video call in the browser: offered when building and sharing.`},pages:{kind:`release`,default:!1,label:`Public page`,hint:`A space's page at the organization's address on wizards.page: its part in the space, the share dialog's switch.`},wordpress:{kind:`release`,default:!1,label:`WordPress plugin`,hint:`The plugin for WordPress sites, and a wizard as a package for one: offered in the share dialog and under Settings → Integrate.`},skills:{kind:`release`,default:!1,label:`Skills`,hint:`Skills in a space's sources: from skills.sh, uploaded or written; always on in every AI step, or read by a wizard when it needs one.`},plugins:{kind:`release`,default:!1,label:`Plugins in the settings`,hint:`Settings › Plugins, also before any plugin is installed. Installing a plugin turns it on.`},goose:{kind:`release`,default:!1,label:`Goose`,hint:`The studio's assistant: its chat at the foot of the page and in the sidebar.`},modelTiers:{kind:`release`,default:!1,label:`Model tiers`,hint:`The organization's model tier: steps may name a maker, calls say what they are for, and the studio shows what each class runs on in the tier.`},customDomains:{kind:`release`,default:!1,label:`Own domains`,hint:`Settings › Allgemein: the organization's wizards under a domain of its own, once a TXT record confirms it.`},ownKeys:{kind:`plan`,default:!0,label:`Own API keys`,hint:`The organization puts its providers' keys into the cloud studio instead of running on credits.`}};function ba(e,t){let n=e?.[t];return typeof n==`boolean`?n:Object.hasOwn(ya,t)?ya[t].default:!1}function xa(e=ya){let t={};for(let[n,r]of Object.entries(e))t[n]=r.default;return t}var Sa=[`left`,`top`,`right`,`bottom`],Ca=`wizards.appbar`,wa={position:`left`,labels:!0},Ta=e=>Sa.includes(e);function Ea(){try{let e=JSON.parse(localStorage.getItem(Ca)??`null`);return{position:Ta(e?.position)?e.position:wa.position,labels:typeof e?.labels==`boolean`?e.labels:wa.labels}}catch{return wa}}var Da=Ea(),Oa=new Set;function ka(e){Da={...Da,...e};try{localStorage.setItem(Ca,JSON.stringify(Da))}catch{}for(let e of Oa)e()}function Aa(){return Pn(`(max-width: 767px)`)}function ja(){let e=(0,I.useSyncExternalStore)(e=>(Oa.add(e),()=>Oa.delete(e)),()=>Da),t=Aa();return(0,I.useMemo)(()=>t?{...e,position:`bottom`,phone:t}:{...e,phone:t},[e,t])}var Ma=e=>e===`top`||e===`bottom`;function Na(e){let{position:t,labels:n}=ja(),r=Pn(`(min-width: 1400px)`)&&!Ma(t)&&!e;return{shown:n&&r,room:r}}function Pa(e,t){switch(e){case`left`:return t===`start`?`top-0 left-full ml-3`:`bottom-0 left-full ml-3`;case`right`:return t===`start`?`top-0 right-full mr-3`:`bottom-0 right-full mr-3`;case`top`:return t===`start`?`top-full left-0 mt-3`:`top-full right-0 mt-3`;case`bottom`:return t===`start`?`bottom-full left-0 mb-3`:`bottom-full right-0 mb-3`}}function Fa(){return Ae({queryKey:[`config`],queryFn:async()=>{let e=await p.get(`/api/config`);return We(e.publicUrl),e},staleTime:6e4})}function Ia(){let e=$t(),t=Fa();return e.data?.features??t.data?.features??xa()}function La(e){return ba(Ia(),e)}var Ra=()=>matchMedia(`(display-mode: standalone)`).matches||matchMedia(`(display-mode: window-controls-overlay)`).matches||navigator.standalone===!0,za=()=>navigator.userAgent,Ba=()=>/iPhone|iPad|iPod/.test(za())||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,Va=()=>!!navigator.userAgentData?.brands?.length||/Chrome|Chromium|Edg/.test(za()),Ha=()=>/Safari/.test(za())&&!/Chrome|Chromium|Edg|Firefox|FxiOS/.test(za());function Ua(e){return e?`prompt`:/Android/.test(za())?Va()?`android`:`none`:Ba()?`ios`:Ha()?`mac`:Va()?`chromium`:`none`}function Wa(){return(0,I.useSyncExternalStore)(e=>(window.addEventListener(`wizard-install`,e),window.addEventListener(`appinstalled`,e),()=>{window.removeEventListener(`wizard-install`,e),window.removeEventListener(`appinstalled`,e)}),()=>window.wizardInstall??null)}async function Ga(e){try{await e.prompt()}finally{window.wizardInstall=null,window.dispatchEvent(new Event(`wizard-install`))}}function Ka(e,t){return e[13]=1,e[14]=t>>8,e[15]=t&255,e[16]=t>>8,e[17]=t&255,e}var qa=112,Ja=72,Ya=89,Xa=115,Za;function Qa(){let e=new Int32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}return e}function $a(e){let t=-1;Za||=Qa();for(let n=0;n<e.length;n++)t=Za[(t^e[n])&255]^t>>>8;return t^-1}function eo(e){let t=e.length-1;for(let n=t;n>=4;n--)if(e[n-4]===9&&e[n-3]===qa&&e[n-2]===Ja&&e[n-1]===Ya&&e[n]===Xa)return n-3;return 0}function to(e,t,n=!1){let r=new Uint8Array(13);t*=39.3701,r[0]=qa,r[1]=Ja,r[2]=Ya,r[3]=Xa,r[4]=t>>>24,r[5]=t>>>16,r[6]=t>>>8,r[7]=t&255,r[8]=r[4],r[9]=r[5],r[10]=r[6],r[11]=r[7],r[12]=1;let i=$a(r),a=new Uint8Array(4);if(a[0]=i>>>24,a[1]=i>>>16,a[2]=i>>>8,a[3]=i&255,n){let t=eo(e);return e.set(r,t),e.set(a,t+13),e}{let t=new Uint8Array(4);t[0]=0,t[1]=0,t[2]=0,t[3]=9;let n=new Uint8Array(54);return n.set(e,0),n.set(t,33),n.set(r,37),n.set(a,50),n}}var no=`AAlwSFlz`,ro=`AAAJcEhZ`,io=`AAAACXBI`;function ao(e){let t=e.indexOf(no);return t===-1&&(t=e.indexOf(ro)),t===-1&&(t=e.indexOf(io)),t}var oo=`[modern-screenshot]`,so=typeof window<`u`,co=so&&`Worker`in window,lo=so&&`atob`in window,uo=so&&`btoa`in window,fo=so?window.navigator?.userAgent:``,po=fo.includes(`Chrome`),mo=fo.includes(`AppleWebKit`)&&!po,ho=fo.includes(`Firefox`),go=e=>e&&`__CONTEXT__`in e,_o=e=>e.constructor.name===`CSSFontFaceRule`,vo=e=>e.constructor.name===`CSSImportRule`,yo=e=>e.constructor.name===`CSSLayerBlockRule`,bo=e=>e.nodeType===1,xo=e=>typeof e.className==`object`,So=e=>e.tagName===`image`,Co=e=>e.tagName===`use`,wo=e=>bo(e)&&e.style!==void 0&&!xo(e),To=e=>e.nodeType===8,Eo=e=>e.nodeType===3,Do=e=>e.tagName===`IMG`,Oo=e=>e.tagName===`VIDEO`,ko=e=>e.tagName===`CANVAS`,Ao=e=>e.tagName===`TEXTAREA`,jo=e=>e.tagName===`INPUT`,Mo=e=>e.tagName===`STYLE`,No=e=>e.tagName===`SCRIPT`,Po=e=>e.tagName===`SELECT`,Fo=e=>e.tagName===`SLOT`,Io=e=>e.tagName===`IFRAME`,Lo=(...e)=>console.warn(oo,...e);function Ro(e){let t=e?.createElement?.(`canvas`);return t&&(t.height=t.width=1),!!t&&`toDataURL`in t&&!!t.toDataURL(`image/webp`).includes(`image/webp`)}var zo=e=>e.startsWith(`data:`);function Bo(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(so&&e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i)||!so)return e;let n=Vo().implementation.createHTMLDocument(),r=n.createElement(`base`),i=n.createElement(`a`);return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}function Vo(e){return(e&&bo(e)?e?.ownerDocument:e)??window.document}var Ho=`http://www.w3.org/2000/svg`;function Uo(e,t,n){let r=Vo(n).createElementNS(Ho,`svg`);return r.setAttributeNS(null,`width`,e.toString()),r.setAttributeNS(null,`height`,t.toString()),r.setAttributeNS(null,`viewBox`,`0 0 ${e} ${t}`),r}function Wo(e,t){let n=new XMLSerializer().serializeToString(e);return t&&(n=n.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,``)),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}function Go(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onload=()=>n(i.result),i.onerror=()=>r(i.error),i.onabort=()=>r(Error(`Failed read blob to ${t}`)),t===`dataUrl`?i.readAsDataURL(e):t===`arrayBuffer`&&i.readAsArrayBuffer(e)})}var R=e=>Go(e,`dataUrl`);function z(e,t){let n=Vo(t).createElement(`img`);return n.decoding=`sync`,n.loading=`eager`,n.src=e,n}function Ko(e,t){return new Promise(n=>{let{timeout:r,ownerDocument:i,onError:a,onWarn:o}=t??{},s=typeof e==`string`?z(e,Vo(i)):e,c=null,l=null;function u(){n(s),c&&clearTimeout(c),l?.()}if(r&&(c=setTimeout(u,r)),Oo(s)){let e=s.currentSrc||s.src;if(!e)return s.poster?Ko(s.poster,t).then(n):u();if(s.readyState>=2)return u();let r=u,i=t=>{o?.(`Failed video load`,e,t),a?.(t),u()};l=()=>{s.removeEventListener(`loadeddata`,r),s.removeEventListener(`error`,i)},s.addEventListener(`loadeddata`,r,{once:!0}),s.addEventListener(`error`,i,{once:!0})}else{let e=So(s)?s.href.baseVal:s.currentSrc||s.src;if(!e)return u();let t=async()=>{if(Do(s)&&`decode`in s)try{await s.decode()}catch(t){o?.(`Failed to decode image, trying to render anyway`,s.dataset.originalSrc||e,t)}u()},n=t=>{o?.(`Failed image load`,s.dataset.originalSrc||e,t),u()};if(Do(s)&&s.complete)return t();l=()=>{s.removeEventListener(`load`,t),s.removeEventListener(`error`,n)},s.addEventListener(`load`,t,{once:!0}),s.addEventListener(`error`,n,{once:!0})}})}async function qo(e,t){wo(e)&&(Do(e)||Oo(e)?await Ko(e,t):await Promise.all([`img`,`video`].flatMap(n=>Array.from(e.querySelectorAll(n)).map(e=>Ko(e,t)))))}var Jo=function(){let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)}();function Yo(e){return e?.split(`,`).map(e=>e.trim().replace(/"|'/g,``).toLowerCase()).filter(Boolean)}var Xo=0;function Zo(e){let t=`${oo}[#${Xo}]`;return Xo++,{time:n=>e&&console.time(`${t} ${n}`),timeEnd:n=>e&&console.timeEnd(`${t} ${n}`),warn:(...t)=>e&&Lo(...t)}}function Qo(e){return{cache:e?`no-cache`:`force-cache`}}async function $o(e,t){return go(e)?e:es(e,{...t,autoDestruct:!0})}async function es(e,t){let{scale:n=1,workerUrl:r,workerNumber:i=1}=t||{},a=!!t?.debug,o=t?.features??!0,s=e.ownerDocument??(so?window.document:void 0),c=e.ownerDocument?.defaultView??(so?window:void 0),l=new Map,u={width:0,height:0,quality:1,type:`image/png`,scale:n,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:a,fetch:{requestInit:Qo(t?.fetch?.bypassingCache),placeholderImage:`data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`,bypassingCache:!1,...t?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:i,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:!1,...t,__CONTEXT__:!0,log:Zo(a),node:e,ownerDocument:s,ownerWindow:c,dpi:n===1?null:96*n,svgStyleElement:ts(s),svgDefsElement:s?.createElementNS(Ho,`defs`),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:co&&r&&i?i:0})].map(()=>{try{let e=new Worker(r);return e.onmessage=async e=>{let{url:t,result:n}=e.data;n?l.get(t)?.resolve?.(n):l.get(t)?.reject?.(Error(`Error receiving message from worker: ${t}`))},e.onmessageerror=e=>{let{url:t}=e.data;l.get(t)?.reject?.(Error(`Error receiving message from worker: ${t}`))},e}catch(e){return u.log.warn(`Failed to new Worker`,e),null}}).filter(Boolean),fontFamilies:new Map,fontCssTexts:new Map,acceptOfImage:`${[Ro(s)&&`image/webp`,`image/svg+xml`,`image/*`,`*/*`].filter(Boolean).join(`,`)};q=0.8`,requests:l,drawImageCount:0,tasks:[],features:o,isEnable:e=>e===`restoreScrollPosition`?typeof o==`boolean`?!1:o[e]??!1:typeof o==`boolean`?o:o[e]??!0,shadowRoots:[]};u.log.time(`wait until load`),await qo(e,{timeout:u.timeout,onWarn:u.log.warn}),u.log.timeEnd(`wait until load`);let{width:d,height:f}=ns(e,u);return u.width=d,u.height=f,u}function ts(e){if(!e)return;let t=e.createElement(`style`),n=t.ownerDocument.createTextNode(`
|
|
11
|
+
.______background-clip--text {
|
|
12
|
+
background-clip: text;
|
|
13
|
+
-webkit-background-clip: text;
|
|
14
|
+
}
|
|
15
|
+
`);return t.appendChild(n),t}function ns(e,t){let{width:n,height:r}=t;if(bo(e)&&(!n||!r)){let t=e.getBoundingClientRect();n=n||t.width||Number(e.getAttribute(`width`))||0,r=r||t.height||Number(e.getAttribute(`height`))||0}return{width:n,height:r}}async function rs(e,t){let{log:n,timeout:r,drawImageCount:i,drawImageInterval:a}=t;n.time(`image to canvas`);let o=await Ko(e,{timeout:r,onWarn:t.log.warn}),{canvas:s,context2d:c}=is(e.ownerDocument,t),l=()=>{try{c?.drawImage(o,0,0,s.width,s.height)}catch(e){t.log.warn(`Failed to drawImage`,e)}};if(l(),t.isEnable(`fixSvgXmlDecode`))for(let e=0;e<i;e++)await new Promise(t=>{setTimeout(()=>{c?.clearRect(0,0,s.width,s.height),l(),t()},e+a)});return t.drawImageCount=0,n.timeEnd(`image to canvas`),s}function is(e,t){let{width:n,height:r,scale:i,backgroundColor:a,maximumCanvasSize:o}=t,s=e.createElement(`canvas`);s.width=Math.floor(n*i),s.height=Math.floor(r*i),s.style.width=`${n}px`,s.style.height=`${r}px`,o&&(s.width>o||s.height>o)&&(s.width>o&&s.height>o?s.width>s.height?(s.height*=o/s.width,s.width=o):(s.width*=o/s.height,s.height=o):s.width>o?(s.height*=o/s.width,s.width=o):(s.width*=o/s.height,s.height=o));let c=s.getContext(`2d`);return c&&a&&(c.fillStyle=a,c.fillRect(0,0,s.width,s.height)),{canvas:s,context2d:c}}function as(e,t){if(e.ownerDocument)try{let t=e.toDataURL();if(t!==`data:,`)return z(t,e.ownerDocument)}catch(e){t.log.warn(`Failed to clone canvas`,e)}let n=e.cloneNode(!1),r=e.getContext(`2d`),i=n.getContext(`2d`);try{return r&&i&&i.putImageData(r.getImageData(0,0,e.width,e.height),0,0),n}catch(e){t.log.warn(`Failed to clone canvas`,e)}return n}function os(e,t){try{if(e?.contentDocument?.documentElement)return Es(e.contentDocument.documentElement,t)}catch(e){t.log.warn(`Failed to clone iframe`,e)}return e.cloneNode(!1)}function ss(e){let t=e.cloneNode(!1);return e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=``),t.loading===`lazy`&&(t.loading=`eager`),t}async function cs(e,t){if(e.ownerDocument&&!e.currentSrc&&e.poster)return z(e.poster,e.ownerDocument);let n=e.cloneNode(!1);n.crossOrigin=`anonymous`,e.currentSrc&&e.currentSrc!==e.src&&(n.src=e.currentSrc);let r=n.ownerDocument;if(r){let i=!0;if(await Ko(n,{onError:()=>i=!1,onWarn:t.log.warn}),!i)return e.poster?z(e.poster,e.ownerDocument):n;n.currentTime=e.currentTime,await new Promise(e=>{n.addEventListener(`seeked`,e,{once:!0})});let a=r.createElement(`canvas`);a.width=e.offsetWidth,a.height=e.offsetHeight;try{let e=a.getContext(`2d`);e&&e.drawImage(n,0,0,a.width,a.height)}catch(r){return t.log.warn(`Failed to clone video`,r),e.poster?z(e.poster,e.ownerDocument):n}return as(a,t)}return n}function ls(e,t){return ko(e)?as(e,t):Io(e)?os(e,t):Do(e)?ss(e):Oo(e)?cs(e,t):e.cloneNode(!1)}function us(e){let t=e.sandbox;if(!t){let{ownerDocument:n}=e;try{n&&(t=n.createElement(`iframe`),t.id=`__SANDBOX__${Jo()}`,t.width=`0`,t.height=`0`,t.style.visibility=`hidden`,t.style.position=`fixed`,n.body.appendChild(t),t.srcdoc=`<!DOCTYPE html><meta charset="UTF-8"><title></title><body>`,e.sandbox=t)}catch(t){e.log.warn(`Failed to getSandBox`,t)}}return t}var ds=[`width`,`height`,`-webkit-text-fill-color`],fs=[`stroke`,`fill`];function ps(e,t,n){let{defaultComputedStyles:r}=n,i=e.nodeName.toLowerCase(),a=xo(e)&&i!==`svg`,o=a?fs.map(t=>[t,e.getAttribute(t)]).filter(([,e])=>e!==null):[],s=[a&&`svg`,i,o.map((e,t)=>`${e}=${t}`).join(`,`),t].filter(Boolean).join(`:`);if(r.has(s))return r.get(s);let c=us(n)?.contentWindow;if(!c)return new Map;let l=c?.document,u,d;a?(u=l.createElementNS(Ho,`svg`),d=u.ownerDocument.createElementNS(u.namespaceURI,i),o.forEach(([e,t])=>{d.setAttributeNS(null,e,t)}),u.appendChild(d)):u=d=l.createElement(i),d.textContent=` `,l.body.appendChild(u);let f=c.getComputedStyle(d,t),p=new Map;for(let e=f.length,t=0;t<e;t++){let e=f.item(t);ds.includes(e)||p.set(e,f.getPropertyValue(e))}return l.body.removeChild(u),r.set(s,p),p}function ms(e,t,n){let r=new Map,i=[],a=new Map;if(n)for(let e of n)o(e);else for(let t=e.length,n=0;n<t;n++)o(e.item(n));for(let e=i.length,t=0;t<e;t++)a.get(i[t])?.forEach((e,t)=>r.set(t,e));function o(n){let o=e.getPropertyValue(n),s=e.getPropertyPriority(n),c=n.lastIndexOf(`-`),l=c>-1?n.substring(0,c):void 0;if(l){let e=a.get(l);e||(e=new Map,a.set(l,e)),e.set(n,[o,s])}(t.get(n)!==o||s)&&(l?i.push(l):r.set(n,[o,s]))}return r}function hs(e,t,n,r){let{ownerWindow:i,includeStyleProperties:a,currentParentNodeStyle:o}=r,s=t.style,c=i.getComputedStyle(e),l=ps(e,null,r);o?.forEach((e,t)=>{l.delete(t)});let u=ms(c,l,a);u.delete(`transition-property`),u.delete(`all`),u.delete(`d`),u.delete(`content`),n&&(u.delete(`position`),u.delete(`margin-top`),u.delete(`margin-right`),u.delete(`margin-bottom`),u.delete(`margin-left`),u.delete(`margin-block-start`),u.delete(`margin-block-end`),u.delete(`margin-inline-start`),u.delete(`margin-inline-end`),u.set(`box-sizing`,[`border-box`,``])),u.get(`background-clip`)?.[0]===`text`&&t.classList.add(`______background-clip--text`),po&&(u.has(`font-kerning`)||u.set(`font-kerning`,[`normal`,``]),(u.get(`overflow-x`)?.[0]===`hidden`||u.get(`overflow-y`)?.[0]===`hidden`)&&u.get(`text-overflow`)?.[0]===`ellipsis`&&e.scrollWidth===e.clientWidth&&u.set(`text-overflow`,[`clip`,``]));for(let e=s.length,t=0;t<e;t++)s.removeProperty(s.item(t));return u.forEach(([e,t],n)=>{s.setProperty(n,e,t)}),u}function gs(e,t){(Ao(e)||jo(e)||Po(e))&&t.setAttribute(`value`,e.value)}var _s=[`::before`,`::after`],vs=[`::-webkit-scrollbar`,`::-webkit-scrollbar-button`,`::-webkit-scrollbar-thumb`,`::-webkit-scrollbar-track`,`::-webkit-scrollbar-track-piece`,`::-webkit-scrollbar-corner`,`::-webkit-resizer`];function ys(e,t,n,r,i){let{ownerWindow:a,svgStyleElement:o,svgStyles:s,currentNodeStyle:c}=r;if(!o||!a)return;function l(n){let o=a.getComputedStyle(e,n),l=o.getPropertyValue(`content`);if(!l||l===`none`)return;i?.(l),l=l.replace(/(')|(")|(counter\(.+\))/g,``);let u=[Jo()],d=ps(e,n,r);c?.forEach((e,t)=>{d.delete(t)});let f=ms(o,d,r.includeStyleProperties);f.delete(`content`),f.delete(`-webkit-locale`),f.get(`background-clip`)?.[0]===`text`&&t.classList.add(`______background-clip--text`);let p=[`content: '${l}';`];if(f.forEach(([e,t],n)=>{p.push(`${n}: ${e}${t?` !important`:``};`)}),p.length===1)return;try{t.className=[t.className,...u].join(` `)}catch(e){r.log.warn(`Failed to copyPseudoClass`,e);return}let m=p.join(`
|
|
16
|
+
`),h=s.get(m);h||(h=[],s.set(m,h)),h.push(`.${u[0]}${n}`)}_s.forEach(l),n&&vs.forEach(l)}var bs=new Set([`symbol`]);async function xs(e,t,n,r,i){if(bo(n)&&(Mo(n)||No(n))||r.filter&&!r.filter(n))return;r.currentParentNodeStyle=bs.has(t.nodeName)||bs.has(n.nodeName)?void 0:r.currentNodeStyle;let a=await Es(n,r,!1,i);r.isEnable(`restoreScrollPosition`)&&Cs(e,a),t.appendChild(a)}async function Ss(e,t,n,r){let i=e.firstChild;bo(e)&&e.shadowRoot&&(i=e.shadowRoot?.firstChild,n.shadowRoots.push(e.shadowRoot));for(let a=i;a;a=a.nextSibling)if(!To(a)){if(bo(a)&&Fo(a)&&typeof a.assignedNodes==`function`){let i=a.assignedNodes();for(let a=0;a<i.length;a++)await xs(e,t,i[a],n,r)}else await xs(e,t,a,n,r)}}function Cs(e,t){if(!wo(e)||!wo(t))return;let{scrollTop:n,scrollLeft:r}=e;if(!n&&!r)return;let{transform:i}=t.style,a=new DOMMatrix(i),{a:o,b:s,c,d:l}=a;a.a=1,a.b=0,a.c=0,a.d=1,a.translateSelf(-r,-n),a.a=o,a.b=s,a.c=c,a.d=l,t.style.transform=a.toString()}function ws(e,t){let{backgroundColor:n,width:r,height:i,style:a}=t,o=e.style;if(n&&o.setProperty(`background-color`,n,`important`),r&&o.setProperty(`width`,`${r}px`,`important`),i&&o.setProperty(`height`,`${i}px`,`important`),a)for(let e in a)o[e]=a[e]}var Ts=/^[\w-:]+$/;async function Es(e,t,n=!1,r){let{ownerDocument:i,ownerWindow:a,fontFamilies:o,onCloneEachNode:s}=t;if(i&&Eo(e))return r&&/\S/.test(e.data)&&r(e.data),i.createTextNode(e.data);if(i&&a&&bo(e)&&(wo(e)||xo(e))){let r=await ls(e,t);if(t.isEnable(`removeAbnormalAttributes`)){let e=r.getAttributeNames();for(let t=e.length,n=0;n<t;n++){let t=e[n];Ts.test(t)||r.removeAttribute(t)}}let i=t.currentNodeStyle=hs(e,r,n,t);n&&ws(r,t);let a=!1;if(t.isEnable(`copyScrollbar`)){let t=[i.get(`overflow-x`)?.[0],i.get(`overflow-y`)?.[0]];a=t.includes(`scroll`)||(t.includes(`auto`)||t.includes(`overlay`))&&(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)}let c=i.get(`text-transform`)?.[0],l=Yo(i.get(`font-family`)?.[0]),u=l?e=>{c===`uppercase`?e=e.toUpperCase():c===`lowercase`?e=e.toLowerCase():c===`capitalize`&&(e=e[0].toUpperCase()+e.substring(1)),l.forEach(t=>{let n=o.get(t);n||o.set(t,n=new Set),e.split(``).forEach(e=>n.add(e))})}:void 0;return ys(e,r,a,t,u),gs(e,r),Oo(e)||await Ss(e,r,t,u),await s?.(r),r}let c=e.cloneNode(!1);return await Ss(e,c,t),await s?.(c),c}function Ds(e){if(e.ownerDocument=void 0,e.ownerWindow=void 0,e.svgStyleElement=void 0,e.svgDefsElement=void 0,e.svgStyles.clear(),e.defaultComputedStyles.clear(),e.sandbox){try{e.sandbox.remove()}catch(t){e.log.warn(`Failed to destroyContext`,t)}e.sandbox=void 0}e.workers=[],e.fontFamilies.clear(),e.fontCssTexts.clear(),e.requests.clear(),e.tasks=[],e.shadowRoots=[]}function Os(e){let{url:t,timeout:n,responseType:r,...i}=e,a=new AbortController,o=n?setTimeout(()=>a.abort(),n):void 0;return fetch(t,{signal:a.signal,...i}).then(e=>{if(!e.ok)throw Error(`Failed fetch, not 2xx response`,{cause:e});switch(r){case`arrayBuffer`:return e.arrayBuffer();case`dataUrl`:return e.blob().then(R);default:return e.text()}}).finally(()=>clearTimeout(o))}function ks(e,t){let{url:n,requestType:r=`text`,responseType:i=`text`,imageDom:a}=t,o=n,{timeout:s,acceptOfImage:c,requests:l,fetchFn:u,fetch:{requestInit:d,bypassingCache:f,placeholderImage:p},font:m,workers:h,fontFamilies:g}=e;r===`image`&&(mo||ho)&&e.drawImageCount++;let _=l.get(n);if(!_){f&&f instanceof RegExp&&f.test(o)&&(o+=(/\?/.test(o)?`&`:`?`)+new Date().getTime());let t=r.startsWith(`font`)&&m&&m.minify,v=new Set;t&&r.split(`;`)[1].split(`,`).forEach(e=>{g.has(e)&&g.get(e).forEach(e=>v.add(e))});let y=t&&v.size,b={url:o,timeout:s,responseType:y?`arrayBuffer`:i,headers:r===`image`?{accept:c}:void 0,...d};_={type:r,resolve:void 0,reject:void 0,response:null},_.response=(async()=>{if(u&&r===`image`){let e=await u(n);if(e)return e}return!mo&&n.startsWith(`http`)&&h.length?new Promise((e,t)=>{h[l.size&h.length-1].postMessage({rawUrl:n,...b}),_.resolve=e,_.reject=t}):Os(b)})().catch(t=>{if(l.delete(n),r===`image`&&p)return e.log.warn(`Failed to fetch image base64, trying to use placeholder image`,o),typeof p==`string`?p:p(a);throw t}),l.set(n,_)}return _.response}async function As(e,t,n,r){if(!js(e))return e;for(let[i,a]of Ns(e,t))try{let t=await ks(n,{url:a,requestType:r?`image`:`text`,responseType:`dataUrl`});e=e.replace(Ps(i),`$1${t}$3`)}catch(e){n.log.warn(`Failed to fetch css data url`,i,e)}return e}function js(e){return/url\((['"]?)([^'"]+?)\1\)/.test(e)}var Ms=/url\((['"]?)([^'"]+?)\1\)/g;function Ns(e,t){let n=[];return e.replace(Ms,(e,r,i)=>(n.push([i,Bo(i,t)]),e)),n.filter(([e])=>!zo(e))}function Ps(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,`\\$1`);return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,`g`)}var Fs=[`background-image`,`border-image-source`,`-webkit-border-image`,`-webkit-mask-image`,`list-style-image`];function Is(e,t){return Fs.map(n=>{let r=e.getPropertyValue(n);return!r||r===`none`?null:((mo||ho)&&t.drawImageCount++,As(r,null,t,!0).then(t=>{t&&r!==t&&e.setProperty(n,t,e.getPropertyPriority(n))}))}).filter(Boolean)}function Ls(e,t){if(Do(e)){let n=e.currentSrc||e.src;if(!zo(n))return[ks(t,{url:n,imageDom:e,requestType:`image`,responseType:`dataUrl`}).then(t=>{t&&(e.srcset=``,e.dataset.originalSrc=n,e.src=t||``)})];(mo||ho)&&t.drawImageCount++}else if(xo(e)&&!zo(e.href.baseVal)){let n=e.href.baseVal;return[ks(t,{url:n,imageDom:e,requestType:`image`,responseType:`dataUrl`}).then(t=>{t&&(e.dataset.originalSrc=n,e.href.baseVal=t||``)})]}return[]}function Rs(e,t){let{ownerDocument:n,svgDefsElement:r}=t,i=e.getAttribute(`href`)??e.getAttribute(`xlink:href`);if(!i)return[];let[a,o]=i.split(`#`);if(o){let i=`#${o}`,s=t.shadowRoots.reduce((e,t)=>e??t.querySelector(`svg ${i}`),n?.querySelector(`svg ${i}`));if(a&&e.setAttribute(`href`,i),r?.querySelector(i))return[];if(s)return r?.appendChild(s.cloneNode(!0)),[];if(a)return[ks(t,{url:a,responseType:`text`}).then(e=>{r?.insertAdjacentHTML(`beforeend`,e)})]}return[]}function zs(e,t){let{tasks:n}=t;bo(e)&&((Do(e)||So(e))&&n.push(...Ls(e,t)),Co(e)&&n.push(...Rs(e,t))),wo(e)&&n.push(...Is(e.style,t)),e.childNodes.forEach(e=>{zs(e,t)})}async function Bs(e,t){let{ownerDocument:n,svgStyleElement:r,fontFamilies:i,fontCssTexts:a,tasks:o,font:s}=t;if(n&&r&&i.size){if(s&&s.cssText){let e=Ks(s.cssText,t);r.appendChild(n.createTextNode(`${e}
|
|
17
|
+
`))}else{let e=Array.from(n.styleSheets).filter(e=>{try{return`cssRules`in e&&!!e.cssRules.length}catch(n){return t.log.warn(`Error while reading CSS rules from ${e.href}`,n),!1}}),s=n.implementation.createHTMLDocument(``),c=s.createElement(`style`);s.head.appendChild(c);let l=c.sheet;await Promise.all(e.flatMap(e=>Array.from(e.cssRules).map(async e=>{if(vo(e)){let n=e.href,r=``;try{r=await ks(t,{url:n,requestType:`text`,responseType:`text`})}catch(e){t.log.warn(`Error fetch remote css import from ${n}`,e)}let i=r.replace(Ms,(e,t,r)=>e.replace(r,Bo(r,n)));for(let e of Us(i))try{l.insertRule(e,l.cssRules.length)}catch(n){t.log.warn(`Error inserting rule from remote css import`,{rule:e,error:n})}}}))),l.cssRules.length&&e.push(l);let u=[];e.forEach(e=>{qs(e.cssRules,u)}),u.filter(e=>_o(e)&&js(e.style.getPropertyValue(`src`))&&Yo(e.style.getPropertyValue(`font-family`))?.some(e=>i.has(e))).forEach(e=>{let i=e,s=a.get(i.cssText);s?r.appendChild(n.createTextNode(`${s}
|
|
18
|
+
`)):o.push(As(i.cssText,i.parentStyleSheet?i.parentStyleSheet.href:null,t).then(e=>{e=Ks(e,t),a.set(i.cssText,e),r.appendChild(n.createTextNode(`${e}
|
|
19
|
+
`))}))})}}}var Vs=/(\/\*[\s\S]*?\*\/)/g,Hs=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;function Us(e){if(e==null)return[];let t=[],n=e.replace(Vs,``);for(;;){let e=Hs.exec(n);if(!e)break;t.push(e[0])}n=n.replace(Hs,``);let r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i=RegExp(`((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})`,`gi`);for(;;){let e=r.exec(n);if(e)i.lastIndex=r.lastIndex;else if(e=i.exec(n),e)r.lastIndex=i.lastIndex;else break;t.push(e[0])}return t}var Ws=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Gs=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Ks(e,t){let{font:n}=t,r=n?n?.preferredFormat:void 0;return r?e.replace(Gs,e=>{for(;;){let[t,,n]=Ws.exec(e)||[];if(!n)return``;if(n===r)return`src: ${t};`}}):e}function qs(e,t=[]){for(let n of Array.from(e))yo(n)?t.push(...qs(n.cssRules)):`cssRules`in n?qs(n.cssRules,t):t.push(n);return t}var Js=/\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;function Ys(e){return Js.test(e.innerHTML)}async function Xs(e,t){let n=await $o(e,t);if(bo(n.node)&&xo(n.node)&&!Ys(n.node))return n.node;let{ownerDocument:r,log:i,tasks:a,svgStyleElement:o,svgDefsElement:s,svgStyles:c,font:l,progress:u,autoDestruct:d,onCloneNode:f,onEmbedNode:p,onCreateForeignObjectSvg:m}=n;i.time(`clone node`);let h=await Es(n.node,n,!0);if(o&&r){let e=``;c.forEach((t,n)=>{e+=`${t.join(`,
|
|
20
|
+
`)} {
|
|
21
|
+
${n}
|
|
22
|
+
}
|
|
23
|
+
`}),o.appendChild(r.createTextNode(e))}i.timeEnd(`clone node`),await f?.(h),l!==!1&&bo(h)&&(i.time(`embed web font`),await Bs(h,n),i.timeEnd(`embed web font`)),i.time(`embed node`),zs(h,n);let g=a.length,_=0,v=async()=>{for(;;){let e=a.pop();if(!e)break;try{await e}catch(e){n.log.warn(`Failed to run task`,e)}u?.(++_,g)}};u?.(_,g),await Promise.all([...Array.from({length:4})].map(v)),i.timeEnd(`embed node`),await p?.(h);let y=Zs(h,n);return s&&y.insertBefore(s,y.children[0]),o&&y.insertBefore(o,y.children[0]),d&&Ds(n),await m?.(y),y}function Zs(e,t){let{width:n,height:r}=t,i=Uo(n,r,e.ownerDocument),a=i.ownerDocument.createElementNS(i.namespaceURI,`foreignObject`);return a.setAttributeNS(null,`x`,`0%`),a.setAttributeNS(null,`y`,`0%`),a.setAttributeNS(null,`width`,`100%`),a.setAttributeNS(null,`height`,`100%`),a.append(e),i.appendChild(a),i}async function Qs(e,t){let n=await $o(e,t),r=await Xs(n),i=Wo(r,n.isEnable(`removeControlCharacter`));return n.autoDestruct||(n.svgStyleElement=ts(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(Ho,`defs`),n.svgStyles.clear()),await rs(z(i,r.ownerDocument),n)}async function $s(e,t){let n=await $o(e,t),{log:r,quality:i,type:a,dpi:o}=n,s=await Qs(n);r.time(`canvas to data url`);let c=s.toDataURL(a,i);if([`image/png`,`image/jpeg`].includes(a)&&o&&lo&&uo){let[e,t]=c.split(`,`),n=0,r=!1;if(a===`image/png`){let e=ao(t);e>=0?(n=Math.ceil((e+28)/3)*4,r=!0):n=44}else a===`image/jpeg`&&(n=24);let i=t.substring(0,n),s=t.substring(n),l=window.atob(i),u=new Uint8Array(l.length);for(let e=0;e<u.length;e++)u[e]=l.charCodeAt(e);let d=a===`image/png`?to(u,o,r):Ka(u,o);c=[e,`,`,window.btoa(String.fromCharCode(...d)),s].join(``)}return r.timeEnd(`canvas to data url`),c}async function ec(e,t){return $s(await $o(e,{...t,type:`image/png`}))}var tc=null,nc=!1,rc=0,ic=new Set,ac=()=>{for(let e of ic)e()};async function oc(e){if(nc)return;nc=!0,ac();let t=await fc();nc=!1,rc+=1,tc={context:e,shot:t,n:rc},ac()}var sc=()=>{tc=null,ac()},cc=e=>(ic.add(e),()=>{ic.delete(e)}),lc=()=>(0,I.useSyncExternalStore)(cc,()=>tc),uc=()=>(0,I.useSyncExternalStore)(cc,()=>nc);function dc(e){if(e instanceof HTMLInputElement){if(![`button`,`submit`,`checkbox`,`radio`,`range`,`color`,`hidden`].includes(e.type)){let t=e.value?`•`.repeat(Math.min(12,e.value.length)):``;e.setAttribute(`value`,t),e.value=t}}else if(e instanceof HTMLTextAreaElement){let t=e.value?`•`.repeat(Math.min(24,e.value.length)):``;e.textContent=t,e.value=t}else e instanceof HTMLElement&&(e.isContentEditable||e.dataset.private!==void 0)&&(e.style.filter=`blur(6px)`)}async function fc(){try{return await ec(document.body,{scale:Math.min(2,window.devicePixelRatio||1),width:window.innerWidth,height:window.innerHeight,style:{transform:`translateY(-${window.scrollY}px)`},backgroundColor:getComputedStyle(document.body).backgroundColor||`#fff`,onCloneEachNode:dc,filter:e=>!(e instanceof HTMLElement&&e.dataset.reportSkip!==void 0)})}catch(e){return console.warn(`[report] no screenshot:`,e.message),null}}function pc(e,t,n){if(!e||!t)return;let r=e.getContext(`2d`);if(r){r.drawImage(t,0,0,e.width,e.height);for(let t of n)if(t.tool===`pen`){r.strokeStyle=`#e11d48`,r.lineWidth=Math.max(3,e.width/300),r.lineCap=`round`,r.lineJoin=`round`,r.beginPath();for(let[e,[n,i]]of t.points.entries())e?r.lineTo(n,i):r.moveTo(n,i);r.stroke()}else{r.fillStyle=`#000`;let[e,n]=t.from,[i,a]=t.to;r.fillRect(Math.min(e,i),Math.min(n,a),Math.abs(i-e),Math.abs(a-n))}}}function mc({src:e,onChange:t}){let n=(0,I.useRef)(null),r=(0,I.useRef)(null),[i,a]=(0,I.useState)(`pen`),[o,s]=(0,I.useState)([]),c=(0,I.useRef)(null),l=e=>pc(n.current,r.current,e);(0,I.useEffect)(()=>{let t=new Image;t.onload=()=>{r.current=t;let e=n.current;e&&(e.width=t.naturalWidth,e.height=t.naturalHeight,pc(e,t,[]))},t.src=e},[e]);let u=e=>{let t=n.current,r=t.getBoundingClientRect();return[(e.clientX-r.left)/r.width*t.width,(e.clientY-r.top)/r.height*t.height]},d=e=>{s(e),l(e),t(n.current.toDataURL(`image/png`))};return(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,children:[(0,L.jsxs)(D,{size:`sm`,variant:i===`pen`?`quiet`:`ghost`,onClick:()=>a(`pen`),children:[(0,L.jsx)(Mr,{className:`size-4`}),` `,P(`report.pen`)]}),(0,L.jsxs)(D,{size:`sm`,variant:i===`cover`?`quiet`:`ghost`,onClick:()=>a(`cover`),children:[(0,L.jsx)(Ie,{className:`size-4 fill-current`}),` `,P(`report.cover`)]}),(0,L.jsxs)(D,{size:`sm`,variant:`ghost`,disabled:!o.length,onClick:()=>d(o.slice(0,-1)),children:[(0,L.jsx)(oa,{className:`size-4`}),` `,P(`report.undo`)]}),o.length?(0,L.jsx)(D,{size:`sm`,variant:`ghost`,onClick:()=>d([]),"aria-label":`Clear`,children:(0,L.jsx)(f,{className:`size-4`})}):null]}),(0,L.jsx)(`canvas`,{ref:n,className:`w-full cursor-crosshair touch-none rounded-lg border border-border`,onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId);let t=u(e);c.current=i===`pen`?{tool:i,points:[t]}:{tool:i,from:t,to:t}},onPointerMove:e=>{let t=c.current;if(!t)return;let n=u(e);t.tool===`pen`?t.points.push(n):t.to=n,l([...o,t])},onPointerUp:()=>{let e=c.current;c.current=null,e&&d([...o,e])}})]})}function hc(){let e=lc();return uc()?(0,L.jsx)(`div`,{"data-report-skip":!0,className:`pointer-events-none fixed inset-x-0 bottom-6 z-50 flex justify-center`,children:(0,L.jsxs)(`span`,{className:`flex items-center gap-2 rounded-full bg-ink px-4 py-2 text-paper text-sm`,children:[(0,L.jsx)(dt,{className:`size-4`}),` `,P(`report.capturing`)]})}):e?(0,L.jsx)(gc,{context:e.context,shot:e.shot},e.n):null}function gc({context:e,shot:t}){let[n,r]=(0,I.useState)(null),[i,a]=(0,I.useState)(!!t),[o,s]=(0,I.useState)(!0),[c,l]=(0,I.useState)(``),[u,d]=(0,I.useState)(``),[f,p]=(0,I.useState)(`idle`),m=ge().map(O),h=O(window.location.href),g=async()=>{p(`sending`);try{let r=await fetch($e(`/api/bug-reports`),{method:`POST`,headers:{"content-type":`application/json`},credentials:`include`,body:JSON.stringify({where:e.where,url:window.location.href.split(`?`)[0],runId:e.runId??null,comment:c.trim()||null,error:e.error?{message:O(e.error.message),stack:e.error.stack?O(e.error.stack):void 0}:null,logs:o?m:[],screenshot:i?n??t:null,contact:u.trim()||null})});p(r.ok?`sent`:`failed`)}catch{p(`failed`)}};return(0,L.jsx)(nt,{open:!0,onClose:sc,title:P(`report.title`),wide:!0,height:`tall`,children:(0,L.jsx)(`div`,{className:`grid gap-5`,"data-report-skip":!0,children:f===`sent`?(0,L.jsxs)(`div`,{className:`py-10 text-center`,children:[(0,L.jsx)(`p`,{className:`font-display font-semibold text-lg`,children:P(`report.sent`)}),(0,L.jsx)(D,{className:`mt-6`,onClick:sc,children:`OK`})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`text-ink-3 text-sm`,children:P(`report.lead`)}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(xe,{hint:P(`report.whatHint`),children:P(`report.what`)}),(0,L.jsx)(Te,{"data-autofocus":!0,value:c,onChange:e=>l(e.target.value),rows:3})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,L.jsx)(xe,{hint:P(`report.screenshotHint`),children:P(`report.screenshot`)}),(0,L.jsx)(it,{checked:i,disabled:!t,onChange:a,label:P(`report.screenshot`)})]}),t?i?(0,L.jsx)(mc,{src:t,onChange:r}):null:(0,L.jsx)(`p`,{className:`text-ink-3 text-sm`,children:P(`report.noShot`)})]}),e.error?(0,L.jsxs)(`div`,{children:[(0,L.jsx)(xe,{children:P(`report.error`)}),(0,L.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-lg bg-paper-2 p-3 text-xs`,children:O(e.error.message)})]}):null,(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,L.jsx)(xe,{hint:P(`report.logsHint`),children:P(`report.logs`,{count:m.length})}),(0,L.jsx)(it,{checked:o,disabled:!m.length,onChange:s,label:P(`report.logs`,{count:m.length})})]}),o&&m.length?(0,L.jsx)(`pre`,{className:`max-h-40 overflow-auto rounded-lg bg-paper-2 p-3 text-xs`,children:m.join(`
|
|
24
|
+
`)}):null]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(xe,{children:P(`report.page`)}),(0,L.jsxs)(`p`,{className:`break-all font-mono text-ink-3 text-xs`,children:[h,(0,L.jsx)(`br`,{}),navigator.userAgent]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(xe,{children:P(`report.contact`)}),(0,L.jsx)(_e,{type:`email`,value:u,onChange:e=>d(e.target.value)})]}),f===`failed`?(0,L.jsx)(`p`,{className:`text-rose text-sm`,children:P(`report.failed`)}):null,(0,L.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,L.jsx)(D,{variant:`ghost`,onClick:sc,children:P(`report.cancel`)}),(0,L.jsx)(D,{onClick:()=>void g(),busy:f===`sending`,children:P(f===`sending`?`report.sending`:`report.send`)})]})]})})})}var _c=(0,I.lazy)(()=>Vt(()=>import(`./AboutDialog-B-JxkELB.js`).then(e=>({default:e.AboutDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))),vc=`0.13.0`;function yc({me:e}){let[t,n]=(0,I.useState)(!1);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{type:`button`,className:`tabular-nums transition hover:text-ink-2`,onClick:()=>n(!0),children:P(`about.version`,{v:vc})}),t?(0,L.jsx)(I.Suspense,{fallback:null,children:(0,L.jsx)(_c,{open:!0,me:e,onClose:()=>n(!1)})}):null]})}var bc=[`update`],xc=36e5;function Sc(e=!0){let t=w(),[n,r]=(0,I.useState)(null),i=Ae({queryKey:bc,queryFn:()=>p.get(`/api/studio/update`),staleTime:xc,refetchInterval:xc,retry:!1,enabled:e}),a=zt({mutationFn:()=>p.get(`/api/studio/update?fresh=1`),onSuccess:e=>t.setQueryData(bc,e)}),o=zt({mutationFn:()=>p.post(`/api/studio/update`),onSuccess:e=>t.setQueryData(bc,e)}),s=i.data,c=s?.latest??null,l=s?.restarts&&(s.applying===`running`||s.applying===`done`),u=s?.current;return(0,I.useEffect)(()=>{if(!(l||s?.applying===`running`)||!c)return;let e=setInterval(async()=>{try{let e=await p.get(`/api/studio/update`);if(e.current!==u){window.location.reload();return}t.setQueryData(bc,e),e.applying===`done`&&e.restarts&&r(c)}catch{r(c)}},2e3);return()=>clearInterval(e)},[l,s?.applying,c,u,t]),{status:i,data:s,latest:c,check:a,apply:o,busy:s?.applying===`running`||n!==null,progress:!s||!c?null:n===null?s.applying===`running`?P(`about.update.installing`,{v:c}):s.applying===`done`?P(`about.update.done`,{v:c}):s.applying===`failed`?P(`about.update.failed`):null:P(`about.update.restarting`,{v:c})}}var Cc=`wizards.install-banner`,wc=`wizards.first-day`,Tc=()=>window.matchMedia(`(pointer: coarse)`).matches;function Ec({open:e,onClose:t}){let n=Wa(),r=Ua(n),i=P(r===`prompt`?`install.app.offer`:r===`none`?`install.app.browser`:`install.app.how.${r}`);return(0,L.jsxs)(nt,{open:e,onClose:t,title:P(`install.app.action`),children:[(0,L.jsx)(`p`,{className:`text-[0.9375rem] text-ink-2 leading-relaxed`,children:i}),(0,L.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,L.jsx)(D,{variant:`ghost`,onClick:t,children:P(`install.app.close`)}),n?(0,L.jsx)(D,{onClick:()=>{Ga(n),t()},children:P(`install.app.action`)}):null]})]})}function Dc(){try{return localStorage.getItem(Cc)===`1`}catch{return!1}}var Oc=()=>new Date().toLocaleDateString(`sv`);function kc(){try{let e=localStorage.getItem(wc);return e?e!==Oc():(localStorage.setItem(wc,Oc()),!1)}catch{return!1}}function Ac({me:e}){let t=Wa(),[n,r]=(0,I.useState)(Dc),[i]=(0,I.useState)(kc);return!(t&&e.hasWizards&&i)||n||Ra()||Tc()?null:(0,L.jsxs)(`div`,{className:`flex items-center gap-3 border-border-soft border-b bg-paper-2 px-4 py-2 text-[0.8125rem] text-ink-2 sm:px-6`,children:[(0,L.jsx)(Dt,{className:`size-4 shrink-0 text-ink-3`}),(0,L.jsx)(`p`,{className:`min-w-0 flex-1`,children:P(`install.app.offer`)}),(0,L.jsx)(D,{size:`sm`,onClick:()=>void Ga(t),children:P(`install.app.action`)}),(0,L.jsx)(be,{label:P(`install.app.close`),onClick:()=>{try{localStorage.setItem(Cc,`1`)}catch{}r(!0)},className:`size-8`,children:(0,L.jsx)(ct,{className:`size-4`})})]})}function jc(e){return e.mode===`managed`&&(e.organizations.length>1||e.mayCreateOrganization)}function Mc(e){if(e.slug){window.location.href=`${a}/${e.slug}/`;return}let t=new URLSearchParams({organization:e.id,return:`${a}/`});window.location.href=$e(`/api/auth/login?${t}`)}function Nc(e){return e.organizations.find(t=>t.id===e.tenant.id)??(e.tenant.name?{id:e.tenant.id,name:e.tenant.name,slug:null,role:e.tenant.role,personal:!1,plan:e.tenant.plan}:null)}function Pc({org:e,size:t=`sm`}){return(0,L.jsx)(`span`,{"aria-hidden":`true`,className:j(`grid shrink-0 place-items-center font-semibold tracking-wide`,t===`md`?`size-10 text-[0.8125rem]`:t===`sm`?`size-9 text-[0.75rem]`:`size-7 text-[0.625rem]`,e.personal?`rounded-full bg-ember-tint text-ember-strong ring-1 ring-border-soft`:`rounded-lg bg-card text-ink-2 ring-1 ring-border`),children:an(e.name)})}function Fc(e){let t=A();return()=>{ba(e.features,`teamPlans`)?t(`/settings/organization`):e.manageUrl&&window.open(`${e.manageUrl}/account`,`_blank`,`noreferrer`)}}function Ic({me:e,roomy:t,onDone:n}){let r=Fc(e),[i,a]=(0,I.useState)(null),o=j(`flex w-full items-center gap-3 rounded-lg px-3 text-left text-ink-2 transition hover:bg-accent hover:text-ink`,t?`py-3 text-[0.9375rem]`:`py-2 text-[0.875rem]`);return(0,L.jsxs)(L.Fragment,{children:[e.organizations.map(r=>{let o=r.id===e.tenant.id;return(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:i!==null,"aria-current":o?`true`:void 0,className:j(`flex w-full items-center gap-3 rounded-lg px-2 text-left transition hover:bg-accent disabled:cursor-default`,t?`py-2.5`:`py-1.5`),onClick:()=>{if(o){n();return}a(r.id),Mc(r)},children:[(0,L.jsx)(Pc,{org:r,size:t?`md`:`sm`}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col leading-tight`,children:[(0,L.jsx)(`span`,{className:j(`truncate`,t?`text-[0.9375rem]`:`text-[0.875rem]`,o?`font-semibold text-ink`:`font-medium text-ink-2`),children:r.name}),(0,L.jsx)(`span`,{className:`truncate text-[0.75rem] text-ink-4`,children:i===r.id?P(`organizations.switching`,{name:r.name}):r.personal?P(`organizations.own`):P(`organization.role.${r.role}`)})]}),r.plan?(0,L.jsx)(`span`,{className:`shrink-0 whitespace-nowrap rounded-full px-2 py-0.5 font-medium text-[0.6875rem] text-ink-3 ring-1 ring-border`,children:r.plan.name}):null,(0,L.jsx)(`span`,{className:`grid w-4 shrink-0 place-items-center`,children:i===r.id?(0,L.jsx)(Xr,{className:`size-4 animate-spin text-ink-3`}):o?(0,L.jsx)(he,{className:`size-4 text-ember-strong`}):null})]},r.id)}),(0,L.jsx)(`div`,{className:`mx-2 my-1.5 h-px bg-border-soft`}),(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:o,onClick:()=>{n(),r()},children:[(0,L.jsx)(Ki,{className:`size-4 shrink-0 text-ink-3`}),(0,L.jsx)(`span`,{className:`truncate`,children:P(`organizations.manage`)})]}),e.mayCreateOrganization&&e.manageUrl?(0,L.jsxs)(`a`,{role:`menuitem`,className:o,href:`${e.manageUrl}/account`,target:`_blank`,rel:`noreferrer`,onClick:n,children:[(0,L.jsx)(De,{className:`size-4 shrink-0 text-ink-3`}),(0,L.jsx)(`span`,{className:`flex-1 truncate`,children:P(`organizations.create`)}),(0,L.jsx)(Xn,{className:`size-3.5 shrink-0 text-ink-4`})]}):null]})}function Lc({me:e,className:t}){let[n,r]=(0,I.useState)(!1),[i,a]=(0,I.useState)({top:0,left:0}),o=(0,I.useRef)(null);bw(o,n,()=>r(!1));let s=Nc(e);return s?jc(e)?(0,L.jsxs)(`div`,{ref:o,className:j(`relative min-w-0 shrink`,t),children:[(0,L.jsxs)(`button`,{type:`button`,"aria-haspopup":`menu`,"aria-expanded":n,title:P(`organizations.switch`),onClick:e=>{let t=e.currentTarget.getBoundingClientRect();a({top:t.bottom+6,left:t.left}),r(e=>!e)},className:j(`-ml-2 flex max-w-[13rem] items-center gap-1 rounded-md py-0.5 pr-1.5 pl-2 text-[0.9375rem] text-ink-2 transition hover:bg-accent hover:text-ink`,n&&`bg-accent text-ink`),children:[(0,L.jsx)(`span`,{className:`truncate`,children:s.name}),(0,L.jsx)(cr,{className:`size-3.5 shrink-0 text-ink-4`})]}),n?(0,L.jsxs)(`div`,{role:`menu`,style:{position:`fixed`,...i},className:`z-50 w-80 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:[(0,L.jsx)(`div`,{className:`px-2 pt-1.5 pb-1 text-[0.75rem] text-ink-3`,children:P(`organizations.mine`)}),(0,L.jsx)(Ic,{me:e,onDone:()=>r(!1)})]}):null]}):(0,L.jsx)(`span`,{className:j(`max-w-[12rem] truncate text-[0.9375rem] text-ink-3`,t),title:s.name,children:s.name}):null}function Rc({me:e,open:t,onClose:n}){let r=(0,I.useRef)(null);return(0,I.useEffect)(()=>{let e=r.current;t&&e&&!e.open?e.showModal():!t&&e?.open&&e.close()},[t]),(0,L.jsx)(`dialog`,{ref:r,onClose:n,onClick:e=>{e.target===r.current&&n()},"aria-label":P(`organizations.switch`),className:j(`max-h-[85dvh] overflow-y-auto overscroll-contain bg-card p-0 text-ink shadow-overlay backdrop:bg-[oklch(20%_0.01_60/0.28)]`,`max-sm:mx-0 max-sm:mt-auto max-sm:mb-0 max-sm:w-full max-sm:max-w-none max-sm:rounded-t-3xl`,`sm:m-auto sm:w-[calc(100%-32px)] sm:max-w-sm sm:rounded-2xl`),children:t?(0,L.jsxs)(`div`,{className:`px-3 pt-2 pb-[max(1rem,env(safe-area-inset-bottom))] sm:pt-3`,children:[(0,L.jsx)(`div`,{className:`mx-auto mb-2 h-1.5 w-9 rounded-full bg-border sm:hidden`}),(0,L.jsx)(zc,{onClose:n,children:P(`organizations.switch`)}),(0,L.jsx)(Ic,{me:e,roomy:!0,onDone:n})]}):null})}function zc({children:e,onClose:t}){return(0,L.jsxs)(`div`,{className:`flex items-center justify-between px-2 pt-1 pb-2.5`,children:[(0,L.jsx)(`h2`,{className:`font-semibold text-[1.0625rem]`,children:e}),(0,L.jsx)(`button`,{type:`button`,onClick:t,"aria-label":P(`common.close`),className:`grid size-8 place-items-center rounded-full bg-paper-2 text-ink-3 transition hover:text-ink`,children:(0,L.jsx)(ct,{className:`size-4`})})]})}var Bc=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform);function Vc({me:e,position:t,horizontal:n,labels:r}){let i=A(),[a,o]=(0,I.useState)(!1),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(!1),d=e.mode===`managed`?Nc(e):null,f=jc(e),p=Fc(e),m=Wa(),h=(0,I.useRef)(null);bw(h,a,()=>o(!1)),(0,I.useEffect)(()=>{a||u(!1)},[a]);let g=e.mode===`local`,{data:_,check:v}=Sc(g);(0,I.useEffect)(()=>{let e=e=>{e.key===`,`&&(Bc?e.metaKey:e.ctrlKey)&&!e.altKey&&!e.shiftKey&&(e.preventDefault(),i(`/settings`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]);let y=e=>{o(!1),i(e)},b=`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[0.875rem] text-ink-2 transition hover:bg-accent hover:text-ink`,ee=`ml-auto shrink-0 text-[0.75rem] text-ink-4`,te=(0,L.jsx)(`div`,{className:`mx-2 my-1.5 h-px bg-border-soft`}),x=v.isPending?{text:P(`about.update.checking`),tone:ee}:_?.newer&&_.latest?{text:_.latest,tone:`ml-auto shrink-0 text-[0.75rem] font-medium text-ember-strong`}:_?{text:P(`about.update.upToDateShort`),tone:`ml-auto shrink-0 text-[0.75rem] text-moss`}:null;return(0,L.jsxs)(`div`,{ref:h,className:j(`relative shrink-0`,r&&`w-full`),children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),"aria-expanded":a,"aria-haspopup":`menu`,title:P(`about.title`),"aria-label":P(`about.title`),className:j(`shrink-0 rounded-lg transition hover:bg-ink/10`,a&&`bg-ink/10`,r?`flex h-12 w-full items-center gap-2 px-1.5`:j(`grid place-items-center`,n?`size-11`:`h-12 w-11`)),children:[(0,L.jsx)(pn,{size:32}),r?(0,L.jsxs)(`span`,{className:`truncate font-display font-semibold text-[1rem] tracking-tight`,children:[`engenty`,(0,L.jsx)(`span`,{className:`text-ember`,children:`.`}),(0,L.jsx)(`span`,{className:`ml-1 font-normal text-ink-3`,children:`wizards`})]}):null]}),a?(0,L.jsxs)(`div`,{role:`menu`,className:j(`absolute z-50 w-72 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,Pa(t,`start`)),children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2 px-3 pt-2 pb-2.5`,children:[(0,L.jsxs)(`span`,{className:`font-display font-semibold text-[1rem] tracking-tight`,children:[`engenty`,(0,L.jsx)(`span`,{className:`text-ember`,children:`.`}),(0,L.jsx)(`span`,{className:`ml-1 font-normal text-ink-3`,children:`wizards`})]}),(0,L.jsx)(`span`,{className:j(ee,`tabular-nums`),children:vc})]}),d?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-haspopup":f?`menu`:void 0,"aria-expanded":f?l:void 0,className:j(`flex w-full items-center gap-3 rounded-lg px-2.5 py-1.5 text-left transition hover:bg-accent`,l&&`bg-accent`),onClick:()=>{f?u(e=>!e):(o(!1),p())},children:[(0,L.jsx)(Pc,{org:d,size:`xs`}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col leading-tight`,children:[(0,L.jsx)(`span`,{className:`truncate font-medium text-[0.875rem] text-ink`,children:d.name}),(0,L.jsx)(`span`,{className:`truncate text-[0.75rem] text-ink-4`,children:d.plan?`${P(`organization.title`)} · ${d.plan.name}`:P(`organization.title`)})]}),f?(0,L.jsx)(me,{className:`size-4 shrink-0 text-ink-4`}):null]}),l?(0,L.jsxs)(`div`,{role:`menu`,className:j(`absolute top-12 z-50 w-80 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,t===`right`?`right-full mr-1.5`:`left-full ml-1.5`),children:[(0,L.jsx)(`div`,{className:`px-2 pt-1.5 pb-1 text-[0.75rem] text-ink-3`,children:P(`organizations.switch`)}),(0,L.jsx)(Ic,{me:e,onDone:()=>o(!1)})]}):null,te]}):null,(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,className:b,onClick:()=>y(`/settings/about`),children:P(`about.title`)}),g?(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:b,onClick:()=>_?.newer?y(`/settings/about`):v.mutate(),children:[P(`about.update.check`),x?(0,L.jsx)(`span`,{className:x.tone,children:x.text}):null]}):null,(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,className:b,onClick:()=>y(`/settings/about?tab=new`),children:P(`about.tab.new`)}),te,(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:b,onClick:()=>y(`/settings`),children:[P(`nav.settings`),` …`,(0,L.jsx)(`span`,{className:ee,children:Bc?`⌘ ,`:`Ctrl ,`})]}),Ra()?null:(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,className:b,onClick:()=>{o(!1),m?Ga(m):c(!0)},children:P(`install.app.action`)}),te,(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,className:b,onClick:()=>y(`/settings/about?tab=credits`),children:P(`about.creditsMenu`)})]}):null,(0,L.jsx)(Ec,{open:s,onClose:()=>c(!1)})]})}var Hc=[],Uc=0,Wc=new Set;function Gc(){for(let e of Wc)e()}function Kc(e){let t=(0,I.useRef)(e);t.current=e;let n=e!==null,r=e?.icon,i=e?.label;(0,I.useEffect)(()=>{if(!n||!r||i===void 0)return;let e=++Uc;return Hc=[...Hc,{id:e,action:{icon:r,label:i,run:()=>t.current?.run()}}],Gc(),()=>{Hc=Hc.filter(t=>t.id!==e),Gc()}},[n,r,i])}function qc(){return(0,I.useSyncExternalStore)(e=>(Wc.add(e),()=>Wc.delete(e)),()=>Hc.at(-1)?.action??null,()=>null)}var Jc=(0,I.lazy)(()=>Vt(()=>import(`./AboutDialog-B-JxkELB.js`).then(e=>({default:e.AboutDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8])));function Yc(e,t=!1){return j(`shrink-0 rounded-lg transition`,t?`flex h-10 w-full items-center gap-3 px-2.5 font-medium text-[0.875rem]`:`grid size-10 place-items-center`,e?`bg-paper text-ink shadow-soft dark:ring-1 dark:ring-border-soft`:`text-ink-3 hover:bg-ink/10 hover:text-ink`)}function Xc({children:e}){return(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e})}function Zc({me:e,labels:t}){let{project:n}=un(),r=ww(e),i=r?e.tenant.name??void 0:void 0;return(0,L.jsxs)(Tw,{me:e,placement:`bar-start`,label:n?.name??P(`nav.space`),className:e=>t?j(`flex w-full items-center gap-3 rounded-lg p-0.5 pr-2 text-left transition hover:bg-ink/10`,e&&`bg-ink/10`):j(`block rounded-lg transition`,e?`ring-2 ring-ink/80 ring-offset-2 ring-offset-sidebar`:`hover:shadow-soft`),children:[(0,L.jsx)(Cw,{project:n,name:i}),t?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-semibold text-[0.875rem] text-ink`,children:i??n?.name??P(`nav.space`)}),r?null:(0,L.jsx)(cr,{className:`size-4 shrink-0 text-ink-4`})]}):null]})}var Qc={left:bi,top:wi,right:Si,bottom:gi},$c=[{pick:`light`,icon:tn,label:`appbar.light`},{pick:`branded`,icon:mi,label:`appbar.branded`},{pick:`dark`,icon:Jt,label:`appbar.dark`},{pick:null,icon:fi,label:`appbar.system`}];function el({at:e,room:t,onClose:n}){let{position:r,labels:i}=ja(),a=Kt(),o=Sa,s=(0,I.useRef)(null);bw(s,!0,n);let[c,l]=(0,I.useState)({x:0,y:0});(0,I.useLayoutEffect)(()=>{let e=s.current?.getBoundingClientRect();e&&l({x:Math.min(0,window.innerWidth-8-e.right),y:Math.min(0,window.innerHeight-8-e.bottom)})},[]);let u=`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[0.875rem] text-ink-2 hover:bg-accent hover:text-ink disabled:pointer-events-none disabled:opacity-50`,d=`px-3 pt-2 pb-1 font-medium text-[0.6875rem] text-ink-4 uppercase tracking-[0.07em]`;return(0,L.jsxs)(`div`,{ref:s,role:`menu`,className:`fixed z-[60] w-56 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,style:{left:Math.max(8,e.x+c.x),top:Math.max(8,e.y+c.y)},onContextMenu:e=>e.preventDefault(),children:[(0,L.jsx)(`div`,{className:d,children:P(`appbar.position`)}),o.map(e=>{let t=Qc[e];return(0,L.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e===r,className:j(u,e===r&&`text-ink`),onClick:()=>{ka({position:e}),n()},children:[(0,L.jsx)(t,{className:`size-4`}),(0,L.jsx)(`span`,{className:`flex-1`,children:P(`appbar.${e}`)}),e===r?(0,L.jsx)(he,{className:`size-4 text-ember-strong`}):null]},e)}),(0,L.jsxs)(`button`,{type:`button`,role:`menuitemcheckbox`,"aria-checked":i,disabled:!(i||t),className:j(u,i&&`text-ink`),onClick:()=>{ka({labels:!i}),n()},children:[(0,L.jsx)(vi,{className:`size-4`}),(0,L.jsx)(`span`,{className:`flex-1`,children:P(`appbar.labels`)}),i?(0,L.jsx)(he,{className:`size-4 text-ember-strong`}):null]}),(0,L.jsx)(`div`,{className:`mx-2 my-1.5 h-px bg-border-soft`}),(0,L.jsx)(`div`,{className:d,children:P(`appbar.theme`)}),$c.map(({pick:e,icon:t,label:r})=>(0,L.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e===a,className:j(u,e===a&&`text-ink`),onClick:()=>{Yt(e),n()},children:[(0,L.jsx)(t,{className:`size-4`}),(0,L.jsx)(`span`,{className:`flex-1`,children:P(r)}),e===a?(0,L.jsx)(he,{className:`size-4 text-ember-strong`}):null]},r))]})}function tl(){let{pathname:e}=Ue();return e===`/new`?`new`:e===`/`||e.startsWith(`/edit/`)?`home`:e===`/space/results`||e.startsWith(`/space/results/`)?`results`:e===`/settings`||e.startsWith(`/settings/`)?`settings`:e===`/space`||e.startsWith(`/space/`)?`space`:null}function nl({me:e,labels:t,room:n}){let r=Kw(),{position:i}=ja(),a=Ma(i),s=tl(),[c,l]=(0,I.useState)(null),u=e=>{e.preventDefault(),l({x:e.clientX,y:e.clientY})},d=(0,I.useRef)(null),f=(0,I.useRef)(!1),p=()=>{d.current&&=(window.clearTimeout(d.current.timer),null)};return(0,L.jsxs)(`aside`,{"aria-label":dn.name,onContextMenu:u,onPointerDown:e=>{if(e.pointerType===`mouse`)return;p();let{clientX:t,clientY:n}=e;d.current={x:t,y:n,timer:window.setTimeout(()=>{d.current=null,f.current=!0,window.setTimeout(()=>{f.current=!1},700),l({x:t,y:n})},500)}},onPointerMove:e=>{d.current&&Math.hypot(e.clientX-d.current.x,e.clientY-d.current.y)>10&&p()},onPointerUp:p,onPointerCancel:p,onPointerLeave:p,onClickCapture:e=>{f.current&&(f.current=!1,e.preventDefault(),e.stopPropagation())},className:j(`flex shrink-0 select-none bg-sidebar [-webkit-touch-callout:none]`,a?`w-full flex-row items-center gap-1.5 px-2`:j(`h-full flex-col pt-2 pb-3 transition-[width] duration-200 ease-out`,t?`w-56 items-stretch px-2.5`:`w-16 items-center`),i===`bottom`&&`pt-1.5 pb-[calc(0.375rem+env(safe-area-inset-bottom))]`,i===`top`&&`pt-[calc(0.375rem+env(safe-area-inset-top))] pb-1.5`),children:[(0,L.jsx)(Vc,{me:e,position:i,horizontal:a,labels:t}),(0,L.jsx)(`div`,{className:a?`ml-1`:`mt-2`,children:(0,L.jsx)(Zc,{me:e,labels:t})}),(0,L.jsxs)(o,{to:`/`,title:P(`nav.home`),"aria-label":P(`nav.home`),"aria-current":s===`home`||s===`new`?`page`:void 0,className:j(Yc(s===`home`||s===`new`,t),a?`ml-1.5`:`mt-2`),children:[(0,L.jsx)(Pr,{className:`size-5 shrink-0`}),t?(0,L.jsx)(Xc,{children:P(`nav.home`)}):null]}),(0,L.jsxs)(o,{to:`/space`,title:P(`nav.sources`),"aria-label":P(`nav.sources`),"aria-current":s===`space`?`page`:void 0,className:j(Yc(s===`space`,t),a?`ml-1.5`:`mt-2`),children:[(0,L.jsx)(Kr,{className:`size-5 shrink-0`}),t?(0,L.jsx)(Xc,{children:P(`nav.sources`)}):null]}),(0,L.jsxs)(o,{to:`/space/results`,title:P(`space.results`),"aria-label":P(`space.results`),"aria-current":s===`results`?`page`:void 0,className:j(Yc(s===`results`,t),a?`ml-1.5`:`mt-2`),children:[(0,L.jsx)(Rr,{className:`size-5 shrink-0`}),t?(0,L.jsx)(Xc,{children:P(`space.results`)}):null]}),r.nav.length?(0,L.jsx)(`div`,{className:j(`shrink-0 bg-border`,a?`mx-2 h-7 w-px`:j(`my-3 h-px`,t?`mx-2.5`:`w-7`))}):null,(0,L.jsx)(`nav`,{className:j(`flex min-h-0 min-w-0 flex-1 gap-1.5`,t?`items-stretch`:`items-center`,a?`flex-row overflow-x-auto`:`flex-col overflow-y-auto`),children:r.nav.map(e=>(0,L.jsx)(gT,{of:e,children:(0,L.jsxs)(Pe,{to:e.to,title:e.label(),"aria-label":e.label(),className:({isActive:e})=>Yc(e,t),children:[(0,L.jsx)(e.icon,{className:`size-5 shrink-0`}),t?(0,L.jsx)(Xc,{children:e.label()}):null]})},e.serial))}),(0,L.jsxs)(`div`,{className:j(`flex shrink-0 gap-2`,a?`flex-row pl-3`:`flex-col pt-3`,t?`items-stretch`:`items-center`),children:[(0,L.jsxs)(Pe,{to:`/settings`,title:P(`nav.settings`),"aria-label":P(`nav.settings`),className:({isActive:e})=>Yc(e,t),children:[(0,L.jsx)(Ki,{className:`size-5 shrink-0`}),t?(0,L.jsx)(Xc,{children:P(`nav.settings`)}):null]}),(0,L.jsx)(kw,{me:e,placement:`bar-end`,named:t})]}),c?(0,L.jsx)(el,{at:c,room:n,onClose:()=>l(null)}):null]})}function rl(e){return j(`glass-press relative grid h-12 w-16 place-items-center rounded-full transition-colors`,e?`text-ink`:`text-ink-3`)}var il=68;function al({index:e}){let t=(0,I.useRef)(null),n=(0,I.useRef)(e);return(0,I.useEffect)(()=>{let r=n.current;n.current=e;let i=t.current;if(!i||r===null||e===null||r===e||matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let a=r*il,o=e*il;i.animate([{transform:`translateX(${a}px)`},{transform:`translateX(${(a+o)/2}px) scaleX(1.35) scaleY(0.92)`,offset:.45},{transform:`translateX(${o}px)`}],{duration:420,easing:`cubic-bezier(0.34, 1.3, 0.64, 1)`})},[e]),(0,L.jsx)(`span`,{ref:t,"aria-hidden":`true`,className:`pointer-events-none absolute top-1 left-1 h-12 w-16 rounded-full bg-ink/12 transition-opacity`,style:{transform:`translateX(${(e??0)*il}px)`,opacity:e===null?0:1}})}function ol({me:e}){let t=Kw(),n=tl(),[r,i]=(0,I.useState)(!1),[a,s]=(0,I.useState)(!1),c=A(),l=(0,I.useRef)(null),u=qc(),d=rn(),{project:f}=un(),p=u??(d&&!f?.readOnly&&n!==`new`?{icon:De,label:P(`home.new`),run:()=>c(`/new`)}:null);bw(l,r,()=>i(!1));let{pathname:m}=Ue();(0,I.useEffect)(()=>i(!1),[m]);let h=e=>!r&&n===e,g=r?2:n===`home`||n===`new`?0:n===`space`?1:n===`results`||n===`settings`?2:null,_=e=>{i(!1),c(e)},v=e=>j(`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left text-[0.9375rem] transition`,e?`bg-accent text-ink`:`text-ink-2 hover:bg-accent hover:text-ink`);return(0,L.jsxs)(`div`,{className:`fixed inset-x-0 bottom-[calc(0.5rem+env(safe-area-inset-bottom))] z-40 flex select-none justify-center gap-2.5 [-webkit-touch-callout:none]`,children:[(0,L.jsxs)(`nav`,{ref:l,"aria-label":dn.name,className:`liquid-glass relative flex gap-1 rounded-full p-1`,children:[(0,L.jsx)(al,{index:g}),(0,L.jsx)(o,{to:`/`,"aria-label":P(`nav.home`),"aria-current":n===`home`?`page`:void 0,onClick:()=>i(!1),className:rl(h(`home`)),children:(0,L.jsx)(Pr,{className:`size-[1.375rem]`})}),(0,L.jsx)(o,{to:`/space`,"aria-label":P(`nav.sources`),"aria-current":n===`space`?`page`:void 0,onClick:()=>i(!1),className:rl(h(`space`)),children:(0,L.jsx)(Kr,{className:`size-[1.375rem]`})}),(0,L.jsx)(`button`,{type:`button`,"aria-label":P(`nav.more`),"aria-expanded":r,"aria-haspopup":`menu`,onClick:()=>i(e=>!e),className:rl(r||n===`results`||n===`settings`),children:(0,L.jsx)(br,{className:`size-[1.375rem]`})}),r?(0,L.jsxs)(`div`,{role:`menu`,className:`absolute right-0 bottom-full mb-3 flex w-60 animate-rise flex-col rounded-2xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:[(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:v(n===`results`),onClick:()=>_(`/space/results`),children:[(0,L.jsx)(Rr,{className:`size-[1.125rem] shrink-0 text-ink-3`}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:P(`space.results`)})]}),(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:v(n===`settings`),onClick:()=>_(`/settings`),children:[(0,L.jsx)(Ki,{className:`size-[1.125rem] shrink-0 text-ink-3`}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:P(`nav.settings`)})]}),t.nav.map(e=>(0,L.jsx)(gT,{of:e,children:(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:v(!1),onClick:()=>_(e.to),children:[(0,L.jsx)(e.icon,{className:`size-[1.125rem] shrink-0 text-ink-3`}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label()})]})},e.serial)),(0,L.jsx)(`div`,{className:`mx-2 my-1.5 h-px bg-border-soft`}),(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:v(!1),onClick:()=>{i(!1),s(!0)},children:[(0,L.jsx)(Br,{className:`size-[1.125rem] shrink-0 text-ink-3`}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:P(`about.nav`)})]})]}):null,a?(0,L.jsx)(I.Suspense,{fallback:null,children:(0,L.jsx)(Jc,{open:!0,me:e,onClose:()=>s(!1)})}):null]}),p?(0,L.jsx)(`button`,{type:`button`,"aria-label":p.label,title:p.label,onClick:p.run,className:`liquid-glass glass-press relative grid size-14 shrink-0 place-items-center rounded-full text-ink`,children:(0,L.jsx)(p.icon,{className:`size-6`})}):null]})}var sl=Sn({route:_n().max(400),title:_n().max(200).optional(),view:_n().max(200).optional(),open:Sn({kind:_n().max(60),id:_n().max(120).optional(),label:_n().max(200)}).optional(),selection:xn(_n().max(120)).max(100).optional(),summary:_n().max(2e3).optional(),fields:xn(Sn({id:_n().max(120),label:_n().max(200),value:jn()})).max(60).optional(),plugin:_n().max(60).optional()}),cl=Sn({name:_n().regex(/^[a-z][a-z0-9_]{1,62}$/),description:_n().max(2e3),parameters:Mn(_n(),jn())});Sn({message:_n().min(1).max(8e3),projectId:_n().max(80).optional(),page:sl.optional(),tools:xn(cl).max(40).default([]),debug:kn().optional(),extra:kn().optional(),model:_n().max(80).optional()}),Sn({ref:_n().min(1).max(40),message:_n().min(1).max(8e3)});var ll={initial:400,min:320,max:720},ul=`wz.readAloud`,dl=typeof window<`u`&&`speechSynthesis`in window&&`SpeechSynthesisUtterance`in window;function fl(){try{return localStorage.getItem(ul)===`1`}catch{return!1}}function pl(e){try{localStorage.setItem(ul,e?`1`:`0`)}catch{}}function ml(e){let t=window.speechSynthesis.getVoices(),n=e.slice(0,2);return t.find(t=>t.lang===e&&t.default)??t.find(t=>t.lang===e)??t.find(e=>e.lang.startsWith(n)&&e.default)??t.find(e=>e.lang.startsWith(n))??null}function hl(e,t=N,n=!1){if(!dl||!e.trim())return;let r=window.speechSynthesis;n&&r.cancel();let i=On(t),a=new SpeechSynthesisUtterance(e.trim().slice(0,2e3));a.lang=i;let o=ml(i);o&&(a.voice=o),r.speak(a)}function gl(e,t=N){if(!dl||!e.trim())return Promise.resolve();let n=window.speechSynthesis;n.cancel();let r=On(t),i=new SpeechSynthesisUtterance(e.trim().slice(0,4e3));i.lang=r;let a=ml(r);return a&&(i.voice=a),new Promise(e=>{i.onend=()=>e(),i.onerror=()=>e(),n.speak(i)})}function _l(e){return e.replace(/```[\s\S]*?```/g,``).replace(/!\[[^\]]*\]\([^)]*\)/g,``).replace(/\[([^\]]+)\]\([^)]*\)/g,`$1`).replace(/https?:\/\/\S+/g,``).replace(/^#+\s*/gm,``).replace(/^\s*[-*]\s+/gm,``).replace(/[*_`>|]/g,``).replace(/\n{2,}/g,`. `).replace(/\s+/g,` `).trim()}function vl(){dl&&window.speechSynthesis.cancel()}function yl(){let[e,t]=(0,I.useState)(()=>dl&&fl()),n=(0,I.useCallback)(e=>{t(e),pl(e),e||vl()},[]);return(0,I.useEffect)(()=>{dl&&window.speechSynthesis.getVoices()},[]),(0,I.useEffect)(()=>()=>vl(),[]),[e,n]}function bl(e,t,n,r){let i=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(!e){i.current=null;return}let a=n.map(e=>e.key);if(!i.current){i.current=new Set(a);let e=[...n].reverse().find(e=>e.who===`bot`&&e.spoken!==!1);if(e){let n=r(e.key);n&&hl(n,t,!0)}return}let o=n.filter(e=>!i.current?.has(e.key));for(let e of a)i.current.add(e);o.some(e=>e.who===`me`)&&vl();for(let e of o)if(e.who===`bot`&&e.spoken!==!1){let n=r(e.key);n&&hl(n,t)}},[e,t,n,r])}var xl=/\.(png|jpe?g|gif|webp|avif|svg)$/i;function Sl(e){let t=e.filter(e=>e.type.startsWith(`image/`));return t.length?Object.fromEntries(t.map(e=>[e.name,URL.createObjectURL(e)])):void 0}function Cl(e){let t=e.match(/(?:^|\n\n)(?:Angehängt|Attached): ([^\n]+)$/);return t?{text:e.slice(0,t.index).trim(),names:t[1].split(`, `).filter(Boolean)}:{text:e,names:[]}}function wl({names:e,previews:t,fileUrl:n}){let r=e.filter(e=>t?.[e]||n&&xl.test(e)),i=e.filter(e=>!r.includes(e));return(0,L.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[r.map(e=>{let r=t?.[e]??n?.(e)??``;return(0,L.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,title:e,children:(0,L.jsx)(`img`,{src:r,alt:e,className:`max-h-60 w-auto max-w-full rounded-xl bg-paper-2 object-contain ring-1 ring-border`})},e)}),i.length?(0,L.jsx)(`div`,{className:`flex flex-wrap justify-end gap-1.5`,children:i.map(e=>(0,L.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-paper-2 px-2.5 py-1 text-[0.75rem] text-ink-2`,children:[(0,L.jsx)(vt,{className:`size-3 shrink-0 text-ink-4`}),(0,L.jsx)(`span`,{className:`truncate`,children:e})]},e))}):null]})}function Tl(e,t){let n=w(),[r,i]=(0,I.useState)([]),[a,o]=(0,I.useState)(`idle`),[s,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(null),[d,f]=(0,I.useState)(null),[p,m]=(0,I.useState)(null),[h,g]=(0,I.useState)(!0),_=(0,I.useRef)(null);return(0,I.useEffect)(()=>{if(e){if(_.current!==e.id){_.current=e.id,i(e.messages);return}a===`idle`&&i(t=>e.messages.length>=t.length?e.messages:t)}},[e,a]),{messages:r,phase:a,activity:l,thought:d,startedAt:p,error:s,send:async(r,s=[])=>{if(!e||!(r.trim()||s.length)||a!==`idle`)return!1;if(c(null),m(Date.now()),f(null),s.length){o(`thinking`);try{for(let t of s){let n=await fetch($e(`/api/studio/wizards/${e.id}/files/${encodeURIComponent(t.name)}`),{method:`PUT`,credentials:`include`,headers:{"content-type":t.type||`application/octet-stream`,"accept-language":N},body:t});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??n.statusText)}}}catch(t){return c(t.message),o(`idle`),m(null),await n.invalidateQueries({queryKey:E.wizard(e.id)}),!1}let t=`${P(`editor.attached`)}: ${s.map(e=>e.name).join(`, `)}`;r=r.trim()?`${r}\n\n${t}`:t}let l=`p-${Date.now()}`;i(e=>[...e,{id:`u-${Date.now()}`,role:`user`,content:r,previews:Sl(s)},{id:l,role:`assistant`,content:``,pending:!0}]),o(`thinking`),u(null);let d=!1;try{await ee(`/api/studio/wizards/${e.id}/chat`,{message:r,extra:h},(e,n)=>{if(e===`text`){let e=JSON.parse(n);i(t=>t.map(t=>t.id===l?{...t,content:t.content+e}:t))}else if(e===`activity`)u(JSON.parse(n));else if(e===`thought`)f(JSON.parse(n));else if(e===`building`)o(`building`);else if(e===`done`){d=!0;let e=JSON.parse(n);i(t=>t.map(t=>t.id===l?{...t,content:e.reply,changed:e.changed,pending:!1}:t)),e.changed&&t(e.draft,e.revision)}else e===`error`&&(d=!0,c(JSON.parse(n).message))}),d||c(P(`editor.chatBroken`))}catch(e){c(e.message)}finally{u(null),f(null),m(null),i(e=>e.filter(e=>!(e.id===l&&!e.content)).map(e=>({...e,pending:!1}))),o(`idle`),await n.invalidateQueries({queryKey:E.wizard(e.id)}),await n.invalidateQueries({queryKey:[`me`]})}return!0},fileUrl:t=>$e(`/api/studio/wizards/${e?.id}/files/${encodeURIComponent(t)}`),extra:h,setExtra:g}}function El(e){let[t,n]=(0,I.useState)(()=>Date.now());return(0,I.useEffect)(()=>{if(e===null)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e===null?null:Math.max(0,Math.floor((t-e)/1e3))}function Dl(e){return e<60?`${e} s`:`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)} min`}function Ol({chat:e,thought:t,className:n,spinner:r=`size-3.5`}){let i=El(e.startedAt);return(0,L.jsxs)(`div`,{className:j(`min-w-0`,n),children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(dt,{className:j(`shrink-0`,r)}),(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e.activity??(e.phase===`building`?P(`editor.building`):P(`editor.thinking`))}),i===null?null:(0,L.jsx)(`span`,{className:`shrink-0 text-ink-4 tabular-nums`,children:Dl(i)})]}),t&&e.thought?(0,L.jsx)(`p`,{className:`mt-0.5 truncate pl-5.5 text-[0.75rem] text-ink-4`,children:e.thought}):null]})}function kl({message:e,fileUrl:t}){let{text:n,names:r}=Cl(e.content);return(0,L.jsxs)(`div`,{className:`ml-8 flex flex-col items-end gap-1.5 self-end`,children:[e.signal?(0,L.jsx)(`span`,{className:`text-[0.6875rem] text-ink-4`,children:P(`assistant.signalled`)}):null,r.length?(0,L.jsx)(wl,{names:r,previews:e.previews,fileUrl:t}):null,n?(0,L.jsx)(`div`,{className:`rounded-xl rounded-br-md bg-paper-2 px-4 py-2.5 text-[0.875rem] leading-relaxed`,children:(0,L.jsx)(`span`,{className:`whitespace-pre-wrap`,children:n})}):null]})}function Al({chat:e,avatar:t,costume:n,changedLabel:r,card:i,calls:a,foot:o}){return(0,L.jsx)(`div`,{className:`flex flex-col gap-4`,children:e.messages.map(s=>s.role===`user`?(0,L.jsx)(kl,{message:s,fileUrl:e.fileUrl},s.id):(0,L.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,L.jsx)(`div`,{className:`shrink-0`,children:(0,L.jsx)(Xt,{kind:t,costume:n,size:28,interactive:!1})}),(0,L.jsxs)(`div`,{className:`min-w-0 pt-0.5 text-[0.875rem]`,children:[s.source===`mcp`?(0,L.jsxs)(`div`,{className:`mb-1 inline-flex items-center gap-1.5 text-[0.75rem] text-ink-3`,children:[(0,L.jsx)(Ut,{className:`size-3`}),` `,P(`editor.viaClient`,{client:s.client??`MCP`})]}):null,a?a(s):null,s.content?(0,L.jsx)(Tt,{text:s.content,className:`text-[0.875rem]`}):null,i&&s.cards?.length?(0,L.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:s.cards.map(e=>(0,L.jsx)(I.Fragment,{children:i(e)},e.id))}):null,s.pending?(0,L.jsx)(Ol,{chat:e,thought:!0,className:`mt-1 text-[0.8125rem] text-ink-3`}):null,s.changed?(0,L.jsxs)(`div`,{className:`mt-2 inline-flex items-center gap-1.5 rounded-full bg-ember-tint px-2.5 py-0.5 text-[0.75rem] text-ember-strong`,children:[(0,L.jsx)(et,{className:`size-3`}),` `,r]}):null,o?o(s):null]})]},s.id))})}var jl=`wizards.editorThread.height`,Ml=320,Nl=120,Pl=()=>Math.max(Nl,window.innerHeight-260);function Fl(){let[e,t]=(0,I.useState)(()=>{try{let e=Number(localStorage.getItem(jl));return e?Math.min(Math.max(e,Nl),Pl()):Ml}catch{return Ml}});return{height:e,set:e=>{let n=Math.round(Math.min(Math.max(e,Nl),Pl()));t(n);try{localStorage.setItem(jl,String(n))}catch{}}}}function Il({open:e,height:t,onHeight:n,onToggle:r}){let i=(0,I.useRef)(null);return(0,L.jsx)(`div`,{role:`separator`,tabIndex:0,"aria-orientation":`horizontal`,"aria-valuenow":t,"aria-valuemin":Nl,"aria-label":P(`editor.threadGrip`),title:P(`editor.threadGrip`),onPointerDown:n=>{n.button===0&&(n.preventDefault(),n.currentTarget.setPointerCapture(n.pointerId),i.current={y:n.clientY,height:e?t:0,moved:!1})},onPointerMove:t=>{let a=i.current;!a||!a.moved&&Math.abs(t.clientY-a.y)<4||!(e||a.moved)&&t.clientY>a.y||(e||a.moved||r(!0),a.moved=!0,n(a.height+(a.y-t.clientY)))},onPointerUp:()=>{let t=i.current&&!i.current.moved;i.current=null,t&&r(!e)},onPointerCancel:()=>{i.current=null},onKeyDown:i=>{if(i.key===`ArrowUp`||i.key===`ArrowDown`){if(i.preventDefault(),!e){i.key===`ArrowUp`&&r(!0);return}n(t+(i.key===`ArrowUp`?32:-32))}else(i.key===`Enter`||i.key===` `)&&(i.preventDefault(),r(!e))},className:`group flex h-3.5 shrink-0 cursor-row-resize touch-none items-center justify-center outline-none`,children:(0,L.jsx)(`span`,{className:`h-1 w-10 rounded-full bg-ink-4/40 transition group-hover:bg-ink-4 group-focus-visible:bg-ember`})})}function Ll({chat:e,avatar:t,costume:n,hello:r=P(`editor.chatHello`),placeholder:i=P(`editor.composer`),changedLabel:a=P(`editor.flowChanged`),compact:o,intro:s,closed:c,card:l,foldOn:u}){let[d,f]=(0,I.useState)(!1);(0,I.useEffect)(()=>{u&&f(!1)},[u]);let p=Fl(),m=(0,I.useRef)(null),h=(0,I.useRef)(null);(0,I.useEffect)(()=>{m.current?.scrollTo({top:m.current.scrollHeight,behavior:`smooth`})},[e.messages,e.phase]);let g=!o||d,_=e.messages.at(-1),[v,y]=(0,I.useState)(!1),b=(0,I.useRef)(0),ee=e=>!c&&e.dataTransfer.types.includes(`Files`);return(0,L.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,onDragEnter:e=>{ee(e)&&(e.preventDefault(),b.current+=1,y(!0))},onDragOver:e=>{ee(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)},onDragLeave:()=>{b.current=Math.max(0,b.current-1),b.current===0&&y(!1)},onDrop:e=>{ee(e)&&(e.preventDefault(),b.current=0,y(!1),h.current?.add(Array.from(e.dataTransfer.files).map(st)),h.current?.focus())},children:[v?(0,L.jsxs)(`div`,{className:`pointer-events-none absolute inset-3 z-20 flex flex-col items-center justify-center gap-2 rounded-2xl border-2 border-ember border-dashed bg-ember-veil text-[0.875rem] text-ember-strong`,children:[(0,L.jsx)(vt,{className:`size-6`}),P(`editor.dropToAttach`)]}):null,(0,L.jsxs)(`div`,{className:o?j(`mb-2 flex min-h-0 flex-col overflow-hidden rounded-2xl bg-card shadow-overlay ring-1 ring-border`,!(_||e.error)&&`hidden`):`contents`,children:[o&&(_||e.error)?(0,L.jsx)(Il,{open:d,height:p.height,onHeight:p.set,onToggle:f}):null,o&&(_||e.error)?(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":d,"aria-label":P(`editor.thread`),onClick:()=>f(e=>!e),className:`flex items-center gap-2 px-4 pb-0.5 text-left text-[0.8125rem] text-ink-3 transition hover:text-ink`,children:[!(e.error||d)&&_?.pending?(0,L.jsx)(Ol,{chat:e,className:`flex-1`}):(0,L.jsx)(`span`,{className:j(`min-w-0 flex-1 truncate`,e.error&&`text-rose`),children:e.error??(d?P(`editor.thread`):_?.content)}),d?(0,L.jsx)(pe,{className:`size-4 shrink-0`}):(0,L.jsx)(or,{className:`size-4 shrink-0`})]}):null,(0,L.jsxs)(`div`,{ref:m,className:j(`min-h-0 flex-1 overflow-y-auto px-5 py-5`,!g&&`hidden`),style:o?{height:p.height,flex:`none`}:void 0,children:[e.messages.length===0&&!c?s??(0,L.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,L.jsx)(Xt,{kind:t,costume:n,size:32,interactive:!1}),(0,L.jsx)(`p`,{className:`pt-1 text-[0.875rem] text-ink-2 leading-relaxed`,children:r})]}):null,(0,L.jsx)(Al,{chat:e,avatar:t,costume:n,changedLabel:a,card:l}),e.error?(0,L.jsx)(`div`,{className:`mt-4 rounded-lg bg-rose-tint px-3 py-2 text-[0.8125rem] text-rose`,children:e.error}):null]})]}),c?(0,L.jsx)(`p`,{className:`m-3 rounded-xl bg-paper-2 px-4 py-3 text-[0.8125rem] text-ink-2 leading-relaxed`,children:c}):(0,L.jsx)(rt,{ref:h,floating:o,className:o?void 0:`p-3`,placeholder:i,disabled:e.phase!==`idle`,onSend:(t,n)=>e.send(t,n),effort:e.setExtra?{on:!!e.extra,onChange:e.setExtra}:void 0})]})}var Rl=1e3;function zl(e){let[t,n]=e.split(`/`);return n&&hn.includes(t)?{maker:t,cls:n}:{maker:null,cls:e}}var Bl=[`low`,`standard`,`high`,`highest`];function Vl(e){let t=e.filter(e=>Bl.includes(zl(e).cls));return t.find(e=>zl(e).maker)??t[0]??null}function Hl(e,t){let n=e.models.find(e=>e.id===t),r=n?Vl(n.classes):t;if(!r)return null;let{maker:i,cls:a}=zl(r);return Bl.includes(a)&&(i?gn[i].includes(a):a!==`highest`)?{maker:i,cls:a}:null}function Ul(e,t,n,r){let i=t?.way===`C`?t.purposes[n].models:null,a=e.classes[r]?.model;return i&&!i.includes(r)&&a&&i.includes(a)?a:r}var Wl=Sn({models:xn(_n().min(1).max(200)).max(100).nullable(),default:_n().min(1).max(200).nullable(),effortCap:Tn(Nn).nullable(),efforts:Mn(_n(),xn(Tn(Nn)).min(1)).nullable()});Sn({way:Tn([`A`,`B`,`C`]),purposes:Sn({wizard:Wl,assistant:Wl,work:Wl}),credits:kn(),ownKeys:kn(),subscriptions:kn(),localModels:kn(),apps:Sn({local:kn(),subscriptions:kn()}),masking:kn(),maskInstructions:_n().max(Rl).optional(),maskLabels:xn(_n().trim().min(1).max(60)).max(20).optional()});var Gl={general:`tier.name.general`,"eu-private":`tier.name.eu-private`,"eu-sovereign":`tier.name.eu-sovereign`};function Kl(e,t){let n=Gl[e];return n?P(n):t}function ql(e){let{tier:t}=e;return t?{...e,tier:{...t,name:Kl(t.id,t.name),choices:t.choices.map(e=>({...e,name:Kl(e.id,e.name)}))}}:e}function Jl(){let e=La(`modelTiers`),{data:t}=Ae({queryKey:[`models`],queryFn:()=>p.get(`/api/studio/models`),select:ql,enabled:e});return e?{tier:t?.tier??null,modelPolicy:t?.modelPolicy??null}:{tier:null,modelPolicy:null}}var Yl=e=>!!(e&&(e.rules.regions||e.rules.zdr||e.rules.noTraining)),Xl=e=>!!e?.model;function Zl(e){let t=e?.name??P(`tier.theModel`);return e&&!Xl(e)?P(`tier.reason.${e.reason}`,{model:t}):P(`tier.reason.unbound`)}function Ql(e){let t=[e.route,e.region].filter(Boolean).join(`, `);return t?`${e.name} · ${t}`:e.name}function $l(e){let{maker:t,cls:n}=zl(e),r=P(`class.${n}`);return t?`${P(`maker.family.${t}`)} · ${r}`:r}function eu(e){return[...mn.filter(e=>e!==`classifier`),...hn.flatMap(t=>gn[t].map(e=>`${t}/${e}`).filter(t=>t in e.classes))]}function tu(e,t){return t.models??eu(e).filter(t=>Xl(e.classes[t]))}function nu(e){return P(`chooser.hint.${zl(e).cls}`)}function ru(e){return e.models.filter(e=>e.kind===`text`)}var iu=(e,t)=>({id:t,model:e.id,name:e.name,hint:nu(t),efforts:e.efforts});function au(e){return ru(e).flatMap(e=>{let t=e.chooser?Vl(e.classes):null;return t?[iu(e,t)]:[]})}function ou(e){return ru(e).flatMap(e=>{let t=e.chooser?null:Vl(e.classes);return t?[iu(e,t)]:[]})}function su(e){return[...au(e),...ou(e)]}function cu(e,t){let n=e.classes[t],r=Xl(n)?n.model:n?null:t,i=r?ru(e).find(e=>e.id===r):void 0,a=i?n?t:Vl(i.classes):null;return i&&a?iu(i,a):null}function lu(e){let t=new Set;return e.filter(e=>!e||t.has(e.model)?!1:(t.add(e.model),!0))}function B(e,t,n){let r=t?.purposes[n]??null,i=t?.way===`C`&&r?tu(e,r):null,a=t?.way===`B`?r?.effortCap??null:null,o=r=>Ul(e,t,n,r);return{way:t?.way??`A`,allowed:t=>Xl(e.classes[t])&&(!i||i.includes(o(t))),notApproved:t=>Xl(e.classes[t])&&!!i&&!i?.includes(o(t)),efforts:e=>i?r?.efforts?.[o(e)]??[...Nn]:a?Nn.slice(0,Nn.indexOf(a)+1):[...Nn],items:i?lu(i.map(t=>cu(e,t))):au(e),auto:!i,itemFor(t,n){let r=cu(e,t)?.model;return n.find(e=>e.id===t)??n.find(e=>e.model===r)??null},default:r?.default??null,cap:a}}var uu=E.cloudSync();function du(e){return e?.mode===`local`&&!!e.account&&ba(e.features,`twoWaySync`)}function fu(){let e=$t(),t=du(e.data),n=ba(e.data?.features??{},`liveChanges`);return Ae({queryKey:uu,queryFn:()=>p.get(`/api/studio/sync`),enabled:t,refetchInterval:t?n?12e4:2e4:!1})}function pu(e){let t=w(),n=ba($t().data?.features??{},`liveChanges`);return zt({mutationFn:e,onSuccess:e=>{e&&typeof e==`object`&&`spaces`in e?t.setQueryData(uu,e):t.invalidateQueries({queryKey:uu}),!n&&(t.invalidateQueries({queryKey:[`wizard`]}),t.invalidateQueries({queryKey:[`space-page`]}),t.invalidateQueries({queryKey:[`space-table`]}))}})}var mu=e=>new Date(e).toLocaleString(N===`de`?`de-AT`:`en-GB`,{day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`}),hu={update_here:`cloudSync.error.updateHere`,update_cloud:`cloudSync.error.updateCloud`,unreachable:`cloudSync.error.unreachable`,signed_out:`cloudSync.error.signedOut`,refused:`cloudSync.error.refused`};function gu(e){let t=e.reason?hu[e.reason]:void 0;return t?P(t):e.message}var _u={space:`cloudSync.kind.space`,wizard:`cloudSync.kind.wizard`,translation:`cloudSync.kind.translation`,message:`cloudSync.kind.message`,page:`cloudSync.kind.page`,table:`cloudSync.kind.table`,row:`cloudSync.kind.row`,category:`cloudSync.kind.category`,file:`cloudSync.kind.file`,connector:`cloudSync.kind.connector`,skill:`cloudSync.kind.skill`},vu={title:`cloudSync.word.title`,markdown:`cloudSync.word.text`,description:`cloudSync.word.description`,steps:`cloudSync.word.steps`,fields:`cloudSync.word.fields`,instructions:`cloudSync.word.instructions`,prompt:`cloudSync.word.prompt`,label:`cloudSync.word.label`,cells:`cloudSync.word.cells`,columns:`cloudSync.word.columns`,name:`cloudSync.word.name`,brand:`cloudSync.word.brand`,facts:`cloudSync.word.facts`,themes:`cloudSync.word.themes`,files:`cloudSync.word.files`,options:`cloudSync.word.options`,categories:`cloudSync.word.categories`,values:`cloudSync.word.values`,texts:`cloudSync.word.texts`,page:`cloudSync.word.page`};function yu(e){return e.split(` › `).map(e=>e.startsWith(`“`)||!vu[e]?e:P(vu[e])).join(` › `)}var bu=new Map,xu=new Set;function Su(e){(0,I.useEffect)(()=>{if(e){bu.set(e,(bu.get(e)??0)+1);for(let e of xu)e();return()=>{bu.set(e,(bu.get(e)??1)-1),bu.get(e)||bu.delete(e);for(let e of xu)e()}}},[e])}function Cu(){let[,e]=(0,I.useState)(0);return(0,I.useEffect)(()=>{let t=()=>e(e=>e+1);return xu.add(t),()=>{xu.delete(t)}},[]),[...bu.keys()]}function wu(){let e=fu(),t=pu(()=>p.post(`/api/studio/sync/now`,{})),n=pu(e=>p.put(`/api/studio/sync/spaces/${e.id}`,{on:e.on})),r=e.data;return r?(0,L.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,L.jsx)(Ct,{title:P(`cloudSync.title`),hint:P(`cloudSync.hint`),action:(0,L.jsxs)(D,{variant:`secondary`,size:`sm`,busy:t.isPending,onClick:()=>t.mutate(void 0),children:[(0,L.jsx)(gt,{className:`size-3.5`}),` `,P(`cloudSync.now`)]}),children:(0,L.jsx)(`ul`,{className:`flex flex-col divide-y divide-border-soft`,children:r.spaces.map(e=>(0,L.jsxs)(`li`,{className:`flex items-start gap-4 py-3 first:pt-0 last:pb-0`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`p`,{className:`font-medium text-[0.9375rem]`,children:e.name}),(0,L.jsx)(Tu,{space:e,refusals:r.refusals[e.spaceId]})]}),e.organization?null:(0,L.jsx)(it,{checked:e.on,label:P(`cloudSync.spaceOn`),disabled:n.isPending,onChange:t=>n.mutate({id:e.spaceId,on:t})})]},e.spaceId))})}),r.conflicts.length?(0,L.jsx)(Eu,{view:r}):null,r.merges.length?(0,L.jsx)(ku,{merges:r.merges}):null]}):e.isLoading?(0,L.jsx)(dt,{className:`size-5`}):null}function Tu({space:e,refusals:t}){let n=`mt-0.5 text-[0.8125rem] text-ink-3`;return e.organization?(0,L.jsx)(`p`,{className:n,children:P(`cloudSync.state.otherOrganization`,{name:e.organization})}):e.on?(0,L.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2`,children:[e.error?(0,L.jsxs)(`p`,{className:`text-[0.8125rem] text-rose`,children:[gu(e.error),e.error.reason===`refused`&&t?.length?` ${t.join(` · `)}`:``]}):e.waiting?(0,L.jsx)(x,{tone:`warn`,children:P(`cloudSync.state.waiting`,{count:e.waiting})}):e.conflicts?null:(0,L.jsx)(x,{tone:`live`,children:P(`cloudSync.state.ok`)}),e.conflicts?(0,L.jsx)(x,{tone:`ember`,children:P(`cloudSync.state.conflicts`,{count:e.conflicts})}):null,e.syncedAt?(0,L.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:P(`cloudSync.state.at`,{when:mu(e.syncedAt)})}):null]}):(0,L.jsx)(`p`,{className:n,children:P(e.here?`cloudSync.state.hereOnly`:`cloudSync.state.cloudOnly`)})}function Eu({view:e}){let t=pu(e=>p.post(`/api/studio/sync/spaces/${e}/keep-cloud`,{})),n=[...new Set(e.conflicts.map(e=>e.spaceId))];return(0,L.jsx)(Ct,{title:P(`cloudSync.conflicts`),hint:P(`cloudSync.conflictsHint`),action:e.conflicts.length>1&&n.length===1?(0,L.jsx)(D,{variant:`secondary`,size:`sm`,busy:t.isPending,onClick:()=>t.mutate(n[0]),children:P(`cloudSync.keepCloudAll`)}):null,children:(0,L.jsx)(`ul`,{className:`flex flex-col divide-y divide-border-soft`,children:e.conflicts.map(e=>(0,L.jsx)(`li`,{className:`py-4 first:pt-0 last:pb-0`,children:(0,L.jsx)(Ou,{conflict:e})},e.id))})})}var Du=e=>e===void 0?P(`cloudSync.removed`):typeof e==`string`?e:JSON.stringify(e,null,1);function Ou({conflict:e}){let[t,n]=(0,I.useState)(!1),[r,i]=(0,I.useState)(()=>e.conflicts.map(()=>`local`)),[a,o]=(0,I.useState)(null),s=pu(t=>p.post(`/api/studio/sync/conflicts/${e.id}/resolve`,t)),c=zt({mutationFn:()=>p.post(`/api/studio/sync/conflicts/${e.id}/propose`,{}),onSuccess:e=>o(e.record)}),l=e.deleted===`remote`?P(`cloudSync.conflict.deletedRemote`):e.deleted===`local`?P(`cloudSync.conflict.deletedLocal`):P(`cloudSync.conflict.both`);return(0,L.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`p`,{className:`font-medium text-[0.9375rem]`,children:[(0,L.jsxs)(`span`,{className:`text-ink-3`,children:[P(_u[e.kind]),` · `]}),e.title]}),(0,L.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:l})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(D,{size:`sm`,variant:`secondary`,busy:s.isPending,onClick:()=>s.mutate({take:`remote`}),children:P(`cloudSync.keepCloud`)}),(0,L.jsx)(D,{size:`sm`,variant:`secondary`,busy:s.isPending,onClick:()=>s.mutate({take:`local`}),children:P(`cloudSync.keepLocal`)}),e.conflicts.length?(0,L.jsx)(D,{size:`sm`,variant:`ghost`,onClick:()=>n(e=>!e),children:P(`cloudSync.pick`)}):null,e.deleted?null:(0,L.jsx)(D,{size:`sm`,variant:`ghost`,busy:c.isPending,onClick:()=>c.mutate(),children:P(`cloudSync.ai`)})]}),t?(0,L.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg bg-paper-2 p-3`,children:[e.conflicts.map((e,t)=>(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`p`,{className:`font-medium text-[0.8125rem]`,children:yu(e.label)}),[`local`,`remote`].map(n=>(0,L.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-[0.8125rem]`,children:[(0,L.jsx)(`input`,{type:`radio`,className:`mt-1`,checked:r[t]===n,onChange:()=>i(e=>e.map((e,r)=>r===t?n:e))}),(0,L.jsxs)(`span`,{className:`min-w-0`,children:[(0,L.jsxs)(`span`,{className:`text-ink-3`,children:[P(n===`local`?`cloudSync.here`:`cloudSync.cloud`),`:`,` `]}),(0,L.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:Du(e[n])})]})]},n))]},e.label)),(0,L.jsx)(`div`,{children:(0,L.jsx)(D,{size:`sm`,busy:s.isPending,onClick:()=>s.mutate({choices:r.map(e=>({take:e}))}),children:P(`cloudSync.apply`)})})]}):null,c.isError?(0,L.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:P(`cloudSync.aiFailed`,{error:c.error.message})}):null,a?(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-paper-2 p-3`,children:[(0,L.jsx)(`p`,{className:`text-[0.8125rem] text-ink-2`,children:P(`cloudSync.aiProposal`)}),(0,L.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words text-[0.75rem] text-ink-2`,children:JSON.stringify(a,null,2)}),(0,L.jsx)(`div`,{children:(0,L.jsx)(D,{size:`sm`,busy:s.isPending,onClick:()=>s.mutate({record:a}),children:P(`cloudSync.aiTake`)})})]}):null,s.isError?(0,L.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:s.error.message}):null]})}function ku({merges:e}){return(0,L.jsx)(Ct,{title:P(`cloudSync.merges`),hint:P(`cloudSync.mergesHint`),children:(0,L.jsx)(`ul`,{className:`flex flex-col divide-y divide-border-soft`,children:e.map(e=>(0,L.jsx)(`li`,{className:`py-4 first:pt-0 last:pb-0`,children:(0,L.jsx)(Au,{merge:e})},e.id))})})}function Au({merge:e,compact:t}){let n=pu(()=>p.post(`/api/studio/sync/merges/seen`,{ids:[e.id]})),r=pu(t=>p.post(`/api/studio/sync/merges/${e.id}/undo`,{take:t}));return(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsxs)(`div`,{className:`text-[0.8125rem]`,children:[(0,L.jsx)(`p`,{className:`font-medium text-[0.9375rem]`,children:t?P(`cloudSync.merged`):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`text-ink-3`,children:[P(_u[e.kind]),` · `]}),e.title]})}),e.local.length?(0,L.jsx)(`p`,{className:`mt-0.5 text-ink-3`,children:P(`cloudSync.mergedHere`,{places:e.local.map(yu).join(`, `)})}):null,e.remote.length?(0,L.jsx)(`p`,{className:`mt-0.5 text-ink-3`,children:P(`cloudSync.mergedThere`,{places:e.remote.map(yu).join(`, `)})}):null]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(D,{size:`sm`,variant:`secondary`,busy:n.isPending,onClick:()=>n.mutate(void 0),children:P(`cloudSync.ok`)}),(0,L.jsx)(D,{size:`sm`,variant:`ghost`,busy:r.isPending,onClick:()=>r.mutate(`local`),children:P(`cloudSync.undoLocal`)}),(0,L.jsx)(D,{size:`sm`,variant:`ghost`,busy:r.isPending,onClick:()=>r.mutate(`remote`),children:P(`cloudSync.undoRemote`)})]})]})}function ju({kind:e,item:t}){let n=fu(),r=n.data?.conflicts.find(n=>n.kind===e&&n.item===t),i=n.data?.merges.find(n=>n.kind===e&&n.item===t);return Su(r?r.id:null),r?(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-border-soft border-b bg-amber-tint px-4 py-2 text-[0.8125rem] text-ink-2 sm:px-6`,children:[(0,L.jsx)(ur,{className:`size-4 shrink-0 text-amber`}),(0,L.jsx)(`p`,{className:`min-w-0 flex-1`,children:P(`cloudSync.conflict.both`)}),(0,L.jsx)(o,{to:`/settings/cloud`,className:`shrink-0 underline transition hover:text-ink`,children:P(`cloudSync.settle`)})]}):i?(0,L.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 border-border-soft border-b bg-moss-tint px-4 py-2 sm:px-6`,children:[(0,L.jsx)(Or,{className:`mt-1 size-4 shrink-0 text-moss`}),(0,L.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,L.jsx)(Au,{merge:i,compact:!0})})]}):null}function Mu({me:e}){let t=fu(),n=Cu(),r=(t.data?.conflicts??[]).filter(e=>!n.includes(e.id)).length;return!du(e)||!r?null:(0,L.jsxs)(`div`,{className:`flex items-center gap-3 border-border-soft border-b bg-amber-tint px-4 py-2 text-[0.8125rem] text-ink-2 sm:px-6`,children:[(0,L.jsx)(ur,{className:`size-4 shrink-0 text-amber`}),(0,L.jsx)(`p`,{className:`min-w-0 flex-1`,children:P(`cloudSync.bar`,{count:r})}),(0,L.jsx)(o,{to:`/settings/cloud`,className:`shrink-0 underline transition hover:text-ink`,children:P(`cloudSync.settle`)})]})}var Nu=[`text`,`image`,`video`,`speech`,`listening`],Pu={text:[`classifier`,`low`,`standard`,`high`],image:[`image`],video:[`video`],speech:[`speech`],listening:[`audio`]},Fu={classifier:{needs:[`json`],context:32e3,blocks:[]},low:{needs:[`tools`,`json`,`vision`],context:64e3,blocks:[]},standard:{needs:[`tools`,`json`,`vision`],context:128e3,blocks:[`tools`]},high:{needs:[`tools`,`json`,`vision`,`reasoning`],context:2e5,blocks:[`tools`]}},Iu=`credits`,Lu=`${Iu}:`;function Ru(e){return e===`credits`||!!e?.startsWith(Lu)}function zu(e){return e?.startsWith(Lu)&&e.slice(Lu.length)||null}function Bu(e){return e?`${Lu}${e}`:Iu}function Vu(e){return e===`transcription`?`listening`:e}var Hu=[`openai`,`anthropic`,`google`,`fal`,`elevenlabs`,`replicate`,`gateway`],Uu={en:{"about.openai":`GPT models, GPT Image and voices.`,fast:`fast`,thorough:`thorough`,versatile:`versatile`,lowCost:`low cost`,fastLowCost:`fast, low cost`,"about.anthropic":`The Claude models.`,strongest:`strongest`,"about.google":`Gemini, Veo for video and voices – one key from AI Studio.`,fastEditsPhotos:`fast, edits photos`,bestQuality:`best quality`,withSound:`with sound`,"about.fal":`Hundreds of image, video and audio models with one key: FLUX, Recraft, Veo, Luma, MiniMax.`,highQuality:`high quality`,graphicsLogosTextIn:`graphics, logos, text in images`,photorealistic:`photorealistic`,"about.elevenlabs":`Natural voices in many languages and accurate transcripts.`,naturalManyLanguages:`natural, many languages`,expressive:`expressive`,veryAccurate:`very accurate`,"about.replicate":`Open image and video models, billed per run.`,"about.gateway":`One key for many providers’ models, billed by Vercel.`},de:{"about.openai":`GPT-Modelle, GPT Image und Stimmen.`,fast:`schnell`,thorough:`gründlich`,versatile:`vielseitig`,lowCost:`günstig`,fastLowCost:`schnell, günstig`,"about.anthropic":`Die Claude-Modelle.`,strongest:`am stärksten`,"about.google":`Gemini, Veo für Videos und Stimmen – ein Key aus dem AI Studio.`,fastEditsPhotos:`schnell, bearbeitet Fotos`,bestQuality:`beste Qualität`,withSound:`mit Ton`,"about.fal":`Hunderte Bild-, Video- und Audio-Modelle mit einem Key: FLUX, Recraft, Veo, Luma, MiniMax.`,highQuality:`hohe Qualität`,graphicsLogosTextIn:`Grafiken, Logos, Text im Bild`,photorealistic:`fotorealistisch`,"about.elevenlabs":`Natürliche Stimmen in vielen Sprachen und genaue Transkripte.`,naturalManyLanguages:`natürlich, viele Sprachen`,expressive:`ausdrucksstark`,veryAccurate:`sehr genau`,"about.replicate":`Offene Bild- und Video-Modelle, abgerechnet pro Lauf.`,"about.gateway":`Ein Key für die Modelle vieler Anbieter, abgerechnet bei Vercel.`}},Wu=(e,t)=>wn(Uu,e,t),Gu=[{id:`openai`,name:`OpenAI`,about:`about.openai`,keyUrl:`https://platform.openai.com/api-keys`,keyPlaceholder:`sk-…`,text:{classifier:`openai:gpt-5.4-mini`,low:`openai:gpt-5.4-mini`,standard:`openai:gpt-5.5`,high:`openai:gpt-5.5`},models:{text:[{ref:`openai:gpt-5.4-mini`,label:`GPT-5.4 mini`,note:`fast`},{ref:`openai:gpt-5.5`,label:`GPT-5.5`,note:`thorough`}],image:[{ref:`openai:gpt-image-2`,label:`GPT Image 2`,note:`versatile`},{ref:`openai:gpt-image-1-mini`,label:`GPT Image 1 mini`,note:`lowCost`}],speech:[{ref:`openai:gpt-4o-mini-tts`,label:`GPT-4o mini TTS`,note:`lowCost`}],listening:[{ref:`openai:gpt-4o-mini-transcribe`,label:`GPT-4o mini Transcribe`,note:`fastLowCost`},{ref:`openai:whisper-1`,label:`Whisper`}]}},{id:`anthropic`,name:`Anthropic`,about:`about.anthropic`,keyUrl:`https://console.anthropic.com/settings/keys`,keyPlaceholder:`sk-ant-…`,text:{classifier:`anthropic:claude-haiku-4-5`,low:`anthropic:claude-haiku-4-5`,standard:`anthropic:claude-sonnet-5-5`,high:`anthropic:claude-opus-5-5`},models:{text:[{ref:`anthropic:claude-haiku-4-5`,label:`Claude Haiku 4.5`,note:`fast`},{ref:`anthropic:claude-sonnet-5-5`,label:`Claude Sonnet 5.5`},{ref:`anthropic:claude-opus-5-5`,label:`Claude Opus 5.5`,note:`strongest`}]}},{id:`google`,name:`Google Gemini`,about:`about.google`,keyUrl:`https://aistudio.google.com/apikey`,keyPlaceholder:`AIza…`,text:{classifier:`google:gemini-flash-lite-latest`,low:`google:gemini-flash-latest`,standard:`google:gemini-pro-latest`,high:`google:gemini-pro-latest`},models:{text:[{ref:`google:gemini-flash-lite-latest`,label:`Gemini Flash-Lite`,note:`lowCost`},{ref:`google:gemini-flash-latest`,label:`Gemini Flash`},{ref:`google:gemini-pro-latest`,label:`Gemini Pro`,note:`thorough`}],image:[{ref:`google:gemini-3.1-flash-image-preview`,label:`Gemini 3.1 Flash Image`,note:`fastEditsPhotos`},{ref:`google:gemini-3-pro-image-preview`,label:`Gemini 3 Pro Image`,note:`bestQuality`}],video:[{ref:`google:veo-3.1-fast-generate-preview`,label:`Veo 3.1 Fast`,note:`withSound`},{ref:`google:veo-3.1-generate-preview`,label:`Veo 3.1`,note:`bestQuality`}],speech:[{ref:`google:gemini-3.8-flash-tts`,label:`Gemini Flash TTS`}],listening:[{ref:`google:gemini-flash-lite-latest`,label:`Gemini Flash-Lite`}]}},{id:`fal`,name:`fal.ai`,about:`about.fal`,keyUrl:`https://fal.ai/dashboard/keys`,keyPlaceholder:`xxxxxxxx-…:…`,models:{image:[{ref:`fal:fal-ai/flux/schnell`,label:`FLUX.1 schnell`,note:`fastLowCost`},{ref:`fal:fal-ai/flux-pro/v1.1`,label:`FLUX 1.1 pro`,note:`highQuality`},{ref:`fal:fal-ai/recraft/v3/text-to-image`,label:`Recraft V3`,note:`graphicsLogosTextIn`},{ref:`fal:fal-ai/imagen4/preview`,label:`Imagen 4`,note:`photorealistic`}],video:[{ref:`fal:veo3/fast`,label:`Veo 3 Fast`,note:`withSound`},{ref:`fal:luma-ray-2-flash`,label:`Luma Ray 2 Flash`,note:`fast`},{ref:`fal:minimax-video`,label:`MiniMax Hailuo`}],speech:[{ref:`fal:fal-ai/minimax/speech-02-turbo`,label:`MiniMax Speech-02 Turbo`,note:`fast`},{ref:`fal:fal-ai/minimax/speech-02-hd`,label:`MiniMax Speech-02 HD`}],listening:[{ref:`fal:wizper`,label:`Wizper`,note:`fast`},{ref:`fal:whisper`,label:`Whisper`}]}},{id:`elevenlabs`,name:`ElevenLabs`,about:`about.elevenlabs`,keyUrl:`https://elevenlabs.io/app/settings/api-keys`,keyPlaceholder:`sk_…`,models:{speech:[{ref:`elevenlabs:eleven_multilingual_v2`,label:`Multilingual v2`,note:`naturalManyLanguages`},{ref:`elevenlabs:eleven_flash_v2_5`,label:`Flash v2.5`,note:`fastLowCost`},{ref:`elevenlabs:eleven_v3`,label:`Eleven v3`,note:`expressive`}],listening:[{ref:`elevenlabs:scribe_v2`,label:`Scribe v2`,note:`veryAccurate`}]}},{id:`replicate`,name:`Replicate`,about:`about.replicate`,keyUrl:`https://replicate.com/account/api-tokens`,keyPlaceholder:`r8_…`,models:{image:[{ref:`replicate:black-forest-labs/flux-schnell`,label:`FLUX.1 schnell`,note:`fastLowCost`},{ref:`replicate:black-forest-labs/flux-1.1-pro`,label:`FLUX 1.1 pro`},{ref:`replicate:recraft-ai/recraft-v3`,label:`Recraft V3`}],video:[{ref:`replicate:minimax/video-01`,label:`MiniMax Video-01`}]}},{id:`gateway`,name:`Vercel AI Gateway`,about:`about.gateway`,keyUrl:`https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fapi-keys`,keyPlaceholder:`vck_…`,text:{classifier:`deepseek/deepseek-v4.1-flash`,low:`deepseek/deepseek-v4.1-flash`,standard:`deepseek/deepseek-v4.1-flash`,high:`moonshotai/kimi-k3`},models:{text:[{ref:`deepseek/deepseek-v4.1-flash`,label:`DeepSeek V4.1 Flash`,note:`fastLowCost`},{ref:`moonshotai/kimi-k3`,label:`Kimi K3`},{ref:`zai/glm-5.3`,label:`GLM 5.3`},{ref:`anthropic/claude-haiku-4.5`,label:`Claude Haiku 4.5`,note:`fast`},{ref:`anthropic/claude-sonnet-5.5`,label:`Claude Sonnet 5.5`},{ref:`openai/gpt-5.5`,label:`GPT-5.5`},{ref:`google/gemini-3.5-flash`,label:`Gemini 3.5 Flash`}],image:[{ref:`google/gemini-3.1-flash-image`,label:`Gemini 3.1 Flash Image`}],video:[{ref:`google/veo-3.1-fast-generate-001`,label:`Veo 3.1 Fast`,note:`withSound`}],speech:[{ref:`google/gemini-3.8-flash-tts`,label:`Gemini Flash TTS`}],listening:[{ref:`google/gemini-3.5-flash-lite`,label:`Gemini 3.5 Flash-Lite`}]}}];function Ku(e){return Gu.find(t=>t.id===e)??null}function qu(e){if(Ru(e))return null;let t=/^([a-z]+):/.exec(e)?.[1];return t?Hu.includes(t)?t:null:e?.includes(`/`)?`gateway`:null}function Ju(e){for(let t of Gu)for(let n of Object.values(t.models)){let t=n?.find(t=>t.ref===e);if(t)return t.label}return e.replace(/^[a-z]+:/,``)}var Yu=2,Xu=1,Zu=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(Yu,Math.floor(u/e.css.cell.width)),rows:Math.max(Xu,Math.floor(l/e.css.cell.height))}}},Qu=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=ed.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function $u(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var ed=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!$u(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),n.isWrapped&&o.indexOf(` `)===-1););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},td=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function nd(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var rd=class{constructor(e=nd,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||td;this._linkProvider=this._terminal.registerLinkProvider(new Qu(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},id=Object.defineProperty,V=Object.getOwnPropertyDescriptor,ad=(e,t)=>{for(var n in t)id(e,n,{get:t[n],enumerable:!0})},H=(e,t,n,r)=>{for(var i=r>1?void 0:r?V(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&id(t,n,i),i},U=(e,t)=>(n,r)=>t(n,r,e),W=`Terminal input`,od={get:()=>W,set:e=>W=e},sd=`Too much output to announce, navigate to rows manually to read`,cd={get:()=>sd,set:e=>sd=e};function ld(e){return e.replace(/\r?\n/g,`\r`)}function ud(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function dd(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function fd(e,t,n,r){e.stopPropagation(),e.clipboardData&&pd(e.clipboardData.getData(`text/plain`),t,n,r)}function pd(e,t,n,r){e=ld(e),e=ud(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function md(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function hd(e,t,n,r,i){md(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function gd(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function _d(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var vd=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},yd=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},bd=``,xd=` `,Sd=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Cd}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Cd=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},wd=class e extends Sd{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Cd,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?gd(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Td=`di$target`,Ed=`di$dependencies`,Dd=new Map;function Od(e){return e[Ed]||[]}function kd(e){if(Dd.has(e))return Dd.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Ad(t,e,r)};return t._id=e,Dd.set(e,t),t}function Ad(e,t,n){t[Td]===t?t[Ed].push({id:e,index:n}):(t[Ed]=[{id:e,index:n}],t[Td]=t)}var jd=kd(`BufferService`),Md=kd(`CoreMouseService`),Nd=kd(`CoreService`),Pd=kd(`CharsetService`),Fd=kd(`InstantiationService`),Id=kd(`LogService`),Ld=kd(`OptionsService`),Rd=kd(`OscLinkService`),zd=kd(`UnicodeService`),Bd=kd(`DecorationService`),Vd=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new wd,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Hd(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Vd=H([U(0,jd),U(1,Ld),U(2,Rd)],Vd);function Hd(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
25
|
+
|
|
26
|
+
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Ud=kd(`CharSizeService`),Wd=kd(`CoreBrowserService`),Gd=kd(`MouseService`),Kd=kd(`RenderService`),qd=kd(`SelectionService`),Jd=kd(`CharacterJoinerService`),Yd=kd(`ThemeService`),Xd=kd(`LinkProviderService`),Zd=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?rf.isErrorNoTelemetry(e)?new rf(e.message+`
|
|
27
|
+
|
|
28
|
+
`+e.stack):Error(e.message+`
|
|
29
|
+
|
|
30
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function Qd(e){ef(e)||Zd.onUnexpectedError(e)}var $d=`Canceled`;function ef(e){return e instanceof tf||e instanceof Error&&e.name===$d&&e.message===$d}var tf=class extends Error{constructor(){super($d),this.name=this.message}};function nf(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var rf=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},af=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function of(e,t=0){return e[e.length-(1+t)]}var sf;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(sf||={});var cf=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||sf.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};cf.empty=new cf(e=>{});function lf(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var uf;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(uf||={});var df=null;function ff(e){return df?.trackDisposable(e),e}function pf(e){df?.markAsDisposed(e)}function mf(e,t){df?.setParent(e,t)}function hf(e){return df?.markAsSingleton(e),e}function gf(e){if(uf.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function _f(...e){return vf(()=>gf(e))}function vf(e){let t=ff({dispose:lf(()=>{pf(t),e()})});return t}var yf=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,ff(this)}dispose(){this._isDisposed||(pf(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{gf(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return mf(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),mf(e,null))}};yf.DISABLE_DISPOSED_WARNING=!1;var G=yf,K=class{constructor(){this._store=new G,ff(this),mf(this._store,this)}dispose(){pf(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};K.None=Object.freeze({dispose(){}});var bf=class{constructor(){this._isDisposed=!1,ff(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&mf(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,pf(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&mf(e,null),e}},xf=typeof window==`object`?window:globalThis,Sf=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Sf.Undefined=new Sf(void 0);var Cf=Sf,wf=class{constructor(){this._first=Cf.Undefined,this._last=Cf.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Cf.Undefined}clear(){let e=this._first;for(;e!==Cf.Undefined;){let t=e.next;e.prev=Cf.Undefined,e.next=Cf.Undefined,e=t}this._first=Cf.Undefined,this._last=Cf.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Cf(e);if(this._first===Cf.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==Cf.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Cf.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Cf.Undefined&&e.next!==Cf.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Cf.Undefined&&e.next===Cf.Undefined?(this._first=Cf.Undefined,this._last=Cf.Undefined):e.next===Cf.Undefined?(this._last=this._last.prev,this._last.next=Cf.Undefined):e.prev===Cf.Undefined&&(this._first=this._first.next,this._first.prev=Cf.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==Cf.Undefined;)yield e.element,e=e.next}},Tf=globalThis.performance&&typeof globalThis.performance.now==`function`,Ef=class e{static create(t){return new e(t)}constructor(e){this._now=Tf&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},Df;(e=>{e.None=()=>K.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(_f(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new q({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new q({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new q({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new q({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new q({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function ee(e){return new Promise(t=>n(e)(t))}e.toPromise=ee;function te(e){let t=new q;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=te;function x(e,t){return e(e=>t.fire(e))}e.forward=x;function ne(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=ne;class S{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new q(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function re(e,t){return new S(e,t).emitter.event}e.fromObservable=re;function C(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof G?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=C})(Df||={});var Of=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new Ef,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Of.all=new Set,Of._idPool=0;var kf=Of,Af=-1,jf=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new Pf(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};jf._idPool=1;var Mf=jf,Nf=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
31
|
+
`).slice(2).join(`
|
|
32
|
+
`))}},Pf=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},Ff=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},If=0,Lf=class{constructor(e){this.value=e,this.id=If++}},Rf=2,q=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Af>0||this._options?.leakWarningThreshold?new Mf(e?.onListenerError??Qd,this._options?.leakWarningThreshold??Af):void 0,this._perfMon=this._options?._profName?new kf(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Ff(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Qd)(n),K.None}if(this._disposed)return K.None;t&&(e=e.bind(t));let r=new Lf(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Nf.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Lf?(this._deliveryQueue??=new zf,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=vf(()=>{i?.(),this._removeListener(r)});return n instanceof G?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Rf<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Qd;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof Lf)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},zf=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Bf=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new q,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new q,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Bf.INSTANCE=new Bf;var Vf=Bf;function Hf(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}Vf.INSTANCE.onDidChangeZoomLevel;function Uf(e){return Vf.INSTANCE.getZoomFactor(e)}Vf.INSTANCE.onDidChangeFullscreen;var Wf=typeof navigator==`object`?navigator.userAgent:``,Gf=Wf.indexOf(`Firefox`)>=0,J=Wf.indexOf(`AppleWebKit`)>=0,Kf=Wf.indexOf(`Chrome`)>=0,qf=!Kf&&Wf.indexOf(`Safari`)>=0;Wf.indexOf(`Electron/`),Wf.indexOf(`Android`);var Jf=!1;if(typeof xf.matchMedia==`function`){let e=xf.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=xf.matchMedia(`(display-mode: fullscreen)`);Jf=e.matches,Hf(xf,e,({matches:e})=>{Jf&&t.matches||(Jf=e)})}function Yf(){return Jf}var Xf=`en`,Zf=!1,Qf=!1,$f=!1,ep=!1,tp=!1,np=Xf,rp,ip=globalThis,Y;typeof ip.vscode<`u`&&typeof ip.vscode.process<`u`?Y=ip.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(Y=process);var ap=typeof Y?.versions?.electron==`string`&&Y?.type===`renderer`;if(typeof Y==`object`){Zf=Y.platform===`win32`,Qf=Y.platform===`darwin`,$f=Y.platform===`linux`,$f&&Y.env.SNAP&&Y.env.SNAP_REVISION,Y.env.CI||Y.env.BUILD_ARTIFACTSTAGINGDIRECTORY,np=Xf;let e=Y.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,np=t.resolvedLanguage||Xf,t.languagePack?.translationsConfigFile}catch{}ep=!0}else typeof navigator==`object`&&!ap?(rp=navigator.userAgent,Zf=rp.indexOf(`Windows`)>=0,Qf=rp.indexOf(`Macintosh`)>=0,(rp.indexOf(`Macintosh`)>=0||rp.indexOf(`iPad`)>=0||rp.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,$f=rp.indexOf(`Linux`)>=0,rp?.indexOf(`Mobi`),tp=!0,np=globalThis._VSCODE_NLS_LANGUAGE||Xf,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var op=Zf,sp=Qf,cp=$f,lp=ep;tp&&typeof ip.importScripts==`function`&&ip.origin;var up=rp,dp=np,fp;(e=>{function t(){return dp}e.value=t;function n(){return dp.length===2?dp===`en`:dp.length>=3&&dp[0]===`e`&&dp[1]===`n`&&dp[2]===`-`}e.isDefaultVariant=n;function r(){return dp===`en`}e.isDefault=r})(fp||={});var pp=typeof ip.postMessage==`function`&&!ip.importScripts;(()=>{if(pp){let e=[];ip.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),ip.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var mp=!!(up&&up.indexOf(`Chrome`)>=0);up&&up.indexOf(`Firefox`),!mp&&up&&up.indexOf(`Safari`),up&&up.indexOf(`Edg/`),up&&up.indexOf(`Android`);var hp=typeof navigator==`object`?navigator:{};lp||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||hp&&hp.clipboard&&hp.clipboard.writeText,lp||hp&&hp.clipboard&&hp.clipboard.readText,lp||Yf()||hp.keyboard,`ontouchstart`in xf||hp.maxTouchPoints,xf.PointerEvent&&(`ontouchstart`in xf||navigator.maxTouchPoints);var gp=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},_p=new gp,vp=new gp,yp=new gp,bp=Array(230),xp;(e=>{function t(e){return _p.keyCodeToStr(e)}e.toString=t;function n(e){return _p.strToKeyCode(e)}e.fromString=n;function r(e){return vp.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return yp.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return vp.strToKeyCode(e)||yp.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return _p.keyCodeToStr(e)}e.toElectronAccelerator=o})(xp||={});var Sp=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Cp([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Cp=class{constructor(e){if(e.length===0)throw nf(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function wp(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return xp.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(Gf)switch(t){case 59:return 85;case 60:if(cp)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(sp)return 57}else if(J&&(sp&&t===93||!sp&&t===92))return 57;return bp[t]||0}var Tp=sp?256:2048,Ep=512,Dp=1024,Op=sp?2048:256,kp=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=wp(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=Tp),this.altKey&&(t|=Ep),this.shiftKey&&(t|=Dp),this.metaKey&&(t|=Op),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Sp(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Ap=new WeakMap;function jp(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var Mp=class{static getSameOriginWindowChain(e){let t=Ap.get(e);if(!t){t=[],Ap.set(e,t);let n=e,r;do r=jp(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},Np=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=Mp.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Pp=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(Kf){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)this.deltaY=r?t.wheelDeltaY/(120*i):t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;this.deltaY=t.deltaMode===t.DOM_DELTA_LINE?Gf&&!sp?-e.deltaY/3:-e.deltaY:-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)this.deltaX=qf&&op?-(t.wheelDeltaX/120):r?t.wheelDeltaX/(120*i):t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;this.deltaX=t.deltaMode===t.DOM_DELTA_LINE?Gf&&!sp?-e.deltaX/3:-e.deltaX:-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(this.deltaY=r?e.wheelDelta/(120*i):e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},Fp=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Ip;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof Lp?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Df.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Fp})})(Ip||={});var Lp=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Fp:(this._emitter||=new q,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},Rp=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new af(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new af(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},zp=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new af(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=vf(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var Bp;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(Bp||={});var Vp=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new q,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Df.toPromise(this._onStateChanged.event)}while(1)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Vp.EMPTY=Vp.fromArray([]);function Hp(e){return Up(e,0)}function Up(e,t){switch(typeof e){case`object`:return e===null?Wp(349,t):Array.isArray(e)?qp(e,t):Jp(e,t);case`string`:return Kp(e,t);case`boolean`:return Gp(e,t);case`number`:return Wp(e,t);case`undefined`:return Wp(937,t);default:return Wp(617,t)}}function Wp(e,t){return(t<<5)-t+e|0}function Gp(e,t){return Wp(e?433:863,t)}function Kp(e,t){t=Wp(149417,t);for(let n=0,r=e.length;n<r;n++)t=Wp(e.charCodeAt(n),t);return t}function qp(e,t){return t=Wp(104579,t),e.reduce((e,t)=>Up(t,e),t)}function Jp(e,t){return t=Wp(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Kp(n,t),Up(e[n],t)),t)}var{registerWindow:Yp,getWindow:Xp,getDocument:Zp,getWindows:Qp,getWindowsCount:$p,getWindowId:em,getWindowById:tm,hasWindow:nm,onDidRegisterWindow:rm,onWillUnregisterWindow:im,onDidUnregisterWindow:am}=function(){let e=new Map,t={window:xf,disposables:new G};e.set(xf.vscodeWindowId,t);let n=new q,r=new q,i=new q;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return K.None;let a=new G,o={window:t,disposables:a.add(new G)};return e.set(t.vscodeWindowId,o),a.add(vf(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(X(t,hm.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:xf},getDocument(e){return Xp(e).document}}}(),om=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function X(e,t,n,r){return new om(e,t,n,r)}function sm(e,t){return function(n){return t(new Np(e,n))}}function cm(e){return function(t){return e(new kp(t))}}var lm=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=sm(Xp(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=cm(n)),X(e,t,i,r)},um,dm=class extends zp{constructor(e){super(),this.defaultTarget=e&&Xp(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},fm=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Qd(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(fm.sort),a.shift().execute();r.set(i,!1)};um=(t,r,a=0)=>{let o=em(t),s=new fm(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var pm=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};pm.None=new pm(0,0);function mm(e){let t=e.getBoundingClientRect(),n=Xp(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=Hp(n),a=r.get(i);if(a)a.users+=1;else{let o=new q,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(vf(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var hm={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:J?`webkitAnimationStart`:`animationstart`,ANIMATION_END:J?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:J?`webkitAnimationIteration`:`animationiteration`},gm=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=_m(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=_m(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=_m(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=_m(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=_m(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=_m(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=_m(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=_m(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=_m(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=_m(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=_m(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=_m(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=_m(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=_m(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function _m(e){return typeof e==`number`?`${e}px`:e}function vm(e){return new gm(e)}var ym=class{constructor(){this._hooks=new G,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(vf(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=Xp(e)}this._hooks.add(X(a,hm.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(X(a,hm.POINTER_UP,e=>this.stopMonitoring(!0)))}};function bm(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var xm;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(xm||={});var Sm=class e extends K{constructor(){super(),this.dispatched=!1,this.targets=new wf,this.ignoreTargets=new wf,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Df.runAndSubscribe(rm,({window:e,disposables:t})=>{t.add(X(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(X(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(X(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:xf,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=hf(new e),vf(e.INSTANCE.targets.push(t))):K.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=hf(new e),vf(e.INSTANCE.ignoreTargets.push(t))):K.None}static isTouchDevice(){return`ontouchstart`in xf||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(xm.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-of(s.rollingPageX))<30&&Math.abs(s.initialPageY-of(s.rollingPageY))<30){let e=this.newGestureEvent(xm.Tap,s.initialTarget);e.pageX=of(s.rollingPageX),e.pageY=of(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-of(s.rollingPageX))<30&&Math.abs(s.initialPageY-of(s.rollingPageY))<30){let e=this.newGestureEvent(xm.Contextmenu,s.initialTarget);e.pageX=of(s.rollingPageX),e.pageY=of(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=of(s.rollingPageX),n=of(s.rollingPageY),i=of(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(xm.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===xm.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===xm.Change||t.type===xm.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=um(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(xm.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(xm.Change,i.initialTarget);a.translationX=r.pageX-of(i.rollingPageX),a.translationY=r.pageY-of(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};Sm.SCROLL_FRICTION=-.005,Sm.HOLD_DELAY=700,Sm.CLEAR_TAP_COUNT_TIME=400,H([bm],Sm,`isTouchDevice`,1);var Cm=Sm,wm=class extends K{onclick(e,t){this._register(X(e,hm.CLICK,n=>t(new Np(Xp(e),n))))}onmousedown(e,t){this._register(X(e,hm.MOUSE_DOWN,n=>t(new Np(Xp(e),n))))}onmouseover(e,t){this._register(X(e,hm.MOUSE_OVER,n=>t(new Np(Xp(e),n))))}onmouseleave(e,t){this._register(X(e,hm.MOUSE_LEAVE,n=>t(new Np(Xp(e),n))))}onkeydown(e,t){this._register(X(e,hm.KEY_DOWN,e=>t(new kp(e))))}onkeyup(e,t){this._register(X(e,hm.KEY_UP,e=>t(new kp(e))))}oninput(e,t){this._register(X(e,hm.INPUT,t))}onblur(e,t){this._register(X(e,hm.BLUR,t))}onfocus(e,t){this._register(X(e,hm.FOCUS,t))}onchange(e,t){this._register(X(e,hm.CHANGE,t))}ignoreGesture(e){return Cm.ignoreTarget(e)}},Tm=11,Em=class extends wm{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=Tm+`px`,this.domNode.style.height=Tm+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new ym),this._register(lm(this.bgDomNode,hm.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(lm(this.domNode,hm.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new dm),this._pointerdownScheduleRepeatTimer=this._register(new Rp)}_arrowPointerDown(e){e.target&&e.target instanceof Element&&(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Xp(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},Dm=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},Om=class extends K{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new q),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Dm(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new Mm(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=Mm.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},km=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Am(e,t){let n=t-e;return function(t){return e+n*Pm(t)}}function jm(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var Mm=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),jm(Am(e,r),Am(i,t),.33)}return Am(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new km(this.scrollLeft(t),this.scrollTop(t),!1):new km(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function Nm(e){return e**3}function Pm(e){return 1-Nm(1-e)}var Fm=class extends K{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Rp)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3||this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},Im=140,Lm=class extends wm{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Fm(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ym),this._shouldRender=!0,this.domNode=vm(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register(X(this.domNode.domNode,hm.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new Em(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=vm(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(X(this.slider.domNode,hm.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=mm(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(op&&a>Im){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Rm=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},zm=class extends Lm{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Rm(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Bm=class extends Lm{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Rm(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Vm=500,Hm=50,Um=!0,Wm=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Gm=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(1);return t<=.5}acceptStandardWheelEvent(e){if(Kf){let t=Uf(Xp(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new Wm(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Gm.INSTANCE=new Gm;var Km=Gm,qm=class extends wm{constructor(e,t,n){super(),this._onScroll=this._register(new q),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new q),this.onWillScroll=this._onWillScroll.event,this._options=Ym(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Bm(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new zm(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=vm(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=vm(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=vm(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new Rp),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=gf(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,sp&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Pp(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=gf(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(X(this._listenOnDomNode,hm.MOUSE_WHEEL,e=>{this._onMouseWheel(new Pp(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Km.INSTANCE;Um&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!sp&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=Hm*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=Hm*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(Um&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Vm)}},Jm=class extends qm{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Ym(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,sp&&(t.className+=` mac`),t}var Xm=class extends K{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new Om({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>um(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Jm(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Df.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(vf(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(vf(()=>this._styleElement.remove())),this._register(Df.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
|
|
33
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Xm=H([U(2,jd),U(3,Wd),U(4,Md),U(5,Yd),U(6,Ld),U(7,Kd)],Xm);var Zm=class extends K{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(vf(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Zm=H([U(1,jd),U(2,Wd),U(3,Bd),U(4,Kd)],Zm);var Qm=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},$m={full:0,left:0,center:0,right:0},eh={full:0,left:0,center:0,right:0},th={full:0,left:0,center:0,right:0},nh=class extends K{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new Qm,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(vf(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);eh.full=this._canvas.width,eh.left=e,eh.center=t,eh.right=e,this._refreshDrawHeightConstants(),th.full=1,th.left=1,th.center=1+eh.left,th.right=1+eh.left+eh.center}_refreshDrawHeightConstants(){$m.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);$m.left=t,$m.center=t,$m.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$m.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$m.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$m.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$m.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(th[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-$m[e.position||`full`]/2),eh[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+$m[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};nh=H([U(2,jd),U(3,Bd),U(4,Kd),U(5,Ld),U(6,Yd),U(7,Wd)],nh);var Z;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
|
|
34
|
+
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(Z||={});var rh;(e=>(e.PAD=``,e.HOP=``,e.BPH=``,e.NBH=``,e.IND=``,e.NEL=`
`,e.SSA=``,e.ESA=``,e.HTS=``,e.HTJ=``,e.VTS=``,e.PLD=``,e.PLU=``,e.RI=``,e.SS2=``,e.SS3=``,e.DCS=``,e.PU1=``,e.PU2=``,e.STS=``,e.CCH=``,e.MW=``,e.SPA=``,e.EPA=``,e.SOS=``,e.SGCI=``,e.SCI=``,e.CSI=``,e.ST=``,e.OSC=``,e.PM=``,e.APC=``))(rh||={});var ih;(e=>e.ST=`${Z.ESC}\\`)(ih||={});var ah=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Z.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};ah=H([U(2,jd),U(3,Ld),U(4,Nd),U(5,Kd)],ah);var oh=0,sh=0,ch=0,lh=0,uh={css:`#00000000`,rgba:0},dh;(e=>{function t(e,t,n,r){return r===void 0?`#${gh(e)}${gh(t)}${gh(n)}`:`#${gh(e)}${gh(t)}${gh(n)}${gh(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(dh||={});var fh;(e=>{function t(e,t){if(lh=(t.rgba&255)/255,lh===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return oh=a+Math.round((n-a)*lh),sh=o+Math.round((r-o)*lh),ch=s+Math.round((i-s)*lh),{css:dh.toCss(oh,sh,ch),rgba:dh.toRgba(oh,sh,ch)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=hh.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return dh.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[oh,sh,ch]=hh.toChannels(t),{css:dh.toCss(oh,sh,ch),rgba:t}}e.opaque=i;function a(e,t){return lh=Math.round(t*255),[oh,sh,ch]=hh.toChannels(e.rgba),{css:dh.toCss(oh,sh,ch,lh),rgba:dh.toRgba(oh,sh,ch,lh)}}e.opacity=a;function o(e,t){return lh=e.rgba&255,a(e,lh*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(fh||={});var ph;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return oh=parseInt(e.slice(1,2).repeat(2),16),sh=parseInt(e.slice(2,3).repeat(2),16),ch=parseInt(e.slice(3,4).repeat(2),16),dh.toColor(oh,sh,ch);case 5:return oh=parseInt(e.slice(1,2).repeat(2),16),sh=parseInt(e.slice(2,3).repeat(2),16),ch=parseInt(e.slice(3,4).repeat(2),16),lh=parseInt(e.slice(4,5).repeat(2),16),dh.toColor(oh,sh,ch,lh);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return oh=parseInt(r[1]),sh=parseInt(r[2]),ch=parseInt(r[3]),lh=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),dh.toColor(oh,sh,ch,lh);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[oh,sh,ch,lh]=t.getImageData(0,0,1,1).data,lh!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:dh.toRgba(oh,sh,ch,lh),css:e}}e.toColor=r})(ph||={});var mh;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(mh||={});var hh;(e=>{function t(e,t){if(lh=(t&255)/255,lh===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return oh=a+Math.round((n-a)*lh),sh=o+Math.round((r-o)*lh),ch=s+Math.round((i-s)*lh),dh.toRgba(oh,sh,ch)}e.blend=t;function n(e,t,n){let a=mh.relativeLuminance(e>>8),o=mh.relativeLuminance(t>>8);if(_h(a,o)<n){if(o<a){let o=r(e,t,n),s=_h(a,mh.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>_h(a,mh.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=_h(a,mh.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>_h(a,mh.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=_h(mh.relativeLuminance2(o,s,c),mh.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=_h(mh.relativeLuminance2(o,s,c),mh.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=_h(mh.relativeLuminance2(o,s,c),mh.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=_h(mh.relativeLuminance2(o,s,c),mh.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(hh||={});function gh(e){let t=e.toString(16);return t.length<2?`0`+t:t}function _h(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var vh=class extends Sd{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},yh=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new wd}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||xd.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)yh._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||xd.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};yh=H([U(0,jd)],yh);function bh(e){return 57508<=e&&e<=57558}function xh(e){return 9472<=e&&e<=9631}function Sh(e){return bh(e)||xh(e)}function Ch(){return{css:{canvas:wh(),cell:wh()},device:{canvas:wh(),cell:wh(),char:{width:0,height:0,left:0,top:0}}}}function wh(){return{width:0,height:0}}var Th=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new wd,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,ee=0,te=!1,x=0,ne=!1,S=0,re=0,C=[],w=l!==-1&&u!==-1;for(let ie=0;ie<m;ie++){e.loadCell(ie,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let ae=!1,oe=ie>=re,se=ie,T=this._workCell;if(f.length>0&&ie===f[0][0]&&oe){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)oe&&=i===this._isCellInSelection(v,t);oe&&=!n||a<r[0]||a>=r[1],oe?(ae=!0,T=new vh(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),se=r[1]-1,m=T.getWidth()):re=r[1]}let ce=this._isCellInSelection(ie,t),le=n&&ie===a,ue=w&&ie>=l&&ie<=u,de=!1;this._decorationService.forEachDecorationAtCell(ie,t,void 0,e=>{de=!0});let fe=T.getChars()||xd;if(fe===` `&&(T.isUnderline()||T.isOverline())&&(fe=`\xA0`),S=m*s-c.get(fe,T.isBold(),T.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(ce&&ne||!ce&&!ne&&T.bg===y)&&(ce&&ne&&p.selectionForeground||T.fg===b)&&T.extended.ext===ee&&ue===te&&S===x&&!le&&!ae&&!de&&oe){T.isInvisible()?_+=xd:_+=fe,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=T.bg,b=T.fg,ee=T.extended.ext,te=ue,x=S,ne=ce,ae&&a>=ie&&a<=se&&(a=ie),!this._coreService.isCursorHidden&&le&&this._coreService.isCursorInitialized){if(C.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&C.push(`xterm-cursor-blink`),C.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:C.push(`xterm-cursor-outline`);break;case`block`:C.push(`xterm-cursor-block`);break;case`bar`:C.push(`xterm-cursor-bar`);break;case`underline`:C.push(`xterm-cursor-underline`)}}if(T.isBold()&&C.push(`xterm-bold`),T.isItalic()&&C.push(`xterm-italic`),T.isDim()&&C.push(`xterm-dim`),_=T.isInvisible()?xd:T.getChars()||xd,T.isUnderline()&&(C.push(`xterm-underline-${T.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!T.isUnderlineColorDefault())){if(T.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${Sd.toColorRGB(T.getUnderlineColor()).join(`,`)})`;else{let e=T.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&T.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}}T.isOverline()&&(C.push(`xterm-overline`),_===` `&&(_=`\xA0`)),T.isStrikethrough()&&C.push(`xterm-strikethrough`),ue&&(h.style.textDecoration=`underline`);let pe=T.getFgColor(),me=T.getFgColorMode(),E=T.getBgColor(),he=T.getBgColorMode(),D=!!T.isInverse();if(D){let e=pe;pe=E,E=e;let t=me;me=he,he=t}let ge,_e,ve=!1;this._decorationService.forEachDecorationAtCell(ie,t,void 0,e=>{e.options.layer!==`top`&&ve||(e.backgroundColorRGB&&(he=50331648,E=e.backgroundColorRGB.rgba>>8&16777215,ge=e.backgroundColorRGB),e.foregroundColorRGB&&(me=50331648,pe=e.foregroundColorRGB.rgba>>8&16777215,_e=e.foregroundColorRGB),ve=e.options.layer===`top`)}),!ve&&ce&&(ge=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,E=ge.rgba>>8&16777215,he=50331648,ve=!0,p.selectionForeground&&(me=50331648,pe=p.selectionForeground.rgba>>8&16777215,_e=p.selectionForeground)),ve&&C.push(`xterm-decoration-top`);let ye;switch(he){case 16777216:case 33554432:ye=p.ansi[E],C.push(`xterm-bg-${E}`);break;case 50331648:ye=dh.toColor(E>>16,E>>8&255,E&255),this._addStyle(h,`background-color:#${Eh((E>>>0).toString(16),`0`,6)}`);break;default:D?(ye=p.foreground,C.push(`xterm-bg-257`)):ye=p.background}switch(ge||T.isDim()&&(ge=fh.multiplyOpacity(ye,.5)),me){case 16777216:case 33554432:T.isBold()&&pe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(pe+=8),this._applyMinimumContrast(h,ye,p.ansi[pe],T,ge,void 0)||C.push(`xterm-fg-${pe}`);break;case 50331648:let e=dh.toColor(pe>>16&255,pe>>8&255,pe&255);this._applyMinimumContrast(h,ye,e,T,ge,_e)||this._addStyle(h,`color:#${Eh(pe.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,ye,p.foreground,T,ge,_e)||D&&C.push(`xterm-fg-257`)}C.length&&=(h.className=C.join(` `),0),!le&&!ae&&!de&&oe?g++:h.textContent=_,S!==this.defaultSpacing&&(h.style.letterSpacing=`${S}px`),d.push(h),ie=se}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||Sh(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=fh.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};Th=H([U(1,Jd),U(2,Ld),U(3,Wd),U(4,Nd),U(5,Bd),U(6,Yd)],Th);function Eh(e,t,n){for(;e.length<n;)e=t+e;return e}var Dh=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},Oh=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function kh(){return new Oh}var Ah=`xterm-dom-renderer-owner-`,jh=`xterm-rows`,Mh=`xterm-fg-`,Nh=`xterm-bg-`,Ph=`xterm-focus`,Fh=`xterm-selection`,Ih=1,Lh=class extends K{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=Ih++,this._rowElements=[],this._selectionRenderModel=kh(),this.onRequestRedraw=this._register(new q).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(jh),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(Fh),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=Ch(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(Th,document),this._element.classList.add(Ah+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(vf(()=>{this._element.classList.remove(Ah+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Dh(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${jh} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${jh} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${jh} .xterm-dim { color: ${fh.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${jh}.${Ph} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${jh}.${Ph} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${jh}.${Ph} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${jh} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${jh} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${jh} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${jh} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${jh} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Fh} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Fh} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Fh} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${Mh}${n} { color: ${r.css}; }${this._terminalSelector} .${Mh}${n}.xterm-dim { color: ${fh.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${Nh}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${Mh}257 { color: ${fh.opaque(e.background).css}; }${this._terminalSelector} .${Mh}257.xterm-dim { color: ${fh.multiplyOpacity(fh.opaque(e.background),.5).css}; }${this._terminalSelector} .${Nh}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Ph),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ph),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Ah}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};Lh=H([U(7,Fd),U(8,Ud),U(9,Ld),U(10,jd),U(11,Nd),U(12,Wd),U(13,Yd)],Lh);var Rh=class extends K{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new q),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Vh(this._optionsService))}catch{this._measureStrategy=this._register(new Bh(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Rh=H([U(2,Ld)],Rh);var zh=class extends K{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},Bh=class extends zh{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},Vh=class extends zh{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},Hh=class extends K{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Uh(this._window)),this._onDprChange=this._register(new q),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new q),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(Df.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(X(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(X(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},Uh=class extends K{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new bf),this._onDprChange=this._register(new q),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(vf(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=X(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},Wh=class extends K{constructor(){super(),this.linkProviders=[],this._register(vf(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Gh(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function Kh(e,t,n,r,i,a,o,s,c){if(!a)return;let l=Gh(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var qh=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return Kh(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=Gh(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};qh=H([U(0,Kd),U(1,Ud)],qh);var Jh=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Yh={};ad(Yh,{getSafariVersion:()=>ng,isChromeOS:()=>cg,isFirefox:()=>$h,isIpad:()=>ig,isIphone:()=>ag,isLegacyEdge:()=>eg,isLinux:()=>sg,isMac:()=>rg,isNode:()=>Xh,isSafari:()=>tg,isWindows:()=>og});var Xh=typeof process<`u`&&`title`in process,Zh=Xh?`node`:navigator.userAgent,Qh=Xh?`node`:navigator.platform,$h=Zh.includes(`Firefox`),eg=Zh.includes(`Edge`),tg=/^((?!chrome|android).)*safari/i.test(Zh);function ng(){if(!tg)return 0;let e=Zh.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var rg=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(Qh),ig=Qh===`iPad`,ag=Qh===`iPhone`,og=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(Qh),sg=Qh.indexOf(`Linux`)>=0,cg=/\bCrOS\b/.test(Zh),lg=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},ug=class extends lg{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},dg=class extends lg{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},fg=!Xh&&`requestIdleCallback`in window?dg:ug,pg=class{constructor(){this._queue=new fg}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},mg=class extends K{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new bf),this._pausedResizeTask=new pg,this._observerDisposable=this._register(new bf),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new q),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new q),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new q),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new q),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Jh((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new hg(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(vf(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=vf(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};mg=H([U(2,Ld),U(3,Ud),U(4,Nd),U(5,Bd),U(6,jd),U(7,Wd),U(8,Yd)],mg);var hg=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function gg(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return yg(i,a,e,t,n,r)+bg(a,t,n,r)+xg(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,Og(Math.abs(i-e),Dg(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return Og(vg(a>t?e:i,n)+(s-1)*n.cols+1+_g(a>t?i:e,n),Dg(o,r))}function _g(e,t){return e-1}function vg(e,t){return t.cols-e}function yg(e,t,n,r,i,a){return bg(t,r,i,a).length===0?``:Og(Eg(e,t,e,t-Cg(t,i),!1,i).length,Dg(`D`,a))}function bg(e,t,n,r){let i=e-Cg(e,n),a=t-Cg(t,n);return Og(Math.abs(i-a)-Sg(e,t,n),Dg(Tg(e,t),r))}function xg(e,t,n,r,i,a){let o;o=bg(t,r,i,a).length>0?r-Cg(r,i):t;let s=r,c=wg(e,t,n,r,i,a);return Og(Eg(e,o,n,s,c===`C`,i).length,Dg(c,a))}function Sg(e,t,n){let r=0,i=e-Cg(e,n),a=t-Cg(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=Tg(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function Cg(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function wg(e,t,n,r,i,a){let o;return o=bg(n,r,i,a).length>0?r-Cg(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function Tg(e,t){return e>t?`A`:`B`}function Eg(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function Dg(e,t){let n=t?`O`:`[`;return Z.ESC+n+e}function Og(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var kg=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Ag(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var jg=50,Mg=15,Ng=50,Pg=500,Fg=RegExp(`\xA0`,`g`),Ig=class extends K{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new wd,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new q),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new q),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new q),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new kg(this._bufferService),this._activeSelectionMode=0,this._register(vf(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(Fg,` `)).join(og?`\r
|
|
35
|
+
`:`
|
|
36
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),sg&&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=Ag(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=Gh(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,-jg),jg),t/=jg,t/Math.abs(t)+Math.round(t*(Mg-1)))}shouldForceSelection(e){return rg?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(),Ng)}_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&&!(rg&&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<Pg&&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=gg(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=Ag(n,this._bufferService.cols)}};Ig=H([U(3,jd),U(4,Nd),U(5,Gd),U(6,Ld),U(7,Kd),U(8,Wd)],Ig);var Lg=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={}}},Rg=class{constructor(){this._color=new Lg,this._css=new Lg}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()}},zg=Object.freeze((()=>{let e=[ph.toColor(`#2e3436`),ph.toColor(`#cc0000`),ph.toColor(`#4e9a06`),ph.toColor(`#c4a000`),ph.toColor(`#3465a4`),ph.toColor(`#75507b`),ph.toColor(`#06989a`),ph.toColor(`#d3d7cf`),ph.toColor(`#555753`),ph.toColor(`#ef2929`),ph.toColor(`#8ae234`),ph.toColor(`#fce94f`),ph.toColor(`#729fcf`),ph.toColor(`#ad7fa8`),ph.toColor(`#34e2e2`),ph.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:dh.toCss(r,i,a),rgba:dh.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:dh.toCss(n,n,n),rgba:dh.toRgba(n,n,n)})}return e})()),Bg=ph.toColor(`#ffffff`),Vg=ph.toColor(`#000000`),Hg=ph.toColor(`#ffffff`),Ug=Vg,Wg={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},Gg=Bg,Kg=class extends K{constructor(e){super(),this._optionsService=e,this._contrastCache=new Rg,this._halfContrastCache=new Rg,this._onChangeColors=this._register(new q),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Bg,background:Vg,cursor:Hg,cursorAccent:Ug,selectionForeground:void 0,selectionBackgroundTransparent:Wg,selectionBackgroundOpaque:fh.blend(Vg,Wg),selectionInactiveBackgroundTransparent:Wg,selectionInactiveBackgroundOpaque:fh.blend(Vg,Wg),scrollbarSliderBackground:fh.opacity(Bg,.2),scrollbarSliderHoverBackground:fh.opacity(Bg,.4),scrollbarSliderActiveBackground:fh.opacity(Bg,.5),overviewRulerBorder:Bg,ansi:zg.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=qg(e.foreground,Bg),t.background=qg(e.background,Vg),t.cursor=fh.blend(t.background,qg(e.cursor,Hg)),t.cursorAccent=fh.blend(t.background,qg(e.cursorAccent,Ug)),t.selectionBackgroundTransparent=qg(e.selectionBackground,Wg),t.selectionBackgroundOpaque=fh.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=qg(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=fh.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?qg(e.selectionForeground,uh):void 0,t.selectionForeground===uh&&(t.selectionForeground=void 0),fh.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=fh.opacity(t.selectionBackgroundTransparent,.3)),fh.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=fh.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=qg(e.scrollbarSliderBackground,fh.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=qg(e.scrollbarSliderHoverBackground,fh.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=qg(e.scrollbarSliderActiveBackground,fh.opacity(t.foreground,.5)),t.overviewRulerBorder=qg(e.overviewRulerBorder,Gg),t.ansi=zg.slice(),t.ansi[0]=qg(e.black,zg[0]),t.ansi[1]=qg(e.red,zg[1]),t.ansi[2]=qg(e.green,zg[2]),t.ansi[3]=qg(e.yellow,zg[3]),t.ansi[4]=qg(e.blue,zg[4]),t.ansi[5]=qg(e.magenta,zg[5]),t.ansi[6]=qg(e.cyan,zg[6]),t.ansi[7]=qg(e.white,zg[7]),t.ansi[8]=qg(e.brightBlack,zg[8]),t.ansi[9]=qg(e.brightRed,zg[9]),t.ansi[10]=qg(e.brightGreen,zg[10]),t.ansi[11]=qg(e.brightYellow,zg[11]),t.ansi[12]=qg(e.brightBlue,zg[12]),t.ansi[13]=qg(e.brightMagenta,zg[13]),t.ansi[14]=qg(e.brightCyan,zg[14]),t.ansi[15]=qg(e.brightWhite,zg[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]=qg(e.extendedAnsi[r],zg[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()}}};Kg=H([U(0,Ld)],Kg);function qg(e,t){if(e!==void 0)try{return ph.toColor(e)}catch{}return t}var Jg=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)}},Yg=class{constructor(){this._services=new Jg,this._services.set(Fd,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Od(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)}},Xg={trace:0,debug:1,info:2,warn:3,error:4,off:5},Zg=`xterm.js: `,Qg=class extends K{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),$g=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Xg[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?``:Zg)+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)}};Qg=H([U(0,Ld)],Qg);var $g,e_=class extends K{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}},Q=3,t_=Object.freeze(new Sd),n_=0,r_=2,i_=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*Q);let r=t||wd.fromCharData([0,bd,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*Q+0],n=t&2097151;return[this._data[e*Q+1],t&2097152?this._combined[e]:n?gd(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*Q+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*Q+0]=e|2097152|t[2]<<22):this._data[e*Q+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*Q+0]>>22}hasWidth(e){return this._data[e*Q+0]&12582912}getFg(e){return this._data[e*Q+1]}getBg(e){return this._data[e*Q+2]}hasContent(e){return this._data[e*Q+0]&4194303}getCodePoint(e){let t=this._data[e*Q+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*Q+0]&2097152}getString(e){let t=this._data[e*Q+0];return t&2097152?this._combined[e]:t&2097151?gd(t&2097151):``}isProtected(e){return this._data[e*Q+2]&536870912}loadCell(e,t){return n_=e*Q,t.content=this._data[n_+0],t.fg=this._data[n_+1],t.bg=this._data[n_+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*Q+0]=t.content,this._data[e*Q+1]=t.fg,this._data[e*Q+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*Q+0]=t|n<<22,this._data[e*Q+1]=r.fg,this._data[e*Q+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*Q+0];r&2097152?this._combined[e]+=gd(t):r&2097151?(this._combined[e]=gd(r&2097151)+gd(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*Q+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 wd;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 wd;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*r_<this._data.buffer.byteLength;let n=e*Q;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*r_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*r_<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*Q+0]&4194303)return e+(this._data[e*Q+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Q+0]&4194303||this._data[e*Q+2]&50331648)return e+(this._data[e*Q+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<Q;e++)this._data[(n+i)*Q+e]=a[(t+i)*Q+e];a[(t+i)*Q+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<Q;e++)this._data[(n+i)*Q+e]=a[(t+i)*Q+e];a[(t+i)*Q+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*Q+0],n=e&2097151,a=e&2097152?this._combined[t]:n?gd(n):xd;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 a_(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=l_(u,d,t),p=1,m=0;for(;p<u.length;){let e=l_(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 o_(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 s_(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 c_(e,t,n){let r=[],i=e.map((n,r)=>l_(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=l_(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 l_(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 u_=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(),gf(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};u_._nextId=1;var d_=u_,f_={},p_=f_.B;f_[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},f_.A={"#":`£`},f_.B=void 0,f_[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},f_.C=f_[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},f_.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},f_.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},f_.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},f_.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},f_.E=f_[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},f_.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},f_.H=f_[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},f_[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var m_=4294967295,h_=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=t_.clone(),this.savedCharset=p_,this.markers=[],this._nullCell=wd.fromCharData([0,bd,1,0]),this._whitespaceCell=wd.fromCharData([0,xd,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new fg,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new e_(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 Cd),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 Cd),this._whitespaceCell}getBlankLine(e,t){return new i_(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>m_?m_:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=t_);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 e_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(t_),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 i_(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 i_(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=a_(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(t_),n);if(r.length>0){let n=o_(this.lines,r);s_(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(t_),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new i_(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(t_),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=c_(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(t_,!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--,_=l_(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 d_(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)}},g_=class extends K{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 h_(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new h_(!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)}},__=2,v_=1,y_=class extends K{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,__),this.rows=Math.max(e.rawOptions.rows||0,v_),this.buffers=this._register(new g_(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))}};y_=H([U(0,Ld)],y_);var b_={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:rg,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},x_=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],S_=class extends K{constructor(e){super(),this._onOptionChange=this._register(new q),this.onOptionChange=this._onOptionChange.event;let t={...b_};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(vf(()=>{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 b_))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in b_))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||=b_[e],!C_(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=b_[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=x_.includes(t)?t:b_[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 C_(e){return e===`block`||e===`underline`||e===`bar`}function w_(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]&&w_(e[r],t-1);return n}var T_=Object.freeze({insertMode:!1}),E_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),D_=class extends K{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=w_(T_),this.decPrivateModes=w_(E_)}reset(){this.modes=w_(T_),this.decPrivateModes=w_(E_)}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))}};D_=H([U(0,jd),U(1,Id),U(2,Ld)],D_);var O_={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 k_(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 A_=String.fromCharCode,j_={DEFAULT:e=>{let t=[k_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${A_(t[0])}${A_(t[1])}${A_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${k_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${k_(e,!0)};${e.x};${e.y}${t}`}},M_=class extends K{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(O_))this.addProtocol(e,O_[e]);for(let e of Object.keys(j_))this.addEncoding(e,j_[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}};M_=H([U(0,jd),U(1,Nd),U(2,Ld)],M_);var N_=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],P_=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],F_;function I_(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 L_=class{constructor(){if(this.version=`6`,!F_){F_=new Uint8Array(65536),F_.fill(1),F_[0]=0,F_.fill(0,1,32),F_.fill(0,127,160),F_.fill(2,4352,4448),F_[9001]=2,F_[9002]=2,F_.fill(2,11904,42192),F_[12351]=1,F_.fill(2,44032,55204),F_.fill(2,63744,64256),F_.fill(2,65040,65050),F_.fill(2,65072,65136),F_.fill(2,65280,65377),F_.fill(2,65504,65511);for(let e=0;e<N_.length;++e)F_.fill(0,N_[e][0],N_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?F_[e]:I_(e,P_)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=R_.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return R_.createPropertyValue(0,n,r)}},R_=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new q,this.onChange=this._onChange.event;let e=new L_;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)}},z_=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 B_(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 V_=2147483647,H_=256,U_=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>H_)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>V_?V_: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>V_?V_: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,V_):e}},W_=[],G_=class{constructor(){this._state=0,this._active=W_,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=W_}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=W_,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||W_,!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`,_d(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=W_,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+=_d(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}},q_=[],J_=class{constructor(){this._handlers=Object.create(null),this._active=q_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=q_}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=q_,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||q_,!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`,_d(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=q_,this._ident=0}},Y_=new U_;Y_.addParam(0);var X_=class{constructor(e){this._handler=e,this._data=``,this._params=Y_,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Y_,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=_d(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=Y_,this._data=``,this._hitLimit=!1,e));return this._params=Y_,this._data=``,this._hitLimit=!1,t}},Z_=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}},Q_=160,$_=function(){let e=new Z_(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(Q_,0,2,0),e.add(Q_,8,5,8),e.add(Q_,6,0,6),e.add(Q_,11,0,11),e.add(Q_,13,13,13),e}(),ev=class extends K{constructor(e=$_){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 U_,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(vf(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new G_),this._dcsParser=this._register(new J_),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw 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:Q_)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<Q_){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<Q_){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<Q_){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<Q_){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<Q_){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<Q_){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}}},tv=/^([\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})$/,nv=/^[\da-f]+$/;function rv(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=tv.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),nv.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 iv(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 av(e,t=16){let[n,r,i]=e;return`rgb:${iv(n,t)}/${iv(r,t)}/${iv(i,t)}`}var ov={"(":0,")":1,"*":2,"+":3,"-":1,".":2},sv=131072,cv=10;function lv(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 uv=5e3,dv=0,fv=class extends K{constructor(e,t,n,r,i,a,o,s,c=new ev){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 vd,this._utf8Decoder=new yd,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=t_.clone(),this._eraseAttrDataInternal=t_.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 pv(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(Z.BEL,()=>this.bell()),this._parser.setExecuteHandler(Z.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Z.BS,()=>this.backspace()),this._parser.setExecuteHandler(Z.HT,()=>this.tab()),this._parser.setExecuteHandler(Z.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Z.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(rh.IND,()=>this.index()),this._parser.setExecuteHandler(rh.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(rh.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 f_)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 X_((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`),uv))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${uv} 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>sv&&(a=this._parseStack.position+sv)}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<sv&&(this._parseBuffer=new Uint32Array(Math.min(e.length,sv))),o||this._dirtyRowTracker.clearRange(),e.length>sv)for(let t=a;t<e.length;t+=sv){let a=t+sv<e.length?t+sv: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=R_.extractWidth(t);let n=R_.extractShouldJoin(t),m=n?R_.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(gd(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 i_&&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=>!lv(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new X_(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(t_));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=R_.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(Z.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(Z.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(Z.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(Z.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(Z.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,p_),this._charsetService.setgCharset(1,p_),this._charsetService.setgCharset(2,p_),this._charsetService.setgCharset(3,p_);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${Z.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=Sd.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=t_.fg,e.bg=t_.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|=t_.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=t_.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|=t_.fg&16777215,r.bg&=-67108864,r.bg|=t_.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Z.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=t_.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(!lv(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Z.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>cv&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>cv&&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(mv(n)){if(r===`?`)t.push({type:0,index:n});else{let e=rv(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=rv(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]);mv(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,p_),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(ov[e[0]],f_[e[1]]||p_),!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=t_.clone(),this._eraseAttrDataInternal=t_.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 wd;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${Z.ESC}${e}${Z.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},pv=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&&(dv=e,e=t,t=dv),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};pv=H([U(0,jd)],pv);function mv(e){return 0<=e&&e<256}var hv=5e7,gv=12,_v=50,vv=class extends K{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>hv)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>=gv?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>=gv)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>_v&&(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()}},yv=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)))}};yv=H([U(0,jd)],yv);var bv=!1,xv=class extends K{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new bf),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 Yg,this.optionsService=this._register(new S_(e)),this._instantiationService.setService(Ld,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(y_)),this._instantiationService.setService(jd,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Qg)),this._instantiationService.setService(Id,this._logService),this.coreService=this._register(this._instantiationService.createInstance(D_)),this._instantiationService.setService(Nd,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(M_)),this._instantiationService.setService(Md,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(R_)),this._instantiationService.setService(zd,this.unicodeService),this._charsetService=this._instantiationService.createInstance(z_),this._instantiationService.setService(Pd,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(yv),this._instantiationService.setService(Rd,this._oscLinkService),this._inputHandler=this._register(new fv(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Df.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Df.forward(this._bufferService.onResize,this._onResize)),this._register(Df.forward(this.coreService.onData,this._onData)),this._register(Df.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 vv((e,t)=>this._inputHandler.parse(e,t))),this._register(Df.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&&!bv&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),bv=!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,__),t=Math.max(t,v_),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(B_.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(B_(this._bufferService),!1))),this._windowsWrappingHeuristics.value=vf(()=>{for(let t of e)t.dispose()})}}},Sv={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 Cv(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=+!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?Z.ESC+`OA`:Z.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?Z.ESC+`OD`:Z.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?Z.ESC+`OC`:Z.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?Z.ESC+`OB`:Z.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:Z.DEL,e.altKey&&(i.key=Z.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Z.ESC+`[Z`;break}i.key=Z.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Z.ESC+Z.CR:Z.CR,i.cancel=!0;break;case 27:i.key=Z.ESC,e.altKey&&(i.key=Z.ESC+Z.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`D`:t?Z.ESC+`OD`:Z.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`C`:t?Z.ESC+`OC`:Z.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`A`:t?Z.ESC+`OA`:Z.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`B`:t?Z.ESC+`OB`:Z.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Z.ESC+`[2~`);break;case 46:i.key=a?Z.ESC+`[3;`+(a+1)+`~`:Z.ESC+`[3~`;break;case 36:i.key=a?Z.ESC+`[1;`+(a+1)+`H`:t?Z.ESC+`OH`:Z.ESC+`[H`;break;case 35:i.key=a?Z.ESC+`[1;`+(a+1)+`F`:t?Z.ESC+`OF`:Z.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?Z.ESC+`[5;`+(a+1)+`~`:Z.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?Z.ESC+`[6;`+(a+1)+`~`:Z.ESC+`[6~`;break;case 112:i.key=a?Z.ESC+`[1;`+(a+1)+`P`:Z.ESC+`OP`;break;case 113:i.key=a?Z.ESC+`[1;`+(a+1)+`Q`:Z.ESC+`OQ`;break;case 114:i.key=a?Z.ESC+`[1;`+(a+1)+`R`:Z.ESC+`OR`;break;case 115:i.key=a?Z.ESC+`[1;`+(a+1)+`S`:Z.ESC+`OS`;break;case 116:i.key=a?Z.ESC+`[15;`+(a+1)+`~`:Z.ESC+`[15~`;break;case 117:i.key=a?Z.ESC+`[17;`+(a+1)+`~`:Z.ESC+`[17~`;break;case 118:i.key=a?Z.ESC+`[18;`+(a+1)+`~`:Z.ESC+`[18~`;break;case 119:i.key=a?Z.ESC+`[19;`+(a+1)+`~`:Z.ESC+`[19~`;break;case 120:i.key=a?Z.ESC+`[20;`+(a+1)+`~`:Z.ESC+`[20~`;break;case 121:i.key=a?Z.ESC+`[21;`+(a+1)+`~`:Z.ESC+`[21~`;break;case 122:i.key=a?Z.ESC+`[23;`+(a+1)+`~`:Z.ESC+`[23~`;break;case 123:i.key=a?Z.ESC+`[24;`+(a+1)+`~`:Z.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Z.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Z.DEL:e.keyCode===219?i.key=Z.ESC:e.keyCode===220?i.key=Z.FS:e.keyCode===221&&(i.key=Z.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=Sv[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=Z.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=Z.ESC+n}else if(e.keyCode===32)i.key=Z.ESC+(e.ctrlKey?Z.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=Z.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=Z.US),e.key===`@`&&(i.key=Z.NUL))}return i}var wv=0,Tv=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new fg,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new fg,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||(wv=this._search(t),wv===-1)||this._getKey(this._array[wv])!==t)return!1;do if(this._array[wv]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(wv),!0;while(++wv<this._array.length&&this._getKey(this._array[wv])===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&&(wv=this._search(e),!(wv<0||wv>=this._array.length)&&this._getKey(this._array[wv])===e))do yield this._array[wv];while(++wv<this._array.length&&this._getKey(this._array[wv])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(wv=this._search(e),!(wv<0||wv>=this._array.length)&&this._getKey(this._array[wv])===e))do t(this._array[wv]);while(++wv<this._array.length&&this._getKey(this._array[wv])===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}},Ev=0,Dv=0,Ov=class extends K{constructor(){super(),this._decorations=new Tv(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(vf(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new kv(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=>{Ev=t.options.x??0,Dv=Ev+(t.options.width??1),e>=Ev&&e<Dv&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},kv=class extends G{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?ph.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?ph.toColor(this.options.foregroundColor):void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Av=1e3,jv=class{constructor(e,t=Av){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)}},Mv=20,Nv=class extends K{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 jv(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(`
|
|
37
|
+
`))),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(X(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(vf(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<Mv+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
38
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Mv+1&&(this._liveRegion.textContent+=cd.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})`}};Nv=H([U(1,Fd),U(2,Wd),U(3,Kd)],Nv);var Pv=class extends K{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(vf(()=>{gf(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(X(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(X(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(X(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(X(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&&Fv(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,gf(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}}};Pv=H([U(1,Gd),U(2,Kd),U(3,jd),U(4,Xd)],Pv);function Fv(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 Iv=class extends xv{constructor(e={}){super(e),this._linkifier=this._register(new bf),this.browser=Yh,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new bf),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(Ov),this._instantiationService.setService(Bd,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Wh),this._instantiationService.setService(Xd,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Vd)),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(Df.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Df.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Df.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Df.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(vf(()=>{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=fh.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${Z.ESC}]${n};${av(r)}${ih.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=dh.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=dh.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(Nv,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(X(this.element,`copy`,e=>{this.hasSelection()&&dd(e,this._selectionService)}));let e=e=>fd(e,this.textarea,this.coreService,this.optionsService);this._register(X(this.textarea,`paste`,e)),this._register(X(this.element,`paste`,e)),$h?this._register(X(this.element,`mousedown`,e=>{e.button===2&&hd(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(X(this.element,`contextmenu`,e=>{hd(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),sg&&this._register(X(this.element,`auxclick`,e=>{e.button===1&&md(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(X(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(X(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(X(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(X(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(X(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(X(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(X(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(X(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`,od.get()),cg||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(Hh,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(Wd,this._coreBrowserService),this._register(X(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(X(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Rh,this._document,this._helperContainer),this._instantiationService.setService(Ud,this._charSizeService),this._themeService=this._instantiationService.createInstance(Kg),this._instantiationService.setService(Yd,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(yh),this._instantiationService.setService(Jd,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(mg,this.rows,this.screenElement)),this._instantiationService.setService(Kd,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(ah,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(qh),this._instantiationService.setService(Gd,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Pv,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(Xm,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(Ig,this.element,this.screenElement,r)),this._instantiationService.setService(qd,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(Df.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Zm,this.screenElement)),this._register(X(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(Nv,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(nh,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(nh,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Lh,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(X(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(X(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=Z.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){pd(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=Cv(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===Z.ETX||n.key===Z.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Lv(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(t_));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(Z.ESC+`[I`):this.coreService.triggerDataEvent(Z.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}};function Lv(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Rv=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)}},zv=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 wd)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Bv=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 zv(t)}getNullCell(){return new wd}},Vv=class extends K{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new q),this.onBufferChange=this._onBufferChange.event,this._normal=new Bv(this._core.buffers.normal,`normal`),this._alternate=new Bv(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)}},Hv=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)}},Uv=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}},Wv=[`cols`,`rows`],Gv=0,Kv=class extends K{constructor(e){super(),this._core=this._register(new Iv(e)),this._addonManager=this._register(new Rv),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(Wv.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 Hv(this._core),this._parser}get unicode(){return this._checkProposedApi(),new Uv(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 Vv(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
|
|
39
|
+
`,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 od.get()},set promptLabel(e){od.set(e)},get tooMuchOutput(){return cd.get()},set tooMuchOutput(e){cd.set(e)}}}_verifyIntegers(...e){for(Gv of e)if(Gv===1/0||isNaN(Gv)||Gv%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Gv of e)if(Gv&&(Gv===1/0||isNaN(Gv)||Gv%1!=0||Gv<0))throw Error(`This API only accepts positive integers`)}};function qv(e){let t=window.engentyDesktop;t?t.open(e):window.open(e,`_blank`,`noopener`)}var Jv=Gu.filter(e=>e.text);function Yv({models:e}){return(0,L.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(xe,{children:P(`local.keys`)}),(0,L.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:P(`local.keysHint`)})]}),(0,L.jsxs)(`div`,{className:`flex flex-col`,children:[Jv.map(t=>(0,L.jsx)(Zv,{provider:t,stored:!!e.keys[t.id]},t.id)),(0,L.jsx)(Qv,{url:e.ollamaUrl})]}),(0,L.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:P(`local.modelsLater`)})]})}function Xv(e){let t=w();return zt({mutationFn:t=>p.post(e,t),onSuccess:()=>t.invalidateQueries({queryKey:[`me`]})})}function Zv({provider:e,stored:t}){let n=w(),[r,i]=(0,I.useState)(``),a=Xv(`/api/studio/local/keys/${e.id}`),o=()=>a.mutate(r.trim()?{key:r.trim()}:{},{onSuccess:e=>e.ok?i(``):void 0}),s=zt({mutationFn:()=>p.put(`/api/studio/local/models`,{keys:{[e.id]:``}}),onSuccess:async()=>{a.reset(),await n.invalidateQueries({queryKey:[`me`]})}});return(0,L.jsx)(ey,{label:e.name,sub:(0,L.jsxs)(`button`,{type:`button`,onClick:()=>qv(e.keyUrl),className:`inline-flex items-center gap-1 text-left hover:text-ink-2 hover:underline`,children:[P(`local.keyGet`),` `,(0,L.jsx)(oe,{className:`size-3`})]}),input:(0,L.jsx)(_e,{type:`password`,autoComplete:`off`,className:`min-w-0 flex-1 font-mono text-[0.8125rem]`,placeholder:t?P(`local.keySet`):e.keyPlaceholder,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&r.trim()&&o()}}),actions:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(D,{variant:`secondary`,busy:a.isPending,disabled:!t&&!r.trim(),onClick:o,children:P(`local.test`)}),t?(0,L.jsx)(D,{variant:`ghost`,size:`sm`,busy:s.isPending,onClick:()=>s.mutate(),children:P(`local.keyRemove`)}):null]}),said:$v(a,t=>qu(t)===e.id)})}function Qv({url:e}){let[t,n]=(0,I.useState)(e),r=Xv(`/api/studio/local/ollama`);return(0,L.jsx)(ey,{label:`Ollama`,sub:P(`local.ollamaWhere`),input:(0,L.jsx)(_e,{className:`min-w-0 flex-1 font-mono text-[0.8125rem]`,value:t,onChange:e=>n(e.target.value)}),actions:(0,L.jsx)(D,{variant:`secondary`,busy:r.isPending,disabled:!t.trim(),onClick:()=>r.mutate({url:t.trim()}),children:P(`local.test`)}),said:$v(r,e=>e.startsWith(`ollama:`))})}function $v(e,t){if(e.isError)return{ok:!1,text:e.error.message};let n=e.data;if(!n)return null;if(!n.ok)return{ok:!1,text:n.message??P(`models.keyBad`)};if(!n.text)return{ok:!0,text:P(`local.keyWorksPlain`)};let r=Ju(n.text);return{ok:!0,text:P(t(n.text)?`local.keyWorks`:`local.keyWorksOther`,{model:r})}}function ey({label:e,sub:t,input:n,actions:r,said:i}){return(0,L.jsxs)(`div`,{className:`grid gap-x-3 gap-y-1.5 border-border-soft border-t py-3 sm:grid-cols-[10rem_minmax(0,1fr)]`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-[0.875rem] text-ink-2`,children:e}),(0,L.jsx)(`div`,{className:`text-[0.75rem] text-ink-4`,children:t})]}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n,r]}),i?(0,L.jsxs)(`p`,{className:j(`flex items-start gap-1.5 text-[0.8125rem]`,i.ok?`text-moss`:`text-rose`),children:[i.ok?(0,L.jsx)(he,{className:`mt-0.5 size-3.5 shrink-0`,strokeWidth:3}):null,i.text]}):null]})]})}function ty({id:e,onExit:t,onDone:n,className:r}){let i=(0,I.useRef)(null),a=(0,I.useRef)(t);a.current=t;let o=(0,I.useRef)(n);return o.current=n,(0,I.useEffect)(()=>{let t=i.current;if(!t)return;let n=new Kv({fontSize:13,lineHeight:1.2,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,cursorBlink:!0,scrollback:3e3,theme:{background:`#0f1424`,foreground:`#e6e9f2`,cursor:`#f0b35b`,selectionBackground:`#2f3a5f`}}),r=new Zu;n.loadAddon(r),n.loadAddon(new rd((e,t)=>qv(t))),n.open(t);let s=`/api/studio/local/terminal/${e}`,c=()=>void 0,l=()=>{try{r.fit()}catch{}p.post(`${s}/resize`,{cols:n.cols,rows:n.rows}).catch(c)};l();let u=new ResizeObserver(l);u.observe(t);let d=n.onData(e=>void p.post(`${s}/input`,{data:e}).catch(c)),f=new EventSource($e(`${s}/stream`),{withCredentials:!0});return f.addEventListener(`data`,e=>{n.write(JSON.parse(e.data).data)}),f.addEventListener(`done`,()=>o.current?.()),f.addEventListener(`exit`,e=>{f.close(),a.current?.(JSON.parse(e.data).code)}),n.focus(),()=>{f.close(),u.disconnect(),d.dispose(),n.dispose()}},[e]),(0,L.jsx)(`div`,{ref:i,className:j(`h-[28rem] max-h-[60dvh] w-full overflow-hidden rounded-lg bg-[#0f1424] p-2`,r)})}function ny({auto:e=!1}){let t=w(),n=zt({mutationFn:()=>p.post(`/api/studio/local/models/test`,{cls:`classifier`}),onSuccess:e=>e.ok?t.invalidateQueries({queryKey:[`me`]}):void 0}),{mutate:r}=n,i=(0,I.useRef)(!1);(0,I.useEffect)(()=>{e&&!i.current&&(i.current=!0,r())},[e,r]);let a=n.data;return(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:P(`local.testHint`)}),(0,L.jsx)(`div`,{children:(0,L.jsx)(D,{variant:`secondary`,busy:n.isPending,onClick:()=>n.mutate(),children:P(`local.test`)})}),a?.ok?(0,L.jsxs)(`p`,{className:`flex items-start gap-2 text-[0.875rem] text-ink-2`,children:[(0,L.jsx)(he,{className:`mt-0.5 size-4 shrink-0 text-moss`}),(0,L.jsx)(`span`,{children:P(`local.testOk`,{s:(a.ms/1e3).toFixed(1),ref:a.ref??``,reply:a.reply??``})})]}):null,a&&!a.ok?(0,L.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:P(`local.testFailed`,{error:a.error??``})}):null,n.isError?(0,L.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:P(`local.testFailed`,{error:n.error.message})}):null]})}function ry({me:e,id:t,autoTest:n=!1}){let r=w(),i=e.harnesses.find(e=>e.id===t),[a,o]=(0,I.useState)(null),[s,c]=(0,I.useState)(null),l=zt({mutationFn:()=>p.post(`/api/studio/local/harness/${t}/detect`),onSuccess:()=>r.invalidateQueries({queryKey:[`me`]})}),u=e=>({mutationFn:()=>p.post(`/api/studio/local/harness/${t}/${e}`,{cols:100,rows:24}),onSuccess:({terminal:t})=>{o({id:t,job:e}),c(null)}}),d=zt(u(`install`)),f=zt(u(`login`)),m=i?.auth===`subscription`,h=i?i.version!==null:!1;if((0,I.useEffect)(()=>{s!==null&&(a?.job===`install`?h:m)&&o(null)},[m,h,s,a?.job]),!i)return null;let g=P(`harness.sub.${t}`),_=(0,L.jsxs)(D,{variant:`ghost`,size:`sm`,busy:l.isPending,onClick:()=>l.mutate(),children:[(0,L.jsx)(gt,{className:`size-3.5`}),` `,P(`local.recheck`)]});return(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,L.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:P(i.images?`harness.hintImages`:`harness.hint`,{name:i.name,sub:g})}),h?(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsxs)(`p`,{className:`flex items-center gap-2 text-[0.875rem] text-ink-2`,children:[(0,L.jsx)(he,{className:`size-4 text-moss`}),P(`harness.found`,{name:i.name,version:i.version??``})]}),(0,L.jsx)(`p`,{className:j(`text-[0.8125rem]`,m?`text-ink-3`:`text-rose`),children:m?P(`harness.authSubscription`,{sub:g}):i.auth===`api_key`?P(`harness.authKey`,{sub:g}):P(`harness.authNone`)}),m||a?null:(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(D,{busy:f.isPending,onClick:()=>f.mutate(),children:P(`harness.signIn`)}),_]}),f.isError?(0,L.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:f.error.message}):null]}):(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:P(`harness.missing`,{name:i.name})}),i.app?(0,L.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:P(`harness.appHere`,{app:i.app,name:i.name,sub:g})}):null,a?null:(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(D,{busy:d.isPending,onClick:()=>d.mutate(),children:P(`harness.installButton`,{name:i.name})}),_]}),d.isError?(0,L.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:d.error.message}):null,(0,L.jsxs)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:[P(`harness.install`),` `,(0,L.jsx)(`code`,{className:`rounded bg-paper px-1.5 py-0.5 font-mono text-[0.75rem] text-ink-2`,children:i.install})]})]}),a?(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:a.job===`install`?P(`harness.installing`,{name:i.name}):i.interactiveLogin?P(`harness.signInInteractive`,{name:i.name,sub:g}):P(`harness.signingIn`)}),(0,L.jsx)(ty,{id:a.id,onDone:()=>l.mutate(),onExit:e=>{c(e),l.mutate()}},a.id),(0,L.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:s===null?(0,L.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>{p.del(`/api/studio/local/terminal/${a.id}`).catch(()=>void 0),o(null)},children:P(`common.cancel`)}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>o(null),children:P(`common.close`)}),a.job===`install`?h?null:(0,L.jsx)(`span`,{className:`text-[0.8125rem] text-rose`,children:P(`harness.installEnded`,{name:i.name})}):m?null:(0,L.jsx)(`span`,{className:`text-[0.8125rem] text-rose`,children:P(`harness.loginEnded`,{name:i.name})})]})})]}):null,h?(0,L.jsx)(ny,{auto:n&&i.auth!==`none`},`${t}:${i.auth}`):null]})}var iy=(0,I.createContext)({slot:null,narrow:!1,setDetail:()=>void 0});function ay(){return(0,I.useContext)(iy)}function oy({children:e}){let{slot:t}=ay();return t?(0,va.createPortal)(e,t):null}function sy(e){let{setDetail:t}=ay();(0,I.useEffect)(()=>(t(e),()=>t(null)),[e,t])}function cy(){return Pn(`(max-width: 767px)`)}function ly(e){return e===`deeper`?`animate-step-deeper`:e===`back`&&`animate-step-back`}function uy({title:e,open:t,onBack:n,root:r}){let i=t??r??null,a=t?n:r?.onBack;return(0,L.jsxs)(`div`,{className:`mb-2 flex h-9 min-w-0 items-center px-1`,children:[(0,L.jsx)(`div`,{className:j(`shrink-0 overflow-hidden transition-[width,margin,opacity] duration-200 ease-out`,i&&a?`-ml-1.5 mr-0.5 w-8 opacity-100`:`w-0 opacity-0`),children:(0,L.jsx)(`button`,{type:`button`,onClick:a,"aria-hidden":!(i&&a),tabIndex:i&&a?void 0:-1,"aria-label":t?e:r?.backLabel,className:`grid size-8 place-items-center rounded-lg text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,L.jsx)(ye,{className:`size-4`})})}),i?(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 font-medium text-[0.875rem]`,children:[(0,L.jsx)(i.icon,{className:`size-4 shrink-0 text-ember-strong`}),(0,L.jsx)(`span`,{className:`truncate`,children:i.label})]}):(0,L.jsx)(`span`,{className:`truncate font-medium text-[0.875rem]`,children:e})]})}function dy({entries:e,current:t,onPick:n}){return(0,L.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:e.map((r,i)=>(0,L.jsxs)(`li`,{children:[r.group===e[i-1]?.group?null:r.group?(0,L.jsx)(`div`,{className:`px-2 pt-4 pb-1 font-medium text-[0.75rem] text-ink-3 first:pt-1`,children:r.group}):(0,L.jsx)(`div`,{className:`h-3`,"aria-hidden":!0}),(0,L.jsxs)(o,{to:r.to,onClick:e=>{r.id===t?.id&&(e.preventDefault(),n(r))},"aria-current":r.id===t?.id?`page`:void 0,className:j(`group flex items-center gap-2 rounded-lg px-2 py-1 text-[0.875rem] transition max-md:py-2`,r.id===t?.id?`bg-paper-2 font-medium text-ink`:`text-ink-2 hover:bg-accent hover:text-ink`),children:[(0,L.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center`,children:(0,L.jsx)(r.icon,{className:`size-4 transition-transform duration-200 ease-out group-hover:scale-110`})}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:r.label}),(0,L.jsx)(me,{className:`size-4 text-ink-4 md:hidden`})]})]},r.id))})}function fy({label:e,onBack:t}){return(0,L.jsxs)(`button`,{type:`button`,onClick:t,className:`-ml-1 flex items-center gap-1 rounded-lg py-1.5 pr-3 pl-1 text-[0.8125rem] text-ink-3 transition hover:text-ink`,children:[(0,L.jsx)(h,{className:`size-4`}),e]})}function py(e){let t=(0,I.useRef)({level:e,direction:null});return e!==t.current.level&&(t.current={level:e,direction:e>t.current.level?`deeper`:`back`}),t.current.direction}function my({label:e,collapsible:t,open:n=!0,count:r,children:i}){let[a,o]=(0,I.useState)(n),s=`font-medium text-[0.6875rem] text-ink-4 uppercase tracking-[0.12em]`;return(0,L.jsxs)(`div`,{className:`mt-5 first:mt-0`,children:[t?(0,L.jsxs)(`button`,{type:`button`,onClick:()=>o(!a),"aria-expanded":a,className:j(`mb-1 flex w-full items-center gap-1 px-2 text-left hover:text-ink-2`,s),children:[(0,L.jsx)(`span`,{className:`flex-1`,children:e}),a?null:(0,L.jsx)(`span`,{className:`tabular-nums tracking-normal`,children:r}),(0,L.jsx)(pe,{className:j(`size-3.5 transition-transform`,a?null:`-rotate-90`)})]}):(0,L.jsx)(`p`,{className:j(`mb-1 px-2`,s),children:e}),a?(0,L.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:i}):null]})}function hy({icon:e,label:t,badge:n,tone:r,toneLabel:i,selected:a,disabled:o,onPick:s}){return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,onClick:s,disabled:o,"aria-current":a?`page`:void 0,className:j(`group flex w-full items-center gap-2 rounded-lg px-2 py-1 text-left text-[0.875rem] transition max-md:py-2`,a?`bg-paper-2 font-medium text-ink`:`text-ink-2 hover:bg-accent hover:text-ink`,o&&`cursor-default opacity-50 hover:bg-transparent hover:text-ink-2`),children:[(0,L.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center`,children:(0,L.jsx)(e,{className:j(`size-4 transition-transform duration-200 ease-out`,!o&&`group-hover:scale-110`,a?`text-ember-strong`:`text-ink-3`)})}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),n,r?(0,L.jsx)(`span`,{role:`img`,title:i,"aria-label":i,className:j(`size-2 shrink-0 rounded-full`,r===`done`&&`bg-moss`,r===`credits`&&`bg-amber`,r===`on`&&`bg-ember`,r===`miss`&&`bg-amber`,r===`off`&&`ring-1 ring-ink-4 ring-inset`)}):null,o?null:(0,L.jsx)(me,{className:`size-4 shrink-0 text-ink-4 md:hidden`})]})})}var gy=e=>e?.runtimeSettings===!0;function _y(){return Ae({queryKey:[`runtime`],queryFn:()=>p.get(`/api/studio/runtime`)})}function vy({label:e,children:t}){return(0,L.jsxs)(`div`,{className:`grid gap-x-6 gap-y-0.5 py-2 sm:grid-cols-[11rem_minmax(0,1fr)]`,children:[(0,L.jsx)(`dt`,{className:`text-[0.875rem] text-ink-3`,children:e}),(0,L.jsx)(`dd`,{className:`min-w-0 break-words text-[0.875rem] text-ink`,children:t})]})}var yy=({children:e})=>(0,L.jsx)(`span`,{className:`font-mono text-[0.8125rem]`,children:e}),by={script:`about.kind.script`,checkout:`about.kind.checkout`,npm:`about.kind.npm`,cloud:`about.kind.cloud`};function xy(e,t){return e===`account`?P(`models.creditsName`):e===`own`?P(`local.sourceOwn`):t.harnesses.find(t=>t.id===e)?.name??e}function Sy(){let[e,t]=(0,I.useState)(`idle`);return(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,L.jsxs)(D,{variant:`secondary`,busy:e===`restarting`,onClick:async()=>{t(`restarting`);let{restarting:e}=await p.post(`/api/studio/runtime/restart`,{}).catch(()=>({restarting:!1}));if(!e){t(`failed`);return}await new Promise(e=>setTimeout(e,2e3));for(let e=0;e<60;e++){if(await fetch(`/api/config`,{cache:`no-store`}).then(e=>e.ok).catch(()=>!1)){window.location.reload();return}await new Promise(e=>setTimeout(e,1e3))}t(`failed`)},children:[(0,L.jsx)(Ii,{className:`size-4`}),` `,P(`runtime.restart`)]}),e===`restarting`?(0,L.jsx)(`span`,{className:`text-[0.875rem] text-ink-3`,children:P(`runtime.restarting`)}):null,e===`failed`?(0,L.jsx)(`span`,{className:`text-[0.875rem] text-rose`,children:P(`runtime.restartFailed`)}):null]})}function Cy({me:e}){let[t,n]=lt(),{narrow:r}=ay(),i=t.get(`show`)===`features`?`features`:`general`;sy(t.get(`show`)||!r?P(wy[i]):null);let a=e=>n({show:e},{replace:!r});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(oy,{children:(0,L.jsxs)(`ul`,{className:`flex flex-col gap-0.5`,children:[(0,L.jsx)(hy,{icon:Wi,label:P(wy.general),selected:i===`general`&&!(!t.get(`show`)&&r),onPick:()=>a(`general`)}),(0,L.jsx)(hy,{icon:ia,label:P(wy.features),selected:i===`features`,onPick:()=>a(`features`)})]})}),i===`features`?(0,L.jsx)(Dy,{me:e}):(0,L.jsx)(Ty,{me:e})]})}var wy={general:`runtime.general`,features:`runtime.featuresNav`};function Ty({me:e}){let t=A(),n=_y(),r=n.data;return r?(0,L.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[r.models?(0,L.jsxs)(Ct,{title:P(`runtime.models`),hint:P(`runtime.modelsHint`),children:[(0,L.jsxs)(`dl`,{className:`-my-2 divide-y divide-border-soft`,children:[(0,L.jsx)(vy,{label:P(`runtime.source`),children:xy(r.models.source,e)}),(0,L.jsx)(vy,{label:P(`runtime.keys`),children:r.models.keys.length?r.models.keys.map(e=>Ku(e)?.name??e).join(`, `):P(`runtime.noKeys`)})]}),(0,L.jsxs)(`div`,{className:`mt-5 flex flex-col gap-5`,children:[(0,L.jsx)(ny,{}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,L.jsx)(D,{variant:`secondary`,onClick:()=>t(`/settings/models`),children:P(`runtime.openModels`)}),(0,L.jsx)(D,{variant:`ghost`,onClick:()=>t(`/setup`),children:P(`runtime.openSetup`)})]})]})]}):null,(0,L.jsx)(Ct,{title:P(`runtime.server`),hint:P(`runtime.serverHint`),children:(0,L.jsxs)(`dl`,{className:`-my-2 divide-y divide-border-soft`,children:[(0,L.jsxs)(vy,{label:P(`runtime.version`),children:[r.version,` · `,P(by[r.kind])]}),(0,L.jsx)(vy,{label:P(`runtime.role`),children:(0,L.jsx)(yy,{children:r.role})}),(0,L.jsx)(vy,{label:P(`runtime.address`),children:(0,L.jsx)(yy,{children:r.publicUrl})}),(0,L.jsx)(vy,{label:P(`runtime.dataDir`),children:(0,L.jsx)(yy,{children:r.dataDir})}),(0,L.jsx)(vy,{label:P(`runtime.database`),children:r.database===`server`?P(`runtime.databaseServer`):P(`runtime.databaseFile`)}),(0,L.jsx)(vy,{label:P(`runtime.files`),children:r.files===`bucket`?P(`runtime.filesBucket`):P(`runtime.filesFolder`)}),(0,L.jsx)(vy,{label:P(`runtime.plugins`),children:r.plugins.length?r.plugins.join(`, `):P(`runtime.noPlugins`)}),(0,L.jsx)(vy,{label:P(`runtime.featuresFile`),children:(0,L.jsx)(yy,{children:r.featuresFile})})]})}),r.restarts?(0,L.jsx)(Ct,{title:P(`runtime.restartTitle`),hint:P(`runtime.restartHint`),children:(0,L.jsx)(Sy,{})}):null]}):n.isLoading?(0,L.jsx)(dt,{className:`size-5 text-ink-3`}):null}var Ey={default:`runtime.fromDefault`,env:`runtime.fromEnv`,remote:`runtime.fromRemote`,file:`runtime.fromFile`};function Dy({me:e}){let t=w(),n=Ae({queryKey:[`runtime`,`features`],queryFn:()=>p.get(`/api/studio/runtime/features`)}),r=zt({mutationFn:({name:e,on:t})=>p.put(`/api/studio/runtime/features/${encodeURIComponent(e)}`,{on:t}),onSettled:()=>Promise.all([t.invalidateQueries({queryKey:[`runtime`,`features`]}),t.invalidateQueries({queryKey:[`me`]}),t.invalidateQueries({queryKey:[`config`]})])}),i=n.data;if(!i)return n.isLoading?(0,L.jsx)(dt,{className:`size-5 text-ink-3`}):null;let a=e.mode===`managed`?P(`runtime.fromOrganization`):P(Ey.remote);return(0,L.jsx)(`div`,{className:`flex flex-col gap-9`,children:(0,L.jsxs)(Ct,{title:P(`runtime.featuresTitle`),hint:P(e.mode===`managed`?`runtime.featuresHintCloud`:`runtime.featuresHint`,{file:i.file}),children:[i.features.length?(0,L.jsx)(`ul`,{className:`-my-2 divide-y divide-border-soft`,children:i.features.map(e=>{let t=r.isPending&&r.variables?.name===e.name;return(0,L.jsxs)(`li`,{className:`flex items-start gap-4 py-3`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,L.jsx)(`span`,{className:`font-medium text-[0.9375rem] text-ink`,children:e.label??e.name}),(0,L.jsx)(x,{children:e.source===`remote`?a:P(Ey[e.source])}),e.kind===`plan`?(0,L.jsx)(x,{children:P(`runtime.kindPlan`)}):null]}),(0,L.jsx)(`p`,{className:`mt-0.5 font-mono text-[0.75rem] text-ink-4`,children:e.name}),e.hint?(0,L.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-3 leading-snug`,children:e.hint}):null,e.source===`file`?(0,L.jsx)(`button`,{type:`button`,disabled:t,onClick:()=>r.mutate({name:e.name,on:null}),className:`mt-1 text-[0.8125rem] text-ink-3 underline-offset-2 hover:text-ink hover:underline`,children:P(`runtime.followDefault`,{state:e.without?P(`runtime.on`):P(`runtime.off`)})}):null]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pt-0.5`,children:[t?(0,L.jsx)(dt,{className:`size-4 text-ink-3`}):null,(0,L.jsx)(it,{checked:e.on,label:e.label??e.name,disabled:t,onChange:t=>r.mutate({name:e.name,on:t})})]})]},e.name)})}):(0,L.jsx)(b,{children:P(`runtime.noFeatures`)}),r.error?(0,L.jsx)(`p`,{className:`mt-4 text-[0.875rem] text-rose`,children:P(`runtime.featureFailed`)}):null,(0,L.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 border-border-soft border-t pt-4`,children:[(0,L.jsx)(`p`,{className:`text-[0.875rem] text-ink-3 leading-snug`,children:P(i.restarts?`runtime.featuresRestart`:`runtime.featuresRestartBySelf`)}),i.restarts?(0,L.jsx)(Sy,{}):null]})]})})}function Oy(e,t){let n=e?.mode===`managed`&&ba(e.features,`organizationSettings`),r=P(`settings.groupOrganization`),i=n?P(`settings.groupStudio`):void 0,a=e=>i?{...e,group:i}:e;return[...n?[]:[{id:`account`,label:P(`account.title`),icon:ca,menu:!0}],...n?[{id:`general`,label:P(`orgSettings.general`),icon:nr,menu:!1,group:r},{id:`members`,label:P(`orgSettings.members`),icon:F,menu:!0,group:r},{id:`credits`,label:P(`credits.title`),icon:kt,menu:!1,group:r},{id:`usage`,label:P(`credits.usage`),icon:Pt,menu:!1,group:r},{id:`invoices`,label:P(`credits.invoices`),icon:Mi,menu:!1,group:r},{id:`keys`,label:P(`orgSettings.keys`),icon:Hr,menu:!1,group:r}]:e?.mode===`managed`&&ba(e.features,`teamPlans`)?[{id:`organization`,label:P(`organization.title`),icon:F,menu:!0}]:[],...du(e)?[a({id:`cloud`,label:P(`cloudSync.title`),icon:fr,menu:!1})]:[],a({id:`connectors`,label:P(`connectors.title`),icon:Ut,menu:!0}),a({id:`models`,label:P(`local.title`),icon:gr,menu:!0}),a({id:`integrate`,label:P(`integrate.nav`),icon:ir,menu:!0}),...ba(e?.features,`plugins`)||t.plugins.length||t.problems.length||t.canReload&&e?.account?[a({id:`plugins`,label:P(`plugins.title`),icon:Qn,menu:!1})]:[],...gy(e)?[a({id:`setup`,label:P(`runtime.setupNav`),icon:da,menu:!1})]:[],{id:`about`,label:P(`about.nav`),icon:Br,menu:!1}]}function ky(){return[{id:`profile`,label:P(`konto.profile`),icon:ca,menu:!0},{id:`orgs`,label:P(`konto.organizations`),icon:nr,menu:!1},{id:`apps`,label:P(`konto.apps`),icon:Ut,menu:!1}]}var Ay=`wizards.assistant`,jy={place:`center`,height:null,dev:!1};function My(){try{let e=JSON.parse(localStorage.getItem(Ay)??`null`);return{place:e?.place===`right`?`right`:`center`,height:typeof e?.height==`number`?e.height:null,dev:e?.dev===!0}}catch{return jy}}var Ny=My(),Py=new Set,Fy=()=>{for(let e of Py)e()},Iy=e=>(Py.add(e),()=>Py.delete(e));function Ly(e){Ny={...Ny,...e};try{localStorage.setItem(Ay,JSON.stringify(Ny))}catch{}Fy()}function Ry(){return(0,I.useSyncExternalStore)(Iy,()=>Ny)}var zy=64,By=12,Vy=null,Hy=new Set;function Uy(e){Vy=e;for(let e of Hy)e()}function Wy(){return(0,I.useSyncExternalStore)(e=>(Hy.add(e),()=>Hy.delete(e)),()=>Vy)}var Gy=e=>Math.min(600,e-24);function Ky(e,t,n){let r=Gy(e.width),i=e.height-By-t;return{center:{left:(e.width-r)/2,top:i,width:r,height:t},right:e.width>=r+24+240?{left:e.width-By-r,top:i,width:r,height:t}:null,sidebar:n?{left:e.width-400+8,top:8,width:384,height:e.height-16}:null}}var qy=e=>e>=Gy(e)+24+240;function Jy(e,t){if(e.button!==0)return;e.preventDefault();let n={x:e.clientX,y:e.clientY},r=t.frame()?.getBoundingClientRect(),i=r?{x:n.x-r.left,y:n.y-r.top}:{x:28,y:24},a=!1,o=null,s=r=>{if(r.pointerId!==e.pointerId||!a&&Math.hypot(r.clientX-n.x,r.clientY-n.y)<5)return;a||(a=!0,document.body.style.userSelect=`none`,t.onLeave?.());let s=t.column()?.getBoundingClientRect();if(!s)return;let c=t.frame()?.getBoundingClientRect(),l=Gy(s.width),u=c?.height??160,d=Math.min(Math.max(r.clientX-s.left-i.x,8),Math.max(8,s.width-120)),f=Math.min(Math.max(r.clientY-s.top-i.y,8),Math.max(8,s.height-u-8)),p=Ky(s,u,t.sidebar),m=s.height-(f+u)<zy,h=s.width-(d+l)<zy||window.innerWidth-r.clientX<zy,g;if(p.sidebar&&h&&(!m||window.innerWidth-r.clientX<zy))g=`sidebar`;else{let e=d+l/2;g=p.right&&Math.abs(e-(p.right.left+l/2))<Math.abs(e-(p.center.left+l/2))?`right`:`center`}o={left:d,top:f,width:l,zone:g,spot:p[g]??o?.spot??null},Uy(o)},c=n=>{if(n.pointerId!==e.pointerId)return;window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),document.body.style.userSelect=``;let r=o;if(Uy(null),!a){t.onClick?.();return}r?.zone&&t.onDrop(r.zone)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)}var Yy=null,Xy=new Set;function Zy(e){Yy=e;for(let e of Xy)e()}function Qy(){return(0,I.useSyncExternalStore)(e=>(Xy.add(e),()=>Xy.delete(e)),()=>Yy)}var $y=null,eb=new Set;function tb(e){$y=e;for(let e of eb)e()}function nb(){return(0,I.useSyncExternalStore)(e=>(eb.add(e),()=>eb.delete(e)),()=>$y)}var rb=1300,ib=3e3;function ab(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}var ob=typeof window<`u`&&(!!ab()||!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<`u`);function sb(e){return e.toLowerCase().split(/[\s\-–—/]+/).map(e=>e.replace(/[^\p{L}\p{N}]/gu,``)).filter(Boolean)}function cb(e,t){let n=new Set(sb(t)),r=sb(e);return r.length<2||r.filter(e=>n.has(e)).length/r.length>=.75}function lb(e){let[t,n]=(0,I.useState)(`off`),[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(null),[s,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(0),[d,f]=(0,I.useState)(``),[m,h]=(0,I.useState)(null),g=(0,I.useRef)(`off`),_=(0,I.useRef)(!1),v=(0,I.useRef)(null),y=(0,I.useRef)(null),b=(0,I.useRef)(null),ee=(0,I.useRef)(``),te=(0,I.useRef)({text:``,until:0}),x=(0,I.useRef)(``),ne=(0,I.useRef)(null),S=(0,I.useRef)(null),re=(0,I.useRef)(e);re.current=e;let C=(0,I.useRef)(m);C.current=m;let w=(0,I.useCallback)(e=>{g.current=e,n(e)},[]),ie=(0,I.useCallback)(()=>{vl(),b.current&&=(b.current.pause(),null),ee.current=``},[]),ae=(0,I.useCallback)(()=>{ne.current&&=(clearTimeout(ne.current),null);let e=x.current.trim();x.current=``,f(``),e&&g.current!==`off`&&(w(`thinking`),S.current=re.current.messages.at(-1)?.id??null,re.current.send(e).then(e=>{!e&&g.current===`thinking`&&w(`listening`)}))},[w]),oe=(0,I.useCallback)((e,t)=>{if(!(_.current||g.current===`off`||g.current===`thinking`)){if(g.current===`speaking`){if(cb(e,ee.current))return;ie(),w(`listening`)}else if(Date.now()<te.current.until&&cb(e,te.current.text))return;f(e),t&&(x.current=`${x.current} ${e}`.trim(),f(x.current)),ne.current&&clearTimeout(ne.current),ne.current=setTimeout(ae,rb)}},[ae,ie,w]),se=(0,I.useCallback)(()=>{let e=ab();if(!e||v.current)return;let t=new e;t.continuous=!0,t.interimResults=!0,t.lang=En[N],t.onresult=e=>{let t=``;for(let n=e.resultIndex;n<e.results.length;n++){let r=e.results[n];r.isFinal?oe(r[0].transcript,!0):t+=r[0].transcript}t.trim()&&oe(`${x.current} ${t}`.trim(),!1)},t.onerror=e=>{(e.error===`not-allowed`||e.error===`service-not-allowed`)&&c(`denied`)},t.onend=()=>{v.current=null,g.current!==`off`&&!_.current&&setTimeout(se,200)},v.current=t;try{t.start()}catch{v.current=null}},[oe]),T=(0,I.useCallback)((e,t)=>{let n=null,r=[],i=0,a=new Uint8Array(t.fftSize),o=()=>{if(g.current===`off`){n?.stop();return}t.getByteTimeDomainData(a);let s=0;for(let e of a)s=Math.max(s,Math.abs(e-128)/128);if(s>.08&&!_.current&&g.current===`listening`){if(i=Date.now(),!n){let t=Date.now()<te.current.until?te.current.text:``;r=[],n=new MediaRecorder(e),n.ondataavailable=e=>e.data.size&&r.push(e.data),n.onstop=async()=>{let e=new File(r,`live`,{type:(n?.mimeType||`audio/webm`).split(`;`)[0]});if(n=null,e.size&&g.current!==`off`){w(`thinking`);try{let{text:n}=await p.upload(`/api/studio/transcribe`,e);if(t&&cb(n,t)){w(`listening`);return}x.current=n,ae()}catch(e){c(e.message),w(`listening`)}}},n.start()}}else n&&Date.now()-i>rb&&n.stop();setTimeout(o,100)};o()},[ae,w]),ce=(0,I.useCallback)(async()=>{if(g.current!==`off`)return;c(null);let e;try{e=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})}catch{c(`denied`);return}y.current=e,S.current=re.current.messages.at(-1)?.id??null,w(`listening`),o(Date.now());let t=new AudioContext,n=t.createAnalyser();n.fftSize=512,t.createMediaStreamSource(e).connect(n);let r=new Uint8Array(n.fftSize),i=()=>{if(g.current===`off`){t.close();return}n.getByteTimeDomainData(r);let e=0;for(let t of r)e=Math.max(e,Math.abs(t-128)/128);u(_.current?0:Math.min(1,e*3)),setTimeout(i,90)};i(),ab()?se():T(e,n),C.current||p.get(`/api/studio/assistant/voice`).then(({way:e})=>h({way:e,natural:e===`key`||e===`local`})).catch(()=>h({way:`none`,natural:!1}))},[se,T,w]),le=(0,I.useCallback)(()=>{w(`off`),o(null),f(``),u(0),x.current=``,ne.current&&clearTimeout(ne.current),v.current?.abort(),v.current=null,ie();for(let e of y.current?.getTracks()??[])e.stop();y.current=null},[ie,w]),ue=(0,I.useCallback)(()=>{let e=!_.current;_.current=e,i(e);for(let t of y.current?.getAudioTracks()??[])t.enabled=!e;e?(v.current?.abort(),v.current=null):g.current!==`off`&&se()},[se]),de=(0,I.useCallback)(async e=>{let t=_l(e);if(!t){w(`listening`);return}w(`speaking`),ee.current=t;let n=C.current?.natural&&C.current.way!==`none`,r=!1;if(n)try{let e=await fetch($e(`/api/studio/assistant/speak`),{method:`POST`,credentials:`include`,headers:{"content-type":`application/json`},body:JSON.stringify({text:t.slice(0,4e3)})});if(e.ok&&g.current===`speaking`){let t=URL.createObjectURL(await e.blob()),n=new Audio(t);b.current=n,await new Promise(e=>{n.onended=()=>e(),n.onerror=()=>e(),n.onpause=()=>e(),n.play().catch(()=>e())}),URL.revokeObjectURL(t),r=!0}}catch{}!r&&g.current===`speaking`&&await gl(t,N),b.current=null,ee.current=``,g.current===`speaking`&&(te.current={text:t,until:Date.now()+ib},x.current=``,f(``),v.current?.abort(),w(`listening`))},[w]);return(0,I.useEffect)(()=>{if(t!==`thinking`||e.phase!==`idle`)return;let n=e.messages.at(-1);n?.role===`assistant`&&n.id!==S.current&&!n.pending?(S.current=n.id,de(n.content)):e.error&&w(`listening`)},[t,e.phase,e.messages,e.error,de,w]),(0,I.useEffect)(()=>()=>le(),[le]),{state:t,muted:r,since:a,error:s,level:l,heard:d,voice:m,setNatural:e=>h(t=>t&&{...t,natural:e}),start:ce,end:le,toggleMute:ue}}var ub=new Map,db={},fb=new Set;function pb(){db=Object.assign({},...ub.values());for(let e of fb)e()}function mb(){return(0,I.useSyncExternalStore)(e=>(fb.add(e),()=>fb.delete(e)),()=>db)}function hb(){for(let e of ub.values())e.onChanged?.()}function gb(e){let t=(0,I.useId)(),n=(0,I.useRef)(e);n.current=e;let{onChanged:r,...i}=e,a=JSON.stringify(i);(0,I.useEffect)(()=>{ub.set(t,{...JSON.parse(a),onChanged:()=>n.current.onChanged?.()}),pb()},[t,a]),(0,I.useEffect)(()=>()=>{ub.delete(t),pb()},[t])}function _b(){let e=document.getElementById(jw);if(!e)return;let t=e.getBoundingClientRect().top;for(let n of e.querySelectorAll(`[data-assist-section]`)){let e=n.getBoundingClientRect();if(e.bottom>t+40&&e.top<window.innerHeight*.6)return n.dataset.assistSection||void 0}}function vb(){let{title:e,hello:t,about:n,placeholder:r,suggestions:i,compact:a,onChanged:o,...s}=db,c=mw().map(e=>e.label),l=window.location.pathname,u=l.startsWith(pt)?l.slice(pt.length)||`/`:l,d=_b(),f=(e,t)=>e&&e.length>t?`${e.slice(0,t-1)}…`:e;return{route:`${u}${window.location.search}`.slice(0,400),...c.length?{title:f(c.join(` / `),200)}:{},...d?{view:f(d,200)}:{},...s.open?{open:{kind:s.open.kind.slice(0,60),...s.open.id?{id:s.open.id.slice(0,120)}:{},label:f(s.open.label,200)??``}}:{},...s.selection?{selection:s.selection.slice(0,100).map(e=>e.slice(0,120))}:{},...s.summary?{summary:f(s.summary,2e3)}:{},...s.fields?{fields:s.fields.slice(0,60).map(e=>({id:e.id.slice(0,120),label:f(e.label,200)??``,value:e.value}))}:{},...s.plugin?{plugin:s.plugin}:{}}}var yb=()=>document.getElementById(`studio-scroll`)??document.body,bb=`[data-assist],h1,h2,h3,h4,button,a[href],input,textarea,select,[role=switch],[role=checkbox],[role=tab],[contenteditable=true]`,xb=150,Sb=0;function Cb(e){return e.dataset.assist?e.dataset.assist:(e.dataset.assistRef||(Sb+=1,e.dataset.assistRef=`e${Sb}`),e.dataset.assistRef)}var wb=(e,t=120)=>(e??``).replace(/\s+/g,` `).trim().slice(0,t);function Tb(e){if(e.dataset.assistLabel)return wb(e.dataset.assistLabel);let t=e.getAttribute(`aria-label`);if(t)return wb(t);if(e.dataset.assist&&!e.matches(`input,textarea,select,button,a`)){let t=e.querySelector(`h1,h2,h3,h4,[data-assist-section]`);if(t)return wb(t.getAttribute(`data-assist-section`)||t.textContent)}if(e.id){let t=document.querySelector(`label[for="${CSS.escape(e.id)}"]`);if(t)return wb(t.textContent)}let n=e.closest(`label`);if(n&&n!==e)return wb(n.textContent);let r=e.parentElement?.querySelector(`label`);return r&&(e.matches(`input,textarea,select`)||e.getAttribute(`role`)===`switch`)?wb(r.textContent):wb(e.textContent||e.placeholder||e.getAttribute(`title`)||``)}function Eb(e){if(e instanceof HTMLInputElement)return e.type===`password`?e.value?`••••`:``:e.type===`checkbox`||e.type===`radio`?e.checked:e.value.slice(0,300);if(e instanceof HTMLTextAreaElement)return e.value.slice(0,600);if(e instanceof HTMLSelectElement)return wb(e.selectedOptions[0]?.textContent??e.value);let t=e.getAttribute(`role`);if(t===`switch`||t===`checkbox`)return e.getAttribute(`aria-checked`)===`true`;if(e.isContentEditable)return wb(e.textContent,600)}function Db(e){return e.dataset.assist&&!e.matches(`input,textarea,select,button,a`)?`area`:/^H[1-4]$/.test(e.tagName)?`heading`:e.matches(`input,textarea,select,[role=switch],[role=checkbox],[contenteditable=true]`)?`field`:e.getAttribute(`role`)===`tab`?`tab`:e.tagName===`A`?`link`:`button`}function Ob(e){if(e.closest(`[data-assistant-ui],[aria-hidden=true]`))return!1;let t=getComputedStyle(e);if(t.display===`none`||t.visibility===`hidden`)return!1;let n=e.getBoundingClientRect();return n.width>0||n.height>0}function kb(e){let t=e.getBoundingClientRect();return t.bottom>0&&t.top<window.innerHeight&&t.right>0&&t.left<window.innerWidth}function Ab(e,t){let n=[];for(let r of e.querySelectorAll(bb)){if(n.length>=xb)break;if(!Ob(r)||t&&!kb(r))continue;let e=Db(r),i=Tb(r);if(!i&&e!==`field`)continue;let a=e===`field`?Eb(r):void 0,o=r.disabled||r.getAttribute(`aria-disabled`)===`true`;n.push({ref:Cb(r),kind:e,label:i,...a===void 0?{}:{value:a},...o?{disabled:!0}:{},...r.getAttribute(`aria-current`)||r.getAttribute(`aria-selected`)===`true`?{current:!0}:{}})}return n}function jb(e){let t=yb(),n=e.trim(),r=document.querySelector(`[data-assist="${CSS.escape(n)}"]`)??document.querySelector(`[data-assist-ref="${CSS.escape(n)}"]`)??(/^[A-Za-z][\w-]*$/.test(n)?document.getElementById(n):null);if(r)return r;let i=n.toLowerCase(),a=null;for(let e of t.querySelectorAll(bb)){if(!Ob(e))continue;let t=Tb(e).toLowerCase();if(t===i)return e;!a&&t.includes(i)&&(a=e)}return a}var Mb=e=>({error:`Nothing on the page is "${e}". look_at_page lists what is there.`}),Nb=null,Pb=0,Fb=new Set;function Ib(e){Nb=e;for(let e of Fb)e()}function Lb(){return(0,I.useSyncExternalStore)(e=>(Fb.add(e),()=>Fb.delete(e)),()=>Nb)}var Rb=null,zb=()=>[];function Bb(e,t){Rb=e,zb=t}function Vb(e){let t=e.split(/[?#]/)[0]||`/`;return zb().some(e=>RegExp(`^${e.split(`/`).map(e=>e.startsWith(`:`)?e.endsWith(`?`)?`(?:[^/]+)?`:`[^/]+`:e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`/`)}/?$`).test(t))}var Hb=()=>new Promise(e=>setTimeout(e,450));function Ub(e){return!e.startsWith(`/`)||e.startsWith(`//`)||/^\/(api|w|s)\//.test(e)||!(Rb&&Vb(e))?!1:(Rb(e),!0)}var Wb={type:`string`,description:`A ref or area from look_at_page, or the label`},Gb=new Map;function Kb(){return[...Gb.values()].map(({name:e,description:t,parameters:n})=>({name:e,description:t,parameters:n}))}var qb=[{name:`navigate`,description:`Open a page of the studio by its address (/settings/models, /space/knowledge, /space/data, a plugin's page). The chat stays open.`,parameters:{type:`object`,properties:{to:{type:`string`,description:`The studio address, starting with /`}},required:[`to`]},run:async({to:e})=>{let t=String(e??``);return t.startsWith(`/`)&&Vb(t)?(Rb?.(t),await Hb(),{opened:t,pageTools:Kb()}):{error:`The studio has no page "${t}".`,pages:zb()}}},{name:`highlight`,description:"Point at one element: `spotlight` dims the page except it, `ring` only rings it. A small card beside it shows a title, a text and buttons; a button the person presses comes back as their next message. Scrolls it into view.",parameters:{type:`object`,properties:{target:Wb,mode:{type:`string`,enum:[`spotlight`,`ring`]},title:{type:`string`,maxLength:80},text:{type:`string`,maxLength:400},buttons:{type:`array`,items:{type:`string`,maxLength:40},maxItems:3,description:`Answers the person can give with one click`}},required:[`target`]},run:async({target:e,mode:t,title:n,text:r,buttons:i})=>{let a=jb(String(e??``));return a?(a.scrollIntoView({behavior:`smooth`,block:`center`}),await Hb(),Pb+=1,Ib({id:Pb,el:a,mode:t===`ring`?`ring`:`spotlight`,title:n?String(n):void 0,text:r?String(r):void 0,buttons:Array.isArray(i)?i.map(String).slice(0,3):[]}),{shown:Tb(a)}):Mb(String(e))}},{name:`look_at_page`,description:`What is on the screen now, as a list: headings, areas, buttons, links, tabs and fields with their values, each with a ref to point at (at most 150). Not a picture.`,parameters:{type:`object`,properties:{}},run:()=>({route:window.location.pathname,scrolled:Math.round(yb().scrollTop),items:Ab(yb(),!0),pageTools:Kb()})},{name:`read_section`,description:`Everything in one area of the page, also what is scrolled away: its elements with values, and its text.`,parameters:{type:`object`,properties:{target:Wb},required:[`target`]},run:({target:e})=>{let t=jb(String(e??``));return t?{area:Tb(t),items:Ab(t,!1),text:wb(t.innerText,4e3)}:Mb(String(e))}},{name:`fill_field`,description:`Put a value into a field of the page, as if typed: text, a choice by its label, yes/no for a switch. Not saved by you: the person checks and saves.`,parameters:{type:`object`,properties:{target:Wb,value:{type:[`string`,`number`,`boolean`]}},required:[`target`,`value`]},run:async({target:e,value:t})=>{let n=jb(String(e??``));if(!n)return Mb(String(e));if(n.scrollIntoView({behavior:`smooth`,block:`center`}),n instanceof HTMLInputElement&&(n.type===`checkbox`||n.type===`radio`))n.checked!==!!t&&n.click();else if(n.getAttribute(`role`)===`switch`||n.getAttribute(`role`)===`checkbox`)n.getAttribute(`aria-checked`)===`true`!=!!t&&n.click();else if(n instanceof HTMLSelectElement){let e=[...n.options].find(e=>e.value===String(t)||wb(e.textContent).toLowerCase()===String(t).toLowerCase());if(!e)return{error:`No such choice.`,choices:[...n.options].map(e=>wb(e.textContent))};n.value=e.value,n.dispatchEvent(new Event(`change`,{bubbles:!0}))}else if(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement){if(n.disabled||n.readOnly)return{error:`The field takes nothing here.`};let e=n instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype;Object.getOwnPropertyDescriptor(e,`value`)?.set?.call(n,String(t)),n.dispatchEvent(new Event(`input`,{bubbles:!0})),n.dispatchEvent(new Event(`change`,{bubbles:!0}))}else return{error:`That is not a field.`};return n.focus({preventScroll:!0}),{filled:Tb(n),value:Eb(n)}}},{name:`page_tool`,description:`Runs a tool the page shown now offers, by its name, with its arguments: a page opened during this answer brings tools that are not among yours (navigate and look_at_page list them with their parameters).`,parameters:{type:`object`,properties:{name:{type:`string`},args:{type:`object`,description:`The tool's arguments, as its parameters say`}},required:[`name`]},run:async({name:e,args:t})=>{let n=Gb.get(String(e??``));return n?n.run(t??{}):{error:`The page offers no tool "${String(e)}".`,pageTools:Kb()}}},{name:`scroll_to`,description:`Scroll an element of the page into view.`,parameters:{type:`object`,properties:{target:Wb},required:[`target`]},run:async({target:e})=>{let t=jb(String(e??``));return t?(t.scrollIntoView({behavior:`smooth`,block:`start`}),await Hb(),{at:Tb(t)}):Mb(String(e))}}];function Jb(e,t,n){let r=(0,I.useRef)(n);r.current=n;let i=JSON.stringify(t);(0,I.useEffect)(()=>{if(qb.some(t=>t.name===e))throw Error(`"${e}" is a tool of the assistant itself.`);if(!/^[a-z][a-z0-9_]{1,62}$/.test(e))throw Error(`"${e}": a tool's name is lower case letters, digits and _.`);let{description:t,parameters:n}=JSON.parse(i);return Gb.set(e,{name:e,description:t,parameters:n??{type:`object`,properties:{}},run:e=>r.current(e)}),()=>{Gb.delete(e)}},[e,i])}function Yb(){return[...qb,...Gb.values()].map(({name:e,description:t,parameters:n})=>({name:e,description:t,parameters:n}))}async function Xb(e,t){let n=qb.find(t=>t.name===e)??Gb.get(e);if(!n)return null;try{return{result:await n.run(t??{})}}catch(e){return{result:{error:e.message}}}}var Zb=e=>({id:e.id,role:e.role,content:e.content,cards:e.cards.map((t,n)=>({...t,id:`${e.id}-${n}`})),toolCalls:e.toolCalls,changed:e.changed});function Qb(e){return e.type.startsWith(`image/`)&&/logo/i.test(e.name)?`logo`:/^(image|video|audio)\//.test(e.type)?`asset`:`document`}var $b=0,ex=e=>`${e}-${Date.now()}-${++$b}`,tx=(0,I.createContext)(null);function nx(){return(0,I.useContext)(tx)}function rx(){let e=Kw(),t=$t(),n=(0,I.useRef)([]);return n.current=[`/`,`/new`,`/edit/:id`,`/space`,`/space/:group`,`/settings`,...Oy(t.data,e).map(e=>`/settings/${e.id}`),...e.pages.map(e=>e.path)],(0,I.useCallback)(()=>n.current,[])}function ix({children:e}){let t=w(),n=$t(),r=!!n.data,{project:i}=un(),a=A(),o=rx();(0,I.useEffect)(()=>{Bb(e=>a(e),o)},[a,o]);let s=Ae({queryKey:[`assistant-chat`],queryFn:()=>p.get(`/api/studio/assistant/chat`),enabled:r,staleTime:1/0}),c=Ae({queryKey:[`assistant-layout`],queryFn:()=>p.get(`/api/studio/assistant/layout`),enabled:r,staleTime:1/0}),[l,u]=(0,I.useState)([]),[d,f]=(0,I.useState)(`idle`),[m,h]=(0,I.useState)(null),[g,_]=(0,I.useState)(null),[v,y]=(0,I.useState)(null),[b,te]=(0,I.useState)(!1),[x,ne]=(0,I.useState)(!1),[S,re]=(0,I.useState)({kind:`chat`}),[C,ie]=(0,I.useState)(null),[ae,oe]=(0,I.useState)(void 0),[se,T]=(0,I.useState)([]),[ce,le]=(0,I.useState)([]),ue=(0,I.useRef)(null),de=Ry(),fe=!!n.data?.assistantDev,pe=fe&&de.dev,me=(0,I.useRef)(pe);me.current=pe;let[he,D]=(0,I.useState)(!1),ge=(0,I.useRef)(he);ge.current=he;let[_e,ve]=(0,I.useState)(null),ye=(0,I.useRef)(_e);ye.current=_e,(0,I.useEffect)(()=>{s.data&&ue.current!==s.data.id&&(ue.current=s.data.id,u(s.data.messages.map(Zb)))},[s.data]);let be=(0,I.useCallback)(e=>{ie(e),t.setQueryData([`assistant-layout`],t=>({...t,layout:e})),p.put(`/api/studio/assistant/layout`,{layout:e}).catch(()=>null)},[t]),O=(0,I.useCallback)((e,n=!0)=>{oe(e),n&&(t.setQueryData([`assistant-layout`],t=>({...t,width:e})),p.put(`/api/studio/assistant/layout`,{width:e}).catch(()=>null))},[t]),k=(0,I.useRef)(null),xe=(0,I.useCallback)(()=>(k.current??=(async()=>{await Promise.all([t.invalidateQueries({queryKey:E.spaces()}),i?t.invalidateQueries({queryKey:E.files(i.id)}):null,i?t.invalidateQueries({queryKey:E.knowledge(i.id)}):null]),hb(),k.current=null})(),k.current),[t,i]),Se=(0,I.useRef)([]),Ce=(0,I.useCallback)(e=>{Se.current=e(Se.current),T(Se.current)},[]),we=(0,I.useRef)(!1),Te=(0,I.useRef)(null),Ee=(0,I.useRef)(null),De=(0,I.useRef)(()=>void 0),Oe=(0,I.useRef)(new Set),ke=(0,I.useCallback)(()=>{let e=Te.current?.runId;if(e)for(let t of Se.current)t.way!==`signal`||Oe.current.has(t.id)||(Oe.current.add(t.id),p.post(`/api/studio/assistant/run/${e}/signal`,{ref:t.id,message:t.text}).catch(()=>{}))},[]),je=(0,I.useCallback)(async(e,t)=>{if(!t.length)return e;if(!i||i.readOnly)return h(P(`assistant.filesNeedSpace`)),null;try{for(let e of t)await p.upload(`/api/studio/projects/${i.id}/files?kind=${Qb(e)}`,e)}catch(e){return h(e.message),await xe(),null}await xe();let n=`${P(`editor.attached`)}: ${t.map(e=>e.name).join(`, `)}`;return e.trim()?`${e}\n\n${n}`:n},[i,xe]),Me=(0,I.useCallback)(async(e,n)=>{we.current=!0,h(null),f(`thinking`),y(Date.now()),Ib(null),re({kind:`chat`});let r=ex(`p`),a=ex(`u`);u(t=>[...t,{id:a,role:`user`,content:e,previews:n},{id:r,role:`assistant`,content:``,pending:!0}]),_(null);let o=e=>{let t=r;u(n=>n.map(n=>n.id===t?e(n):n))},s=me.current?{id:ex(`t`),message:e,startedAt:Date.now(),endedAt:null,prompt:null,events:[]}:null;s&&le(e=>[...e,s]);let c=(e,t)=>{s&&(s.events.push({at:Date.now(),event:e,data:t}),e===`prompt`&&(s.prompt=t),le(e=>e.map(e=>e.id===s.id?{...s}:e)))},l=new AbortController,d={runId:null,abort:l,stopped:!1};Te.current=d;let m=!1;try{await ee(`/api/studio/assistant/turn`,{message:e,projectId:i?.id,page:vb(),tools:Yb(),lang:N,...me.current?{debug:!0}:{},...ge.current?{extra:!0}:{},...ye.current?{model:ye.current}:{}},(e,t)=>{let n=JSON.parse(t);switch(c(e,n),e){case`run_started`:{let e=n;d.runId=e.runId,u(t=>t.map(t=>t.id===a?{...t,id:e.messageId}:t)),ke();break}case`text`:o(e=>({...e,content:e.content+n.delta}));break;case`activity`:_(n.label);break;case`tool_call`:{let e=n;o(t=>({...t,toolCalls:[...t.toolCalls??[],e]})),Xb(e.toolCallName,e.args).then(t=>{t&&p.post(`/api/studio/assistant/tool/${e.toolCallId}`,{result:t.result??null}).catch(()=>null)});break}case`tool_result`:{let e=n;o(t=>({...t,toolCalls:t.toolCalls?.map(t=>t.toolCallId===e.toolCallId?{...t,result:e.content}:t)}));break}case`card`:{let e=n;o(t=>({...t,cards:[...t.cards??[],{...e,id:`${t.id}-${t.cards?.length??0}`}]}));break}case`changed`:xe();break;case`step`:o(e=>({...e,steps:[...e.steps??[],n]}));break;case`signal`:{let e=n,t=r;r=ex(`p`),Ce(t=>t.filter(t=>t.id!==e.ref)),u(n=>[...n.flatMap(n=>n.id===t?n.content||n.toolCalls?.length||n.cards?.length||n.steps?.length?[{...n,id:e.answerId??n.id,pending:!1}]:[]:[n]),{id:e.messageId,role:`user`,content:e.content,signal:!0},{id:r,role:`assistant`,content:``,pending:!0}]);break}case`done`:{m=!0;let e=n;o(t=>({...t,id:e.messageId,content:e.reply,changed:e.changed,pending:!1}));break}case`error`:m=!0,h(n.message)}},l.signal),m||h(P(`editor.chatBroken`))}catch(e){d.stopped||h(e.message)}finally{s&&(s.endedAt=Date.now(),le(e=>e.map(e=>e.id===s.id?{...s}:e))),Te.current=null,_(null),y(null),u(e=>e.filter(e=>!(e.pending&&!e.content&&!e.cards?.length&&!e.toolCalls?.length&&!e.steps?.length)).map(e=>({...e,pending:!1}))),f(`idle`),we.current=!1,await k.current,t.invalidateQueries({queryKey:[`me`]})}let g=Ee.current;if(Ee.current=null,!(g||d.stopped)){let e=Se.current.filter(e=>e.way===`signal`),t=e.length?e:Se.current.filter(e=>e.way===`queue`).slice(0,1);t.length&&(Ce(e=>e.filter(e=>!t.includes(e))),g=t.map(e=>e.text).join(`
|
|
40
|
+
|
|
41
|
+
`))}g&&De.current(g)},[i,xe,t,ke,Ce]);De.current=e=>void Me(e);let Ne=(0,I.useCallback)(async(e,t=[],n=`signal`)=>{if(!(e.trim()||t.length))return!1;if(ne(!0),!we.current){we.current=!0,f(`thinking`);let n=await je(e,t);return n===null?(we.current=!1,f(`idle`),!1):(Me(n,Sl(t)),!0)}let r=await je(e,t);return r!==null&&(Ce(e=>[...e,{id:ex(`s`),text:r,way:n}]),ke(),!0)},[je,Me,ke,Ce]),Pe=(0,I.useCallback)(()=>{let e=Te.current;e&&(e.stopped=!0,e.abort.abort())},[]),Fe=(0,I.useCallback)(e=>{let t=Se.current.find(t=>t.id===e);t&&(Ce(e=>e.filter(e=>e!==t)),Te.current?(Ee.current=t.text,Pe()):we.current||Me(t.text))},[Me,Pe,Ce]),Ie=(0,I.useCallback)(e=>{let t=Se.current.find(t=>t.id===e);return Ce(e=>e.filter(e=>e!==t)),t},[Ce]),Le=(0,I.useCallback)(async()=>{Pe(),Ce(()=>[]),u([]),le([]),h(null),re({kind:`chat`}),te(!0);try{let e=await p.post(`/api/studio/assistant/chat/new`);ue.current=e.id,t.setQueryData([`assistant-chat`],e),await t.invalidateQueries({queryKey:[`assistant-chats`]})}catch(e){h(e.message)}finally{te(!1)}},[t,Pe,Ce]),Re=(0,I.useCallback)((e,t)=>Ne(e,t),[Ne]),ze=(0,I.useMemo)(()=>({messages:l,phase:d,activity:g,startedAt:v,error:m,send:Re}),[l,d,g,v,m,Re]),Be=lb(ze),Ve=(0,I.useCallback)(e=>Ly({dev:e}),[]),He=(0,I.useMemo)(()=>({chat:ze,ready:!!s.data,renewing:b,newChat:Le,send:Ne,pending:se,sendNow:Fe,takeBack:Ie,stop:Pe,extra:he,setExtra:D,model:_e,setModel:ve,layout:C??c.data?.layout??`bottom`,setLayout:be,width:ae===void 0?c.data?.width??null:ae,setWidth:O,open:x,setOpen:ne,view:S,setView:re,live:Be,dev:{offered:fe,on:pe,set:Ve,turns:ce}}),[ze,s.data,b,Le,Ne,se,Fe,Ie,Pe,he,_e,C,c.data,be,ae,O,x,S,Be,fe,pe,Ve,ce]);return(0,L.jsx)(tx.Provider,{value:He,children:e})}function ax(e){return Ae({queryKey:[`assistant-chats`],queryFn:()=>p.get(`/api/studio/assistant/chats`),enabled:e,refetchInterval:e=>e.state.data?.chats.some(e=>e.summarising)?2e3:!1})}function ox(e){return Ae({queryKey:[`assistant-chat`,e],queryFn:async()=>{let t=await p.get(`/api/studio/assistant/chats/${e}`);return{...t,messages:t.messages.map(Zb)}},enabled:!!e})}var sx=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e),cx=e=>e<1e3?`${e} ms`:`${(e/1e3).toFixed(1)} s`,lx=e=>e?`$${e<.01?e.toFixed(4):e.toFixed(3)}`:`$0`,ux=e=>Math.round(e/4),dx=(e,t)=>P(`assistant.tokens`,{input:sx(e),output:sx(t),total:sx(e+t)});function fx({steps:e}){return e?.length?(0,L.jsx)(`div`,{className:`mt-1.5 flex flex-col gap-0.5`,children:e.map(e=>(0,L.jsxs)(`details`,{className:`group text-[0.75rem] text-ink-4`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer list-none truncate hover:text-ink-3`,children:[P(`assistant.step`,{n:e.step}),e.model,dx(e.inputTokens,e.outputTokens),cx(e.ms),e.costUsd?lx(e.costUsd):null].filter(Boolean).join(` · `)}),(0,L.jsxs)(`div`,{className:`mt-1 rounded-lg bg-paper-2 px-3 py-2 font-mono text-[0.6875rem] text-ink-3`,children:[P(`assistant.stepTools`),`: `,e.tools.length?e.tools.join(`, `):`–`,e.cachedInputTokens?` · cache ${sx(e.cachedInputTokens)}`:``]})]},e.step))}):null}function px(e){if(typeof e!=`string`)return JSON.stringify(e,null,2)??``;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function mx({calls:e}){return e?.length?(0,L.jsx)(`div`,{className:`mb-1.5 flex flex-col gap-1`,children:e.map(e=>(0,L.jsxs)(`details`,{className:`rounded-lg bg-paper-2 text-[0.75rem]`,children:[(0,L.jsxs)(`summary`,{className:`cursor-pointer px-2.5 py-1 font-mono text-ink-3 hover:text-ink`,children:[e.toolCallName,e.result===void 0?` …`:``]}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-1 px-2.5 pb-2`,children:[(0,L.jsx)(`span`,{className:`text-ink-4`,children:P(`assistant.args`)}),(0,L.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-all font-mono text-[0.6875rem] text-ink-2`,children:px(e.args)}),e.result===void 0?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`text-ink-4`,children:P(`assistant.result`)}),(0,L.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-all font-mono text-[0.6875rem] text-ink-2`,children:px(e.result)})]})]})]},e.toolCallId))}):null}function hx(e){let t=[];for(let n of e)n.role===`user`&&!n.signal?t.push([]):n.steps?.length&&(t.length||t.push([]),t[t.length-1].push(...n.steps));let n=e=>({input:e.reduce((e,t)=>e+t.inputTokens,0),output:e.reduce((e,t)=>e+t.outputTokens,0),ms:e.reduce((e,t)=>e+t.ms,0),cost:e.reduce((e,t)=>e+t.costUsd,0),steps:e.length}),r=t.flat(),i=r.at(-1);return{last:n([...t].reverse().find(e=>e.length)??[]),thread:n(r),lastStep:i,context:i?.inputTokens??0,window:i?.window??null}}function gx({ratio:e}){let t=2*Math.PI*7;return(0,L.jsxs)(`svg`,{viewBox:`0 0 18 18`,className:`size-[18px] -rotate-90`,"aria-hidden":`true`,children:[(0,L.jsx)(`circle`,{cx:`9`,cy:`9`,r:7,fill:`none`,strokeWidth:`2.5`,className:`stroke-paper-3`}),(0,L.jsx)(`circle`,{cx:`9`,cy:`9`,r:7,fill:`none`,strokeWidth:`2.5`,strokeDasharray:`${Math.min(1,e)*t} ${t}`,strokeLinecap:`round`,className:e>.8?`stroke-rose`:`stroke-ember`})]})}function _x({messages:e,narrow:t}){let[n,r]=(0,I.useState)(!1),i=(0,I.useRef)(null);bw(i,n,()=>r(!1));let a=hx(e);if(!a.lastStep)return null;let o=a.window?a.context/a.window:0,s=(e,t)=>(0,L.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,L.jsx)(`span`,{className:`text-ink-3`,children:e}),(0,L.jsx)(`span`,{className:`font-mono tabular-nums`,children:t})]});return(0,L.jsxs)(`div`,{className:`relative`,ref:i,children:[(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":n,title:P(`assistant.usage`),onClick:()=>r(e=>!e),className:`flex h-8 items-center gap-1.5 rounded-lg px-1.5 font-mono text-[0.75rem] text-ink-3 tabular-nums transition hover:bg-accent hover:text-ink`,children:[t?null:(0,L.jsxs)(`span`,{className:`whitespace-nowrap max-sm:hidden`,children:[sx(a.last.input+a.last.output),` / `,sx(a.thread.input+a.thread.output)]}),(0,L.jsx)(gx,{ratio:o})]}),n?(0,L.jsxs)(`div`,{role:`dialog`,"aria-label":P(`assistant.window`),className:`absolute top-9 right-0 z-50 flex w-72 animate-rise flex-col gap-1.5 rounded-xl bg-card p-3 text-[0.8125rem] shadow-overlay ring-1 ring-border-soft`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:P(`assistant.window`)}),(0,L.jsxs)(`span`,{className:`font-mono text-[0.75rem] text-ink-3`,children:[sx(a.context),` /`,` `,a.window?`${sx(a.window)} (${Math.round(o*100)}%)`:`?`]})]}),(0,L.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-paper-2`,children:(0,L.jsx)(`span`,{className:j(`block h-full rounded-full`,o>.8?`bg-rose`:`bg-ember`),style:{width:`${Math.min(100,o*100)}%`}})}),(0,L.jsx)(`span`,{className:`truncate text-[0.75rem] text-ink-4`,children:a.lastStep.model}),(0,L.jsx)(`span`,{className:`mt-1 font-medium text-[0.75rem] text-ink-3`,children:P(`assistant.lastTurn`)}),s(P(`assistant.promptTokens`),sx(a.last.input)),s(P(`assistant.answerTokens`),sx(a.last.output)),s(P(`assistant.duration`),cx(a.last.ms)),s(P(`assistant.cost`),lx(a.last.cost)),(0,L.jsx)(`span`,{className:`mt-1 font-medium text-[0.75rem] text-ink-3`,children:P(`assistant.wholeChat`)}),s(P(`assistant.promptTokens`),sx(a.thread.input)),s(P(`assistant.answerTokens`),sx(a.thread.output)),s(P(`assistant.steps`),String(a.thread.steps)),s(P(`assistant.cost`),lx(a.thread.cost))]}):null]})}function vx(e,t){return JSON.stringify({messages:e.map(({previews:e,...t})=>t),turns:t},null,2)}function yx({messages:e,turns:t}){let[n,r]=(0,I.useState)(!1);return(0,I.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>r(!1),1500);return()=>clearTimeout(e)},[n]),(0,L.jsx)(be,{label:P(n?`assistant.copied`:`assistant.copyThread`),onClick:()=>void navigator.clipboard.writeText(vx(e,t)).then(()=>r(!0)),className:`size-8`,children:n?(0,L.jsx)(he,{className:`size-4`}):(0,L.jsx)(Et,{className:`size-4`})})}function bx({prompt:e}){let t=e.history.reduce((e,t)=>e+t.chars,0),n=e.tools.reduce((e,t)=>e+t.chars,0),r=[{label:P(`assistant.system`),chars:e.system.length},{label:P(`assistant.context`),chars:e.context.length},{label:P(`assistant.history`,{n:e.history.length}),chars:t},{label:P(`assistant.tools`,{n:e.tools.length}),chars:n}],i=r.reduce((e,t)=>e+t.chars,0)||1,a=(e,t)=>(0,L.jsxs)(`details`,{className:`rounded-lg bg-paper-2`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer px-3 py-2 font-medium text-[0.8125rem]`,children:e}),(0,L.jsx)(`div`,{className:`px-3 pb-3`,children:t})]});return(0,L.jsxs)(`div`,{className:`flex flex-col gap-3 text-[0.8125rem]`,children:[(0,L.jsxs)(`div`,{className:`flex justify-between text-ink-3`,children:[(0,L.jsx)(`span`,{className:`font-mono`,children:e.model}),(0,L.jsx)(`span`,{children:P(`assistant.estimate`,{tokens:sx(ux(i))})})]}),(0,L.jsx)(`div`,{className:`flex h-2 overflow-hidden rounded-full bg-paper-2`,children:r.map((e,t)=>(0,L.jsx)(`span`,{title:e.label,className:[`bg-ember`,`bg-ink-3`,`bg-ember-strong`,`bg-ink-4`][t],style:{width:`${e.chars/i*100}%`}},e.label))}),(0,L.jsx)(`ul`,{className:`flex flex-col gap-1`,children:r.map(e=>(0,L.jsxs)(`li`,{className:`flex justify-between gap-4`,children:[(0,L.jsx)(`span`,{children:e.label}),(0,L.jsxs)(`span`,{className:`font-mono text-ink-3 tabular-nums`,children:[sx(ux(e.chars)),` · `,Math.round(e.chars/i*100),`%`]})]},e.label))}),a(P(`assistant.system`),(0,L.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap font-mono text-[0.6875rem] text-ink-2`,children:e.system})),a(P(`assistant.context`),(0,L.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap font-mono text-[0.6875rem] text-ink-2`,children:e.context})),a(P(`assistant.tools`,{n:e.tools.length}),(0,L.jsx)(`ul`,{className:`flex flex-col gap-0.5 font-mono text-[0.6875rem]`,children:e.tools.map(e=>(0,L.jsxs)(`li`,{className:`flex justify-between gap-4`,children:[(0,L.jsx)(`span`,{children:e.name}),(0,L.jsx)(`span`,{className:`text-ink-3`,children:sx(ux(e.chars))})]},e.name))}))]})}function xx({turn:e}){let t=e.endedAt??e.events.at(-1)?.at??e.startedAt,n=Math.max(1,t-e.startedAt),r=[],i=new Map;for(let t of e.events){let e=t.data;if(t.event===`tool_call`)i.set(e.toolCallId,{name:e.toolCallName,at:t.at});else if(t.event===`tool_result`&&i.has(e.toolCallId)){let n=i.get(e.toolCallId);r.push({label:n.name,from:n.at,to:t.at,kind:`tool`})}else t.event===`step`&&r.push({label:`${P(`assistant.step`,{n:e.step})} · ${dx(e.inputTokens,e.outputTokens)}`,from:t.at-e.ms,to:t.at,kind:`step`})}return r.sort((e,t)=>e.from-t.from),(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`div`,{className:`flex justify-between gap-3 text-[0.8125rem]`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.message}),(0,L.jsx)(`span`,{className:`shrink-0 text-ink-3 tabular-nums`,children:cx(n)})]}),r.map((t,r)=>(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-[0.75rem]`,children:[(0,L.jsx)(`span`,{className:`w-40 shrink-0 truncate font-mono text-ink-3`,children:t.label}),(0,L.jsx)(`span`,{className:`relative h-3 flex-1 rounded bg-paper-2`,children:(0,L.jsx)(`span`,{className:j(`absolute inset-y-0 rounded`,t.kind===`step`?`bg-ember`:`bg-ink-4`),style:{left:`${Math.max(0,t.from-e.startedAt)/n*100}%`,width:`${Math.max(1,(t.to-t.from)/n*100)}%`}})}),(0,L.jsx)(`span`,{className:`w-14 shrink-0 text-right text-ink-4 tabular-nums`,children:cx(t.to-t.from)})]},`${t.label}-${r}`))]})}function Sx({open:e,onClose:t,turns:n,messages:r}){let[i,a]=(0,I.useState)(`timeline`),o=n.at(-1);return(0,L.jsx)(nt,{open:e,onClose:t,title:P(`assistant.turns`),wide:!0,height:`tall`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,L.jsx)(He,{value:i,onChange:a,options:[{id:`timeline`,label:P(`assistant.turnsTimeline`)},{id:`prompt`,label:P(`assistant.turnsPrompt`)},{id:`events`,label:P(`assistant.turnsEvents`)}]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(yx,{messages:r,turns:n}),(0,L.jsx)(be,{label:P(`assistant.download`),onClick:()=>{let e=n.flatMap(e=>e.events.map(t=>JSON.stringify({turn:e.id,...t}))),t=new Blob([`${e.join(`
|
|
42
|
+
`)}\n`],{type:`application/x-ndjson`}),r=document.createElement(`a`);r.href=URL.createObjectURL(t),r.download=`goose-${new Date().toISOString().slice(0,19)}.jsonl`,r.click(),setTimeout(()=>URL.revokeObjectURL(r.href),1e3)},disabled:!n.length,className:`size-8`,children:(0,L.jsx)(ne,{className:`size-4`})})]})]}),n.length?i===`timeline`?(0,L.jsx)(`div`,{className:`flex flex-col gap-5`,children:n.map(e=>(0,L.jsx)(xx,{turn:e},e.id))}):i===`prompt`?o?.prompt?(0,L.jsx)(bx,{prompt:o.prompt}):(0,L.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:P(`assistant.noTurns`)}):(0,L.jsx)(`div`,{className:`flex flex-col gap-1 font-mono text-[0.6875rem]`,children:n.flatMap(e=>e.events.map((t,n)=>(0,L.jsxs)(`details`,{className:`rounded bg-paper-2`,children:[(0,L.jsxs)(`summary`,{className:`cursor-pointer px-2 py-1 text-ink-3`,children:[(0,L.jsxs)(`span`,{className:`tabular-nums`,children:[`+`,cx(t.at-e.startedAt)]}),` `,(0,L.jsx)(`span`,{className:`text-ink`,children:t.event})]}),(0,L.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-all px-2 pb-2 text-ink-2`,children:JSON.stringify(t.data,null,2)})]},`${e.id}-${n}`)))}):(0,L.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:P(`assistant.noTurns`)})]})})}var Cx=(0,I.lazy)(()=>Vt(()=>import(`./Marketplace-DoH4YO3D.js`).then(e=>e.a).then(e=>({default:e.MarketplaceCards})),__vite__mapDeps([9,1,2,3,4,5,10,11,12,13,7,6]))),wx=1520,Tx=768,Ex={min:120,max:900};function Dx(){return(0,I.useSyncExternalStore)(e=>(window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)),()=>window.innerWidth)}function Ox(e){let t=Dx(),n=mb(),r=t>=wx,i=t<Tx,a=e.layout;a===`sidebar`&&(!r||i)&&(a=`bottom`);let o=a===`bottom`&&!!n.compact;return o&&(a=`avatar`),{where:a,wide:r&&!i,phone:i,compact:o}}var kx=new Set([`scroll_to`]);function Ax(e){let t=e.args??{},n={};try{n=e.result?JSON.parse(e.result):{}}catch{}let r=/^e\d+$/.test(String(t.target??``))?``:String(t.target??``),i=String(n.shown||n.filled||n.area||r);switch(e.toolCallName){case`navigate`:return P(`assistant.tool.navigate`,{where:String(t.to??``)});case`highlight`:return P(`assistant.tool.highlight`,{what:i});case`look_at_page`:return P(`assistant.tool.look`);case`read_section`:return P(`assistant.tool.read`,{what:i});case`fill_field`:return P(`assistant.tool.fill`,{what:i});case`docs_search`:case`docs_read`:case`authoring_guide`:return P(`assistant.tool.docs`);case`gallery_search`:case`gallery_detail`:case`show_templates`:return P(`assistant.tool.gallery`);case`plans`:case`account`:case`usage`:return P(`assistant.tool.account`);case`chats_search`:case`chat_read`:return P(`assistant.tool.chats`);case`wizards`:case`runs`:return P(`assistant.tool.space`);case`models`:return P(`assistant.tool.models`);default:return null}}function jx({calls:e}){let t=[...new Set((e??[]).filter(e=>!kx.has(e.toolCallName)).map(Ax).filter(e=>!!e))];return t.length?(0,L.jsx)(`div`,{className:`mb-1.5 flex flex-wrap gap-1.5`,children:t.map(e=>(0,L.jsx)(`span`,{className:`inline-flex max-w-full items-center rounded-full bg-paper-2 px-2.5 py-0.5 text-[0.75rem] text-ink-3`,children:(0,L.jsx)(`span`,{className:`truncate`,children:e})},e))}):null}function Mx({card:e,send:t}){if(!e.plugin&&e.tool===`extraEffort`)return(0,L.jsx)(Nx,{reason:String(e.data.reason??``)});if(!e.plugin&&e.tool===`templates`){let{entries:t}=e.data;return(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(dt,{className:`m-2 size-4`}),children:(0,L.jsx)(Cx,{entries:t})})}return(0,L.jsx)(Px,{card:e,send:t})}function Nx({reason:e}){let t=nx(),[n,r]=(0,I.useState)(!1);return!t||n?null:(0,L.jsxs)(`div`,{className:`my-2 flex flex-col gap-2 rounded-xl bg-amber/10 p-3 text-[0.8125rem] ring-1 ring-amber/30`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`b`,{className:`font-medium`,children:P(`assistant.extraTitle`)}),` `,(0,L.jsx)(`span`,{className:`text-ink-2`,children:e})]}),t.extra?(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-ink-2`,children:[(0,L.jsx)(he,{className:`size-3.5 text-moss`,strokeWidth:3}),` `,P(`assistant.extraOn`)]}):(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>t.setExtra(!0),className:`inline-flex h-8 items-center rounded-full bg-primary px-3 font-medium text-primary-foreground text-[0.8125rem]`,children:P(`assistant.extraOnButton`)}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>r(!0),className:`inline-flex h-8 items-center rounded-full px-3 text-ink-2 ring-1 ring-border hover:bg-paper-2`,children:P(`assistant.extraNo`)})]})]})}function Px({card:e,send:t}){let n=Kw().cards.find(t=>t.plugin===e.plugin&&t.tool===e.tool);return n?(0,L.jsx)(gT,{of:n,children:(0,L.jsx)(n.component,{data:e.data,send:t})}):null}function Fx(){return[{label:P(`assistant.suggest.what`)},{label:P(`assistant.suggest.models`)},{label:P(`assistant.suggest.credits`)}]}function Ix({state:e,composer:t,top:n}){let r=mb(),i=(r.suggestions?.length?r.suggestions:Fx()).slice(0,3);return(0,L.jsxs)(`div`,{className:j(`flex flex-col`,n?`gap-5`:`gap-4`),children:[(0,L.jsxs)(`div`,{className:j(`flex items-start`,n?`gap-4`:`gap-3`),children:[(0,L.jsx)(`div`,{className:`shrink-0`,children:(0,L.jsx)(Xt,{kind:`round`,size:n?64:44,helmet:!0,interactive:!1})}),(0,L.jsxs)(`div`,{className:`min-w-0 pt-0.5`,children:[(0,L.jsx)(`h2`,{className:j(`font-display font-semibold leading-tight tracking-tight`,n?`text-[1.25rem]`:`text-[1.0625rem]`),children:r.title??P(`assistant.helloTitle`)}),(0,L.jsx)(`p`,{className:j(`mt-1 text-ink-2 leading-relaxed`,n?`max-w-2xl text-[0.9375rem]`:`text-[0.875rem]`),children:r.hello??P(`assistant.hello`)}),n&&r.about?(0,L.jsx)(`p`,{className:`mt-2 max-w-2xl text-[0.875rem] text-ink-3 leading-relaxed`,children:r.about}):null]})]}),(0,L.jsx)(`div`,{className:j(`flex gap-1.5`,n?`flex-wrap sm:pl-20`:`flex-col`),children:i.map(r=>(0,L.jsxs)(`button`,{type:`button`,disabled:e.chat.phase!==`idle`,onClick:()=>{let n=r.message??r.label;r.fill?t.current?.fill(n):e.chat.send(n)},className:j(`flex items-center gap-2 bg-paper-2 text-left text-[0.875rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink disabled:opacity-60`,n?`rounded-full px-3.5 py-2`:`rounded-xl px-3.5 py-2.5`),children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1`,children:r.label}),r.fill?(0,L.jsx)(Xi,{className:`size-3.5 shrink-0 text-ink-4`}):null]},r.label))})]})}function Lx({state:e}){let t=ax(!0);if(t.isLoading)return(0,L.jsx)(dt,{className:`m-4 size-4`});let n=t.data?.chats??[];return n.length?(0,L.jsx)(`ul`,{className:`flex flex-col gap-1`,children:n.map(t=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,onClick:()=>e.setView({kind:`read`,id:t.id}),className:`flex w-full flex-col gap-0.5 rounded-lg px-3 py-2.5 text-left transition hover:bg-accent`,children:[(0,L.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-[0.875rem]`,children:t.title||P(`assistant.untitled`)}),(0,L.jsx)(`span`,{className:`shrink-0 text-[0.75rem] text-ink-4 tabular-nums`,children:new Date(t.closedAt).toLocaleDateString(N)})]}),(0,L.jsx)(`span`,{className:`line-clamp-1 text-[0.8125rem] text-ink-3`,children:t.summarising?P(`assistant.summarising`):t.summary.split(`
|
|
43
|
+
`)[0]})]})},t.id))}):(0,L.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:P(`assistant.noEarlier`)})}function Rx({id:e}){let t=ox(e);return t.data?(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,L.jsxs)(`div`,{className:`rounded-xl bg-paper-2 px-4 py-3 text-[0.8125rem] text-ink-2 leading-relaxed`,children:[(0,L.jsx)(`div`,{className:`font-medium text-ink`,children:t.data.title||P(`assistant.untitled`)}),(0,L.jsx)(`p`,{className:`mt-1 whitespace-pre-line`,children:t.data.summary})]}),(0,L.jsx)(Al,{chat:{messages:t.data.messages,phase:`idle`,activity:null,startedAt:null,error:null,send:async()=>!1},avatar:`round`,changedLabel:P(`project.assistantChanged`),card:e=>(0,L.jsx)(Mx,{card:e,send:()=>void 0}),calls:e=>(0,L.jsx)(jx,{calls:e.toolCalls})})]}):(0,L.jsx)(dt,{className:`m-4 size-4`})}function zx({state:e,composer:t,top:n}){let r=(0,I.useRef)(null),{chat:i,view:a}=e;return(0,I.useEffect)(()=>{let e=r.current,t=e=>{let t=e.target.closest(`a`)?.getAttribute(`href`);!t||e.metaKey||e.ctrlKey||e.shiftKey||(Ub(t)?e.preventDefault():/^https?:\/\//.test(t)&&(e.preventDefault(),window.open(t,`_blank`,`noopener,noreferrer`)))};return e?.addEventListener(`click`,t),()=>e?.removeEventListener(`click`,t)},[]),(0,I.useEffect)(()=>{r.current?.scrollTo({top:r.current.scrollHeight,behavior:`smooth`})},[i.messages,i.phase,a]),(0,L.jsxs)(`div`,{ref:r,"data-assistant-thread":!0,className:j(`min-h-0 flex-1 overflow-y-auto px-4 py-4`,n?`sm:px-6 sm:py-5`:`sm:px-5`),children:[a.kind===`earlier`?(0,L.jsx)(Lx,{state:e}):a.kind===`read`?(0,L.jsx)(Rx,{id:a.id}):i.messages.length?(0,L.jsx)(Al,{chat:i,avatar:`round`,changedLabel:P(`project.assistantChanged`),card:e=>(0,L.jsx)(Mx,{card:e,send:e=>void i.send(e)}),calls:t=>e.dev.on?(0,L.jsx)(mx,{calls:t.toolCalls}):(0,L.jsx)(jx,{calls:t.toolCalls}),foot:t=>e.dev.on?(0,L.jsx)(fx,{steps:t.steps}):null}):(0,L.jsx)(Ix,{state:e,composer:t,top:n}),i.error&&a.kind===`chat`?(0,L.jsx)(`div`,{className:`mt-4 rounded-lg bg-rose-tint px-3 py-2 text-[0.8125rem] text-rose`,children:i.error}):null]})}function Bx({state:e}){let[t,n]=(0,I.useState)(!1),r=!!ax(!0).data?.chats.length,i=(0,I.useRef)(null);bw(i,t,()=>n(!1));let a=`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-[0.875rem] text-ink-2 hover:bg-accent hover:text-ink disabled:opacity-50`;return(0,L.jsxs)(`div`,{className:`relative shrink-0`,ref:i,children:[(0,L.jsxs)(`button`,{type:`button`,"aria-haspopup":`menu`,"aria-expanded":t,"aria-label":P(`assistant.menu`),onClick:()=>n(e=>!e),className:`-ml-1 flex items-center gap-1 rounded-lg px-1.5 py-0.5 font-display font-semibold text-[0.9375rem] transition hover:bg-accent`,children:[P(`assistant.name`),(0,L.jsx)(pe,{className:`size-3.5 text-ink-4`})]}),t?(0,L.jsxs)(`div`,{role:`menu`,className:`absolute top-8 left-0 z-50 w-56 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:[(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:a,disabled:e.renewing,onClick:()=>{n(!1),e.newChat()},children:[(0,L.jsx)(Xi,{className:`size-4`}),` `,P(`assistant.newChat`)]}),r?(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:a,onClick:()=>{n(!1),e.setView({kind:`earlier`})},children:[(0,L.jsx)(Pi,{className:`size-4`}),` `,P(`assistant.earlier`)]}):null]}):null]})}function Vx({state:e}){let t=e.dev.on;return(0,L.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"aria-label":P(`assistant.dev`),title:P(t?`assistant.devOn`:`assistant.devOff`),onClick:()=>e.dev.set(!t),className:j(`inline-flex h-5 shrink-0 items-center gap-1 rounded-full font-mono font-semibold text-[0.625rem] uppercase tracking-wide transition`,t?`bg-ember pr-0.5 pl-2 text-white`:`flex-row-reverse bg-paper-3 pr-2 pl-0.5 text-ink-3`),children:[`dev`,(0,L.jsx)(`span`,{className:`size-4 rounded-full bg-white shadow-sm`})]})}function Hx({state:e,where:t,wide:n,phone:r,compact:i,grip:a}){let o=e.live,[s,c]=(0,I.useState)(!1),l=hw().map(e=>e.label).join(` · `),u=e.dev.on&&e.view.kind===`chat`,d=t===`sidebar`,f=e.chat.messages;return(0,L.jsxs)(`div`,{className:j(`flex items-center border-border-soft border-b py-1`,d?`px-3`:`px-3 sm:px-4`),children:[a,e.view.kind===`chat`?t===`sidebar`?(0,L.jsx)(Xt,{kind:`round`,size:26,helmet:!0,interactive:!1}):null:(0,L.jsx)(be,{label:P(`assistant.back`),onClick:()=>e.setView({kind:e.view.kind===`read`?`earlier`:`chat`}),className:`size-8`,children:(0,L.jsx)(ye,{className:`size-4`})}),(0,L.jsx)(`div`,{className:`mr-1 ml-1.5 min-w-[8.5rem] flex-1`,children:(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.view.kind===`chat`?(0,L.jsx)(Bx,{state:e}):(0,L.jsx)(`span`,{className:`font-display font-semibold text-[0.9375rem]`,children:P(`assistant.earlier`)}),e.dev.offered&&e.view.kind===`chat`?(0,L.jsx)(Vx,{state:e}):null,o.state===`off`?l?(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[0.75rem] text-ink-4`,children:P(`assistant.sees`,{page:l})}):null:(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-[0.75rem] text-ember-strong`,children:[(0,L.jsx)(`span`,{className:`size-1.5 animate-pulse-dot rounded-full bg-ember`}),P(`assistant.live`),` · `,(0,L.jsx)(Ux,{since:o.since})]})]})}),u?(0,L.jsx)(_x,{messages:f,narrow:d}):null,u?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(be,{label:P(`assistant.inspect`),onClick:()=>c(!0),className:`size-8 max-sm:hidden`,children:(0,L.jsx)(Kn,{className:`size-4`})}),f.length&&!d?(0,L.jsx)(`span`,{className:`max-sm:hidden`,children:(0,L.jsx)(yx,{messages:f,turns:e.dev.turns})}):null,(0,L.jsx)(Sx,{open:s,onClose:()=>c(!1),turns:e.dev.turns,messages:f})]}):null,e.view.kind===`chat`&&f.length?(0,L.jsx)(be,{label:P(`assistant.newChat`),disabled:e.renewing,onClick:()=>void e.newChat(),className:`size-8`,children:(0,L.jsx)(Xi,{className:`size-4`})}):null,t!==`sidebar`&&n?(0,L.jsx)(be,{label:P(`assistant.layoutSidebar`),onClick:()=>e.setLayout(`sidebar`),className:`size-8`,children:(0,L.jsx)(Si,{className:`size-4`})}):null,t===`sidebar`||t===`avatar`&&!r&&!i?(0,L.jsx)(be,{label:P(`assistant.layoutBottom`),onClick:()=>{e.setLayout(`bottom`),e.setOpen(!0)},className:`size-8`,children:(0,L.jsx)(gi,{className:`size-4`})}):null,(0,L.jsx)(be,{label:P(`assistant.close`),onClick:()=>{t!==`avatar`&&e.setLayout(`avatar`),e.setOpen(!1)},className:`size-8`,children:(0,L.jsx)(ct,{className:`size-4`})})]})}function Ux({since:e}){let[t,n]=(0,I.useState)(()=>Date.now());(0,I.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let r=e?Math.max(0,Math.floor((t-e)/1e3)):0;return(0,L.jsxs)(`span`,{className:`tabular-nums`,children:[String(Math.floor(r/60)).padStart(2,`0`),`:`,String(r%60).padStart(2,`0`)]})}function Wx({state:e}){let t=e.live,n=t.state===`thinking`?P(`assistant.liveThinking`):t.state===`speaking`?P(`assistant.liveSpeaking`):t.muted?P(`assistant.liveMuted`):P(`assistant.liveListening`);return(0,L.jsxs)(`div`,{className:`flex items-center gap-2 rounded-full bg-card p-1 pl-4 shadow-overlay ring-1 ring-ember-veil`,children:[(0,L.jsx)(`span`,{className:`size-2 shrink-0 animate-pulse-dot rounded-full bg-ember`}),(0,L.jsx)(`span`,{"aria-hidden":!0,className:`flex h-5 shrink-0 items-center gap-0.5`,children:[.5,.8,1,.75,.45].map((e,n)=>(0,L.jsx)(`span`,{className:`w-1 rounded-full bg-ember transition-[height] duration-100`,style:{height:`${Math.max(3,Math.round(t.level*e*20))}px`}},n))}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[0.8125rem] text-ink-2`,children:t.heard?(0,L.jsx)(`span`,{className:`text-ink`,children:t.heard}):t.state===`thinking`?(0,L.jsx)(Ol,{chat:e.chat,className:`text-ink-3`}):(0,L.jsxs)(L.Fragment,{children:[n,` · `,(0,L.jsx)(Ux,{since:t.since})]})}),t.voice&&t.voice.way!==`none`?(0,L.jsx)(be,{label:P(`assistant.naturalVoice`),"aria-pressed":t.voice.natural,onClick:()=>t.setNatural(!t.voice?.natural),className:j(t.voice.natural&&`bg-ember-tint text-ember-strong`),children:(0,L.jsx)(Gt,{className:`size-4`})}):null,(0,L.jsx)(be,{label:t.muted?P(`assistant.unmute`):P(`assistant.mute`),"aria-pressed":t.muted,onClick:t.toggleMute,children:t.muted?(0,L.jsx)(ui,{className:`size-4`}):(0,L.jsx)(u,{className:`size-4`})}),(0,L.jsxs)(`button`,{type:`button`,onClick:t.end,className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-full bg-rose px-3.5 font-medium text-[0.8125rem] text-white coarse:h-11`,children:[(0,L.jsx)(Oi,{className:`size-4`}),` `,P(`assistant.end`)]})]})}function Gx({state:e,composer:t}){return e.pending.length?(0,L.jsx)(`ul`,{"aria-label":P(`assistant.pending`),className:`mb-2 flex flex-col gap-1`,children:e.pending.map(n=>(0,L.jsxs)(`li`,{className:`flex items-center gap-2 rounded-xl bg-card py-1 pr-1 pl-3 text-[0.8125rem] shadow-soft ring-1 ring-border`,children:[(0,L.jsx)(`span`,{title:n.way===`queue`?P(`assistant.pendingQueueHint`):P(`assistant.pendingSignalHint`),className:j(`shrink-0 rounded-full px-2 py-0.5 text-[0.6875rem]`,n.way===`queue`?`bg-paper-2 text-ink-3`:`bg-ember-tint text-ember-strong`),children:n.way===`queue`?P(`assistant.pendingQueue`):P(`assistant.pendingSignal`)}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.text}),(0,L.jsx)(`button`,{type:`button`,title:P(`assistant.sendNowHint`),onClick:()=>e.sendNow(n.id),className:`shrink-0 rounded-full px-2 py-1 font-medium text-[0.75rem] text-ember-strong transition hover:bg-ember-tint`,children:P(`assistant.sendNow`)}),(0,L.jsx)(be,{label:P(`assistant.edit`),onClick:()=>{let r=e.takeBack(n.id);r&&t.current?.fill(r.text)},className:`size-7`,children:(0,L.jsx)(xt,{className:`size-3.5`})}),(0,L.jsx)(be,{label:P(`assistant.remove`),onClick:()=>e.takeBack(n.id),className:`size-7`,children:(0,L.jsx)(ct,{className:`size-3.5`})})]},n.id))}):null}var Kx=`auto`;function qx(e,t){let{tier:n,modelPolicy:r}=Jl(),i=n?B(n,r,`assistant`):null,a=i?e&&i.allowed(e)?e:i.way===`A`?null:i.default??(i.auto?null:i.items[0]?.id??null):null,o=i!==null;if((0,I.useEffect)(()=>{o&&a!==e&&t(a)},[o,a,e,t]),!n||!i)return{model:void 0,effort:{}};let s=a?i.itemFor(a,i.items):null,c={items:[...i.auto?[{id:Kx,label:P(`chooser.auto`),note:P(`chooser.auto.hint`)}]:[],...i.items.map(e=>({id:e.id,label:e.name,note:e.hint}))],value:s?.id??a??Kx,onChange:e=>t(e===Kx?null:e)},l=i.efforts(a??`standard`).filter(e=>!s||s.efforts.includes(e));return{model:c,effort:l.includes(`high`)?{}:{disabled:!0,hint:s&&!s.efforts.length?P(`chooser.noEffort`,{model:s.name}):P(`composer.extraCap`,{effort:P(`class.effort.${l.at(-1)??`low`}`)})}}}function Jx({state:e,composer:t,floating:n,bare:r}){let i=mb(),a=e.live,o=qx(e.model,e.setModel);if(e.view.kind===`earlier`)return null;if(e.view.kind===`read`)return(0,L.jsx)(`p`,{className:`m-3 rounded-xl bg-paper-2 px-4 py-3 text-[0.8125rem] text-ink-2 leading-relaxed`,children:P(`assistant.readOnly`)});let s=e.chat.phase!==`idle`;return(0,L.jsxs)(`div`,{className:n?void 0:`p-3`,children:[a.state===`off`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Gx,{state:e,composer:t}),(0,L.jsx)(rt,{ref:t,floating:n,bare:r,placeholder:s?P(`assistant.busyComposer`,{keys:we}):i.placeholder??P(`assistant.composer`),busy:s,onStop:e.stop,effort:{on:e.extra,onChange:e.setExtra,...o.effort},model:o.model,onSend:(t,n,r)=>e.send(t,n,r?`queue`:`signal`),onTalk:ob?()=>{e.setOpen(!0),a.start()}:void 0})]}):(0,L.jsx)(Wx,{state:e}),a.error?(0,L.jsx)(`p`,{className:`mt-2 px-3 text-[0.75rem] text-rose`,children:a.error===`denied`?P(`editor.micDenied`):a.error}):null]})}function Yx({composer:e,children:t,className:n,style:r}){return(0,L.jsx)(`div`,{"data-assistant-ui":!0,className:n,style:r,onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&e.preventDefault()},onDrop:t=>{t.dataTransfer.files.length&&(t.preventDefault(),e.current?.add(Array.from(t.dataTransfer.files)),e.current?.focus())},children:t})}function Xx(e){let[t,n]=(0,I.useState)({width:0,height:0});return(0,I.useLayoutEffect)(()=>{let t=null,r=0,i=()=>{let a=e.current;if(!a){r=requestAnimationFrame(i);return}let o=()=>n({width:a.clientWidth,height:a.clientHeight});o(),t=new ResizeObserver(o),t.observe(a)};return i(),()=>{cancelAnimationFrame(r),t?.disconnect()}},[e]),t}function Zx(e){return t=>{if(t===`sidebar`){e.setLayout(`sidebar`);return}Ly({place:t})}}function Qx({state:e,column:t,frame:n,wide:r,from:i}){let a=Ry(),o=Zx(e);return(0,L.jsx)(`button`,{type:`button`,title:P(`assistant.move`),"aria-label":P(`assistant.move`),onPointerDown:a=>Jy(a,{column:()=>t.current,frame:n,sidebar:r,onLeave:i===`sidebar`?()=>{e.setLayout(`bottom`),e.setOpen(!0)}:void 0,onDrop:o}),onKeyDown:e=>{let n=null;i===`sidebar`?n=e.key===`ArrowLeft`||e.key===`ArrowDown`?`right`:null:e.key===`ArrowLeft`?n=`center`:e.key===`ArrowRight`&&(n=qy(t.current?.clientWidth??0)&&a.place!==`right`?`right`:r?`sidebar`:null),n&&(e.preventDefault(),o(n))},className:`-ml-1.5 inline-flex h-8 w-5 shrink-0 cursor-grab touch-none items-center justify-center rounded-md text-ink-4 transition hover:bg-accent hover:text-ink active:cursor-grabbing`,children:(0,L.jsx)(Ge,{className:`size-4`})})}function $x(){let e=Wy();return e?.spot?(0,L.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute rounded-2xl border-2 border-ember border-dashed bg-ember-veil transition-all duration-200`,style:e.spot}):null}function eS({place:e,width:t,column:n,frame:r,children:i}){let a=Wy(),o;return o=a?{left:a.left,top:a.top,width:t}:{left:e===`right`?n.width-t-12:(n.width-t)/2,bottom:0,width:t},(0,L.jsx)(`div`,{ref:r,className:j(`pointer-events-none absolute flex flex-col`,a?`opacity-90`:`transition-[left,bottom] duration-300 ease-out`),style:o,children:i})}function tS({thread:e,max:t,folded:n,onFold:r,onOpen:i}){let a=Ry(),o=(0,I.useRef)(null),s=e=>Math.round(Math.min(Math.max(e,Ex.min),t)),c=a.height??e.current?.offsetHeight??Ex.min;return(0,L.jsx)(`div`,{role:`separator`,tabIndex:0,"aria-orientation":`horizontal`,"aria-valuenow":c,"aria-valuemin":Ex.min,"aria-valuemax":t,"aria-label":P(n?`assistant.open`:`assistant.flap`),title:P(n?`assistant.open`:`assistant.flap`),onPointerDown:t=>{t.button===0&&(t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),o.current={y:t.clientY,height:e.current?.offsetHeight??0,moved:!1})},onPointerMove:e=>{let t=o.current;!t||!t.moved&&Math.abs(e.clientY-t.y)<4||n&&e.clientY>t.y||(n&&!t.moved&&i(),t.moved=!0,Ly({height:s(t.height+(t.y-e.clientY))}))},onPointerUp:()=>{let e=o.current&&!o.current.moved;o.current=null,e&&(n?i:r)()},onPointerCancel:()=>{o.current=null},onKeyDown:e=>{if(e.key===`ArrowUp`||e.key===`ArrowDown`){if(e.preventDefault(),n){e.key===`ArrowUp`&&i();return}Ly({height:s(c+(e.key===`ArrowUp`?32:-32))})}else(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),(n?i:r)())},className:`group absolute top-0 left-1/2 z-10 flex h-3 w-16 -translate-x-1/2 cursor-row-resize touch-none items-center justify-center outline-none`,children:(0,L.jsx)(`span`,{className:`h-1 w-10 rounded-full bg-ink-4/40 transition group-hover:bg-ink-4 group-focus-visible:bg-ember`})})}var nS=48,rS=32,iS=240;function aS(){return(0,L.jsx)(`div`,{ref:Zy,className:`hidden`})}function oS(e,t){let[n,r]=(0,I.useState)(!1);return(0,I.useLayoutEffect)(()=>{if(!e){r(!1);return}let n=0,i=()=>{n=0;let i=Mw().getBoundingClientRect(),a=e.getBoundingClientRect();if(!e.offsetParent){r(!0);return}let o=a.top+Math.max(a.height,t.current||iS);r(o<i.top+nS||a.top>i.bottom)},a=()=>{n||=requestAnimationFrame(i)};i();let o=new ResizeObserver(a);return o.observe(e),window.addEventListener(`scroll`,a,{passive:!0,capture:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(n),o.disconnect(),window.removeEventListener(`scroll`,a,{capture:!0}),window.removeEventListener(`resize`,a)}},[e,t]),n}function sS({column:e}){let t=nx(),n=!!Lb(),r=(0,I.useRef)(null),i=(0,I.useRef)(null),a=(0,I.useRef)(null),o=(0,I.useRef)(null),s=(0,I.useRef)(null),c=lS(t),l=Ry(),u=Xx(e),d=t&&c,f=c?.where===`sidebar`,p=nb(),m=Gy(u.width),h=c?.phone||!qy(u.width)?`center`:l.place,g=Qy(),_=g&&d&&c.where===`bottom`?g:null,v=(0,I.useRef)(0);(0,I.useLayoutEffect)(()=>{g&&(g.style.display=_?`block`:``)},[g,_]);let y=oS(_,v),b=!!_&&!y,ee=c?.where===`avatar`,x=!!t?.open,[ne,S]=(0,I.useState)(!1),re=ne||x||t?.chat.phase!==`idle`||(t?.live.state??`off`)!==`off`,C=!(b||f),w=!!c?.phone,ie=!!d&&!(ee&&!x),[ae]=(0,I.useState)(()=>{let e=document.createElement(`div`);return e.className=`flex min-h-0 flex-col`,e}),[oe,se]=(0,I.useState)(null),[T,ce]=(0,I.useState)(!1);(0,I.useLayoutEffect)(()=>{let e=f?p:b?_:oe;if(ae.className=j(`flex min-h-0 flex-col`,f&&`flex-1`),!e||ae.parentElement===e)return;let t=ae.contains(document.activeElement)?document.activeElement:null;e.appendChild(ae),t instanceof HTMLElement&&t.focus({preventScroll:!0});for(let e of ae.querySelectorAll(`[data-assistant-thread]`))e.scrollTop=e.scrollHeight;ce(!0)},[f,p,b,_,oe,ae]),(0,I.useLayoutEffect)(()=>{if(!g||(g.style.minHeight=_&&y?`${v.current}px`:``,!(_&&b)))return;let e=new ResizeObserver(()=>{v.current=ae.offsetHeight});return e.observe(ae),()=>e.disconnect()},[g,_,y,b,ae]),(0,I.useEffect)(()=>()=>{ae.remove()},[ae]),(0,I.useLayoutEffect)(()=>{let t=ee&&!x?i.current:o.current,n=e.current;if(!(t&&n&&d&&C)){n?.style.setProperty(`--assistant-dock`,`0px`);return}let r=new ResizeObserver(()=>{let e=t===o.current&&!w?rS:0,r=n.getBoundingClientRect().bottom-t.getBoundingClientRect().top;n.style.setProperty(`--assistant-dock`,`${Math.max(0,Math.ceil(r))+e+8}px`)});return r.observe(t),r.observe(n),()=>{r.disconnect(),n.style.setProperty(`--assistant-dock`,`0px`)}},[e,d,C,ee,x,T,w]);let le=(0,I.useRef)(b);if((0,I.useEffect)(()=>{le.current&&!b&&_&&t?.open&&t.setOpen(!1),le.current=b},[b,_,t]),(0,I.useEffect)(()=>{if(!t?.open)return;let e=e=>{e.key===`Escape`&&!document.querySelector(`[role=dialog], dialog[open]`)&&t.setOpen(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t]),!(t&&c&&d))return null;let ue=Math.max(Ex.min,Math.min(Ex.max,u.height-220)),de=l.height===null?null:Math.min(l.height,ue),fe=c.phone||b?void 0:(0,L.jsx)(Qx,{state:t,column:e,frame:()=>f?null:o.current,wide:c.wide,from:f?`sidebar`:`bottom`}),pe=x||b||f,me=ie&&T?(0,va.createPortal)((0,L.jsx)(Yx,{composer:r,className:j(`flex min-h-0 flex-col`,f&&`flex-1`),children:(0,L.jsxs)(`div`,{className:j(`pointer-events-auto relative flex min-h-0 flex-col overflow-hidden`,f?`flex-1`:b?`rounded-xl bg-card bg-linear-to-br from-ember-tint via-card to-card shadow-soft ring-1 ring-ember-veil focus-within:ring-ember`:`rounded-[1.375rem] bg-card shadow-overlay ring-1 ring-border focus-within:ring-focus`),children:[b||f?null:(0,L.jsx)(tS,{thread:s,max:ue,folded:!x,onFold:()=>t.setOpen(!1),onOpen:()=>t.setOpen(!0)}),(0,L.jsx)(`div`,{className:j(`relative flex min-h-0 flex-col`,f&&`flex-1`),children:(0,L.jsxs)(`div`,{className:j(`flex min-h-0 flex-col`,f&&`flex-1`),style:pe&&!(b||f)?{maxHeight:ue+60}:void 0,children:[(0,L.jsx)(Hx,{state:t,where:f?`sidebar`:ee?`avatar`:`bottom`,wide:c.wide,phone:c.phone,compact:c.compact,grip:fe}),pe?(0,L.jsx)(`div`,{ref:s,className:j(`flex min-h-0 flex-col border-border-soft border-b`,f?`flex-1`:!b&&`animate-rise`),style:f?void 0:b?{maxHeight:Math.min(480,ue)}:de===null?{maxHeight:Math.min(ue,Math.round(u.height*.45))}:{height:de},children:(0,L.jsx)(zx,{state:t,composer:r,top:b})}):t.chat.messages.length||t.chat.error?(0,L.jsx)(cS,{state:t}):null]})}),(0,L.jsx)(`div`,{ref:i,onFocusCapture:()=>S(!0),onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||S(!1)},className:`relative w-full`,children:(0,L.jsx)(Jx,{state:t,composer:r,floating:!0,bare:!0})})]})}),ae):null,E=(0,L.jsx)(`button`,{type:`button`,"aria-label":P(`assistant.open`),title:`${P(`assistant.open`)} · ${P(`assistant.move`)}`,tabIndex:-1,onPointerDown:n=>Jy(n,{column:()=>e.current,frame:()=>o.current,sidebar:c.wide,onClick:()=>t.setOpen(!0),onDrop:Zx(t)}),onClick:e=>{e.detail===0&&t.setOpen(!0)},className:j(`pointer-events-auto absolute bottom-full left-6 -mb-3 origin-bottom cursor-grab touch-none transition duration-300 ease-out active:cursor-grabbing max-sm:hidden`,re?`translate-y-0 scale-100 opacity-100`:`pointer-events-none translate-y-3 scale-75 opacity-0`),children:(0,L.jsx)(Xt,{kind:`round`,size:44,helmet:!0,interactive:re})}),he=(0,L.jsx)(Yx,{composer:r,className:j(`pointer-events-none absolute inset-0`,n?`z-[61]`:`z-30`),children:(0,L.jsx)(`div`,{ref:i,className:j(`pointer-events-auto absolute right-3 sm:right-4`,w?`bottom-[calc(4.75rem+env(safe-area-inset-bottom))]`:`bottom-3 sm:bottom-4`),children:(0,L.jsxs)(`div`,{className:`flex items-center gap-1 rounded-full bg-card p-1 pr-1.5 shadow-overlay ring-1 ring-border`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>t.setOpen(!0),className:`flex items-center gap-2 rounded-full py-0.5 pr-2 pl-0.5 text-[0.875rem] text-ink-2 transition hover:text-ink`,children:[(0,L.jsxs)(`span`,{className:`relative`,children:[(0,L.jsx)(Xt,{kind:`round`,size:36,helmet:!0,interactive:!1}),t.chat.phase!==`idle`||t.live.state!==`off`?(0,L.jsx)(`span`,{className:`absolute top-0 right-0 size-2.5 animate-pulse-dot rounded-full bg-ember ring-2 ring-card`}):null]}),(0,L.jsx)(`span`,{className:`max-sm:hidden`,children:P(`assistant.ask`)})]}),ob?(0,L.jsx)(be,{label:P(`assistant.talk`),onClick:()=>{t.setOpen(!0),t.live.start()},className:`size-8 bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground`,children:(0,L.jsx)(te,{className:`size-4`})}):null]})})});return(0,L.jsxs)(L.Fragment,{children:[me,b||f?null:ee&&!x?he:(0,L.jsxs)(Yx,{composer:r,className:j(`pointer-events-none absolute inset-0`,n?`z-[61]`:`z-30`),children:[(0,L.jsx)($x,{}),(0,L.jsxs)(eS,{place:h,width:m,column:u,frame:o,children:[E,(0,L.jsx)(`div`,{ref:se,className:`flex min-h-0 flex-col`}),(0,L.jsx)(`div`,{ref:a,className:j(`shrink-0`,w?`h-[calc(4.75rem+env(safe-area-inset-bottom))]`:`h-[max(0.75rem,env(safe-area-inset-bottom))]`)})]})]})]})}function cS({state:e}){let t=e.chat.messages.at(-1);return(0,L.jsx)(`button`,{type:`button`,onClick:()=>e.setOpen(!0),className:`flex w-full items-center gap-2 border-border-soft border-b px-4 py-2.5 text-left text-[0.8125rem] text-ink-3 transition hover:text-ink`,children:t?.pending?(0,L.jsx)(Ol,{chat:e.chat,className:`flex-1`}):(0,L.jsx)(`span`,{className:j(`min-w-0 flex-1 truncate`,e.chat.error&&`text-rose`),children:e.chat.error??_l(t?.content??``)})})}function lS(e){let t=Ox(e??uS);return e?t:null}var uS={layout:`bottom`,open:!1,chat:{messages:[]}},dS=e=>Math.max(ll.min,Math.min(ll.max,e-1120));function fS({state:e,width:t,max:n}){let r=e=>Math.round(Math.min(Math.max(e,ll.min),n));return(0,L.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":P(`editor.resize`),"aria-valuenow":t,"aria-valuemin":ll.min,"aria-valuemax":n,tabIndex:0,title:P(`editor.resize`),onPointerDown:n=>{if(n.button!==0)return;n.preventDefault();let i=n.clientX,a=t,o=n=>{a=r(t-(n.clientX-i)),e.setWidth(a,!1)},s=()=>{window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`),e.setWidth(a===ll.initial?null:a)};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},onKeyDown:n=>{if(n.key===`ArrowLeft`||n.key===`ArrowRight`){n.preventDefault();let i=n.shiftKey?64:16;e.setWidth(r(t+(n.key===`ArrowLeft`?i:-i)))}},onDoubleClick:()=>e.setWidth(null),className:`group -left-2 absolute inset-y-0 z-10 w-2 cursor-col-resize outline-none`,children:(0,L.jsx)(`span`,{className:`-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 h-8 w-1 rounded-full bg-ink-4/20 transition group-hover:bg-ember/60 group-focus-visible:bg-ember group-active:h-12 group-active:bg-ember`})})}function pS(){return lS(nx())?.where===`sidebar`}function mS(){let e=nx(),t=!!Lb(),n=lS(e),r=dS(Dx());if(!(e&&n&&n.where===`sidebar`))return null;let i=Math.min(Math.max(e.width??ll.initial,ll.min),r);return(0,L.jsxs)(`div`,{className:j(`relative flex shrink-0`,t&&`z-[61]`),style:{width:i},children:[(0,L.jsx)(fS,{state:e,width:i,max:r}),(0,L.jsx)(`aside`,{"aria-label":P(`assistant.name`),className:`flex min-w-0 flex-1 flex-col overflow-hidden rounded-xl bg-background shadow-elevated dark:ring-1 dark:ring-border-soft`,children:(0,L.jsx)(`div`,{ref:tb,className:`flex min-h-0 flex-1 flex-col`})})]})}function hS(){let e=Lb(),t=nx(),[n,r]=(0,I.useState)(null);if((0,I.useEffect)(()=>{if(!e){r(null);return}let t=0,n=()=>{if(!e.el.isConnected){Ib(null);return}r(e.el.getBoundingClientRect()),t=requestAnimationFrame(n)};n();let i=e=>{e.key===`Escape`&&Ib(null)};return document.addEventListener(`keydown`,i),()=>{cancelAnimationFrame(t),document.removeEventListener(`keydown`,i)}},[e]),!(e&&n))return null;let i={left:n.left-6,top:n.top-6,width:n.width+12,height:n.height+12},a=i.top+i.height+220<window.innerHeight,o=a?i.top+i.height+10:Math.max(10,i.top-10),s=Math.min(Math.max(10,i.left),window.innerWidth-330),c=e=>{Ib(null),t?.chat.send(e)};return(0,va.createPortal)((0,L.jsxs)(`div`,{"data-assistant-ui":!0,className:`pointer-events-none fixed inset-0 z-[60]`,children:[e.mode===`spotlight`?(0,L.jsx)(`div`,{className:`pointer-events-auto absolute rounded-xl transition-all duration-200`,style:{...i,boxShadow:`0 0 0 100vmax oklch(0.2 0.01 60 / 0.45)`},onClick:()=>Ib(null),onKeyDown:void 0,role:`presentation`}):null,(0,L.jsx)(`div`,{className:`absolute rounded-xl ring-2 ring-ember ring-offset-2 ring-offset-transparent transition-all duration-200`,style:i}),e.title||e.text||e.buttons.length?(0,L.jsxs)(`div`,{className:`pointer-events-auto absolute w-80 max-w-[calc(100vw-20px)] animate-rise rounded-xl bg-card p-3.5 shadow-overlay ring-1 ring-border`,style:{left:s,...a?{top:o}:{bottom:window.innerHeight-o}},children:[(0,L.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,L.jsx)(Xt,{kind:`round`,size:28,helmet:!0,interactive:!1}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[e.title?(0,L.jsx)(`div`,{className:`font-medium text-[0.875rem]`,children:e.title}):null,e.text?(0,L.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-2 leading-relaxed`,children:e.text}):null]})]}),(0,L.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-1.5`,children:[e.buttons.map(e=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>c(e),className:`rounded-full bg-paper-2 px-3 py-1.5 text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:e},e)),(0,L.jsx)(`button`,{type:`button`,onClick:()=>Ib(null),className:`rounded-full bg-primary px-3 py-1.5 font-medium text-[0.8125rem] text-primary-foreground`,children:P(`assistant.gotIt`)})]})]}):null]}),document.body)}function gS({enabled:e=!0,align:t=`center`}){let{status:n,data:r,latest:i,check:a,apply:o,busy:s,progress:c}=Sc(e),l=r?.checkedAt?new Date(r.checkedAt).toLocaleTimeString(N,{hour:`2-digit`,minute:`2-digit`}):null,u=t===`center`;return(0,L.jsxs)(`div`,{className:j(`flex flex-col gap-3 text-[0.875rem] text-ink-2`,u?`items-center text-center`:`items-start`),children:[n.isPending||a.isPending?(0,L.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,L.jsx)(dt,{className:`size-4 text-ember-strong`}),P(`about.update.checking`)]}):c?(0,L.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[s?(0,L.jsx)(dt,{className:`size-4 text-ember-strong`}):null,c]}):r?.newer&&i?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2.5 font-medium text-ink`,children:[(0,L.jsx)(ne,{className:`size-4 shrink-0 text-ember-strong`}),P(`about.update.available`,{v:i})]}),r.canApply?null:(0,L.jsx)(`p`,{className:`text-ink-3`,children:P(`about.update.manual`)})]}):r?.enabled?r.latest===null?(0,L.jsx)(`p`,{children:P(`about.update.unknown`)}):(0,L.jsxs)(`p`,{children:[P(`about.update.upToDate`),l?(0,L.jsxs)(`span`,{className:`text-ink-4`,children:[` `,`· `,P(`about.update.checkedAt`,{when:l})]}):null]}):(0,L.jsx)(`p`,{children:P(`about.update.off`)}),s||n.isPending?null:(0,L.jsxs)(`div`,{className:j(`flex flex-wrap gap-2`,u&&`justify-center`),children:[r?.newer&&r.canApply&&r.applying!==`running`?(0,L.jsxs)(D,{size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(),children:[(0,L.jsx)(ne,{className:`size-4`}),` `,P(`about.update.install`)]}):null,r?.enabled===!1?null:(0,L.jsxs)(D,{size:`sm`,variant:`secondary`,disabled:a.isPending,onClick:()=>a.mutate(),children:[(0,L.jsx)(gt,{className:j(`size-4`,a.isPending&&`animate-spin`)}),` `,P(`about.update.check`)]})]})]})}function _S({me:e}){let t=e.mode===`local`,{status:n,data:r,latest:i,check:a,apply:o,busy:s,progress:c}=Sc(t),l=n.isPending||a.isPending;return(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-2 text-[0.8125rem] text-ink-3`,children:[(0,L.jsx)(yc,{me:e}),(0,L.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t?l?(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,L.jsx)(dt,{className:`size-3.5 text-ember-strong`}),` `,P(`about.update.checking`)]}):c?(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[s?(0,L.jsx)(dt,{className:`size-3.5 text-ember-strong`}):null,c]}):r?.newer&&i?(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium text-ink`,children:[(0,L.jsx)(ne,{className:`size-3.5 shrink-0 text-ember-strong`}),P(`about.update.available`,{v:i})]}):r?.enabled?r.latest===null?(0,L.jsx)(`span`,{children:P(`about.update.unknown`)}):(0,L.jsx)(`span`,{children:P(`about.update.upToDate`)}):(0,L.jsx)(`span`,{children:P(`about.update.off`)}):(0,L.jsx)(`span`,{children:P(`about.kind.cloud`)}),!t||l||s?null:r?.newer&&r.canApply?(0,L.jsxs)(D,{size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(),children:[(0,L.jsx)(ne,{className:`size-4`}),` `,P(`about.update.install`)]}):r?.enabled?(0,L.jsx)(be,{label:P(`about.update.check`),className:`size-7 coarse:size-9`,onClick:()=>a.mutate(),children:(0,L.jsx)(gt,{className:`size-3.5`})}):null]})}var vS=`cubic-bezier(0.3, 0.7, 0.2, 1)`,yS=`(max-width: 639px)`;function bS({tone:e=`ground`,ink:t}){let n=Cn(),r=Qt(),i=Dn();return i?(0,L.jsx)(xS,{langs:[`en`,i],value:n,onPick:e=>{yn(e)&&r(e)},tone:e,ink:t}):null}function xS({langs:e,value:t,onPick:n,tone:r=`ground`,ink:i,label:a}){let o=Pn(yS),s=(0,I.useRef)({}),[c,l]=(0,I.useState)(null),u=e=>a?a(e):bn(e),d=e.join(`|`);(0,I.useLayoutEffect)(()=>{let e=()=>{let e={};for(let[t,n]of Object.entries(s.current))e[t]=n?Math.ceil(n.getBoundingClientRect().width):0;l(e)};e(),document.fonts?.ready.then(e)},[d]);let f=e=>c?(c[e===t&&!o?`${e}-full`:`${e}-short`]??0)+24:void 0,p=c?e.slice(0,e.indexOf(t)).reduce((e,t)=>e+(f(t)??0),0):0,m=`300ms ${vS}`,h=r===`ground`;return(0,L.jsxs)(`fieldset`,{className:j(`relative inline-flex items-center rounded-full border-0 p-0.5 ring-1`,h?`bg-white/10 ring-white/15`:`bg-paper-2 ring-border-soft`),children:[(0,L.jsx)(`legend`,{className:`sr-only`,children:P(`nav.language`)}),c?(0,L.jsx)(`span`,{"aria-hidden":`true`,className:j(`absolute top-0.5 bottom-0.5 left-0.5 rounded-full shadow-sm motion-reduce:transition-none`,h?`bg-white`:`bg-card`),style:{width:f(t),transform:`translateX(${p}px)`,transition:`transform ${m}, width ${m}`}}):null,e.map(e=>{let r=e===t;return(0,L.jsxs)(`button`,{"aria-pressed":r,className:j(`relative h-7 cursor-pointer overflow-hidden whitespace-nowrap rounded-full font-medium text-[0.75rem] motion-reduce:transition-none`,h?r?`text-[oklch(32%_0.15_262)]`:`text-white/70`:r?`text-ink`:`text-ink-3`),lang:e,onClick:()=>{r||n(e)},style:{width:f(e),transition:`width ${m}, color ${m}`,...h&&r&&i?{color:i}:{}},title:u(e),type:`button`,children:[[u(e),e.toUpperCase()].map((e,t)=>{let n=r&&!o?t===0:t===1;return(0,L.jsx)(`span`,{"aria-hidden":!n,className:`absolute inset-0 grid place-items-center motion-reduce:transition-none`,style:{opacity:+!!n,transition:`opacity 220ms ${vS}`},children:e},`${t}:${e}`)}),(0,L.jsx)(`span`,{ref:t=>{s.current[`${e}-full`]=t},"aria-hidden":`true`,className:`invisible absolute`,children:u(e)}),(0,L.jsx)(`span`,{ref:t=>{s.current[`${e}-short`]=t},"aria-hidden":`true`,className:`invisible absolute`,children:e.toUpperCase()}),(0,L.jsx)(`span`,{className:`invisible px-3`,children:r?u(e):e.toUpperCase()})]},e)})]})}function SS(){let e=Cn(),t=Qt();return(0,L.jsx)(Ne,{className:`w-44`,value:e,onChange:e=>{yn(e)&&t(e)},options:An.map(e=>({value:e,label:vn[e]}))})}var CS=[{theme:`light`,icon:tn,label:`theme.light`},{theme:`branded`,icon:mi,label:`theme.branded`},{theme:`dark`,icon:Jt,label:`theme.dark`}],wS=`cubic-bezier(0.3, 0.7, 0.2, 1)`;function TS({tone:e=`surface`}){let t=nn(),n=qt(),r=e===`ground`,i=r?n:t,a=CS.findIndex(e=>e.theme===i);return(0,L.jsxs)(`fieldset`,{className:j(`relative inline-flex items-center rounded-full border-0 p-0.5 ring-1`,r?`bg-white/10 ring-white/15`:`bg-paper-2 ring-border-soft`),children:[(0,L.jsx)(`legend`,{className:`sr-only`,children:P(`nav.theme`)}),(0,L.jsx)(`span`,{"aria-hidden":`true`,className:j(`absolute top-0.5 bottom-0.5 left-0.5 w-9 rounded-full shadow-sm motion-reduce:transition-none`,r?`bg-white`:`bg-card`),style:{transform:`translateX(${a*100}%)`,transition:`transform 300ms ${wS}`}}),CS.map(({theme:e,icon:t,label:n})=>(0,L.jsx)(`button`,{"aria-label":P(n),"aria-pressed":e===i,className:j(`relative grid h-7 w-9 cursor-pointer place-items-center rounded-full transition-colors motion-reduce:transition-none`,r?e===i?`text-[oklch(32%_0.15_262)]`:`text-white/70 hover:text-white`:e===i?`text-ink`:`text-ink-3 hover:text-ink-2`),onClick:()=>Yt(e),title:P(n),type:`button`,children:(0,L.jsx)(t,{className:`size-3.5`})},e))]})}function ES(e){try{return new URL(e).host}catch{return e}}var DS=e=>`${ot()}/w/${e.shareToken}`;function OS(e,t,n){if(!e.published)return{kind:`draft`};if(t.mode===`managed`)return{kind:`live`,url:DS(e),runs:e.publishedVersion??0,notes:0,cloud:!1};if(!t.account||n===null)return{kind:`here`};if(n===void 0)return{kind:`unknown`};let{copy:r,error:i}=n,a=r?.publishedVersion??null,o=r&&a!==null?r.shareUrl:null;return i?.again?{kind:`sending`,url:o,runs:a,again:i.again}:i?{kind:`missing`,url:o,runs:a,why:i.message}:!r||r.version<(e.publishedVersion??0)?{kind:`missing`,url:o,runs:a,why:P(`cloud.notSent`)}:!r.runnable||!o||a===null?{kind:`missing`,url:o,runs:a,why:`${P(`cloud.notRunnable`,{v:r.version})} ${a===null?P(`cloud.nothingRuns`):P(`cloud.keepsRunning`,{v:a})}`}:{kind:`live`,url:o,runs:a,notes:r.problems.filter(e=>!e.blocking).length,cloud:!0}}function kS(e){return e.kind===`live`||e.kind===`sending`||e.kind===`missing`?e.url:null}function AS({where:e,me:t,version:n}){let r=ES(t.account?.cloudUrl??``),i=`size-3.5`;switch(e.kind){case`draft`:return null;case`unknown`:return(0,L.jsx)(x,{tone:`live`,children:P(`home.live`)});case`here`:return(0,L.jsx)(x,{icon:(0,L.jsx)(Wr,{className:i}),title:P(`where.hereHint`),children:n?P(`where.hereVersion`,{v:n}):P(`where.here`)});case`live`:{let t=n?P(`editor.published`,{v:e.runs}):P(`home.live`),a=e.notes===1?P(`where.note`):e.notes>1?P(`where.notes`,{n:e.notes}):null;return(0,L.jsx)(x,{tone:`live`,icon:e.cloud?(0,L.jsx)(mr,{className:i}):void 0,title:e.cloud?P(`where.liveHint`,{host:r}):void 0,children:a?`${t} · ${a}`:t})}case`sending`:return(0,L.jsx)(x,{tone:`warn`,icon:(0,L.jsx)(c,{className:i}),title:P(`cloud.again`,{when:new Intl.DateTimeFormat(N,{timeStyle:`short`}).format(new Date(e.again))}),children:P(`where.sending`)});case`missing`:return(0,L.jsx)(x,{tone:`warn`,icon:(0,L.jsx)(Ot,{className:i}),title:e.why,children:e.runs===null?P(`where.missing`):P(`editor.published`,{v:e.runs})})}}var jS=`mt-1.5 text-[0.8125rem] text-ink-3`;function MS(e){let t=w(),[n,r]=(0,I.useState)(!1),i=zt({mutationFn:e=>p.post(`/api/studio/account/link`,e),onSuccess:({url:e})=>{qv(e),r(!0)}});return(0,I.useEffect)(()=>{if(!n)return;let e=setInterval(()=>void t.invalidateQueries({queryKey:[`me`]}),2e3),i=setTimeout(()=>r(!1),3e5);return()=>{clearInterval(e),clearTimeout(i)}},[n,t]),(0,I.useEffect)(()=>{e&&r(!1)},[e]),{link:i,waiting:n}}function NS({link:e,waiting:t}){return e.isError?(0,L.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:P(`local.accountFailed`)}):t?(0,L.jsxs)(`p`,{className:`flex items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,L.jsx)(dt,{className:`size-3.5`}),` `,P(`local.accountWaiting`)]}):null}function PS({me:e}){let t=La(`account`),n=MS(!1),{link:r}=n,[i,a]=(0,I.useState)(``);return(0,L.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,L.jsxs)(`div`,{className:`flex items-start gap-4 py-5 first:pt-0 last:pb-0`,children:[(0,L.jsx)(`div`,{className:`flex size-11 shrink-0 items-center justify-center rounded-full bg-paper-2 text-ink-2`,children:(0,L.jsx)(Ar,{className:`size-5`})}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`div`,{className:`font-medium text-[0.9375rem]`,children:P(`account.local`)}),(0,L.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-3 leading-relaxed`,children:P(`account.localText`)}),(0,L.jsx)(`div`,{className:`mt-2`,children:(0,L.jsx)(_S,{me:e})})]})]}),t?(0,L.jsxs)(`div`,{className:`flex flex-col gap-4 py-5 last:pb-0`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`font-medium text-[0.9375rem]`,children:P(`account.with`)}),(0,L.jsxs)(`ul`,{className:`mt-2 flex flex-col gap-2 text-[0.875rem] text-ink-2 leading-snug`,children:[(0,L.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,L.jsx)(kt,{className:`mt-0.5 size-4 shrink-0 text-amber`}),P(`account.withCredits`)]}),(0,L.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,L.jsx)(mr,{className:`mt-0.5 size-4 shrink-0 text-cobalt`}),P(`account.withCloud`)]})]})]}),(0,L.jsx)(`div`,{children:(0,L.jsx)(D,{busy:r.isPending&&!r.variables?.signup,onClick:()=>r.mutate({}),children:P(`account.signIn`)})})]}):null,t?(0,L.jsxs)(`form`,{className:`flex flex-col gap-3 py-5 last:pb-0`,onSubmit:e=>{e.preventDefault(),r.mutate({signup:!0,code:i.trim()||void 0})},children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`font-medium text-[0.9375rem]`,children:P(`account.new`)}),(0,L.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-3 leading-relaxed`,children:P(`account.newHint`)})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(_e,{value:i,maxLength:64,autoComplete:`off`,spellCheck:!1,placeholder:P(`account.code`),"aria-label":P(`account.code`),onChange:e=>a(e.target.value),className:`w-56 font-mono text-[0.875rem]`}),(0,L.jsx)(D,{type:`submit`,variant:`secondary`,className:`h-11`,busy:r.isPending&&!!r.variables?.signup,children:P(`account.create`)})]}),(0,L.jsx)(NS,{...n})]}):null]})}var FS=e=>({...e,slug:null,personal:!1,plan:null});function IS({account:e}){let t=w(),[n,r]=(0,I.useState)(!1),[i,a]=(0,I.useState)(!1),o=e.organizations.filter(t=>t.id!==e.organizationId),s=e.organizations.find(t=>t.id===e.organizationId),c=e.organization??s?.name??null,l=zt({mutationFn:()=>p.post(`/api/studio/account/refresh`,{}),onSettled:()=>t.invalidateQueries()}),u=zt({mutationFn:e=>p.post(`/api/studio/account/switch`,e),onSuccess:({url:e})=>{qv(e),a(!0)}});return(0,I.useEffect)(()=>{if(!i)return;let e=setInterval(()=>void t.invalidateQueries({queryKey:[`me`]}),2e3),n=setTimeout(()=>a(!1),3e5);return()=>{clearInterval(e),clearTimeout(n)}},[i,t]),(0,I.useEffect)(()=>{a(!1),r(!1)},[e.organizationId]),c?(0,L.jsxs)(`div`,{className:`py-5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,L.jsx)(Pc,{org:FS({id:e.organizationId,name:c,role:s?.role??`member`})}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:P(`account.organization`)}),(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`truncate font-medium text-[0.9375rem]`,children:c}),e.plan?(0,L.jsx)(x,{children:e.plan.name}):null,(0,L.jsx)(be,{label:P(`account.refresh`),className:`size-7 coarse:size-9`,disabled:l.isPending,onClick:()=>l.mutate(),children:(0,L.jsx)(gt,{className:j(`size-3.5`,l.isPending&&`animate-spin`)})})]})]})]}),o.length?(0,L.jsxs)(D,{variant:`secondary`,onClick:()=>r(e=>!e),"aria-expanded":n,children:[(0,L.jsx)(Jn,{className:`size-4`}),` `,P(`organizations.switch`)]}):null]}),n&&o.length?(0,L.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3`,children:[(0,L.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3 leading-relaxed`,children:P(`account.switchHint`,{name:c})}),(0,L.jsx)(`div`,{className:`flex flex-col rounded-xl ring-1 ring-border-soft`,children:o.map(e=>(0,L.jsxs)(`button`,{type:`button`,disabled:u.isPending||i,className:`flex w-full items-center gap-3 px-3 py-2.5 text-left transition first:rounded-t-xl last:rounded-b-xl hover:bg-accent disabled:cursor-default disabled:opacity-70`,onClick:()=>u.mutate({organization:e.id}),children:[(0,L.jsx)(Pc,{org:FS(e)}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col leading-tight`,children:[(0,L.jsx)(`span`,{className:`truncate font-medium text-[0.875rem] text-ink-2`,children:e.name}),(0,L.jsx)(`span`,{className:`truncate text-[0.75rem] text-ink-4`,children:u.isPending&&u.variables?.organization===e.id?P(`organizations.switching`,{name:e.name}):P(`organization.role.${e.role}`)})]}),u.isPending&&u.variables?.organization===e.id?(0,L.jsx)(dt,{className:`size-4`}):null]},e.id))}),u.isError?(0,L.jsxs)(`div`,{className:`flex flex-col items-start gap-2`,children:[(0,L.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:u.error instanceof S?u.error.message:P(`local.accountFailed`)}),u.error instanceof S&&u.error.body?.reason===`changes_waiting`&&u.variables?(0,L.jsx)(D,{variant:`secondary`,size:`sm`,onClick:()=>u.mutate({...u.variables,anyway:!0}),children:P(`account.switchAnyway`)}):null]}):i?(0,L.jsxs)(`p`,{className:`flex items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,L.jsx)(dt,{className:`size-3.5`}),` `,P(`local.accountWaiting`)]}):null]}):null]}):null}var LS={start:`account.kind.start`,monthly:`account.kind.monthly`,gift:`account.kind.gift`};function RS({account:e,me:t}){let n=w(),r=MS(e.signedIn),i=zt({mutationFn:()=>p.del(`/api/studio/account`),onSuccess:()=>n.invalidateQueries({queryKey:[`me`]})}),a=new Intl.DateTimeFormat(N,{dateStyle:`medium`});return(0,L.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 py-5 first:pt-0`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`truncate font-medium text-[0.9375rem]`,children:e.name||e.email}),e.signedIn?(0,L.jsx)(x,{tone:`live`,children:P(`account.linked`)}):null]}),(0,L.jsx)(`div`,{className:`truncate text-[0.875rem] text-ink-3`,children:e.email}),(0,L.jsx)(`div`,{className:`mt-2`,children:(0,L.jsx)(_S,{me:t})})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(D,{variant:`secondary`,onClick:()=>qv(e.url),children:[P(`setup.openAccount`),` `,(0,L.jsx)(oe,{className:`size-4`})]}),(0,L.jsxs)(D,{variant:`ghost`,busy:i.isPending,onClick:()=>i.mutate(),children:[(0,L.jsx)(Qr,{className:`size-4`}),` `,P(`nav.logout`)]})]})]}),e.signedIn?(0,L.jsx)(IS,{account:e}):null,e.signedIn?null:(0,L.jsxs)(`div`,{className:`flex flex-col gap-3 py-5`,children:[(0,L.jsx)(`p`,{className:`text-[0.875rem] text-ink-2`,children:P(`local.accountExpired`)}),(0,L.jsx)(`div`,{children:(0,L.jsx)(D,{busy:r.link.isPending,onClick:()=>r.link.mutate({}),children:P(`account.signInAgain`)})}),(0,L.jsx)(NS,{...r})]}),e.credits===null?null:(0,L.jsxs)(`div`,{className:`py-5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:P(`account.credits`)}),(0,L.jsx)(`div`,{className:`font-display font-semibold text-[1.375rem] tabular-nums leading-tight`,children:P(`nav.credits`,{n:Math.floor(e.credits).toLocaleString(N)})})]}),(0,L.jsxs)(D,{variant:`secondary`,onClick:()=>qv(`${e.url}/billing`),children:[P(`account.topUp`),` `,(0,L.jsx)(oe,{className:`size-4`})]})]}),e.expiring.length?(0,L.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1 text-[0.8125rem] text-ink-3 tabular-nums`,children:e.expiring.map(e=>(0,L.jsxs)(`li`,{children:[P(`account.expires`,{n:Math.floor(e.credits).toLocaleString(N),date:a.format(new Date(e.expiresAt))}),LS[e.kind]?(0,L.jsxs)(`span`,{className:`text-ink-4`,children:[` · `,P(LS[e.kind])]}):null]},`${e.kind}:${e.expiresAt}`))}):null]}),(0,L.jsxs)(`div`,{className:`flex items-start gap-2.5 py-5 text-[0.875rem] text-ink-2 leading-snug last:pb-0`,children:[(0,L.jsx)(mr,{className:`mt-0.5 size-4 shrink-0 text-cobalt`}),(0,L.jsx)(`p`,{children:P(`account.cloud`,{host:ES(e.cloudUrl)})})]})]})}function zS({me:e,fromAccount:t}){let n=w(),[r,i]=(0,I.useState)(e.profile),a=e=>i(t=>({...t,...e})),o=s(r,async e=>{await p.put(`/api/studio/profile`,e),await n.invalidateQueries({queryKey:[`me`]})});return(0,L.jsx)(Ct,{title:P(`account.profile`),hint:P(`account.hint`),save:o,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-6 sm:flex-row sm:gap-8`,children:[(0,L.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-2 sm:w-32`,children:[(0,L.jsx)(`div`,{className:`flex size-20 items-center justify-center overflow-hidden rounded-full bg-ember-tint font-semibold text-[1.75rem] text-ember-strong ring-1 ring-border-soft`,children:e.user.image?(0,L.jsx)(`img`,{src:e.user.image,alt:``,className:`size-full object-cover`}):an(r.name)||`?`}),(0,L.jsx)(`p`,{className:`text-center text-[0.75rem] text-ink-3 leading-snug`,children:P(`account.initials`)})]}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(xe,{children:P(`account.name`)}),(0,L.jsx)(_e,{value:r.name,maxLength:80,disabled:t,onChange:e=>a({name:e.target.value})}),(0,L.jsx)(`p`,{className:jS,children:P(t?`account.fromAccount`:`account.nameHint`)})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(xe,{children:P(`account.about`)}),(0,L.jsx)(Te,{minRows:3,maxLength:2e3,value:r.about,onChange:e=>a({about:e.target.value})}),(0,L.jsx)(`p`,{className:jS,children:P(`account.aboutHint`)})]}),(0,L.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(xe,{children:P(`account.email`)}),(0,L.jsx)(_e,{type:`email`,value:r.email,maxLength:200,disabled:t,onChange:e=>a({email:e.target.value})})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(xe,{children:P(`account.phone`)}),(0,L.jsx)(_e,{type:`tel`,value:r.phone,maxLength:40,onChange:e=>a({phone:e.target.value})})]})]})]})]})})}function BS({me:e}){let t=e.mode===`managed`,n=t||!!e.account;return(0,L.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[(0,L.jsx)(Ct,{title:P(`account.connection`),hint:P(`account.connectionHint`),children:t?(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`truncate font-medium text-[0.9375rem]`,children:e.user.name}),(0,L.jsx)(x,{tone:`live`,children:P(`account.linked`)})]}),(0,L.jsx)(`div`,{className:`truncate text-[0.875rem] text-ink-3`,children:e.user.email}),(0,L.jsx)(`div`,{className:`mt-2`,children:(0,L.jsx)(_S,{me:e})})]}),e.manageUrl?(0,L.jsxs)(D,{variant:`secondary`,onClick:()=>qv(`${e.manageUrl}/account`),children:[P(`setup.openAccount`),` `,(0,L.jsx)(oe,{className:`size-4`})]}):null]}):e.account?(0,L.jsx)(RS,{account:e.account,me:e}):(0,L.jsx)(PS,{me:e})}),(0,L.jsx)(zS,{me:e,fromAccount:n},n?`account`:`own`),(0,L.jsx)(Ct,{title:P(`account.look`),hint:P(`account.lookHint`),children:(0,L.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pb-4`,children:[(0,L.jsx)(`span`,{className:`font-medium text-[0.875rem]`,children:P(`nav.language`)}),(0,L.jsx)(SS,{})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pt-4`,children:[(0,L.jsx)(`span`,{className:`font-medium text-[0.875rem]`,children:P(`nav.theme`)}),(0,L.jsx)(TS,{})]})]})})]})}var VS={steps:Ri,chat:ii,talk:u,whatsapp:ni,sms:oi,call:Ei,video:ke},HS=e=>VS[e]??Lt,US=[`steps`,`chat`];function WS(){return Ae({queryKey:[`runners`],queryFn:()=>p.get(`/api/studio/runners`),staleTime:6e4})}function GS(e,t){let n=new Set(t.map(e=>e.id)),r=(e.runners?.enabled??US).filter(e=>n.has(e)),i=e.runners?.default??`steps`;return[...r].sort((e,t)=>e===i?-1:+(t===i))}function KS({w:e,runners:t}){let n=GS(e,t),r=e.runners?.default??`steps`;return(0,L.jsx)(`span`,{className:`inline-flex items-center gap-1.5`,children:n.map(e=>{let n=HS(e),i=t.find(t=>t.id===e)?.label[N]??e;return(0,L.jsx)(n,{"aria-label":i,className:j(`size-3.5`,e===r?`text-ink-2`:`text-ink-4`),children:(0,L.jsx)(`title`,{children:i})},e)})})}async function qS(e,t){let n=e.isFetching({queryKey:t.queryKey,exact:!0})>0;await e.cancelQueries({queryKey:t.queryKey,exact:!0});let r=e.getQueryData(t.queryKey),i=t.update(r);i!==r&&e.setQueryData(t.queryKey,i);let a=e.getQueryData(t.queryKey),o=()=>e.invalidateQueries({queryKey:t.queryKey,exact:!0});return{invalidate:o,wasFetching:n,rollback:()=>{if(e.getQueryData(t.queryKey)!==a)return o(),`invalidated`;if(r===void 0){if(a===void 0)return`unchanged`;e.removeQueries({queryKey:t.queryKey,exact:!0})}else e.setQueryData(t.queryKey,r);return`restored`}}}function JS(e,t=150){let n=new Map;return r=>{let i=JSON.stringify(r),a=n.get(i);a&&clearTimeout(a),n.set(i,setTimeout(()=>{n.delete(i),e.invalidateQueries({queryKey:r,refetchType:`active`})},t))}}var YS=[];function XS(e){for(let t of e)YS.some(e=>e.id===t.id)||YS.push(t)}var ZS=new Map;function QS(e,t,n){let r=`${e}|${t}`;return ZS.set(r,n),()=>{ZS.get(r)===n&&ZS.delete(r)}}var $S=(e,t)=>ZS.get(`${e}|${t}`);function eC(e,t){return e?typeof t.revision==`number`&&typeof e.revision==`number`?t.revision>e.revision:t.updatedAt&&e.updatedAt?Date.parse(t.updatedAt)>Date.parse(e.updatedAt):!0:!0}async function tC(e,t,n){if(!e.getQueryCache().find({queryKey:t,exact:!0}))return!1;let r=!1,i=await qS(e,{queryKey:t,update:e=>{let t=n(e);return t===void 0||t===e?e:(r=!0,t)}});return i.wasFetching&&i.invalidate(),r}function nC(e,t,n){e.setQueriesData({queryKey:t},e=>Array.isArray(e)?n(e)??e:e)}function rC(e,t,n){let r=e.findIndex(e=>e.id===t.id);if(r<0)return n===`none`?void 0:n===`first`?[t,...e]:[...e,t];if(!eC(e[r],t))return;let i=e.slice();return i[r]=t,i}var iC=(e,t)=>e.some(e=>e.id===t)?e.filter(e=>e.id!==t):void 0,aC=1500,oC=new Map,sC=new Map,cC=e=>{for(let t of sC.get(e)??[])t()};function lC(e){oC.set(e,{at:Date.now(),n:(oC.get(e)?.n??0)+1}),cC(e),setTimeout(()=>{let t=oC.get(e);t&&Date.now()-t.at>=aC&&(oC.delete(e),cC(e))},1550)}function uC(e){let t=oC.get(e);return!t||Date.now()-t.at>=aC?``:t.n%2?`live-flash-a`:`live-flash-b`}function dC(e,t){let n=sC.get(e)??new Set;return n.add(t),sC.set(e,n),()=>{n.delete(t),n.size||sC.delete(e)}}function fC(e){let t=JS(e,150),n={qc:e,invalidate:t,flash:lC};return async function(e){let r=[];Se.batch(()=>{for(let i of e)for(let e of YS){if(!e.kinds.includes(i.kind))continue;let a=()=>{for(let n of e.fallback(i))t(n)};if(i.op===`put`&&i.view===void 0){a();continue}try{let t=e.patch(i,n);t&&r.push(t.catch(t=>{console.warn(`[live] ${e.id} could not patch ${i.kind}:`,t),a()}))}catch(t){console.warn(`[live] ${e.id} could not patch ${i.kind}:`,t),a()}}}),await Promise.all(r)}}function pC(e){e.invalidateQueries({refetchType:`active`})}var mC=(e,t)=>(e.getQueryCache().find({queryKey:t,exact:!0})?.getObserversCount()??0)>0,hC=[{id:`wizards`,kinds:[`wizard`],patch:async(e,{qc:t,flash:n})=>{let r=[E.wizards(e.projectId??void 0),E.projectWizards(e.projectId??``)];if(e.op===`del`){for(let n of r)nC(t,n,t=>iC(t,e.item));return}let i=e.view;for(let n of r)nC(t,n,t=>rC(t,{...t.find(t=>t.id===e.item),...i.summary},`first`));n(e.item);let a=$S(`wizard`,e.item);a?a(e):mC(t,E.wizard(e.item))||await tC(t,E.wizard(e.item),e=>eC(e,i.detail)?i.detail:e)},fallback:e=>[E.wizards(e.projectId??void 0),E.projectWizards(e.projectId??``)]},{id:`translations`,kinds:[`translation`],patch:(e,{qc:t})=>{e.parent&&e.view&&t.setQueryData(E.translations(e.parent),e.view)},fallback:e=>e.parent?[E.translations(e.parent)]:[]},{id:`messages`,kinds:[`message`],patch:()=>void 0,fallback:()=>[]}],gC=[{id:`pages`,kinds:[`page`],patch:async(e,{qc:t,invalidate:n,flash:r})=>{let i=E.page(e.item),a=t.getQueryData(i);if(e.op===`del`)t.removeQueries({queryKey:i,exact:!0});else{let n=e.view,r=$S(`page`,e.item);if(r?r(e):await tC(t,i,e=>eC(e,n)?n:e),a&&a.title===n.title)return}r(e.item),n(E.knowledge(e.projectId??void 0)),n(E.spaceData(e.projectId??void 0))},fallback:e=>[E.page(e.item),E.knowledge(e.projectId??void 0),E.spaceData(e.projectId??void 0)]},{id:`tables`,kinds:[`table`],patch:async(e,{qc:t,invalidate:n})=>{let r=E.table(e.item),i=t.getQueryData(r);if(e.op===`del`)t.removeQueries({queryKey:r,exact:!0});else{let n=e.view;if(await tC(t,r,e=>e&&{...n,rows:e.rows}),i&&i.title===n.title)return}n(E.knowledge(e.projectId??void 0)),n(E.spaceData(e.projectId??void 0))},fallback:e=>[E.table(e.item),E.knowledge(e.projectId??void 0),E.spaceData(e.projectId??void 0)]},{id:`rows`,kinds:[`row`],patch:async(e,{qc:t,invalidate:n,flash:r})=>{if(!e.parent)return;let i=E.table(e.parent),a=e.view;await tC(t,i,t=>{if(!t)return t;if(e.op===`del`||!a){let n=iC(t.rows,e.item);return n?{...t,rows:n}:t}let{tableId:n,...r}=a,i=rC(t.rows,r,`last`);return i?{...t,rows:i}:t}),e.op===`put`&&r(e.item),n(E.spaceData(e.projectId??void 0))},fallback:e=>[...e.parent?[E.table(e.parent)]:[],E.spaceData(e.projectId??void 0)]},{id:`categories`,kinds:[`category`],patch:(e,{invalidate:t})=>{t(E.knowledge(e.projectId??void 0)),t(E.knowledgeValues())},fallback:e=>[E.knowledge(e.projectId??void 0),E.knowledgeValues()]},{id:`files`,kinds:[`file`],patch:(e,{qc:t,invalidate:n,flash:r})=>{if(!e.projectId)return;let i=E.files(e.projectId),a=t.getQueryData(i);if(a){let n=e.op===`del`?iC(a.files,e.item):rC(a.files,e.view,`first`);n&&t.setQueryData(i,{...a,files:n})}e.op===`put`&&r(e.item),n(E.fileText(e.item)),n(E.knowledge(e.projectId))},fallback:e=>[...e.projectId?[E.files(e.projectId),E.knowledge(e.projectId)]:[],E.fileText(e.item)]}],_C=[{id:`skills`,kinds:[`skill`],patch:(e,{invalidate:t,flash:n})=>{n(e.item),t(E.skills(e.projectId??void 0)),t(E.skill(e.item))},fallback:e=>[E.skills(e.projectId??void 0),E.skill(e.item)]}],vC=Math.random().toString(36).slice(2,10),yC=[{id:`presence`,kinds:[`presence`],patch:(e,{qc:t})=>{if(!e.parent)return;let n=e.item.slice(e.parent.length+1),r=e.view??[];t.setQueryData(E.presence(e.parent,n),r),t.setQueryData(E.presentItems(e.parent),e=>{if(!e)return e;let t={...e};return r.length?t[n]=r:delete t[n],t})},fallback:e=>e.parent?[E.presence(e.parent,e.item.slice(e.parent.length+1)),E.presentItems(e.parent)]:[]}];function bC(e,t,n){let r=La(`liveChanges`);return(Ae({queryKey:E.presence(e,t??``),queryFn:()=>p.get(`/api/studio/presence/${e}/${t}`),enabled:r&&!!t,refetchInterval:6e4}).data??[]).filter(e=>e.who!==n)}function xC(e){let t=La(`liveChanges`);return Ae({queryKey:E.presentItems(e),queryFn:()=>p.get(`/api/studio/presence/${e}`),enabled:t,refetchInterval:6e4}).data}var SC=2e4;function CC(e,t,n){let r=La(`liveChanges`),i=(0,I.useRef)(n);i.current=n;let a=`${n.state}|${n.place??``}`;(0,I.useEffect)(()=>{if(!r||!t)return;let n=()=>p.put(`/api/studio/presence`,{kind:e,item:t,tab:vC,...i.current}).catch(()=>void 0);n();let a=setInterval(()=>void n(),SC),o=()=>navigator.sendBeacon?.($e(`/api/studio/presence/leave`),new Blob([JSON.stringify({kind:e,item:t,tab:vC})],{type:`text/plain`}));return window.addEventListener(`pagehide`,o),()=>{clearInterval(a),window.removeEventListener(`pagehide`,o),p.post(`/api/studio/presence/leave`,{kind:e,item:t,tab:vC}).catch(()=>void 0)}},[r,e,t]),(0,I.useEffect)(()=>{if(!r||!t)return;let n=setTimeout(()=>void p.put(`/api/studio/presence`,{kind:e,item:t,tab:vC,...i.current}).catch(()=>void 0),1e3);return()=>clearTimeout(n)},[r,e,t,a])}var wC=[{id:`spaces`,kinds:[`space`],patch:(e,{qc:t,invalidate:n})=>{let r=t.getQueryData(E.spaces());if(r){let n=e.op===`del`?iC(r,e.item):rC(r,e.view,`last`);n&&t.setQueryData(E.spaces(),n)}n(E.themes(e.item))},fallback:e=>[E.spaces(),E.themes(e.item)]},{id:`connectors`,kinds:[`connector`],patch:(e,{qc:t})=>{if(!e.projectId)return;let n=E.connectors(e.projectId),r=t.getQueryData(n);if(!r)return;let i=e.item.slice(e.projectId.length+1),a=e.op===`del`?iC(r,i):rC(r,e.view,`last`);a&&t.setQueryData(n,a)},fallback:e=>e.projectId?[E.connectors(e.projectId)]:[]}],TC=100,EC=45e3,DC=3e4;function OC(e){let t=La(`liveChanges`),n=w();(0,I.useEffect)(()=>{if(!t){console.info(`[live] off: the liveChanges switch is off`);return}return kC(n,e)},[t,n,e])}function kC(e,t){let n=`wz-live:${t}`,r=new AbortController,i=typeof BroadcastChannel==`function`?new BroadcastChannel(n):null,a=fC(e),o=null,s=new Map,c=null,l=()=>{c=null;let e=[...s.values()];s=new Map,a(e)},u=t=>{if(`seq`in t&&(o=t.seq),t.event===`changes`){for(let e of t.items){let t=`${e.kind}|${e.item}`;s.delete(t),s.set(t,e)}c??=setTimeout(l,TC)}else t.event===`reset`?(s.clear(),pC(e)):t.event===`sync`&&e.invalidateQueries({queryKey:E.cloudSync()})};i&&(i.onmessage=e=>u(e.data));let d=async()=>{await AC(()=>o,e=>{u(e),i?.postMessage(e)},r.signal)};return typeof navigator<`u`&&navigator.locks?navigator.locks.request(n,{signal:r.signal},d).catch(e=>{r.signal.aborted||console.warn(`[live]`,e)}):d(),()=>{r.abort(),i?.close(),c&&clearTimeout(c)}}async function AC(e,t,n){let r=1e3;for(;!n.aborted;){let i=new AbortController,a=()=>i.abort();n.addEventListener(`abort`,a,{once:!0});let o=null,s=()=>{o&&clearTimeout(o),o=setTimeout(()=>i.abort(),EC)};try{let a=e(),o=await fetch($e(`/api/studio/live`),{credentials:`include`,headers:{accept:`text/event-stream`,"x-wizards-client":`web`,...a===null?{}:{"last-event-id":String(a)}},signal:i.signal});if(o.status===404){console.info(`[live] off: this runtime has no live stream`);return}if(o.status===429){console.info(`[live] waiting: too many studio windows are open`),await jC(DC,n);continue}if(!o.ok||!o.body)throw Error(`live stream answered ${o.status}`);r=1e3,s(),await MC(o.body,e=>{s(),t(e)})}catch(e){if(n.aborted)return;i.signal.aborted||console.info(`[live] dropped, reconnecting:`,e.message)}finally{o&&clearTimeout(o),n.removeEventListener(`abort`,a)}await jC(r,n),r=Math.min(r*2,3e4)}}function jC(e,t){return new Promise(n=>{let r=()=>{clearTimeout(a),document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`online`,r),t.removeEventListener(`abort`,r),n()},i=()=>{document.visibilityState===`visible`&&r()},a=setTimeout(r,e);document.addEventListener(`visibilitychange`,i),window.addEventListener(`online`,r),t.addEventListener(`abort`,r)})}async function MC(e,t){let n=e.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:a}=await n.read();if(e)return;i+=r.decode(a,{stream:!0});let o=i.indexOf(`
|
|
44
|
+
|
|
45
|
+
`);for(;o>=0;){let e=i.slice(0,o);i=i.slice(o+2);let n=`message`,r=``;for(let t of e.split(`
|
|
46
|
+
`))t.startsWith(`event:`)?n=t.slice(6).trim():t.startsWith(`data:`)&&(r+=t.slice(5).replace(/^ /,``));t({event:n,...r?JSON.parse(r):{}}),o=i.indexOf(`
|
|
47
|
+
|
|
48
|
+
`)}}}XS([...wC,...hC,...gC,..._C,...yC]);function NC(e){let[,t]=(0,I.useReducer)(e=>e+1,0);return(0,I.useEffect)(()=>dC(e,t),[e]),uC(e)}function PC(e){let t=0;for(let n of e)t=(t*31+n.charCodeAt(0))%360;return`oklch(72% 0.13 ${t})`}var FC=e=>e.split(/\s+/).filter(Boolean).slice(0,2).map(e=>e[0]?.toUpperCase()).join(``)||`?`;function IC(e){let t=Math.max(0,Math.round((Date.parse(e)-Date.now())/1e3));return new Intl.RelativeTimeFormat(N,{numeric:`auto`}).format(Math.abs(t)<60?-Math.abs(t):-Math.round(Math.abs(t)/60),Math.abs(t)<60?`second`:`minute`)}function LC(e){let t=e.whoKind===`assistant`?P(`presence.assistant`,{person:e.client??P(`presence.someone`)}):e.whoKind===`agent`?e.client?P(`presence.agentFor`,{name:e.name,person:e.client,ago:IC(e.seenAt)}):P(`presence.agent`,{name:e.name,ago:IC(e.seenAt)}):P(e.state===`editing`?`presence.editing`:`presence.viewing`,{name:e.name});return e.placeLabel?P(`presence.at`,{who:t,place:e.placeLabel}):t}function RC({kind:e,item:t,me:n,className:r}){let i=bC(e,t,n),a=new Map;for(let e of i){let t=a.get(e.who);(!t||e.state===`editing`&&t.state!==`editing`)&&a.set(e.who,e)}let o=[...a.values()];return o.length?(0,L.jsxs)(`ul`,{"aria-label":P(`presence.here`),className:j(`flex shrink-0 items-center -space-x-1.5`,r),children:[o.slice(0,4).map(e=>(0,L.jsx)(`li`,{title:LC(e),"aria-label":LC(e),className:j(`relative grid size-7 place-items-center rounded-full font-semibold text-[0.6875rem] ring-2 ring-background`,e.state===`editing`&&`outline-2 outline-offset-1`),style:{background:PC(e.who),outlineColor:PC(e.who),color:`oklch(24% 0.03 260)`},children:e.whoKind===`person`?FC(e.name):(0,L.jsx)(Ht,{className:`size-3.5`})},e.who)),o.length>4?(0,L.jsxs)(`li`,{className:`grid size-7 place-items-center rounded-full bg-paper-2 text-[0.6875rem] text-ink-3 ring-2 ring-background`,children:[`+`,o.length-4]}):null]}):null}function zC(e,t,n,r){let i=bC(e,t,n);return r?i.find(e=>e.place===r&&e.state===`editing`&&e.whoKind===`person`)??null:null}function BC(e,t,n){return bC(e,t,n).filter(e=>e.state===`editing`)}function VC({wizard:e,className:t,onDeleted:n}){let r=w(),i=A(),a=M(),[o,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)(!1),u=(0,I.useRef)(null);bw(u,o,()=>s(!1));let d=zt({mutationFn:()=>p.post(`/api/studio/wizards/${e.id}/duplicate`),onSuccess:async({id:e})=>{await r.invalidateQueries({queryKey:[`wizards`]}),i(`/edit/${e}`)}}),f=zt({mutationFn:()=>p.del(`/api/studio/wizards/${e.id}`),onSuccess:async()=>{l(!1),await r.invalidateQueries({queryKey:[`wizards`]}),await r.invalidateQueries({queryKey:E.spaces()}),n?.()}}),m=`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[0.875rem] text-ink-2 transition hover:bg-accent hover:text-ink`;return(0,L.jsxs)(`div`,{ref:u,className:j(`relative`,t),onClick:e=>e.stopPropagation(),children:[(0,L.jsx)(`button`,{type:`button`,"aria-label":P(`wizardMenu.label`),title:P(`wizardMenu.label`),"aria-haspopup":`menu`,"aria-expanded":o,onClick:()=>s(e=>!e),className:j(`grid size-8 place-items-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,o&&`bg-accent text-ink`),children:(0,L.jsx)(g,{className:`size-4`})}),o?(0,L.jsxs)(`div`,{role:`menu`,className:`absolute top-full right-0 z-50 mt-1 w-60 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:[(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:m,disabled:d.isPending,onClick:()=>{s(!1),d.mutate()},children:[(0,L.jsx)(Et,{className:`size-4 shrink-0`}),` `,P(`wizardMenu.duplicate`)]}),(0,L.jsxs)(`a`,{role:`menuitem`,href:$e(`/api/studio/wizards/${e.id}/export`),download:!0,className:m,onClick:()=>s(!1),children:[(0,L.jsx)(ne,{className:`size-4 shrink-0`}),` `,P(`editor.export`)]}),a?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`mx-2 my-1.5 h-px bg-border-soft`}),(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:j(m,`text-rose hover:bg-rose-tint hover:text-rose`),onClick:()=>{s(!1),l(!0)},children:[(0,L.jsx)(mt,{className:`size-4 shrink-0`}),` `,P(`wizardMenu.delete`)]})]}):null]}):null,(0,L.jsxs)(nt,{open:c,onClose:()=>l(!1),title:P(`wizardMenu.deleteTitle`,{title:e.title}),children:[(0,L.jsx)(`p`,{className:`-mt-2 text-[0.875rem] text-ink-2`,children:e.published?P(`wizardMenu.deletePublished`):P(`wizardMenu.deleteDraft`)}),f.error?(0,L.jsx)(`p`,{className:`mt-3 text-[0.8125rem] text-rose`,children:f.error.message}):null,(0,L.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,L.jsx)(D,{variant:`ghost`,onClick:()=>l(!1),children:P(`common.cancel`)}),(0,L.jsxs)(D,{variant:`danger`,busy:f.isPending,onClick:()=>f.mutate(),children:[(0,L.jsx)(mt,{className:`size-4`}),` `,P(`wizardMenu.delete`)]})]})]})]})}var HC=e({HomePage:()=>aw,NewSpaceDialog:()=>WC,ProjectSwitcher:()=>GC}),UC=[{icon:Mt,name:()=>P(`nav.wizards`),what:`space.holds.wizards`},{icon:Sr,name:()=>P(`space.info`),what:`space.holds.info`},{icon:er,name:()=>`${P(`space.knowledge`)} & ${P(`space.data`)}`,what:`space.holds.knowledge`},{icon:Ut,name:()=>P(`connectors.title`),what:`space.holds.connectors`},{icon:Rr,name:()=>P(`space.results`),what:`space.holds.results`}];function WC({open:e,onClose:t}){let{select:n}=un(),r=w(),[i,a]=(0,I.useState)(``),o=zt({mutationFn:()=>p.post(`/api/studio/projects`,{name:i}),onSuccess:async({id:e})=>{await r.invalidateQueries({queryKey:E.spaces()}),n(e),a(``),t()}});return(0,L.jsxs)(nt,{open:e,onClose:t,title:P(`home.newProject`),children:[(0,L.jsx)(`p`,{className:`-mt-2 text-[0.875rem] text-ink-2`,children:P(`space.holds.intro`)}),(0,L.jsx)(`dl`,{className:`mt-4 flex flex-col gap-2.5 text-[0.8125rem]`,children:UC.map(e=>(0,L.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,L.jsx)(e.icon,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,L.jsx)(`dt`,{className:`w-28 shrink-0 font-medium text-ink`,children:e.name()}),(0,L.jsx)(`dd`,{className:`min-w-0 text-ink-3`,children:P(e.what)})]},e.what))}),(0,L.jsx)(`p`,{className:`mt-3 text-[0.8125rem] text-ink-4`,children:P(`space.holds.shared`)}),(0,L.jsxs)(`form`,{className:`mt-5`,onSubmit:e=>{e.preventDefault(),i.trim()&&o.mutate()},children:[(0,L.jsx)(_e,{autoFocus:!0,placeholder:P(`home.projectName`),value:i,onChange:e=>a(e.target.value)}),(0,L.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,L.jsx)(D,{variant:`ghost`,onClick:t,children:P(`common.cancel`)}),(0,L.jsx)(D,{type:`submit`,busy:o.isPending,disabled:!i.trim(),children:P(`home.newProject`)})]})]})]})}function GC(){let{project:e,projects:t,select:n}=un(),r=$t().data?.limits.projects??1,i=rn(),[a,o]=(0,I.useState)(!1);return!e||r!==null&&r<=1?null:(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(Ne,{className:`w-56`,value:e.id,onChange:e=>e===`__new`?o(!0):n(e),options:[...t.map(e=>({value:e.id,label:e.name})),...i?[r===null||t.length<r?{value:`__new`,label:`+ ${P(`home.newProject`)}`}:{value:`__new`,label:P(`home.projectLimit`,{n:r}),disabled:!0}]:[]]}),(0,L.jsx)(WC,{open:a,onClose:()=>o(!1)})]})}function KC({url:e}){let[t,n]=(0,I.useState)(!1);return(0,L.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},className:`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] text-ink-3 hover:bg-accent hover:text-ink`,children:[t?(0,L.jsx)(he,{className:`size-3.5`}):(0,L.jsx)(Et,{className:`size-3.5`}),P(t?`share.copied`:`share.link`)]})}function qC(){let e=A(),t=MS(!1),[n,r]=(0,I.useState)(!1),i=(0,I.useRef)(null);return(0,I.useEffect)(()=>{if(!n)return;let e=e=>{i.current?.contains(e.target)||r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]),(0,L.jsxs)(`div`,{className:`relative`,ref:i,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>r(e=>!e),className:`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] text-ink-3 hover:bg-accent hover:text-ink`,children:[(0,L.jsx)(Et,{className:`size-3.5`}),` `,P(`share.link`)]}),n?(0,L.jsxs)(`div`,{className:`absolute right-0 bottom-10 z-20 flex w-72 animate-rise flex-col gap-3 rounded-xl bg-card p-3.5 shadow-overlay ring-1 ring-border-soft`,children:[(0,L.jsx)(`p`,{className:`text-[0.8125rem] text-ink-2 leading-relaxed`,children:P(`teaser.link`)}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(D,{size:`sm`,busy:t.link.isPending,onClick:()=>t.link.mutate({}),children:P(`account.signIn`)}),(0,L.jsx)(D,{size:`sm`,variant:`secondary`,onClick:()=>e(`/settings/account`),children:P(`account.create`)})]}),(0,L.jsx)(NS,{...t})]}):null]})}function JC({w:e,me:t,runners:n,present:r}){let i=La(`account`),a=A(),o=OS(e,t,e.cloud),s=kS(o),c=s??(e.published?DS(e):null),l=NC(e.id);return(0,L.jsxs)(`div`,{className:`group/card relative pt-6`,children:[(0,L.jsx)(`div`,{className:`pointer-events-none absolute top-0 left-4 z-10`,children:(0,L.jsx)(Xt,{kind:e.avatar,costume:e.costume,size:52})}),(0,L.jsxs)(m,{className:j(`relative flex h-full cursor-pointer flex-col px-5 pt-10 pb-3 transition hover:shadow-elevated`,l),onClick:()=>a(`/edit/${e.id}`),children:[(0,L.jsx)(`div`,{className:`absolute top-3 right-3`,children:e.published?(0,L.jsx)(AS,{where:o,me:t}):(0,L.jsx)(x,{children:P(`home.draft`)})}),(0,L.jsx)(`h3`,{className:`font-display font-semibold text-[1.0625rem] leading-snug`,children:e.title}),(0,L.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[0.875rem] text-ink-3`,children:e.description}),(0,L.jsxs)(`div`,{className:`mt-auto flex min-h-8 items-center justify-between pt-3`,children:[(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-2.5 text-[0.75rem] text-ink-4`,children:[P(`home.steps`,{n:e.stepCount}),(0,L.jsx)(KS,{w:e,runners:n}),r?.length?(0,L.jsx)(`span`,{role:`img`,className:`inline-flex items-center gap-1`,title:r.map(LC).join(`
|
|
49
|
+
`),"aria-label":r.map(LC).join(`, `),children:r.slice(0,3).map(e=>(0,L.jsx)(`span`,{className:`size-2 rounded-full`,style:{background:PC(e.who)}},`${e.who}|${e.tab}`))}):null]}),(0,L.jsxs)(`div`,{className:`flex items-center`,children:[(0,L.jsx)(VC,{wizard:e,className:`opacity-0 transition group-hover/card:opacity-100 has-[[aria-expanded=true]]:opacity-100 focus-within:opacity-100 coarse:opacity-100`}),s?(0,L.jsx)(KC,{url:s}):o.kind===`here`&&i?(0,L.jsx)(qC,{}):null,c?(0,L.jsx)(be,{label:P(s?`share.open`:`share.openHere`),className:`ml-1 size-8`,onClick:e=>{e.stopPropagation(),qv(c)},children:(0,L.jsx)(Xn,{className:`size-4`})}):null]})]})]})]})}var YC=[`draft`,`here`,`live`,`missing`],XC={draft:ue,here:Wr,live:Ai,missing:Ot},ZC=e=>P(e===`draft`?`home.draft`:e===`here`?`where.here`:e===`live`?`home.live`:`where.missing`);function QC(e,t){let{kind:n}=OS(e,t,e.cloud);return n===`draft`||n===`here`?n:n===`live`||n===`unknown`?`live`:`missing`}function $C({wizards:e,me:t,value:n,onChange:r}){let i=new Map;for(let n of e){let e=QC(n,t);i.set(e,(i.get(e)??0)+1)}if(i.size<2)return null;let a=e=>j(`inline-flex h-8 items-center gap-1.5 rounded-full px-3 font-medium text-[0.8125rem] transition`,e?`bg-paper-2 text-ink`:`text-ink-3 hover:text-ink`);return(0,L.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-1`,children:[(0,L.jsxs)(`button`,{type:`button`,className:a(n===null),onClick:()=>r(null),children:[P(`home.all`),(0,L.jsx)(`span`,{className:`text-[0.75rem] text-ink-4`,children:e.length})]}),YC.filter(e=>i.has(e)).map(e=>{let t=XC[e];return(0,L.jsxs)(`button`,{type:`button`,"aria-pressed":n===e,className:a(n===e),onClick:()=>r(n===e?null:e),children:[(0,L.jsx)(t,{className:`size-3.5`}),ZC(e),(0,L.jsx)(`span`,{className:`text-[0.75rem] text-ink-4`,children:i.get(e)})]},e)})]})}var ew=12,tw=3;function nw({value:e,onChange:t}){return(0,L.jsxs)(`label`,{className:`relative flex h-10 w-full max-w-md items-center gap-2.5 rounded-full bg-card px-4 shadow-soft ring-1 ring-border-soft transition focus-within:ring-2 focus-within:ring-focus sm:h-11`,children:[(0,L.jsx)(Re,{className:`size-4 shrink-0 text-ink-3`}),(0,L.jsx)(`input`,{type:`search`,value:e,onChange:e=>t(e.target.value),placeholder:P(`home.search`),"aria-label":P(`home.search`),className:`min-w-0 flex-1 bg-transparent text-[0.9375rem] outline-none placeholder:text-ink-4 [&::-webkit-search-cancel-button]:hidden`}),e?(0,L.jsx)(`button`,{type:`button`,"aria-label":P(`market.reset`),onClick:()=>t(``),className:`-mr-1.5 flex size-7 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-paper-2 hover:text-ink`,children:(0,L.jsx)(ct,{className:`size-4`})}):null]})}var rw=`curl -fsSL https://engenty.ai/install.sh | bash`;function iw(){let[e,t]=(0,I.useState)(!1),n=[P(`home.local.install`),P(`home.local.signIn`),P(`home.local.publish`)];return(0,L.jsxs)(`div`,{className:`mx-auto flex max-w-xl animate-rise flex-col items-center pt-4 text-center`,children:[(0,L.jsx)(Xt,{kind:`round`,size:120}),(0,L.jsx)(`h1`,{className:`mt-2 font-display font-semibold text-[1.75rem] leading-tight tracking-tight`,children:P(`home.local.title`)}),(0,L.jsx)(`p`,{className:`mt-3 text-[0.9375rem] text-ink-2 leading-relaxed`,children:P(`home.local.text`)}),(0,L.jsx)(`ol`,{className:`mt-8 flex w-full flex-col gap-4 text-left`,children:n.map((n,r)=>(0,L.jsxs)(`li`,{className:`flex gap-3`,children:[(0,L.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-paper-2 font-medium text-[0.8125rem] text-ink-2`,children:r+1}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,L.jsx)(`p`,{className:`text-[0.9375rem] leading-snug`,children:n}),r===0?(0,L.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 rounded-lg bg-paper-2 py-1.5 pr-1.5 pl-3`,children:[(0,L.jsx)(`code`,{className:`min-w-0 flex-1 select-all overflow-x-auto whitespace-nowrap font-mono text-[0.8125rem] text-ink-2`,children:rw}),(0,L.jsxs)(D,{variant:`secondary`,size:`sm`,onClick:()=>{navigator.clipboard.writeText(rw),t(!0),setTimeout(()=>t(!1),1500)},children:[e?(0,L.jsx)(he,{className:`size-3.5`}):(0,L.jsx)(Et,{className:`size-3.5`}),P(e?`share.copied`:`share.copy`)]})]}):null]})]},n))})]})}function aw(){let e=A(),t=w(),{project:n,projects:r,loading:i}=un(),a=$t().data,o=sn(),s=rn(),c=Ae({queryKey:[`wizards`,n?.id,!!a?.account],queryFn:()=>p.get(`/api/studio/projects/${n.id}/wizards`),enabled:!!n}),l=WS().data??[],u=xC(`wizard`),[d,f]=(0,I.useState)(null),[m,h]=(0,I.useState)(``),g=(c.data?.length??0)>ew,_=g?m.trim().toLowerCase():``,v=(c.data??[]).filter(e=>(!d||!a||QC(e,a)===d)&&(!_||`${e.title} ${e.description}`.toLowerCase().includes(_))),y=!!_&&v.length<tw,ee=zt({mutationFn:e=>p.post(`/api/studio/wizards`,{projectId:n.id,starterId:e,lang:N}),onSuccess:async({id:n})=>{await t.invalidateQueries({queryKey:E.spaces()}),await t.invalidateQueries({queryKey:[`wizards`]}),e(`/edit/${n}`)}}),te=r.reduce((e,t)=>e+t.wizardCount,0),x=s&&!n?.readOnly;return!i&&x&&r.length&&te===0?(0,L.jsx)(ft,{to:`/new`,replace:!0}):!i&&!o&&r.length===0?(0,L.jsx)(iw,{}):(0,L.jsxs)(`div`,{className:`animate-rise`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[g?(0,L.jsx)(nw,{value:m,onChange:h}):(0,L.jsx)(`h1`,{className:`font-display font-semibold text-[1.75rem] tracking-tight`,children:P(`home.title`,{space:n?.name??``})}),x?(0,L.jsxs)(D,{onClick:()=>e(`/new`),children:[(0,L.jsx)(De,{className:`size-4`}),` `,P(`home.new`)]}):null]}),n?.origin===`local`?(0,L.jsxs)(`p`,{className:`mt-2 text-[0.875rem] text-ink-3`,children:[P(`home.fromLocal`),` `,n.syncedAt?P(`home.syncedAt`,{when:new Intl.DateTimeFormat(N,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(n.syncedAt))}):null]}):null,c.data&&c.data.length===0?(0,L.jsxs)(b,{children:[(0,L.jsx)(`p`,{children:P(`home.empty`)}),x?(0,L.jsxs)(D,{className:`mt-5`,onClick:()=>e(`/new`),children:[(0,L.jsx)(De,{className:`size-4`}),` `,P(`home.new`)]}):null]}):null,c.data?.length&&a?(0,L.jsx)($C,{wizards:c.data,me:a,value:d,onChange:f}):null,_&&v.length===0?(0,L.jsx)(`p`,{className:`mt-6 text-[0.875rem] text-ink-3`,children:P(`home.noMatch`)}):null,(0,L.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:a?v.map(e=>(0,L.jsx)(JC,{w:e,me:a,runners:l,present:u?.[e.id]?.filter(e=>e.who!==a.user.id)},e.id)):null}),y?(0,L.jsxs)(L.Fragment,{children:[x?(0,L.jsx)(Nt,{query:m,busy:ee.isPending,onUse:e=>n&&!ee.isPending&&ee.mutate(e.id)}):(0,L.jsx)(Nt,{query:m}),x?(0,L.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,L.jsxs)(D,{variant:`secondary`,onClick:()=>e(`/new?wish=${encodeURIComponent(m.trim())}`),children:[(0,L.jsx)(et,{className:`size-4`}),` `,P(`home.newFromSearch`,{q:m.trim()})]})}):null]}):null]})}var ow=(0,I.lazy)(()=>Vt(()=>import(`./ChangelogDialog-SwyId00t.js`).then(e=>({default:e.ChangelogDialog})),__vite__mapDeps([8,1,2,3,4,5]))),sw=`wizards.update-banner`;function cw(){try{return localStorage.getItem(sw)}catch{return null}}function lw(){let[e,t]=(0,I.useState)(cw),[n,r]=(0,I.useState)(!1),{data:i,latest:a,apply:o,busy:s,progress:c}=Sc(),l=i&&!i.newer?i.updated?.to??null:null,u=l??(i?.newer?a:null);if(!(i&&u)||e===u&&i.applying===`idle`)return null;let d=()=>{try{localStorage.setItem(sw,u)}catch{}t(u)},f=c??(l?P(`about.update.updated`,{v:u}):i.pending?.version===u?P(`about.update.ready`,{v:u}):P(`about.update.available`,{v:u}));return(0,L.jsxs)(`div`,{className:`flex items-center gap-3 border-border-soft border-b bg-ember-tint px-4 py-2 text-[0.8125rem] text-ink-2 sm:px-6`,children:[s?(0,L.jsx)(dt,{className:`size-4 shrink-0 text-ember-strong`}):(0,L.jsx)(ne,{className:`size-4 shrink-0 text-ember-strong`}),(0,L.jsx)(`p`,{className:`min-w-0 flex-1`,children:f}),s?null:(0,L.jsx)(`button`,{type:`button`,onClick:()=>r(!0),className:`shrink-0 underline transition hover:text-ink`,children:P(`about.update.notes`)}),n?(0,L.jsx)(I.Suspense,{fallback:null,children:(0,L.jsx)(ow,{open:!0,version:u,onClose:()=>r(!1)})}):null,i.canApply&&!l&&(i.applying===`idle`||i.applying===`failed`)?(0,L.jsx)(D,{size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(),children:P(`about.update.install`)}):null,s?null:(0,L.jsx)(be,{label:P(`install.app.close`),onClick:d,className:`size-8`,children:(0,L.jsx)(ct,{className:`size-4`})})]})}var uw=[],dw=new Set;function fw(e){uw=e;for(let e of dw)e()}function pw(e){let t=JSON.stringify(e);(0,I.useEffect)(()=>(fw(JSON.parse(t)),()=>fw([])),[t])}function mw(){return uw}function hw(){return(0,I.useSyncExternalStore)(e=>(dw.add(e),()=>dw.delete(e)),()=>uw)}function gw({alone:e=!1}){let t=hw();return t.length?(0,L.jsx)(`nav`,{"aria-label":P(`nav.breadcrumb`),className:`flex min-w-0 items-center text-[0.9375rem] max-sm:hidden`,children:t.map((n,r)=>(0,L.jsxs)(I.Fragment,{children:[e&&r===0?null:(0,L.jsx)(`span`,{className:j(`mr-2 text-ink-4`,r===0?`-ml-1 sm:-ml-2`:`ml-2`),children:`/`}),n.to&&r<t.length-1?(0,L.jsx)(o,{to:n.to,className:`truncate text-ink-3 transition hover:text-ink`,children:n.label}):(0,L.jsx)(`span`,{"aria-current":`page`,className:`truncate font-medium text-ink`,children:n.label})]},`${r}:${n.label}`))}):null}var _w=e=>e.manageUrl??e.account?.url??null;function vw(e){let t=_w(e);return t?`${t}/billing`:null}function yw(e,t){return e.mode===`local`?e.account?e.account.signedIn?`linked`:`expired`:t?`alone`:null:null}function bw(e,t,n){let r=(0,I.useRef)(n);r.current=n,(0,I.useEffect)(()=>{if(!t)return;let n=t=>{e.current?.contains(t.target)||r.current()},i=e=>{e.key===`Escape`&&r.current()};return document.addEventListener(`pointerdown`,n),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`pointerdown`,n),document.removeEventListener(`keydown`,i)}},[e,t])}function xw(e,t,n){return e===`below`?n:Pa(t,e===`bar-start`?`start`:`end`)}var Sw=e=>`oklch(from ${e} calc(0.16 + 0.83 * clamp(0, (0.65 - l) * 1000, 1)) 0.01 h)`;function Cw({project:e,name:t,size:n=`md`}){let r=e?.brand.colors?.[0]?.value,i=an(t??e?.name??``),a=(0,L.jsx)(`span`,{className:j(`grid shrink-0 place-items-center font-semibold tracking-wide`,n===`md`?`size-10 rounded-lg text-[0.8125rem]`:n===`sm`?`size-9 rounded-lg text-[0.75rem]`:`size-6 rounded-md text-[0.5625rem]`,r?null:`bg-paper-3 text-ink ring-1 ring-border`),style:r?{background:r,color:Sw(r)}:void 0,children:i||(0,L.jsx)(Er,{className:`size-4`})});return e?.origin===`local`?(0,L.jsxs)(`span`,{className:`relative shrink-0`,title:P(`readonly.project`),children:[a,(0,L.jsx)(`span`,{className:`-right-1 -bottom-1 absolute grid size-4 place-items-center rounded-full bg-amber ring-2 ring-paper`,children:(0,L.jsx)(Wr,{className:`size-2.5 text-paper`})})]}):a}function ww(e){let{projects:t}=un();return e.mode===`managed`&&!!e.tenant.name&&e.limits.projects===1&&t.length<=1}function Tw({me:e,placement:t,label:n,className:r,children:i}){let a=A(),{position:o,phone:s}=ja(),{project:c,projects:l,select:u}=un(),d=ww(e),f=Fc(e),p=rn(),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)(!1),[v,y]=(0,I.useState)(!1),[b,ee]=(0,I.useState)(!1),te=Nc(e),[x,ne]=(0,I.useState)({top:0,left:0}),S=(0,I.useRef)(null);bw(S,m,()=>h(!1));let re=e.limits.projects,C=re!==null&&l.length>=re,w=`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[0.875rem] text-ink-2 transition hover:bg-accent hover:text-ink`;return(0,L.jsx)(`div`,{className:`shrink-0`,ref:S,children:(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();ne({top:t.bottom+6,left:t.left}),h(e=>!e)},"aria-expanded":m,"aria-haspopup":`menu`,"aria-label":n,title:d?void 0:P(`nav.switchSpace`),className:typeof r==`function`?r(m):r,children:i}),m?(0,L.jsxs)(`div`,{role:`menu`,style:t===`below`?{position:`fixed`,...x}:void 0,className:j(`z-50 w-72 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,t===`below`?null:j(`absolute`,xw(t,o,`top-10 left-0`))),children:[d&&jc(e)&&!s?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`px-2 pt-1.5 pb-1 text-[0.75rem] text-ink-3`,children:P(`organizations.mine`)}),(0,L.jsx)(Ic,{me:e,onDone:()=>h(!1)}),(0,L.jsx)(`div`,{className:`mx-2 my-1.5 h-px bg-border-soft`})]}):null,d&&!(jc(e)&&s)?null:te&&jc(e)?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`flex w-full items-center gap-3 rounded-lg px-2 py-1.5 text-left transition hover:bg-accent`,onClick:()=>{h(!1),ee(!0)},children:[(0,L.jsx)(Pc,{org:te,size:`xs`}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col leading-tight`,children:[(0,L.jsx)(`span`,{className:`truncate font-semibold text-[0.875rem] text-ink`,children:te.name}),te.plan?(0,L.jsx)(`span`,{className:`truncate text-[0.75rem] text-ink-4`,children:te.plan.name}):null]}),(0,L.jsx)(`span`,{className:`shrink-0 text-[0.8125rem] text-ink-3`,children:P(`organizations.switchShort`)}),(0,L.jsx)(me,{className:`size-4 shrink-0 text-ink-4`})]}),(0,L.jsx)(`div`,{className:`mx-2 my-1.5 h-px bg-border-soft`})]}):e.tenant.name?(0,L.jsx)(`div`,{className:`truncate px-2 pt-1.5 pb-1 text-[0.75rem] text-ink-3`,children:e.tenant.name}):null,(d?[]:l).map(e=>{let t=e.id===c?.id;return(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`flex w-full items-center gap-3 rounded-lg px-2 py-1.5 text-left transition hover:bg-accent`,onClick:()=>{h(!1),t?a(`/`):u(e.id)},children:[(0,L.jsx)(Cw,{project:e,size:`sm`}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col leading-tight`,children:[(0,L.jsx)(`span`,{className:j(`truncate text-[0.875rem]`,t?`font-semibold text-ink`:`font-medium text-ink-2`),children:e.name}),(0,L.jsx)(`span`,{className:`truncate text-[0.75rem] text-ink-4`,children:P(`nav.wizardCount`,{n:e.wizardCount})})]}),t?(0,L.jsx)(he,{className:`size-4 shrink-0 text-ember-strong`}):null]},e.id)}),d?null:(0,L.jsx)(`div`,{className:`mx-2 my-1.5 h-px bg-border-soft`}),[{to:`/`,icon:Mt,label:P(d?`nav.allWizards`:`nav.wizardsInSpace`),show:!0},{to:`/new`,icon:De,label:P(`nav.addWizard`),show:p}].filter(e=>e.show).map(e=>(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:w,onClick:()=>{h(!1),a(e.to)},children:[(0,L.jsx)(e.icon,{className:`size-4 shrink-0 text-ink-3`}),(0,L.jsx)(`span`,{className:`truncate`,children:e.label})]},e.to)),d&&!jc(e)?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`mx-2 my-1.5 h-px bg-border-soft`}),(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:w,onClick:()=>{h(!1),f()},children:[(0,L.jsx)(Ki,{className:`size-4 shrink-0 text-ink-3`}),(0,L.jsx)(`span`,{className:`truncate`,children:P(`organizations.manage`)})]})]}):null,c&&!c.readOnly&&!d?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`mx-2 my-1.5 h-px bg-border-soft`}),(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:w,onClick:()=>{h(!1),y(!0)},children:[(0,L.jsx)(xt,{className:`size-4 shrink-0 text-ink-3`}),(0,L.jsx)(`span`,{className:`truncate`,children:P(`nav.renameSpace`)})]})]}):null,p&&!C?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`mx-2 my-1.5 h-px bg-border-soft`}),(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:w,onClick:()=>{h(!1),_(!0)},children:[(0,L.jsx)(De,{className:`size-4 shrink-0 text-ink-3`}),(0,L.jsx)(`span`,{className:`flex min-w-0 flex-1 flex-col leading-tight`,children:(0,L.jsx)(`span`,{className:`truncate`,children:P(`nav.addSpace`)})})]})]}):null]}):null,(0,L.jsx)(WC,{open:g,onClose:()=>_(!1)}),jc(e)?(0,L.jsx)(Rc,{me:e,open:b,onClose:()=>ee(!1)}):null,c?(0,L.jsx)(Ew,{project:c,open:v,onClose:()=>y(!1)}):null]})})}function Ew({project:e,open:t,onClose:n}){let r=w(),[i,a]=(0,I.useState)(e.name);(0,I.useEffect)(()=>{t&&a(e.name)},[t,e.name]);let o=zt({mutationFn:()=>p.patch(`/api/studio/projects/${e.id}`,{name:i.trim()}),onSuccess:async()=>{await r.invalidateQueries({queryKey:E.spaces()}),n()}});return(0,L.jsx)(nt,{open:t,onClose:n,title:P(`nav.renameSpace`),children:(0,L.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.trim()&&o.mutate()},children:[(0,L.jsx)(_e,{autoFocus:!0,maxLength:80,"aria-label":P(`nav.renameSpace`),value:i,onChange:e=>a(e.target.value)}),(0,L.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,L.jsx)(D,{variant:`ghost`,onClick:n,children:P(`common.cancel`)}),(0,L.jsx)(D,{type:`submit`,busy:o.isPending,disabled:!i.trim(),children:P(`settings.save`)})]})]})})}function Dw({me:e,project:t}){let n=e.mode===`local`||t.origin===`local`,r=n?Wr:mr,i=P(n?`nav.spaceLocal`:`nav.spaceCloud`);return(0,L.jsx)(`span`,{title:i,className:`grid size-6 shrink-0 place-items-center text-ink-4`,children:(0,L.jsx)(r,{className:`size-3.5`,"aria-label":i})})}function Ow({me:e}){let{project:t}=un(),{phone:n}=ja(),r=ww(e);return t?r&&e.tenant.name?(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,L.jsxs)(Tw,{me:e,placement:`below`,label:e.tenant.name,className:e=>j(n?`-ml-1 flex max-w-[16rem] items-center gap-2.5 rounded-xl py-1 pr-2 pl-1`:`-mx-1 flex max-w-[16rem] items-center gap-1 rounded-md px-2 py-0.5`,`text-left font-medium text-[0.9375rem] text-ink transition hover:bg-accent`,e&&`bg-accent`),children:[n?(0,L.jsx)(Cw,{project:t,name:e.tenant.name,size:`sm`}):null,(0,L.jsx)(`span`,{className:`truncate`,children:e.tenant.name}),(0,L.jsx)(cr,{className:`size-3.5 shrink-0 text-ink-4`})]}),(0,L.jsx)(Dw,{me:e,project:t})]}):(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[e.tenant.name&&!n?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Lc,{me:e,className:`max-lg:hidden`}),(0,L.jsx)(`span`,{className:`text-ink-4 max-lg:hidden`,"aria-hidden":`true`,children:`/`})]}):null,(0,L.jsx)(Tw,{me:e,placement:`below`,label:t.name,className:e=>j(n?`-ml-1 flex max-w-[16rem] items-center gap-2.5 rounded-xl py-1 pr-2 pl-1 text-left font-medium text-[0.9375rem] text-ink transition hover:bg-accent`:`-mx-1 max-w-[16rem] translate-y-[0.5px] truncate rounded-md px-2 py-0.5 text-left font-medium text-[0.9375rem] text-ink transition hover:bg-accent`,e&&`bg-accent`),children:n?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Cw,{project:t,size:`sm`}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-col leading-tight`,children:[e.tenant.name?(0,L.jsx)(`span`,{className:`truncate font-normal text-[0.75rem] text-ink-3`,children:e.tenant.name}):null,(0,L.jsx)(`span`,{className:`truncate`,children:t.name})]})]}):t.name}),(0,L.jsx)(Dw,{me:e,project:t})]}):null}function kw({me:e,placement:t=`below`,named:n}){let[r,i]=(0,I.useState)(!1),a=(0,I.useRef)(null),o=A(),{position:s,phone:c}=ja();bw(a,r,()=>i(!1));let l=Wa(),[u,d]=(0,I.useState)(!1),f=an(e.user.name),p=yw(e,La(`account`)),m=e.mode===`managed`&&ba(e.features,`organizationSettings`),h=`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left text-[0.875rem] text-ink-2 hover:bg-accent hover:text-ink`;return(0,L.jsxs)(`div`,{className:j(`relative`,n&&`w-full`),ref:a,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:n?j(`flex w-full items-center gap-3 rounded-lg p-0.5 pr-2 text-left transition hover:bg-ink/10`,r&&`bg-ink/10`):`block shrink-0 rounded-full`,"aria-label":e.user.name||`Menu`,children:[(0,L.jsxs)(`span`,{className:j(`relative flex shrink-0 items-center justify-center rounded-full bg-ember-tint font-semibold text-[0.8125rem] text-ember-strong ring-1 ring-border-soft`,t===`below`?`size-9`:`size-10`),children:[e.user.image?(0,L.jsx)(`img`,{src:e.user.image,alt:``,className:`size-full rounded-full object-cover`}):f,p===`linked`||p===`expired`?(0,L.jsx)(`span`,{title:p===`linked`?P(`nav.connected`,{host:ES(e.account?.cloudUrl??``)}):P(`nav.expired`),className:`-right-1 -bottom-1 absolute flex size-4 items-center justify-center rounded-full bg-card ring-1 ring-border-soft`,children:p===`linked`?(0,L.jsx)(mr,{className:`size-2.5 text-moss`}):(0,L.jsx)(Ot,{className:`size-2.5 text-amber`})}):null]}),n?(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-[0.875rem] text-ink-2`,children:e.user.name}):null]}),r?(0,L.jsxs)(`div`,{className:j(`absolute z-50 w-72 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,xw(t,s,`top-11 right-0`)),children:[(0,L.jsxs)(`div`,{className:`px-3 pt-2 pb-2.5`,children:[(0,L.jsxs)(`div`,{className:`truncate font-medium text-[0.875rem]`,children:[e.user.name,p===`alone`?(0,L.jsxs)(`span`,{className:`font-normal text-ink-4`,children:[` (`,P(`nav.local`),`)`]}):null]}),(0,L.jsx)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:e.user.email}),e.tenant.name?(0,L.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5 text-[0.75rem] text-ink-2`,children:[(0,L.jsx)(nr,{className:`size-3.5 shrink-0 text-ink-4`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`truncate`,children:e.tenant.name})]}):null]}),p?(0,L.jsxs)(`button`,{type:`button`,className:`mx-1.5 mb-1.5 flex w-[calc(100%-0.75rem)] items-start gap-2.5 rounded-lg bg-paper-2 px-2.5 py-2 text-left text-[0.8125rem] text-ink-2 hover:text-ink`,onClick:()=>{i(!1),o(`/settings/account`)},children:[p===`linked`?(0,L.jsx)(mr,{className:`mt-0.5 size-4 shrink-0 text-moss`}):p===`expired`?(0,L.jsx)(Ot,{className:`mt-0.5 size-4 shrink-0 text-amber`}):(0,L.jsx)(Wr,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col leading-snug`,children:[(0,L.jsx)(`span`,{className:`break-words`,children:p===`linked`?P(`nav.connected`,{host:ES(e.account?.cloudUrl??``)}):P(p===`expired`?`nav.expired`:`nav.onlyHere`)}),(0,L.jsx)(`span`,{className:`font-medium text-ink tabular-nums`,children:p===`linked`?e.account?.credits!==null&&e.account?.credits!==void 0?P(`nav.credits`,{n:Math.floor(e.account.credits).toLocaleString(N)}):null:P(p===`expired`?`account.signInAgain`:`account.signIn`)})]})]}):null,(0,L.jsxs)(`button`,{type:`button`,className:h,onClick:()=>{i(!1),o(m?`/account`:`/settings/account`)},children:[(0,L.jsx)(ca,{className:`size-4`}),` `,P(`konto.title`)]}),!m&&e.manageUrl?(0,L.jsxs)(`a`,{className:h,href:`${e.manageUrl}/account`,target:`_blank`,rel:`noreferrer`,children:[(0,L.jsx)(vr,{className:`size-4`}),` `,P(`nav.account`)]}):null,c&&!Ra()?(0,L.jsxs)(`button`,{type:`button`,className:h,onClick:()=>{i(!1),l?Ga(l):d(!0)},children:[(0,L.jsx)(Dt,{className:`size-4`}),` `,P(`install.app.action`)]}):null,(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2 text-[0.875rem] text-ink-2`,children:[P(`nav.theme`),(0,L.jsx)(TS,{})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2 text-[0.875rem] text-ink-2`,children:[P(`nav.language`),(0,L.jsx)(bS,{tone:`surface`})]}),e.mode===`managed`?(0,L.jsxs)(`button`,{type:`button`,className:h,onClick:()=>{i(!1),oc({where:`studio`})},children:[(0,L.jsx)(jt,{className:`size-4`}),` `,P(`report.open`)]}):null,e.mode===`managed`?(0,L.jsxs)(`button`,{type:`button`,className:h,onClick:()=>void ln(),children:[(0,L.jsx)(Qr,{className:`size-4`}),` `,P(`nav.logout`)]}):null]}):null,(0,L.jsx)(Ec,{open:u,onClose:()=>d(!1)})]})}function Aw({me:e,children:t}){let{phone:n}=ja(),r=Ue().pathname.startsWith(`/account`);return(0,L.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-2 px-3 coarse:h-14 sm:gap-3 sm:px-4 md:px-5`,children:[r?null:(0,L.jsx)(Ow,{me:e}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,L.jsx)(gw,{alone:r}),t]}),n?(0,L.jsx)(kw,{me:e}):null]})}var jw=`studio-scroll`;function Mw(){return document.getElementById(`studio-scroll`)??document.documentElement}var Nw={left:`md:py-2 md:pr-2`,right:`md:py-2 md:pl-2`,top:`md:px-2 md:pb-2`,bottom:`md:px-2 md:pt-2`},Pw={left:`flex-row`,right:`flex-row-reverse`,top:`flex-col`,bottom:`flex-col-reverse`};function Fw({me:e,wide:t,full:n,children:r}){let{position:i,phone:a}=ja(),o=(0,I.useRef)(null),s=a&&!n?`calc(4.75rem + env(safe-area-inset-bottom))`:`0px`,c=La(`goose`),l=pS()&&c&&!n,u=Na(!!n||l);return OC(e.tenant.id),(0,L.jsxs)(`div`,{className:j(`flex h-dvh overflow-hidden bg-sidebar`,Pw[i]),children:[a?n?null:(0,L.jsx)(ol,{me:e}):(0,L.jsx)(nl,{me:e,labels:u.shown,room:u.room}),(0,L.jsxs)(`div`,{className:j(`flex min-h-0 min-w-0 flex-1 md:gap-2`,Nw[i]),children:[(0,L.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background md:rounded-xl md:shadow-elevated md:dark:ring-1 md:dark:ring-border-soft`,children:[e.impersonation?(0,L.jsx)(ma,{name:e.user.name||e.user.email,until:e.impersonation.until}):null,(0,L.jsx)(lw,{}),(0,L.jsx)(Ac,{me:e}),(0,L.jsx)(Mu,{me:e}),n?(0,L.jsx)(`main`,{className:`relative flex min-h-0 flex-1 flex-col overflow-hidden`,children:r}):(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsx)(Aw,{me:e}),(0,L.jsxs)(`div`,{ref:o,className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,L.jsx)(`main`,{id:jw,className:`relative min-h-0 flex-1 overflow-y-auto`,style:{paddingBottom:`max(var(--assistant-dock, 0px), ${s})`},children:(0,L.jsx)(`div`,{className:j(`mx-auto w-full px-3 pt-4 pb-12 sm:px-6 sm:pt-6`,t?`max-w-[88rem]`:`max-w-5xl`),children:r})}),c&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(sS,{column:o}),(0,L.jsx)(hS,{})]})]})]})]}),c&&!n?(0,L.jsx)(mS,{}):null]})]})}function Iw(){return[{id:`info`,label:P(`space.info`),icon:Sr},{id:`brand`,label:P(`space.brand`),icon:Qi},{id:`knowledge`,label:P(`space.knowledge`),icon:er},{id:`data`,label:P(`space.data`),icon:le},{id:`skills`,label:P(`space.skills`),icon:Bi},{id:`page`,label:P(`space.page`),icon:Wt}]}function Lw(e,t){let n=[...e];for(let e of t.spaceParts){let r=n.findIndex(t=>t.id===(e.after??`data`))+1;for(;r<n.length&&t.spaceParts.some(e=>e.id===n[r].id);)r++;n.splice(r,0,{id:e.id,label:e.label(),icon:e.icon})}return n}function Rw(e){return e===`info`||e===`brand`||e===`knowledge`||e===`data`||e===`page`||e===`results`||e===`skills`}var zw=[{id:`base`,group:`info`,label:`project.base`,icon:It},{id:`facts`,group:`info`,label:`project.facts`,icon:At},{id:`logos`,group:`brand`,label:`project.logos`,icon:Ji},{id:`colors`,group:`brand`,label:`project.colors`,icon:mi},{id:`typography`,group:`brand`,label:`project.typography`,icon:Wn},{id:`assets`,group:`brand`,label:`project.assets`,icon:Ir},{id:`documents`,group:`knowledge`,label:`project.documents`,icon:C},{id:`page`,group:`page`,label:`page.sectionPage`,icon:Wt},{id:`page-words`,group:`page`,label:`page.sectionWords`,icon:It},{id:`page-wizards`,group:`page`,label:`page.sectionWizards`,icon:Jr}],Bw=zw.map(e=>e.id);function Vw(e,t){let n=t.spaceSections.find(t=>t.id===e);return zw.find(t=>t.id===e)?.group??(n?n.group??`knowledge`:null)}function Hw(e,t,n=[]){let r=zw.filter(t=>t.group===e&&!n.includes(t.id)).map(e=>({id:e.id,label:P(e.label),icon:e.icon})),i=new Map;for(let n of t.spaceSections){if((n.group??`knowledge`)!==e)continue;let t=i.get(n.plugin)??[];t.push({id:n.id,label:n.label()}),i.set(n.plugin,t)}return[...r.length?[{plugin:null,label:null,sections:r}]:[],...[...i].map(([e,n])=>({plugin:e,label:t.plugins.find(t=>t.id===e)?.name??e,sections:n}))]}globalThis.__WIZARDS_STUDIO__={react:I,jsx:L,reactDom:{createPortal:va.createPortal,flushSync:va.flushSync},router:{Link:o,Navigate:ft,NavLink:Pe,useLocation:Ue,useNavigate:A,useParams:Qe,useSearchParams:lt},query:{useMutation:zt,useQuery:Ae,useQueryClient:w},ui:ut,sdk:ga};var Uw=0,$={status:`idle`,plugins:[],canReload:!1,problems:[],failed:{},pages:[],nav:[],sections:[],spaceSections:[],spaceParts:[],spaceMenus:{},shareSections:[],shareSetups:[],cards:[]},Ww=new Set;function Gw(e){$={...$,...e};for(let e of Ww)e()}function Kw(){return(0,I.useSyncExternalStore)(e=>(Ww.add(e),()=>Ww.delete(e)),()=>$)}var qw=new Set([`account`,`project`,`connectors`,`models`,`build`,`plugins`]),Jw=new Set([`info`,`brand`,`knowledge`,`data`,`page`,`results`]),Yw=new Map,Xw=null,Zw=e=>`${e.script}|${e.styles}`,Qw=e=>`__wizardsPlugin_${e.replaceAll(`-`,`_`)}`;function $w(){let{project:e}=un(),t=e?.id,n=e?.name??``,r=e?.readOnly??!1,i=JSON.stringify({name:e?.brand.name??``,colors:(e?.brand.colors??[]).map(({name:e,value:t})=>({name:e,value:t})),fonts:(e?.brand.fonts??[]).map(({family:e,role:t,weights:n})=>({family:e,role:t,weights:n}))});return(0,I.useMemo)(()=>t?{id:t,name:n,readOnly:r,brand:JSON.parse(i)}:null,[t,n,r,i])}var eT=(0,I.createContext)(null);function tT({part:e,children:t}){return(0,L.jsx)(eT.Provider,{value:e,children:t})}function nT(e){let t=(0,I.useContext)(eT),n=JSON.stringify(e.map(e=>[e.id,e.label]));(0,I.useEffect)(()=>{if(t)return Gw({spaceMenus:{...$.spaceMenus,[t]:e}}),()=>{let{[t]:e,...n}=$.spaceMenus;Gw({spaceMenus:n})}},[t,n])}function rT({plugin:e,...t}){return gb({...t,plugin:e}),null}function iT(e,t){let{id:n}=e,r=e=>`/api/studio/plugins/${n}${e.startsWith(`/`)?e:`/${e}`}`,i=e=>e.filter(e=>e.plugin!==n);return{plugin:{id:n,name:e.name,version:e.version},registerPage(e){let r=e.path.split(`/`)[1]??``;if(!e.path.startsWith(`/`)||Fe.has(r))throw Error(`"${e.path}" is an address of the studio itself.`);if([...i($.pages),...t.pages].some(t=>t.path===e.path))throw Error(`"${e.path}" is registered already.`);t.pages.push({...e,plugin:n,serial:++Uw})},registerNav(e){t.nav.push({...e,plugin:n,serial:++Uw})},registerSettingsSection(e){let r=[...i($.sections),...t.sections].some(t=>t.id===e.id);if(qw.has(e.id)||r)throw Error(`The settings have a section "${e.id}" already.`);t.sections.push({...e,plugin:n,serial:++Uw})},registerSpaceSection(e){let r=[...i($.spaceSections),...t.spaceSections].some(t=>t.id===e.id);if(Bw.includes(e.id)||r)throw Error(`The space page has a section "${e.id}" already.`);t.spaceSections.push({...e,plugin:n,serial:++Uw})},registerSpacePart(e){let r=[...i($.spaceParts),...t.spaceParts].some(t=>t.id===e.id);if(!/^[a-z][a-z0-9-]{0,39}$/.test(e.id)||Jw.has(e.id)||r)throw Error(`The space page has a part "${e.id}" already.`);t.spaceParts.push({...e,plugin:n,serial:++Uw})},registerShareSection(e){if([...i($.shareSections),...t.shareSections].some(t=>t.runner===e.runner))throw Error(`The runner "${e.runner}" has a share section already.`);t.shareSections.push({...e,plugin:n,serial:++Uw})},registerShareSetup(e){if([...i($.shareSetups),...t.shareSetups].some(t=>t.runner===e.runner))throw Error(`The runner "${e.runner}" has a share setup already.`);t.shareSetups.push({...e,plugin:n,serial:++Uw})},registerAssistantCard(e){if(t.cards.some(t=>t.tool===e.tool))throw Error(`The tool "${e.tool}" has a card already.`);t.cards.push({...e,plugin:n,serial:++Uw})},useSpace:$w,useSpaceMenu:nT,useCrumbs:pw,Assistant:e=>(0,L.jsx)(rT,{plugin:n,...e}),useAssistantPage:e=>gb({...e,plugin:n}),useAssistantTool:(e,t,r)=>Jb(`${n.replaceAll(`-`,`_`)}_${e}`,t,r),i18n:{register:e=>(t,n)=>{let r=e[N]?.[t]??e.de[t]??t;for(let[e,t]of Object.entries(n??{}))r=r.replace(`{${e}}`,String(t));return r},lang:()=>N},api:{get:e=>p.get(r(e)),post:(e,t)=>p.post(r(e),t),put:(e,t)=>p.put(r(e),t),patch:(e,t)=>p.patch(r(e),t),del:e=>p.del(r(e))},me:()=>({user:{id:Xw.user.id,name:Xw.user.name,email:Xw.user.email},tenant:Xw.tenant,mode:Xw.mode}),onUnload(e){t.disposers.push(e)}}}function aT(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.src=e,r.onload=()=>{r.remove(),t()},r.onerror=()=>{r.remove(),n(Error(`The plugin's script did not load.`))},document.head.append(r)})}function oT(e,t){return new Promise(n=>{let r=document.createElement(`link`);r.rel=`stylesheet`,r.href=t,r.dataset.plugin=e,r.onload=()=>n(r),r.onerror=()=>n(r),document.head.append(r)})}function sT(e,t,n){for(let n of t)try{n()}catch(t){console.error(`[plugin ${e}]`,t)}n?.remove()}function cT(e){let t=Yw.get(e);Yw.delete(e),sT(e,t?.disposers??[],t?.link??null);let{[e]:n,...r}=$.failed;Gw({failed:r,pages:$.pages.filter(t=>t.plugin!==e),nav:$.nav.filter(t=>t.plugin!==e),sections:$.sections.filter(t=>t.plugin!==e),spaceSections:$.spaceSections.filter(t=>t.plugin!==e),spaceParts:$.spaceParts.filter(t=>t.plugin!==e),shareSections:$.shareSections.filter(t=>t.plugin!==e),shareSetups:$.shareSetups.filter(t=>t.plugin!==e),cards:$.cards.filter(t=>t.plugin!==e)})}async function lT(e){let{id:t}=e,n={pages:[],nav:[],sections:[],spaceSections:[],spaceParts:[],shareSections:[],shareSetups:[],cards:[],disposers:[]},r=null;try{e.styles&&(r=await oT(t,$e(e.styles))),await aT($e(e.script));let i=globalThis,a=Qw(t),o=i[a];i[a]=void 0;let s=typeof o==`function`?o:o?.default;if(typeof s!=`function`)throw Error(`The plugin's script has no default export.`);s(iT(e,n))}catch(i){console.error(`[plugin ${t}]`,i),sT(t,n.disposers,r),cT(t),Yw.set(t,{key:Zw(e),disposers:[],link:null}),Gw({failed:{...$.failed,[t]:i.message}});return}let i=Yw.get(t);Yw.set(t,{key:Zw(e),disposers:n.disposers,link:r});let{[t]:a,...o}=$.failed;Gw({failed:o,pages:[...$.pages.filter(e=>e.plugin!==t),...n.pages],nav:[...$.nav.filter(e=>e.plugin!==t),...n.nav],sections:[...$.sections.filter(e=>e.plugin!==t),...n.sections],spaceSections:[...$.spaceSections.filter(e=>e.plugin!==t),...n.spaceSections],spaceParts:[...$.spaceParts.filter(e=>e.plugin!==t),...n.spaceParts],shareSections:[...$.shareSections.filter(e=>e.plugin!==t),...n.shareSections],shareSetups:[...$.shareSetups.filter(e=>e.plugin!==t),...n.shareSetups],cards:[...$.cards.filter(e=>e.plugin!==t),...n.cards]}),sT(t,i?.disposers??[],i?.link??null)}var uT=Promise.resolve();function dT(){return uT=uT.catch(()=>void 0).then(async()=>{let e=await p.get(`/api/studio/plugins`);for(let t of[...Yw.keys()])e.plugins.some(e=>e.id===t&&e.script)||cT(t);Gw(e);for(let t of e.plugins)t.script&&Yw.get(t.id)?.key!==Zw(t)&&await lT(t)}).catch(e=>console.error(`[plugins]`,e)).finally(()=>Gw({status:`ready`})),uT}var fT=null;function pT(e){Xw=e,$.status===`idle`&&(Gw({status:`loading`}),dT().then(()=>{$.canReload&&!fT&&(fT=new EventSource($e(`/api/studio/plugins/-/events`),{withCredentials:!0}),fT.addEventListener(`change`,()=>void dT()))}))}async function mT(e){await p.post(e?`/api/studio/plugins/-/reload/${e}`:`/api/studio/plugins/-/reload`),await dT()}var hT=class extends I.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){console.error(`[plugin]`,e)}render(){return this.state.failed?(0,L.jsx)(b,{children:P(`plugins.crashed`)}):this.props.children}};function gT({of:e,children:t}){return(0,L.jsx)(`div`,{"data-plugin":e.plugin,className:`contents`,children:(0,L.jsx)(hT,{children:t},e.serial)})}function _T({end:e,className:t}){return(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-4 ${t??``}`,children:[(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-2.5`,children:[(0,L.jsx)(pn,{size:28}),(0,L.jsxs)(`span`,{className:`font-display font-semibold text-[1.0625rem] tracking-tight ${e?`max-sm:sr-only`:``}`,children:[`engenty`,(0,L.jsx)(`span`,{className:`mr-[0.09em] ml-[0.06em] text-ember-strong`,children:`.`}),(0,L.jsx)(`span`,{className:`font-normal text-ink-2`,children:`wizards`})]})]}),(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:e?`flex max-sm:hidden`:`flex`,children:(0,L.jsx)(TS,{tone:`surface`})}),(0,L.jsx)(bS,{tone:`surface`}),e]})]})}var vT={de:{imprint:`/de/impressum`,privacy:`/de/datenschutz`,terms:`/de/nutzungsbedingungen`},en:{imprint:`/imprint`,privacy:`/privacy`,terms:`/terms`}};function yT({failed:e}){let t=Cn(),[n,r]=(0,I.useState)(()=>en()??``),[i,o]=(0,I.useState)(!1),s=qe(n,r,{endpoint:null}),c=()=>{let e=n.trim();e&&!i&&(s.listening&&s.stop(),o(!0),cn(e),on(`${a}/new`,e))};return(0,L.jsxs)(`div`,{className:`min-h-dvh px-6 pb-16 sm:px-10`,children:[(0,L.jsx)(_T,{className:`pt-6 sm:pt-8`,end:(0,L.jsx)(D,{variant:`secondary`,size:`sm`,onClick:()=>on(`${a}/`),children:P(`guest.signIn`)})}),(0,L.jsxs)(`div`,{className:`mx-auto max-w-2xl animate-rise pt-8 md:pt-12`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,L.jsx)(`div`,{className:`size-[84px] md:size-auto`,children:(0,L.jsx)(`div`,{className:`origin-top-left scale-[0.56] md:scale-100`,children:(0,L.jsx)(Xt,{kind:`sprout`,size:150,fluffy:!0})})}),(0,L.jsx)(`h1`,{className:`mt-1 font-display font-semibold text-[1.5rem] leading-tight tracking-tight md:mt-2 md:text-[2.375rem]`,children:P(`new.title`)})]}),(0,L.jsxs)(`div`,{className:`relative mt-6 rounded-2xl bg-card p-2 shadow-elevated ring-1 ring-border-soft focus-within:ring-focus md:mt-8`,children:[(0,L.jsx)(Te,{autoFocus:!0,minRows:4,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&c()},placeholder:s.listening?P(`editor.listening`):P(`new.placeholder`),className:`border-0 bg-transparent text-[1rem] shadow-none focus:ring-0`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2 px-1 pb-1`,children:[s.supported?(0,L.jsx)(Ve,{speech:s,labelled:!0}):null,(0,L.jsx)(`span`,{className:`flex-1`}),(0,L.jsxs)(D,{size:`md`,onClick:c,busy:i,disabled:!n.trim(),children:[P(`new.build`),` `,(0,L.jsx)(y,{className:`size-4`})]})]})]}),s.error?(0,L.jsx)(`p`,{className:`mt-2 px-3 text-[0.75rem] text-rose`,children:s.error===`denied`?P(`editor.micDenied`):s.error}):null,e?(0,L.jsx)(`p`,{className:`mt-3 text-center text-[0.875rem] text-rose`,children:P(`auth.failed`)}):null,(0,L.jsx)(`p`,{className:`mt-3 text-center text-[0.875rem] text-ink-3`,children:P(`guest.hint`)})]}),(0,L.jsxs)(`section`,{className:`mx-auto max-w-5xl`,children:[(0,L.jsx)(`h2`,{className:`mt-16 mb-5 text-center font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.08em]`,children:P(`new.orStarter`)}),(0,L.jsx)(Ft,{onGuestOpen:e=>on(`${a}/new?starter=${encodeURIComponent(e.id)}`)})]}),(0,L.jsxs)(`footer`,{className:`mt-16 flex flex-wrap justify-center gap-x-5 gap-y-1 text-[0.75rem] text-ink-3`,children:[(0,L.jsx)(`span`,{children:`engenty.wizards`}),[`imprint`,`privacy`,`terms`].map(e=>(0,L.jsx)(`a`,{href:vT[t][e],className:`transition hover:text-ink-2`,children:P(`legal.${e}`)},e))]})]})}var bT=/(?:^|;\s*)engenty_signed_in=1(?:;|$)/;function xT(){return!!window.engentyDesktop}function ST({text:e}){return e.split(/(?<=[.!?])\s+/).map(e=>(0,L.jsx)(`span`,{className:`block`,children:e},e))}function CT({title:e,children:t,className:n=`mt-8`}){return(0,L.jsxs)(`div`,{className:`${n} w-full rounded-xl bg-card px-5 py-4 text-left text-[0.875rem] text-ink-2 leading-relaxed shadow-soft ring-1 ring-border-soft`,children:[(0,L.jsx)(`div`,{className:`mb-1.5 font-medium text-ink`,children:e}),t]})}function wT({text:e}){let[t,n]=(0,I.useState)(!1);return(0,L.jsxs)(`div`,{className:`mt-2 flex items-center gap-3 rounded-xl bg-[oklch(22%_0.02_262)] py-2.5 pr-2.5 pl-4 font-mono text-[0.9375rem] text-white shadow-soft`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`select-none text-white/40`,children:`$`}),(0,L.jsx)(`code`,{className:`min-w-0 flex-1 select-all break-all`,children:e}),(0,L.jsx)(`button`,{type:`button`,"aria-label":P(t?`settings.copied`:`settings.copy`),title:P(t?`settings.copied`:`settings.copy`),className:`flex size-8 shrink-0 items-center justify-center rounded-lg text-white/60 transition hover:bg-white/10 hover:text-white focus-visible:outline-2 focus-visible:outline-white/60`,onClick:async()=>{try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}},children:t?(0,L.jsx)(he,{className:`size-4`}):(0,L.jsx)(Et,{className:`size-4`})})]})}function TT(){let e=Ae({queryKey:[`config`],queryFn:()=>p.get(`/api/config`),refetchInterval:e=>e.state.status===`error`&&!(e.state.error instanceof S&&e.state.error.body?.code===`host`)&&2e3,retry:!1}),t=w(),[n,r]=(0,I.useState)(!1),[i,a]=(0,I.useState)(!1),o=new URLSearchParams(window.location.search).get(`signin`)===`failed`,s=e.data?.mode===`local`&&e.data.devLogin,[c,l]=(0,I.useState)(!1),u=e.data?.mode===`managed`&&!o&&!xT()&&bT.test(document.cookie);if((0,I.useEffect)(()=>{u&&on()},[u]),(0,I.useEffect)(()=>{if(!s||c)return;let e=!0;return p.post(`/api/dev/login`).then(()=>t.invalidateQueries()).catch(()=>{e&&l(!0)}),()=>{e=!1}},[s,c,t]),e.isLoading||u||s&&!c)return(0,L.jsx)(`div`,{className:`flex min-h-dvh items-center justify-center`,children:(0,L.jsx)(Xt,{kind:`round`,size:56})});if(e.data?.mode===`managed`&&!e.data.devLogin&&!xT())return(0,L.jsx)(yT,{failed:o});let d=e.data?.mode===`local`&&!e.data.devLogin,f=e.error instanceof S&&e.error.body?.code===`host`?e.error:null,m=f?String(f.body.appUrl??``):null,h=d&&!f&&!e.isError,g=e.data?.openCommand===void 0?`wizards open`:e.data.openCommand;return(0,L.jsxs)(`div`,{className:`relative flex min-h-dvh flex-col items-center justify-center px-6 py-16`,children:[(0,L.jsx)(_T,{className:`absolute inset-x-6 top-6 sm:inset-x-10 sm:top-8`}),(0,L.jsxs)(`div`,{className:`flex w-full max-w-md animate-rise flex-col items-center text-center`,children:[(0,L.jsx)(Xt,{kind:`round`,size:d||e.isError?140:200,fluffy:!0}),(0,L.jsxs)(`span`,{className:`mt-2 font-display font-semibold text-[0.9375rem] text-ink-3 tracking-tight`,children:[(0,L.jsx)(fn,{}),(0,L.jsx)(`span`,{className:`font-normal`,children:`wizards`})]}),(0,L.jsx)(`h1`,{className:`mt-3 text-balance font-display font-semibold text-[2.125rem] leading-[1.1] tracking-tight`,children:h?P(`auth.localTitle`):(0,L.jsx)(ST,{text:P(`brand.tagline`)})}),h?null:(0,L.jsx)(`p`,{className:`mt-4 text-balance text-[1rem] text-ink-2 leading-relaxed`,children:(0,L.jsx)(ST,{text:P(`brand.sub`)})}),m?(0,L.jsxs)(CT,{title:P(`auth.wrongHost`),children:[(0,L.jsx)(`p`,{children:P(`auth.wrongHostWhy`)}),(0,L.jsx)(`a`,{href:`${m}${window.location.pathname}`,className:`mt-1.5 block break-all font-medium text-ember-strong underline-offset-2 hover:underline`,children:m})]}):e.isError?(0,L.jsx)(CT,{title:P(`auth.unreachable`),children:P(`auth.unreachableWhy`,{address:window.location.host})}):null,(0,L.jsxs)(`div`,{className:`mt-10 flex w-full flex-col gap-3`,children:[o?(0,L.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:P(`auth.failed`)}):null,e.data?.mode===`managed`?(0,L.jsx)(D,{size:`lg`,busy:n,className:`w-full`,onClick:async()=>{r(!0);let e=window.engentyDesktop;if(!e){on();return}let{url:t}=await p.post(`/api/auth/desktop/start`);e.open(t),a(!0),r(!1)},children:P(i?`local.accountWaiting`:`auth.signIn`)}):null,e.data?.devLogin?(0,L.jsx)(D,{size:`lg`,busy:n,className:`w-full`,onClick:async()=>{r(!0),await p.post(`/api/dev/login`),await t.invalidateQueries(),r(!1)},children:P(`auth.dev`)}):null,h?(0,L.jsxs)(`div`,{className:`-mt-6 text-left text-[0.9375rem] text-ink-2 leading-relaxed`,children:[g?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{children:P(`auth.localWhy`)}),(0,L.jsx)(wT,{text:g}),(0,L.jsx)(`p`,{className:`mt-6 text-[0.875rem] text-ink-3`,children:P(`auth.localStartLink`)}),(0,L.jsx)(wT,{text:`${g} --print`})]}):(0,L.jsx)(`p`,{children:P(`auth.localFromStart`)}),(0,L.jsx)(`p`,{className:`mt-6 text-center text-[0.875rem] text-ink-3`,children:P(`auth.localNoAccount`)})]}):null]}),e.data?.mode===`managed`?(0,L.jsx)(`p`,{className:`mt-6 text-[0.8125rem] text-ink-3`,children:P(`auth.legal`)}):null]}),(0,L.jsxs)(`footer`,{className:`absolute inset-x-0 bottom-6 text-center text-[0.75rem] text-ink-3 sm:bottom-8`,children:[`© engenty · `,P(`about.version`,{v:vc})]})]})}var ET=(0,I.lazy)(()=>Vt(()=>import(`./PublicRunner-MicrpVsv.js`).then(e=>({default:e.PublicRunner})),__vite__mapDeps([14,1,2,3,4,5,15,16,11,13,7,6,17,18]))),DT=(0,I.lazy)(()=>Vt(()=>import(`./SharePage-DXGzJSnR.js`).then(e=>({default:e.SharePage})),__vite__mapDeps([19,1,2,3,4,5,15,16,11,13,7,6,17,18,14]))),OT=(0,I.lazy)(()=>Vt(()=>import(`./EditorPage-DQ_2FOzI.js`).then(e=>({default:e.EditorPage})),__vite__mapDeps([20,1,2,3,4,5,9,10,11,12,13,7,6,16,21,15,17,18,22,23,24,25,26,27,28]))),kT=(0,I.lazy)(()=>Vt(()=>Promise.resolve().then(()=>HC).then(e=>({default:e.HomePage})),void 0)),AT=(0,I.lazy)(()=>Vt(()=>import(`./OnboardingPage-BEvq4slJ.js`).then(e=>({default:e.OnboardingPage})),__vite__mapDeps([29,1,2,3,4,5,10,13,7,6,22]))),jT=(0,I.lazy)(()=>Vt(()=>import(`./NewWizardPage-B24AF482.js`).then(e=>({default:e.NewWizardPage})),__vite__mapDeps([30,1,2,3,4,5,9,10,11,12,13,7,6,22,28,17,23]))),MT=(0,I.lazy)(()=>Vt(()=>import(`./SettingsPage-DY8O1r43.js`).then(e=>({default:e.SettingsPage})),__vite__mapDeps([31,1,2,3,4,5,9,10,11,12,13,7,6,24,32,22]))),NT=(0,I.lazy)(()=>Vt(()=>import(`./ProjectPage-ClRuhFJo.js`).then(e=>({default:e.ProjectPage})),__vite__mapDeps([33,1,2,3,4,5,9,10,11,12,13,7,6,21,15,16,17,18,22,23,32]))),PT=(0,I.lazy)(()=>Vt(()=>import(`./SetupPage-BOVkVpMu.js`).then(e=>({default:e.SetupPage})),__vite__mapDeps([34,1,2,3,4,5,10,13,7,6]))),FT=null;function IT(){return(0,L.jsx)(`div`,{className:`flex min-h-dvh items-center justify-center`,children:(0,L.jsx)(Xt,{kind:`round`,size:56})})}function LT({children:e,bare:t,wide:n,full:r}){let i=$t(),a=Ue();return Zt(i.data),(0,I.useEffect)(()=>{i.data&&pT(i.data)},[i.data]),i.isLoading?(0,L.jsx)(IT,{}):i.data?i.data.mode===`local`&&!i.data.setupDone&&a.pathname!==`/setup`?(0,L.jsx)(ft,{to:`/setup`,replace:!0}):i.data.onboarding&&a.pathname!==`/start`?(0,L.jsx)(ft,{to:`/start`,replace:!0}):t?(0,L.jsxs)(L.Fragment,{children:[i.data.impersonation?(0,L.jsx)(ma,{name:i.data.user.name||i.data.user.email,until:i.data.impersonation.until}):null,e]}):(0,L.jsx)(Fw,{me:i.data,wide:n,full:r,children:e}):(0,L.jsx)(TT,{})}function RT(){return Cn(),(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(IT,{}),children:(0,L.jsxs)(at,{children:[FT,(0,L.jsx)(Xe,{path:`/w/:token`,element:(0,L.jsx)(ET,{})}),(0,L.jsx)(Xe,{path:`/w/:token/steps`,element:(0,L.jsx)(ET,{steps:!0})}),(0,L.jsx)(Xe,{path:`/w/:token/steps/:runId`,element:(0,L.jsx)(ET,{steps:!0})}),(0,L.jsx)(Xe,{path:`/w/:token/chat`,element:(0,L.jsx)(ET,{chat:!0})}),(0,L.jsx)(Xe,{path:`/w/:token/chat/:runId`,element:(0,L.jsx)(ET,{chat:!0})}),(0,L.jsx)(Xe,{path:`/w/:token/talk`,element:(0,L.jsx)(ET,{chat:!0,talk:!0})}),(0,L.jsx)(Xe,{path:`/w/:token/talk/:runId`,element:(0,L.jsx)(ET,{chat:!0,talk:!0})}),(0,L.jsx)(Xe,{path:`/w/:token/video`,element:(0,L.jsx)(ET,{chat:!0,video:!0})}),(0,L.jsx)(Xe,{path:`/w/:token/video/:runId`,element:(0,L.jsx)(ET,{chat:!0,video:!0})}),(0,L.jsx)(Xe,{path:`/w/:token/:runId`,element:(0,L.jsx)(ET,{})}),(0,L.jsx)(Xe,{path:`/s/:token`,element:(0,L.jsx)(DT,{})}),(0,L.jsx)(Xe,{path:`*`,element:(0,L.jsx)(zT,{})})]})})}function zT(){return(0,I.useEffect)(()=>{window.location.replace(`${a}/`)},[]),(0,L.jsx)(IT,{})}function BT(){return Kw().status===`ready`?(0,L.jsx)(ft,{to:`/`,replace:!0}):(0,L.jsx)(IT,{})}function VT(){Cn(),(0,I.useEffect)(()=>(document.documentElement.dataset.studio=``,()=>{delete document.documentElement.dataset.studio}),[]);let e=Kw();return(0,L.jsx)(ix,{children:(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(IT,{}),children:(0,L.jsxs)(at,{children:[(0,L.jsx)(Xe,{path:`/`,element:(0,L.jsx)(LT,{children:(0,L.jsx)(kT,{})})}),(0,L.jsx)(Xe,{path:`/sign-in`,element:(0,L.jsx)(LT,{children:(0,L.jsx)(ft,{to:`/`,replace:!0})})}),(0,L.jsx)(Xe,{path:`/new`,element:(0,L.jsx)(LT,{children:(0,L.jsx)(jT,{})})}),(0,L.jsx)(Xe,{path:`/edit/:id`,element:(0,L.jsx)(LT,{full:!0,children:(0,L.jsx)(OT,{})})}),(0,L.jsx)(Xe,{path:`/space/:group?`,element:(0,L.jsx)(LT,{wide:!0,children:(0,L.jsx)(NT,{})})}),(0,L.jsx)(Xe,{path:`/settings/:section?`,element:(0,L.jsx)(LT,{wide:!0,children:(0,L.jsx)(MT,{})})}),(0,L.jsx)(Xe,{path:`/account/:section?`,element:(0,L.jsx)(LT,{wide:!0,children:(0,L.jsx)(MT,{scope:`account`})})}),(0,L.jsx)(Xe,{path:`/setup`,element:(0,L.jsx)(LT,{bare:!0,children:(0,L.jsx)(PT,{})})}),(0,L.jsx)(Xe,{path:`/start`,element:(0,L.jsx)(LT,{bare:!0,children:(0,L.jsx)(AT,{})})}),e.pages.map(e=>(0,L.jsx)(Xe,{path:e.path,element:(0,L.jsx)(LT,{wide:e.wide,children:(0,L.jsx)(gT,{of:e,children:(0,L.jsx)(e.component,{})})})},e.serial)),(0,L.jsx)(Xe,{path:`*`,element:(0,L.jsx)(LT,{bare:!0,children:(0,L.jsx)(BT,{})})})]})})})}var HT=class extends I.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e){tt(`error`,e.message,e.stack)}render(){let{error:e}=this.state;return e?(0,L.jsxs)(`div`,{className:`flex min-h-dvh flex-col items-center justify-center p-6 text-center`,children:[(0,L.jsx)(`h1`,{className:`font-display font-semibold text-[1.375rem]`,children:P(`report.crashed`)}),(0,L.jsx)(`p`,{className:`mt-2 max-w-md text-[0.9375rem] text-ink-3`,children:P(`report.crashedNote`)}),(0,L.jsxs)(`div`,{className:`mt-6 flex gap-3`,children:[(0,L.jsx)(D,{variant:`secondary`,onClick:()=>window.location.reload(),children:P(`report.reload`)}),(0,L.jsx)(D,{onClick:()=>oc({where:this.props.where,error:{message:e.message,stack:e.stack}}),children:P(`report.open`)})]}),(0,L.jsx)(hc,{})]}):this.props.children}},UT=`wizards.organizationHint`,WT=30;function GT(e){try{let t=JSON.parse(sessionStorage.getItem(UT)??`null`);return t?.slug===e&&Date.now()-t.at<WT*1e3}catch{return!1}}function KT(e){try{sessionStorage.setItem(UT,JSON.stringify({slug:e,at:Date.now()}))}catch{}}function qT(e,t){let n=e.slice(a.length),r=n.split(`/`)[1]??``;if(!t)return{kind:`here`,root:Fe.has(r)?a:`${a}/${r}`};let i=t.mode===`managed`?t.tenant.slug:null;if(!i)return{kind:`here`,root:a};let o=`${a}/${i}`;return r===i?{kind:`here`,root:o}:t.organizations.some(e=>e.slug===r)&&!GT(r)?{kind:`switch`,slug:r}:Fe.has(r)?{kind:`move`,root:o,to:`${o}${n||`/`}`}:{kind:`foreign`,address:r,home:`${o}${n.slice(r.length+1)||`/`}`,me:t}}function JT({children:e}){let t=$t(),n=(0,I.useRef)(null);if(t.isLoading)return(0,L.jsx)(IT,{});n.current||={place:qT(window.location.pathname,t.data),tenant:t.data?.tenant.id??null};let{place:r}=n.current,{pathname:i,search:o,hash:s}=window.location;if(r.kind===`switch`){KT(r.slug);let e=new URLSearchParams({organization:r.slug,return:`${i}${o}`});return window.location.replace($e(`/api/auth/login?${e}`)),(0,L.jsx)(IT,{})}if(r.kind===`foreign`)return(0,L.jsx)(YT,{address:r.address,home:r.home,me:r.me});r.kind===`move`&&(window.history.replaceState(window.history.state,``,`${r.to}${o}${s}`),n.current.place={kind:`here`,root:r.root});let c=r.root,l=t.data?.mode===`managed`?t.data.tenant.slug:null,u=l?`${a}/${l}`:c;if(c!==a&&u!==c&&t.data?.tenant.id===n.current.tenant){let e=i.startsWith(c)?i.slice(c.length):`/`;window.history.replaceState(window.history.state,``,`${u}${e}${o}${s}`),n.current.place={kind:`here`,root:u},c=u}return Ee(c),(0,L.jsx)(ce,{basename:c,children:e},c)}function YT({address:e,home:t,me:n}){return(0,L.jsx)(`div`,{className:`flex min-h-dvh items-center justify-center px-6`,children:(0,L.jsxs)(`div`,{className:`flex max-w-md flex-col items-center gap-5 text-center`,children:[(0,L.jsx)(Xt,{kind:`round`,size:56}),(0,L.jsxs)(`div`,{className:`rounded-md bg-paper-2 px-2.5 py-1 font-mono text-[0.8125rem] text-ink-2`,children:[`/studio/`,e]}),(0,L.jsx)(`h1`,{className:`text-balance font-display font-semibold text-2xl`,children:P(`address.foreign.title`)}),(0,L.jsx)(`p`,{className:`text-[0.9375rem] text-ink-2`,children:P(`address.foreign.text`,{email:n.user.email})}),(0,L.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[(0,L.jsxs)(D,{onClick:()=>window.location.assign(t),children:[P(`address.foreign.continue`,{name:n.tenant.name??``}),(0,L.jsx)(y,{className:`size-4`})]}),(0,L.jsxs)(D,{variant:`secondary`,onClick:()=>void ln(),children:[(0,L.jsx)(Qr,{className:`size-4`}),P(`address.foreign.switchAccount`)]})]})]})})}function XT({view:e,failed:t}){let n=Fa(),[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(``),[s,c]=(0,I.useState)(!1);if(!n.data?.reports)return null;let l=(0,L.jsxs)(D,{variant:`ghost`,size:`sm`,onClick:()=>oc({where:`run`,runId:e.id,error:t&&e.error?{message:e.error}:null}),children:[(0,L.jsx)(jt,{className:`size-4`}),` `,P(`report.open`)]});if(t)return(0,L.jsx)(`div`,{className:`mt-4 flex justify-center`,children:l});let u=async(t,n)=>{i(t),await fetch($e(`/api/runs/${e.id}/feedback`),{method:`POST`,headers:{"content-type":`application/json`},credentials:`include`,body:JSON.stringify({good:t,...n?{comment:n}:{}})}).catch(()=>void 0),n!==void 0&&c(!0)};return(0,L.jsx)(`div`,{className:`mt-8 rounded-2xl border border-border bg-card p-4 sm:p-5`,children:s?(0,L.jsx)(`p`,{className:`text-ink-2 text-sm`,children:P(`feedback.thanks`)}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`mr-2 font-medium text-[0.9375rem]`,children:P(`feedback.ask`)}),(0,L.jsxs)(D,{size:`sm`,variant:r===!0?`quiet`:`secondary`,onClick:()=>void u(!0),children:[(0,L.jsx)(na,{className:`size-4`}),` `,P(`feedback.good`)]}),(0,L.jsxs)(D,{size:`sm`,variant:r===!1?`quiet`:`secondary`,onClick:()=>void u(!1),children:[(0,L.jsx)(ea,{className:`size-4`}),` `,P(`feedback.bad`)]}),(0,L.jsx)(`span`,{className:`ml-auto`,children:l})]}),r===null?null:(0,L.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 sm:flex-row sm:items-end`,children:[(0,L.jsx)(Te,{rows:2,value:a,placeholder:P(`feedback.more`),onChange:e=>o(e.target.value),className:`flex-1`}),(0,L.jsx)(D,{size:`sm`,onClick:()=>void u(r,a.trim()),children:P(`feedback.send`)})]})]})})}var ZT={mail:ei,folder:wr,chat:ci,plug:Ut,globe:Wt};function QT({runId:e,job:t,onAgain:n,onHome:r}){let[i,a]=(0,I.useState)(!1);if(t.status===`running`&&t.ask)return(0,L.jsx)(se,{runId:e,ask:t.ask},t.ask.id);if(t.status===`running`){let n=t.events.slice(-5);return(0,L.jsxs)(`div`,{className:`animate-rise`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col items-center py-6 text-center`,children:[(0,L.jsx)(dt,{className:`size-7 text-ember`}),(0,L.jsx)(`h3`,{className:`mt-4 font-display font-semibold text-[1.125rem]`,children:P(`shareRun.working`)}),(0,L.jsx)(`div`,{className:`mt-4 flex min-h-[5.5rem] w-full max-w-sm flex-col gap-1.5`,children:n.map((e,t)=>(0,L.jsxs)(`div`,{className:j(`flex items-center justify-center gap-2 text-[0.8125rem]`,t===n.length-1?`text-ink-2`:`text-ink-4`),children:[t===n.length-1?(0,L.jsx)(et,{className:`size-3.5 shrink-0 animate-breathe text-ember`}):null,(0,L.jsx)(`span`,{className:`truncate`,children:e.message})]},e.at+e.message))})]}),(0,L.jsx)(`div`,{className:`flex justify-center`,children:(0,L.jsx)(D,{variant:`ghost`,busy:i,onClick:()=>{a(!0),p.post(`/api/runs/${e}/share/jobs/${t.id}/cancel`).catch(()=>void 0)},children:P(`common.cancel`)})})]})}let o=t.status===`done`;return(0,L.jsxs)(`div`,{className:`animate-rise`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col items-center py-4 text-center`,children:[(0,L.jsx)(`div`,{className:j(`flex size-12 items-center justify-center rounded-full`,o?`bg-moss-tint text-moss`:`bg-rose-tint text-rose`),children:o?(0,L.jsx)(he,{className:`size-6`}):(0,L.jsx)(Je,{className:`size-6`})}),(0,L.jsx)(`h3`,{className:`mt-4 font-display font-semibold text-[1.125rem]`,children:P(o?`shareRun.done`:t.status===`cancelled`?`shareRun.cancelled`:`shareRun.failed`)}),o&&t.result?(0,L.jsx)(Tt,{text:t.result.summary,className:`mt-2 max-w-md text-[0.875rem] text-ink-2`}):t.error?(0,L.jsx)(`p`,{className:`mt-2 max-w-md text-[0.875rem] text-ink-2 leading-relaxed`,children:t.error}):null,o&&t.result?.url?(0,L.jsxs)(`a`,{href:t.result.url,target:`_blank`,rel:`noreferrer`,className:`mt-4 inline-flex h-10 items-center gap-2 rounded-full bg-paper-2 px-4 font-medium text-[0.875rem] text-ink hover:bg-paper-3 coarse:h-11`,children:[(0,L.jsx)(oe,{className:`size-4`}),` `,P(`share.open`)]}):null]}),(0,L.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3`,children:[n?(0,L.jsx)(D,{variant:`ghost`,onClick:n,children:P(o?`shareRun.again`:`shareRun.backToForm`)}):(0,L.jsx)(`span`,{}),(0,L.jsx)(D,{onClick:r,children:P(`shareRun.elsewhere`)})]})]})}function $T({steps:e,now:t}){return(0,L.jsx)(`ol`,{className:`mb-6 flex gap-2`,children:e.map((e,n)=>(0,L.jsxs)(`li`,{className:`min-w-0 flex-1`,"aria-current":n===t?`step`:void 0,children:[(0,L.jsx)(`div`,{className:j(`h-1 rounded-full`,n<t?`bg-moss`:n===t?`bg-ember`:`bg-paper-3`)}),(0,L.jsxs)(`div`,{className:j(`mt-1.5 truncate font-medium text-[0.75rem]`,n<t?`text-moss`:n===t?`text-ember-strong`:`text-ink-4`),children:[n+1,` · `,e]})]},e))})}function eE(e){return[...e.shown.filter(e=>e.output&&e.formats.length).map(e=>({from:e.step.id,label:e.label??e.step.title,formats:e.formats})),...e.lists.filter(e=>e.formats.length).map(e=>({from:`lists.${e.def.id}`,label:e.label??e.def.title,formats:e.formats}))]}function tE({deliverables:e,picked:t,onPick:n,error:r}){return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(xe,{children:P(`shareRun.files`)}),(0,L.jsx)(`ul`,{className:`overflow-hidden rounded-lg ring-1 ring-input`,children:e.map(e=>{let r=!!t[e.from];return(0,L.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 border-border-soft border-b bg-card px-3 py-2.5 last:border-0`,children:[(0,L.jsxs)(`label`,{className:`flex min-w-0 flex-1 basis-40 cursor-pointer items-center gap-2.5 text-[0.875rem] coarse:min-h-11`,children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:r,onChange:t=>n(e.from,t.target.checked?e.formats[0]:null),className:`size-4 shrink-0 accent-[var(--ember)] coarse:size-5`}),(0,L.jsx)(`span`,{className:j(`truncate`,!r&&`text-ink-3`),children:e.label})]}),r?(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.formats.map(r=>(0,L.jsx)(`button`,{type:`button`,"aria-pressed":t[e.from]===r,onClick:()=>n(e.from,r),className:j(`h-7 rounded-full px-2.5 font-medium text-[0.75rem] ring-1 transition coarse:h-9 coarse:px-3`,t[e.from]===r?`bg-ember-tint text-ink ring-ember`:`bg-card text-ink-3 ring-input hover:text-ink`),children:Ce[r]},r))}):null]},e.from)})}),r?(0,L.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-rose`,children:r}):null]})}function nE({field:e,value:t,choices:n,error:r,onChange:i}){let a=e.fromAccount?n:e.options;return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(xe,{required:e.required,hint:e.help,children:e.label}),e.kind===`textarea`?(0,L.jsx)(Te,{minRows:3,maxRows:12,value:t,placeholder:e.placeholder,onChange:e=>i(e.target.value)}):e.kind===`select`&&a?.length?(0,L.jsx)(Ne,{value:t,onChange:i,options:a,placeholder:``}):(0,L.jsx)(_e,{type:e.kind===`url`?`url`:`text`,inputMode:e.kind===`emails`?`email`:void 0,autoCapitalize:e.kind===`text`?void 0:`off`,autoComplete:`off`,spellCheck:e.kind===`text`,value:t,disabled:e.fromAccount&&n===void 0,placeholder:e.fromAccount&&n===void 0?P(`common.loading`):e.placeholder,onChange:e=>i(e.target.value)}),e.fromAccount&&n===null?(0,L.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:P(`shareRun.choicesFailed`)}):null,r?(0,L.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-rose`,children:r}):null]})}function rE({view:e,target:t,draft:n,onStarted:r}){let i=e.id,a=!!t.connection,o=!t.connection||!!t.connection.account,[s,c]=(0,I.useState)(!o);(0,I.useEffect)(()=>{o||c(!0)},[o]);let l=(0,I.useMemo)(()=>eE(e),[e]),[u,d]=(0,I.useState)(()=>n?.picked??Object.fromEntries(l.map(e=>[e.from,e.formats[0]]))),[f,m]=(0,I.useState)(()=>n?.values??Object.fromEntries(t.fields.map(e=>[e.id,e.value??``]))),[h,g]=(0,I.useState)({}),[_,v]=(0,I.useState)({}),[b,ee]=(0,I.useState)(null),[te,x]=(0,I.useState)(!1),ne=t.fields.filter(e=>e.fromAccount).map(e=>e.id);(0,I.useEffect)(()=>{if(!o)return;let e=!0;for(let n of ne)p.get(`/api/runs/${i}/share/targets/${encodeURIComponent(t.key)}/choices/${n}?lang=${N}`).then(t=>e&&g(e=>({...e,[n]:t.choices.length?t.choices:null})),()=>e&&g(e=>({...e,[n]:null})));return()=>{e=!1}},[o,i,t.key]);let re=[...a?[P(`shareRun.stepAccount`)]:[],P(`shareRun.stepForm`),P(`shareRun.stepSend`)],C=async()=>{x(!0),v({}),ee(null);let e=t.takes===`files`?l.flatMap(e=>u[e.from]?[{from:e.from,format:u[e.from]}]:[]):[];try{r(await p.post(`/api/runs/${i}/share/jobs`,{target:t.key,items:e,values:f,lang:N}),{values:f,picked:u})}catch(e){let t=e instanceof S&&e.status===422?e.body?.fields:null;t?(v(t),t._account&&c(!0)):ee(e.message)}finally{x(!1)}};return a&&s?(0,L.jsxs)(`div`,{className:`animate-rise`,children:[(0,L.jsx)($T,{steps:re,now:0}),(0,L.jsx)(`p`,{className:`mb-4 text-[0.875rem] text-ink-2 leading-relaxed`,children:P(`shareRun.accountHint`)}),(0,L.jsx)(bt,{runId:i,connection:t.connection??void 0}),_._account?(0,L.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:_._account}):null,(0,L.jsx)(`div`,{className:`mt-6 flex justify-end`,children:(0,L.jsxs)(D,{disabled:!o,onClick:()=>c(!1),children:[P(`run.next`),` `,(0,L.jsx)(y,{className:`size-4`})]})})]}):(0,L.jsxs)(`form`,{className:`animate-rise`,onSubmit:e=>{e.preventDefault(),C()},children:[(0,L.jsx)($T,{steps:re,now:+!!a}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[a&&t.connection?.account?(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-paper-2 px-3 py-2 text-[0.8125rem]`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate text-ink-2`,children:P(`shareRun.as`,{account:t.connection.account.label})}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>c(!0),className:`shrink-0 text-ink-3 hover:text-ink coarse:min-h-11`,children:P(`shareRun.changeAccount`)})]}):null,t.agent?(0,L.jsxs)(`p`,{className:`flex items-start gap-2.5 rounded-lg bg-ember-tint px-3 py-2.5 text-[0.8125rem] text-ink-2 leading-relaxed`,children:[(0,L.jsx)(Ht,{className:`mt-0.5 size-4 shrink-0 text-ember-strong`}),` `,P(`shareRun.agentHint`)]}):null,t.presets.length?(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.presets.map(e=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>m(t=>({...t,...e.values})),className:`h-9 rounded-full bg-card px-3.5 font-medium text-[0.8125rem] text-ink-2 ring-1 ring-input transition hover:text-ink hover:ring-ember coarse:h-11`,children:e.label},e.label))}):null,t.fields.map(e=>(0,L.jsx)(nE,{field:e,value:f[e.id]??``,choices:h[e.id],error:_[e.id],onChange:t=>m(n=>({...n,[e.id]:t}))},e.id)),t.takes===`files`&&l.length?(0,L.jsx)(tE,{deliverables:l,picked:u,error:_._files,onPick:(e,t)=>d(n=>({...n,[e]:t}))}):null,b?(0,L.jsx)(`p`,{className:`rounded-lg bg-rose-tint px-3 py-2 text-[0.875rem] text-rose`,children:b}):null]}),(0,L.jsx)(`div`,{className:`action-bar mt-6 flex justify-end`,children:(0,L.jsxs)(D,{type:`submit`,busy:te,children:[(0,L.jsx)(Hi,{className:`size-4`}),` `,P(t.agent?`shareRun.start`:`shareRun.send`)]})})]})}function iE(e,t){let n=encodeURIComponent(e),r=encodeURIComponent(t);return[{id:`mail`,label:P(`shareRun.email`),href:`mailto:?subject=${r}&body=${r}%0A%0A${n}`},{id:`x`,label:`X`,href:`https://x.com/intent/post?text=${r}&url=${n}`},{id:`linkedin`,label:`LinkedIn`,href:`https://www.linkedin.com/sharing/share-offsite/?url=${n}`},{id:`whatsapp`,label:`WhatsApp`,href:`https://wa.me/?text=${r}%20${n}`},{id:`facebook`,label:`Facebook`,href:`https://www.facebook.com/sharer/sharer.php?u=${n}`}]}var aE={x:`𝕏`,linkedin:`in`,whatsapp:`WA`,facebook:`f`};function oE({view:e,title:t}){let n=e.id,[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)({at:`home`}),[s,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(null),[d,f]=(0,I.useState)({}),m=e.shareJob?.status===`running`?e.shareJob:null,h=(0,I.useCallback)(async()=>{try{c(await p.get(`/api/runs/${n}/share/targets?lang=${N}`)),u(null)}catch(e){u(e.message)}},[n]),g=()=>{i(!0),o(m?{at:`job`,id:m.id,key:null}:{at:`home`}),h()};(0,I.useEffect)(()=>{r&&a.at===`target`&&h()},[r,a.at,e,h]);let _=e.shareJob?.status;(0,I.useEffect)(()=>{r&&_&&_!==`running`&&h()},[r,_,h]);let v=a.at===`target`||a.at===`job`?s?.targets.find(e=>e.key===a.key):void 0,y=a.at===`job`?e.shareJob?.id===a.id?e.shareJob:s?.jobs.find(e=>e.id===a.id):void 0,b=a.at===`home`||a.at===`job`&&y?.status===`running`?null:()=>o({at:`home`});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(D,{variant:`secondary`,onClick:g,children:[m?(0,L.jsx)(dt,{className:`size-4`}):(0,L.jsx)(Be,{className:`size-4`}),` `,P(`shareRun.button`)]}),(0,L.jsx)(nt,{open:r,onClose:()=>i(!1),wide:!0,title:(0,L.jsxs)(`span`,{className:`flex items-center gap-1`,children:[b?(0,L.jsx)(be,{label:P(`run.back`),onClick:b,className:`-my-1.5 -ml-2`,children:(0,L.jsx)(ye,{className:`size-4`})}):null,a.at===`link`?P(`shareRun.linkTitle`):v?.name??y?.name??P(`shareRun.title`)]}),children:a.at===`link`?(0,L.jsx)(dE,{view:e,title:t,onWithdrawn:()=>o({at:`home`})}):a.at===`target`&&v?(0,L.jsx)(rE,{view:e,target:v,draft:d[v.key],onStarted:(e,t)=>{f(e=>({...e,[v.key]:t})),o({at:`job`,id:e.id,key:v.key})}},v.key):a.at===`job`&&y?(0,L.jsx)(QT,{runId:n,job:y,onAgain:a.key?()=>o({at:`target`,key:a.key}):null,onHome:()=>o({at:`home`})}):l?(0,L.jsx)(`p`,{className:`rounded-lg bg-rose-tint px-3 py-2 text-[0.875rem] text-rose`,children:l}):s?(0,L.jsx)(lE,{overview:s,onLink:()=>o({at:`link`}),onTarget:e=>o({at:`target`,key:e}),onJob:e=>o({at:`job`,id:e,key:null})}):(0,L.jsx)(`div`,{className:`flex justify-center py-8 text-ink-4`,children:(0,L.jsx)(dt,{})})})]})}function sE({icon:e,name:t,description:n,onClick:r,selected:i}){let a=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:j(`flex size-11 shrink-0 items-center justify-center rounded-full bg-paper-2 text-ink-2 transition`,r&&`group-hover:bg-ember-tint group-hover:text-ember-strong`,i&&`bg-ember-tint text-ember-strong`),children:(0,L.jsx)(e,{className:`size-5`})}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`span`,{className:`block truncate font-medium text-[0.9375rem]`,children:t}),(0,L.jsx)(`span`,{className:`block text-[0.8125rem] text-ink-3 leading-snug`,children:n})]}),r?(0,L.jsx)(me,{className:`size-4 shrink-0 text-ink-4 transition group-hover:text-ember-strong`}):null]}),o=j(`group flex items-center gap-3 rounded-xl bg-card p-3 text-left ring-1 ring-input transition`,r&&`hover:ring-ember`,i&&`ring-2 ring-ember`);return r?(0,L.jsx)(`button`,{type:`button`,onClick:r,className:o,children:a}):(0,L.jsx)(`div`,{className:o,children:a})}function cE(e){return new Intl.DateTimeFormat(N,{dateStyle:`short`,timeStyle:`short`}).format(new Date(e))}function lE({overview:e,onLink:t,onTarget:n,onJob:r}){let i=e.jobs.filter(e=>e.status!==`cancelled`);return(0,L.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,L.jsxs)(`div`,{className:`grid gap-2.5 sm:grid-cols-2`,children:[(0,L.jsx)(sE,{icon:ie,name:P(`share.link`),description:P(`shareRun.linkHint`),onClick:t}),e.targets.map(e=>(0,L.jsx)(sE,{icon:ZT[e.icon],name:e.name,description:e.description,onClick:()=>n(e.key)},e.key))]}),i.length?(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`mb-2 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:P(`shareRun.recent`)}),(0,L.jsx)(`ul`,{className:`overflow-hidden rounded-lg ring-1 ring-border-soft`,children:i.slice(0,5).map(e=>(0,L.jsx)(`li`,{className:`border-border-soft border-b last:border-0`,children:(0,L.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`flex w-full items-center gap-2.5 px-3 py-2 text-left text-[0.8125rem] hover:bg-paper-2 coarse:min-h-11`,children:[(0,L.jsx)(uE,{job:e}),(0,L.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ink-3`,children:e.result?.summary??e.error??P(`shareRun.working`)}),(0,L.jsx)(`span`,{className:`shrink-0 text-ink-4 tabular-nums`,children:cE(e.createdAt)})]})},e.id))})]}):null]})}function uE({job:e}){return e.status===`running`?(0,L.jsx)(dt,{className:`size-3.5 shrink-0 text-ember`}):(0,L.jsx)(`span`,{className:j(`size-2 shrink-0 rounded-full`,e.status===`done`?`bg-moss`:e.status===`failed`?`bg-rose`:`bg-ink-4`)})}function dE({view:e,title:t,onWithdrawn:n}){let r=e.id,[i,a]=(0,I.useState)(e.shareUrl?{url:e.shareUrl,expiresAt:e.expiresAt}:null),[o,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)(null);(0,I.useEffect)(()=>{if(i)return;let e=!0;return p.post(`/api/runs/${r}/share`).then(t=>e&&a(t)).catch(t=>e&&l(t.message)),()=>{e=!1}},[r,i]);let u=async()=>{await p.del(`/api/runs/${r}/share`),n()},d=()=>{i&&(navigator.clipboard.writeText(i.url),s(!0),setTimeout(()=>s(!1),1500))},f=Ye(`share`)||typeof navigator<`u`&&`share`in navigator,m=i?.expiresAt?new Intl.DateTimeFormat(N,{dateStyle:`long`}).format(new Date(i.expiresAt)):null;return c?(0,L.jsx)(`p`,{className:`rounded-lg bg-rose-tint px-3 py-2 text-[0.875rem] text-rose`,children:c}):i?(0,L.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-paper-2 p-1.5 pl-3`,children:[(0,L.jsx)(ie,{className:`size-4 shrink-0 text-ink-3`}),(0,L.jsx)(`input`,{readOnly:!0,value:i.url,onFocus:e=>e.target.select(),"aria-label":P(`share.link`),className:`min-w-0 flex-1 bg-transparent text-[0.875rem] outline-none coarse:h-11`}),(0,L.jsxs)(D,{size:`sm`,onClick:d,children:[o?(0,L.jsx)(he,{className:`size-3.5`}):(0,L.jsx)(Et,{className:`size-3.5`}),P(o?`share.copied`:`share.copy`)]})]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 sm:grid-cols-6`,children:[iE(i.url,t).map(e=>(0,L.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,className:`flex flex-col items-center gap-1.5 text-[0.75rem] text-ink-2 hover:text-ink`,children:[(0,L.jsx)(`span`,{className:`inline-flex size-12 items-center justify-center rounded-full bg-paper-2 font-semibold text-[0.9375rem] transition hover:bg-paper-3`,children:e.id===`mail`?(0,L.jsx)(ei,{className:`size-5`}):aE[e.id]}),e.label]},e.id)),f?(0,L.jsxs)(`button`,{type:`button`,onClick:()=>void(Ye(`share`)?je(`share`,{link:i.url,title:t}):navigator.share({title:t,url:i.url})).catch(()=>void 0),className:`flex flex-col items-center gap-1.5 text-[0.75rem] text-ink-2 hover:text-ink`,children:[(0,L.jsx)(`span`,{className:`inline-flex size-12 items-center justify-center rounded-full bg-paper-2 transition hover:bg-paper-3`,children:(0,L.jsx)(Be,{className:`size-5`})}),P(`shareRun.more`)]}):null]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[0.8125rem] text-ink-3`,children:[(0,L.jsx)(`span`,{children:m?P(`shareRun.until`,{date:m}):P(`shareRun.kept`)}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void u(),className:`shrink-0 hover:text-rose coarse:min-h-11`,children:P(`shareRun.withdraw`)})]})]}):(0,L.jsx)(`div`,{className:`flex justify-center py-8 text-ink-4`,children:(0,L.jsx)(dt,{})})}_({lang:N,runBase:e=>`/api/runs/${e}`,withBase:$e,asset:Ze,serviceWorker:`${T}/sw.js`,app:{can:Ye,call:je,tell:Le,download:ht},Mascot:Xt,ShareResultButton:oE,RunEnd:XT,onServerError:e=>tt(`error`,e)}),v(),ve();var fE=`wizards.reloadedForBuild`;window.addEventListener(`vite:preloadError`,e=>{let t=0;try{if(t=Number(sessionStorage.getItem(fE))||0,Date.now()-t<6e4)return;sessionStorage.setItem(fE,String(Date.now()))}catch{return}e.preventDefault(),window.location.reload()}),`engentyDesktop`in window&&(document.documentElement.dataset.desktop=``);var pE=window.location.pathname,mE=pE===a||pE.startsWith(`${a}/`);mE&&`serviceWorker`in navigator&&navigator.serviceWorker.register(`${T}/sw.js`).catch(()=>void 0);var hE=new Rn({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});(0,fa.createRoot)(document.getElementById(`root`)).render((0,L.jsx)(I.StrictMode,{children:(0,L.jsx)(re,{client:hE,children:mE?(0,L.jsx)(JT,{children:(0,L.jsxs)(HT,{where:`studio`,children:[(0,L.jsx)(VT,{}),(0,L.jsx)(hc,{})]})}):(0,L.jsx)(ce,{basename:T,children:(0,L.jsxs)(HT,{where:`run`,children:[(0,L.jsx)(RT,{}),(0,L.jsx)(hc,{})]})})})}));export{ly as $,ha as $t,BS as A,Xn as An,B as At,gS as B,Ol as Bt,LC as C,Ar as Cn,su as Ct,bC as D,mr as Dn,Xl as Dt,NC as E,vr as En,Yl as Et,OS as F,ql as Ft,Cy as G,Kc as Gt,gb as H,dl as Ht,TS as I,Rl as It,dy as J,vc as Jt,fy as K,Mc as Kt,SS as L,Hl as Lt,MS as M,Ql as Mt,AS as N,$l as Nt,CC as O,or as On,eu as Ot,kS as P,Jl as Pt,oy as Q,ba as Qt,xS as R,zl as Rt,PC as S,Rr as Sn,ju as St,BC as T,br as Tn,cu as Tt,ky as U,yl as Ut,aS as V,Tl as Vt,Oy as W,bl as Wt,hy as X,La as Xt,my as Y,Fa as Yt,iy as Z,Ia as Zt,Mw as _,Jr as _n,Ju as _t,$T as a,Bi as an,ny as at,VC as b,Hr as bn,Wu as bt,tT as c,Pi as cn,Pu as ct,Vw as d,fi as dn,Nu as dt,da as en,sy as et,Rw as f,ui as fn,Gu as ft,vw as g,ei as gn,Ru as gt,Lw as h,ii as hn,Bu as ht,tE as i,Ki as in,ry as it,NS as j,Zl as jt,QS as k,Qn as kn,au as kt,mT as l,Oi as ln,Fu as lt,Iw as m,oi as mn,zu as mt,sE as n,ca as nn,ay as nt,ZT as o,Ri as on,Yv as ot,Hw as p,ci as pn,Vu as pt,uy as q,Sc as qt,nE as r,oa as rn,py as rt,gT as s,Ii as sn,qv as st,oE as t,F as tn,cy as tt,Kw as u,mi as un,Iu as ut,pw as v,Kr as vn,Ku as vt,zC as w,Or as wn,tu as wt,RC as x,Br as xn,wu as xt,GC as y,Wr as yn,qu as yt,bS as z,Ll as zt};
|