Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
feat(web): put the live iPhones beside the hero, fix the demo on Vercel
leepokai97c24648f691
diff --git a/apps/desktop/src/renderer/components/Icon.tsx b/apps/desktop/src/renderer/components/Icon.tsxindex 2d745ed0..c51f728a 100644--- a/apps/desktop/src/renderer/components/Icon.tsx+++ b/apps/desktop/src/renderer/components/Icon.tsx@@ -14,7 +14,7 @@ interface Metrics {let manifest: Record<string, Metrics> | null = nullconst listeners = new Set<() => void>()if (window.codync?.platform === 'darwin') {- void fetch('./symbols/manifest.json')+ void fetch(`${import.meta.env.BASE_URL}symbols/manifest.json`).then((r) => (r.ok ? r.json() : {})).then((m: Record<string, Metrics>) => {manifest = m@@ -58,7 +58,7 @@ export function Icon({ name, size, weight = 'regular', color, style, className,const metrics = m?.[name]const unit = scaled ? `${size}px * var(--scale)` : `${size}px`if (metrics) {- const url = `url("./symbols/${name}.${weight}.png")`+ const url = `url("${import.meta.env.BASE_URL}symbols/${name}.${weight}.png")`return (<spanclassName={className}diff --git a/apps/desktop/vite.demo.config.ts b/apps/desktop/vite.demo.config.tsindex dcbfe5c6..f3db166c 100644--- a/apps/desktop/vite.demo.config.ts+++ b/apps/desktop/vite.demo.config.ts@@ -14,7 +14,8 @@ const alwaysDark: Plugin = {export default defineConfig({root: resolve('src/renderer/demo'),publicDir: resolve('src/renderer/public'),- base: './',+ // Absolute, so assets resolve however the host serves the page (folder URL or index.html).+ base: '/demo/desktop/',resolve: { alias: { '@shared': resolve('src/shared') } },plugins: [react(), alwaysDark],build: { outDir: resolve('../../web/public/demo/desktop'), emptyOutDir: true, chunkSizeWarningLimit: 1500 },diff --git a/web/app/components/hero.tsx b/web/app/components/hero.tsxindex ebcc1f8b..fbaf0920 100644--- a/web/app/components/hero.tsx+++ b/web/app/components/hero.tsx@@ -5,6 +5,7 @@ import { AppleLogo, DeviceMobile, GithubLogo, LinuxLogo, OpenAiLogo, Terminal }import DownloadButton from "./download-button";import Halftone from "./halftone";import MacWindow from "./mac-window";+import LivePhones from "./live-phone/live-phones";import { CharacterAvatar } from "./live-phone/avatar";import { APP_STORE, GITHUB, PRODUCT_HUNT } from "../links";@@ -31,91 +32,98 @@ export default function Hero() {<section className="relative overflow-hidden px-4 pt-14 pb-20 sm:px-6 md:pt-20 md:pb-28"><Halftone corner="top-right" className="w-[44rem] max-w-[90vw] text-neutral-50 opacity-[0.12]" /><Halftone corner="top-left" className="w-[30rem] max-w-[70vw] text-neutral-50 opacity-[0.08]" />- <div className="relative mx-auto flex max-w-5xl flex-col items-center text-center">- <motion.div {...rise(0)} className="flex flex-col items-center gap-4">- <a- href={PRODUCT_HUNT}- target="_blank"- rel="noopener noreferrer"- className="flex items-center gap-3 transition hover:opacity-80"- >- {/* eslint-disable-next-line @next/next/no-img-element -- live badge served by Product Hunt */}- <img- src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1267264&theme=dark"- alt="Codync on Product Hunt"- width={250}- height={54}- className="h-10 w-auto"- />- <span className="text-sm font-medium text-neutral-300">#16 Product of the Day</span>- </a>- <span className="inline-flex items-center gap-2 rounded-full bg-neutral-900 py-1.5 pr-4 pl-1.5 text-sm">- <span className="rounded-full bg-neutral-50 px-2.5 py-0.5 text-xs font-semibold whitespace-nowrap text-neutral-950">100% free</span>- <span className="text-neutral-300">No hidden fees, no paid tier</span>- </span>- </motion.div>+ <div className="relative mx-auto grid max-w-6xl grid-cols-1 items-center gap-14 md:grid-cols-[1.15fr_1fr] md:gap-8">+ <div className="flex flex-col items-start text-left">+ <motion.div {...rise(0)} className="flex flex-col items-start gap-4">+ <a+ href={PRODUCT_HUNT}+ target="_blank"+ rel="noopener noreferrer"+ className="flex items-center gap-3 transition hover:opacity-80"+ >+ {/* eslint-disable-next-line @next/next/no-img-element -- live badge served by Product Hunt */}+ <img+ src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1267264&theme=dark"+ alt="Codync on Product Hunt"+ width={250}+ height={54}+ className="h-10 w-auto"+ />+ <span className="text-sm font-medium text-neutral-300">#16 Product of the Day</span>+ </a>+ <span className="inline-flex items-center gap-2 rounded-full bg-neutral-900 py-1.5 pr-4 pl-1.5 text-sm">+ <span className="rounded-full bg-neutral-50 px-2.5 py-0.5 text-xs font-semibold whitespace-nowrap text-neutral-950">100% free</span>+ <span className="text-neutral-300">No hidden fees, no paid tier</span>+ </span>+ </motion.div>- <motion.h1- {...rise(0.04)}- className="mt-8 flex flex-wrap items-center justify-center gap-x-4 text-6xl font-semibold leading-none tracking-tighter text-neutral-50 sm:text-7xl md:gap-x-6 md:text-8xl"- >- Meet- <span className="inline-flex size-[0.95em] items-center justify-center rounded-[0.24em] bg-neutral-50 [&_svg]:size-[78%]">- <CharacterAvatar shape="squircle" color="blue" size={88} mood="working" />- </span>- Codync- </motion.h1>+ <motion.h1+ {...rise(0.04)}+ className="mt-8 flex flex-wrap items-center gap-x-4 text-6xl font-semibold leading-none tracking-tighter text-neutral-50 sm:text-7xl md:gap-x-5 lg:text-8xl"+ >+ Meet+ <span className="inline-flex size-[0.95em] items-center justify-center rounded-[0.24em] bg-neutral-50 [&_svg]:size-[78%]">+ <CharacterAvatar shape="squircle" color="blue" size={88} mood="working" />+ </span>+ Codync+ </motion.h1>- <motion.p {...rise(0.1)} className="mt-8 max-w-[44rem] text-lg leading-relaxed text-neutral-400 md:text-xl">- The 100% free, open-source Grok Bot alternative. Persistent AI teammates on your own computer, for code- and everyday life. Run{" "}- {agents.map(([name, icon], i) => (- <span key={name}>- <span className="inline-flex items-baseline gap-1.5 font-medium whitespace-nowrap text-neutral-50">- {icon ? (- // eslint-disable-next-line @next/next/no-img-element -- brand marks from Simple Icons- <img src={icon} alt="" width={18} height={18} className="size-[0.9em] self-center" />- ) : (- <OpenAiLogo size="0.95em" weight="fill" className="self-center" />- )}- {name}- {i < agents.length - 2 ? "," : ""}+ <motion.p {...rise(0.1)} className="mt-8 max-w-[36rem] text-lg leading-relaxed text-neutral-400">+ The 100% free, open-source Grok Bot alternative. Persistent AI teammates on your own computer, for code+ and everyday life. Run{" "}+ {agents.map(([name, icon], i) => (+ <span key={name}>+ <span className="inline-flex items-baseline gap-1.5 font-medium whitespace-nowrap text-neutral-50">+ {icon ? (+ // eslint-disable-next-line @next/next/no-img-element -- brand marks from Simple Icons+ <img src={icon} alt="" width={18} height={18} className="size-[0.9em] self-center" />+ ) : (+ <OpenAiLogo size="0.95em" weight="fill" className="self-center" />+ )}+ {name}+ {i < agents.length - 2 ? "," : ""}+ </span>+ {i === agents.length - 2 ? " and " : " "}</span>- {i === agents.length - 2 ? " and " : " "}- </span>- ))}- with the plans you already pay for.- </motion.p>+ ))}+ with the plans you already pay for.+ </motion.p>- <motion.div {...rise(0.16)} className="mt-10 flex flex-wrap items-center justify-center gap-3">- <DownloadButton />- <a- href={APP_STORE}- target="_blank"- rel="noopener noreferrer"- className="inline-flex h-12 items-center gap-2 rounded-full bg-neutral-900 px-6 font-medium text-neutral-100 transition hover:bg-neutral-800 active:scale-[0.98]"- >- <DeviceMobile size={18} weight="fill" />- iPhone app- </a>- <a- href={GITHUB}- target="_blank"- rel="noopener noreferrer"- className="inline-flex h-12 items-center gap-2 rounded-full bg-neutral-900 px-6 font-medium text-neutral-100 transition hover:bg-neutral-800 active:scale-[0.98]"- >- <GithubLogo size={18} weight="fill" />- Star on GitHub- </a>- </motion.div>+ <motion.div {...rise(0.16)} className="mt-10 flex flex-wrap items-center gap-3">+ <DownloadButton />+ <a+ href={APP_STORE}+ target="_blank"+ rel="noopener noreferrer"+ className="inline-flex h-12 items-center gap-2 rounded-full bg-neutral-900 px-6 font-medium text-neutral-100 transition hover:bg-neutral-800 active:scale-[0.98]"+ >+ <DeviceMobile size={18} weight="fill" />+ iPhone app+ </a>+ <a+ href={GITHUB}+ target="_blank"+ rel="noopener noreferrer"+ className="inline-flex h-12 items-center gap-2 rounded-full bg-neutral-900 px-6 font-medium text-neutral-100 transition hover:bg-neutral-800 active:scale-[0.98]"+ >+ <GithubLogo size={18} weight="fill" />+ Star on GitHub+ </a>+ </motion.div>++ <motion.p {...rise(0.2)} className="mt-6 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm text-neutral-500">+ <span className="inline-flex items-center gap-1.5"><AppleLogo size={15} weight="fill" /> macOS</span>+ <span className="inline-flex items-center gap-1.5"><LinuxLogo size={15} weight="fill" /> Linux</span>+ <span className="inline-flex items-center gap-1.5"><DeviceMobile size={15} weight="fill" /> iPhone</span>+ <span className="inline-flex items-center gap-1.5"><Terminal size={15} weight="bold" /> Terminal</span>+ <a href={GITHUB} className="underline underline-offset-4 hover:text-neutral-300">MIT licensed</a>+ </motion.p>+ </div>- <motion.p {...rise(0.2)} className="mt-6 flex flex-wrap items-center justify-center gap-x-4 gap-y-2 text-sm text-neutral-500">- <span className="inline-flex items-center gap-1.5"><AppleLogo size={15} weight="fill" /> macOS</span>- <span className="inline-flex items-center gap-1.5"><LinuxLogo size={15} weight="fill" /> Linux</span>- <span className="inline-flex items-center gap-1.5"><DeviceMobile size={15} weight="fill" /> iPhone</span>- <span className="inline-flex items-center gap-1.5"><Terminal size={15} weight="bold" /> Terminal</span>- <a href={GITHUB} className="underline underline-offset-4 hover:text-neutral-300">MIT licensed</a>- </motion.p>+ {/* The live iPhones; the front one hangs below the back one, so reserve room for it. */}+ <div className="relative mx-auto mb-16 w-full max-w-[26rem] md:mb-20 md:max-w-none">+ <LivePhones />+ </div></div><motion.divdiff --git a/web/app/components/mac-window.tsx b/web/app/components/mac-window.tsxindex cd7dca09..113a36e5 100644--- a/web/app/components/mac-window.tsx+++ b/web/app/components/mac-window.tsx@@ -6,6 +6,7 @@ import { useLayoutEffect, useRef, useState } from "react";const MIN_WIDTH = 960;const RATIO = 1096 / 1600;+// The file itself, not the folder: Vercel doesn't serve a folder's index.html from public/.// The real desktop app (apps/desktop, `npm run build:demo`) on an in-memory host, in a Mac window.// The app hides the title bar on macOS, so the window draws the traffic lights.export default function MacWindow() {@@ -28,7 +29,7 @@ export default function MacWindow() {>{width ? (<iframe- src="/demo/desktop/"+ src="/demo/desktop/index.html"title="Codync for Mac, live demo: Ship room, where Pacer, Reviewer and Scout discuss an isoWeek fix"loading="lazy"className="absolute top-0 left-0 origin-top-left border-0"diff --git a/web/app/components/pocket.tsx b/web/app/components/pocket.tsxdeleted file mode 100644index fd3bfe99..00000000--- a/web/app/components/pocket.tsx+++ /dev/null@@ -1,24 +0,0 @@-import Reveal from "./reveal";-import LivePhones from "./live-phone/live-phones";--// The live iPhones (a recreation of the app you can tap), with what the phone adds.-export default function Pocket() {- return (- <section className="px-4 py-20 sm:px-6 md:py-28">- <div className="mx-auto grid max-w-6xl grid-cols-1 items-center gap-14 md:grid-cols-[1fr_1.1fr]">- <Reveal>- <h2 className="text-3xl font-semibold tracking-tight text-neutral-50 md:text-5xl">In your pocket, too</h2>- <p className="mt-5 max-w-[30rem] text-lg leading-relaxed text-neutral-400">- A native iPhone app for the same bots. You get a ping when one needs you or finishes, a Live Activity while- it works, widgets for your team and usage, voice calls with a bot, and the computer's screen when you- need it. Try it: tap a bot.- </p>- </Reveal>- {/* The front phone hangs below the back one, so reserve room for it. */}- <div className="relative mx-auto mb-16 w-full max-w-[26rem] md:mb-20 md:max-w-none">- <LivePhones />- </div>- </div>- </section>- );-}diff --git a/web/app/page.tsx b/web/app/page.tsxindex 61eed2fc..ab0310d8 100644--- a/web/app/page.tsx+++ b/web/app/page.tsx@@ -1,6 +1,5 @@import Hero from "./components/hero";import Film from "./components/film";-import Pocket from "./components/pocket";import { Answers, Features } from "./components/features";import Surfaces from "./components/surfaces";import Privacy from "./components/privacy";@@ -19,7 +18,6 @@ export default function Home() {<main className="flex-1"><Hero /><Film />- <Pocket /><Answers /><Features /><Surfaces />diff --git a/web/public/demo/desktop/assets/index-D8ZgdR6B.js b/web/public/demo/desktop/assets/index-DJ5oPlCe.jssimilarity index 80%rename from web/public/demo/desktop/assets/index-D8ZgdR6B.jsrename to web/public/demo/desktop/assets/index-DJ5oPlCe.jsindex 44cfa24e..b155cefa 100644--- a/web/public/demo/desktop/assets/index-D8ZgdR6B.js+++ b/web/public/demo/desktop/assets/index-DJ5oPlCe.js@@ -1,4 +1,4 @@-(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const h of l)if(h.type==="childList")for(const d of h.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function n(l){const h={};return l.integrity&&(h.integrity=l.integrity),l.referrerPolicy&&(h.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?h.credentials="include":l.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function r(l){if(l.ep)return;l.ep=!0;const h=n(l);fetch(l.href,h)}})();function Of(e){const t=e.createdAt??0;return{id:e.id,kind:e.kind??"agent",members:e.members??[],name:e.name??"Bot",description:e.description??"",avatarColor:e.avatarColor??"blue",avatarShape:e.avatarShape??"blob",backend:e.backend??"custom",command:e.command??null,cwd:e.cwd??"",managedWorkspace:e.managedWorkspace??!1,permission:e.permission??"auto",model:e.model??null,pinned:e.pinned??!1,hidden:e.hidden??!1,notify:e.notify??null,connectors:e.connectors??[],skills:e.skills??[],computer:e.computer??!1,autoName:e.autoName??!1,createdAt:t,rev:e.rev??0,status:e.status??"idle",activity:e.activity??"",startedAt:e.startedAt??null,workingChat:e.workingChat??null,workingThread:e.workingThread??null,unread:e.unread??0,lastMessage:e.lastMessage??null,lastAt:e.lastAt??t}}const At=e=>e.kind==="group",Jn=e=>e.status==="working"||e.status==="needsInput",ln=e=>e.status==="needsInput",$2=(e,t,n)=>Jn(e)&&(e.workingChat??e.id)===t&&(e.workingThread??null)===(n??null),bo=e=>e.managedWorkspace?"Personal workspace":e.cwd.split("/").filter(Boolean).pop()??e.cwd,O3=e=>["png","jpg","jpeg","heic","gif","webp","tiff","bmp"].includes(e.split(".").pop()?.toLowerCase()??"");function _o(e){switch(e.kind){case"user":case"permission":case"notice":return!0;case"agent":return e.data.final===!0;default:return!1}}function zf(e){return e?{enabled:e.enabled??!1,connected:e.connected??!1,platform:e.platform??"",capture:e.capture??!1,input:e.input??!1,displays:e.displays??[],userControl:e.userControl??!1,agentBot:e.agentBot??null,viewers:e.viewers??0}:null}function yo(e){return{id:e.id,name:e.name,description:e.description,avatarColor:e.avatarColor,avatarShape:e.avatarShape,backend:e.backend,command:e.command??null,cwd:e.managedWorkspace?"":e.cwd,permission:e.permission,model:e.model??null,pinned:e.pinned,hidden:e.hidden,notify:e.notify??null,connectors:e.connectors,skills:e.skills,computer:e.computer}}const Rh="demo-mac",z3="MacBook Pro",H3="/Users/demo/code/pace",tb=[{id:"pacer",name:"Pacer",description:"Owns the pace math",avatarColor:"orange",avatarShape:"squircle",backend:"claude",model:"opus",permission:"ask",status:"needsInput",activity:"Needs approval: Edit src/pace.js",unread:1},{id:"scout",name:"Scout",description:"Finds things in the repo and builds them",avatarColor:"green",avatarShape:"cloud",backend:"codex",model:null,unread:1},{id:"reviewer",name:"Reviewer",description:"Reviews every change before it ships",avatarColor:"violet",avatarShape:"blob",backend:"claude",model:"sonnet",unread:1},{id:"relay",name:"Relay",description:"Writes the release notes",avatarColor:"blue",avatarShape:"tablet",backend:"codex",model:null,unread:1},{id:"ship",kind:"group",members:["pacer","scout","reviewer"],name:"Ship room",description:"Getting weeklyTotals out",avatarColor:"gray",avatarShape:"blob",backend:"",model:null}],R0=H3,Er=(e,t,n,r,l)=>({id:e,botId:t,kind:"user",at:n,data:{text:r,status:"sent"},threadId:l}),Un=(e,t,n,r,l,h)=>({id:e,botId:t,kind:"agent",at:r,data:{text:l,final:!0,author:n},threadId:h}),Kv=(e,t,n,r)=>({id:e,botId:t,kind:"thought",at:n,data:{text:r,author:t}}),nh=(e,t,n,r,l,h="")=>({id:e,botId:t,kind:"tool",at:n,data:{title:r,toolKind:l,status:"completed",output:h,author:t}}),ib=["@@ -18,3 +18,15 @@ export function isoWeek(date) {"," ","+export function weeklyTotals(runs) {","+ const weeks = {}","+ for (const run of runs) {","+ const key = isoWeek(run.date)","+ const week = (weeks[key] ??= { distance: 0, time: 0 })","+ week.distance += run.distance","+ week.time += run.time","+ }","+ return weeks","+}"].join(`+(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const h of l)if(h.type==="childList")for(const d of h.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function n(l){const h={};return l.integrity&&(h.integrity=l.integrity),l.referrerPolicy&&(h.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?h.credentials="include":l.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function r(l){if(l.ep)return;l.ep=!0;const h=n(l);fetch(l.href,h)}})();function Of(e){const t=e.createdAt??0;return{id:e.id,kind:e.kind??"agent",members:e.members??[],name:e.name??"Bot",description:e.description??"",avatarColor:e.avatarColor??"blue",avatarShape:e.avatarShape??"blob",backend:e.backend??"custom",command:e.command??null,cwd:e.cwd??"",managedWorkspace:e.managedWorkspace??!1,permission:e.permission??"auto",model:e.model??null,pinned:e.pinned??!1,hidden:e.hidden??!1,notify:e.notify??null,connectors:e.connectors??[],skills:e.skills??[],computer:e.computer??!1,autoName:e.autoName??!1,createdAt:t,rev:e.rev??0,status:e.status??"idle",activity:e.activity??"",startedAt:e.startedAt??null,workingChat:e.workingChat??null,workingThread:e.workingThread??null,unread:e.unread??0,lastMessage:e.lastMessage??null,lastAt:e.lastAt??t}}const At=e=>e.kind==="group",Jn=e=>e.status==="working"||e.status==="needsInput",ln=e=>e.status==="needsInput",$2=(e,t,n)=>Jn(e)&&(e.workingChat??e.id)===t&&(e.workingThread??null)===(n??null),bo=e=>e.managedWorkspace?"Personal workspace":e.cwd.split("/").filter(Boolean).pop()??e.cwd,O3=e=>["png","jpg","jpeg","heic","gif","webp","tiff","bmp"].includes(e.split(".").pop()?.toLowerCase()??"");function _o(e){switch(e.kind){case"user":case"permission":case"notice":return!0;case"agent":return e.data.final===!0;default:return!1}}function zf(e){return e?{enabled:e.enabled??!1,connected:e.connected??!1,platform:e.platform??"",capture:e.capture??!1,input:e.input??!1,displays:e.displays??[],userControl:e.userControl??!1,agentBot:e.agentBot??null,viewers:e.viewers??0}:null}function yo(e){return{id:e.id,name:e.name,description:e.description,avatarColor:e.avatarColor,avatarShape:e.avatarShape,backend:e.backend,command:e.command??null,cwd:e.managedWorkspace?"":e.cwd,permission:e.permission,model:e.model??null,pinned:e.pinned,hidden:e.hidden,notify:e.notify??null,connectors:e.connectors,skills:e.skills,computer:e.computer}}const Dh="demo-mac",z3="MacBook Pro",H3="/Users/demo/code/pace",tb=[{id:"pacer",name:"Pacer",description:"Owns the pace math",avatarColor:"orange",avatarShape:"squircle",backend:"claude",model:"opus",permission:"ask",status:"needsInput",activity:"Needs approval: Edit src/pace.js",unread:1},{id:"scout",name:"Scout",description:"Finds things in the repo and builds them",avatarColor:"green",avatarShape:"cloud",backend:"codex",model:null,unread:1},{id:"reviewer",name:"Reviewer",description:"Reviews every change before it ships",avatarColor:"violet",avatarShape:"blob",backend:"claude",model:"sonnet",unread:1},{id:"relay",name:"Relay",description:"Writes the release notes",avatarColor:"blue",avatarShape:"tablet",backend:"codex",model:null,unread:1},{id:"ship",kind:"group",members:["pacer","scout","reviewer"],name:"Ship room",description:"Getting weeklyTotals out",avatarColor:"gray",avatarShape:"blob",backend:"",model:null}],D0=H3,Er=(e,t,n,r,l)=>({id:e,botId:t,kind:"user",at:n,data:{text:r,status:"sent"},threadId:l}),Un=(e,t,n,r,l,h)=>({id:e,botId:t,kind:"agent",at:r,data:{text:l,final:!0,author:n},threadId:h}),Kv=(e,t,n,r)=>({id:e,botId:t,kind:"thought",at:n,data:{text:r,author:t}}),nh=(e,t,n,r,l,h="")=>({id:e,botId:t,kind:"tool",at:n,data:{title:r,toolKind:l,status:"completed",output:h,author:t}}),ib=["@@ -18,3 +18,15 @@ export function isoWeek(date) {"," ","+export function weeklyTotals(runs) {","+ const weeks = {}","+ for (const run of runs) {","+ const key = isoWeek(run.date)","+ const week = (weeks[key] ??= { distance: 0, time: 0 })","+ week.distance += run.distance","+ week.time += run.time","+ }","+ return weeks","+}"].join(``),sb=["@@ -4,9 +4,10 @@ export function isoWeek(date) {"," const d = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()))","- const year = d.getUTCFullYear()"," d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7))","+ // The ISO year is the year of the Thursday of this week.","+ const year = d.getUTCFullYear()"," const start = new Date(Date.UTC(year, 0, 1))"," const week = Math.ceil(((d - start) / 86400000 + 1) / 7)",' return `${year}-W${String(week).padStart(2, "0")}`'].join(``),nb=[Er("s1","scout",58,"Add a weeklyTotals(runs) helper that sums distance and time per ISO week, with a test."),Kv("s2","scout",58,"isoWeek already lives in src/pace.js, so weeklyTotals can key on it and stay small."),nh("s3","scout",57,"Read src/pace.js","read"),{id:"s4",botId:"scout",kind:"tool",at:57,data:{title:"Edit src/pace.js",toolKind:"edit",status:"completed",author:"scout",diffs:[{path:"src/pace.js",added:10,removed:0,isNew:!1,startLine:18,patch:ib}]}},{id:"s5",botId:"scout",kind:"tool",at:56,data:{title:"npm test",toolKind:"execute",command:"npm test",status:"completed",output:`✓ isoWeek: mid year✓ isoWeek: first week@@ -9,48 +9,48 @@Two small things:- A bad date becomes a \`"NaN-WNaN"\` bucket instead of an error.-- Weeks are grouped in UTC, so a late evening run west of UTC can land in the next week.`),Er("l1","relay",41,"Summarize what changed in pace today for the team channel."),Un("l2","relay","relay",40,"Added `weeklyTotals` to group run distance and time by ISO week, with a test for the 2026 to 2027 rollover. Reviewer found no blockers. An invalid-date guard is being added in Ship room."),Er("l3","relay",38,"Make it one line for the changelog.","l2"),Un("l4","relay","relay",38,"Pace now shows your weekly distance and time totals.","l2"),Er("g1","ship",22,"Is weeklyTotals ready to ship? One short sentence each."),Un("g2","ship","reviewer",21,'Almost: the week math is right and all 4 tests pass, but a bad date gets bucketed as `"NaN-WNaN"` instead of raising an error. @Scout, can you add an invalid-date guard?'),Un("g3","ship","scout",19,"Added the guard: `weeklyTotals` now throws a `RangeError` on an invalid date, and all 5 tests pass. Weeks are still grouped in UTC, so say if they should follow the runner's local time instead."),Er("g4","ship",17,"UTC is right, keep it.","g3"),Un("g5","ship","scout",17,"Got it, UTC stays. I left a comment above `weeklyTotals` so nobody flips it later.","g3"),Un("g6","ship","pacer",15,"Ship it once my `isoWeek` New Year fix lands. Dec 30, 2024 still comes out as 2024-W01 instead of 2025-W01."),Er("p1","pacer",9,"Fix the isoWeek New Year bug you mentioned."),Kv("p2","pacer",9,"The year is read before moving to the Thursday of the week, so late December dates get the wrong ISO year."),nh("p3","pacer",8,"Read src/pace.js","read"),{id:"p4",botId:"pacer",kind:"agent",at:7,data:{text:"Found it: the year comes from the date itself, not from the Thursday of its week.",final:!1,author:"pacer"}},{id:"p5",botId:"pacer",kind:"permission",at:6,data:{title:"Edit src/pace.js",toolKind:"edit",cwd:H3,status:"pending",selected:void 0,author:"pacer",diffs:[{path:"src/pace.js",added:2,removed:1,isNew:!1,startLine:4,patch:sb}],options:[{optionId:"allow",name:"Allow",kind:"allow_once"},{optionId:"always",name:"Always allow",kind:"allow_always"},{optionId:"deny",name:"Deny",kind:"reject_once"}]}}],rb={pacer:["Sure. I'll keep it inside `src/pace.js` and rerun `npm test` when it's done.","Makes sense. The week math is the risky part, so I'll add a test for it first.","Good call. Nothing else imports that function, so it's a one-file change."],scout:["On it. I'll grep the repo first so we know what else touches it.","Done a quick pass: only `src/pace.js` and its test use it, so the change stays small.","Sure. I'll write the test first, then make it pass."],reviewer:["I'll look at the diff once it lands and flag anything that isn't a nit.","Looks fine to me. Just keep the test for the New Year week, that's where it broke before.","One thing to watch: dates without a time zone are read as UTC. Worth a comment."],relay:[`Here's a draft: "Pace now groups your runs by week, with totals for distance and time."`,"Noted. I'll fold that into the release notes for the next version.","Short version for the channel: weekly totals are in, a New Year week fix is next."]},ab="I'm still waiting on your approval for the `isoWeek` edit. Once you allow it, I'll keep going.",lb="Fixed: `isoWeek` now takes the year from the Thursday of the week, so Dec 30, 2024 is 2025-W01. I added a test for it and all 6 tests pass.",ob="OK, I left `src/pace.js` alone. Want me to explain the fix so you can make it yourself?";function Yv(e){const t=n=>e+n*36e5;return{providers:[{id:"claude",name:"Claude",source:"statusline",updatedAt:e,windows:[{id:"five_hour",label:"5-hour",percent:38,resetsAt:t(2.4)},{id:"seven_day",label:"Weekly",percent:61,resetsAt:t(70)}]},{id:"codex",name:"Codex",source:"sessions",updatedAt:e,windows:[{id:"primary",label:"5-hour",percent:22,resetsAt:t(3.1)},{id:"secondary",label:"Weekly",percent:47,resetsAt:t(95)}]}]}}const Gv=1500,Dh="Not available in the web demo. Install Codync to use this.";class cb{constructor(t,n=Date.now()){this.version=t;for(const r of tb)this.bots.set(r.id,Of({...r,cwd:r.kind==="group"?"":R0,createdAt:n-864e5,permission:r.permission??"auto"}));for(const r of nb)this.add({botId:r.botId,threadId:r.threadId??null,kind:r.kind,data:r.data},r.id,n-r.at*6e4,!1);for(const r of this.bots.values())this.refreshPreview(r),r.rev=++this.rev}version;hostId="demo-host";rev=0;seq=0;bots=new Map;entries=[];listeners=new Set;turns=new Map;nextReply=new Map;subscribe(t,n){const r=[...[...this.bots.values()].filter(p=>p.rev>t).map(p=>({rev:p.rev,line:{type:"bot",rev:p.rev,bot:this.botJSON(p)}})),...this.entries.filter(p=>p.rev>t).map(p=>({rev:p.rev,line:{type:"entry",rev:p.rev,entry:p}}))].sort((p,g)=>p.rev-g.rev),l={type:"hello",hostId:this.hostId,computerId:Rh,rev:this.rev,usage:Yv(Date.now()),screen:null};let h=!0;const d=p=>h&&n(p);return setTimeout(()=>{if(h){for(const p of[{line:l},...r])n(JSON.stringify(p.line));this.listeners.add(d)}},0),()=>{h=!1,this.listeners.delete(d)}}emit(t){const n=JSON.stringify(t);for(const r of this.listeners)r(n)}emitBot(t){if(t.rev=++this.rev,this.emit({type:"bot",rev:t.rev,bot:this.botJSON(t)}),t.kind!=="group")for(const n of this.bots.values())n.kind==="group"&&n.members.includes(t.id)&&this.emitBot(n)}emitEntry(t){t.rev=++this.rev,t.updatedAt=Date.now(),this.emit({type:"entry",rev:t.rev,entry:t})}botJSON(t){if(t.kind!=="group")return t;const n=t.members.map(r=>this.bots.get(r)).find(r=>r&&r.status!=="idle"&&r.workingChat===t.id);return n?{...t,status:n.status,activity:n.activity,startedAt:n.startedAt,workingChat:t.id,workingThread:n.workingThread}:t}add(t,n=crypto.randomUUID(),r=Date.now(),l=!0){const h={...t,id:n,seq:++this.seq,rev:++this.rev,turn:1,createdAt:r,updatedAt:r};if(this.entries.push(h),h.threadId&&this.summarize(h.botId,h.threadId,l),l){this.emit({type:"entry",rev:h.rev,entry:h});const d=this.bots.get(h.botId);d&&!h.threadId&&_o(h)&&(this.refreshPreview(d),h.kind!=="user"&&d.unread++,this.emitBot(d))}return h}summarize(t,n,r){const l=this.entries.find(p=>p.id===n);if(!l)return;const h=this.entries.filter(p=>p.botId===t&&p.threadId===n&&_o(p)),d=[];for(const p of h){const g=p.kind==="user"?"user":p.data.author??t;d.includes(g)||d.push(g)}l.data={...l.data,thread:{count:h.length,lastAt:h.at(-1)?.createdAt??0,authors:d,unread:0}},r&&this.emitEntry(l)}refreshPreview(t){const n=this.entries.filter(l=>l.botId===t.id&&!l.threadId&&(l.kind==="user"||l.kind==="agent"&&l.data.final)).at(-1);if(!n)return;const r=n.data.text??"";t.lastAt=n.createdAt,t.lastMessage=n.kind==="user"?`You: ${r}`:t.kind==="group"?`${this.bots.get(n.data.author??"")?.name??"A bot"}: ${r}`:r}setStatus(t,n,r="",l=null,h=null){const d=this.bots.get(t);d&&(Object.assign(d,{status:n,activity:r,startedAt:n==="idle"?null:Date.now(),workingChat:l,workingThread:h}),this.emitBot(d))}pending(t){return this.entries.find(n=>n.kind==="permission"&&n.data.author===t&&n.data.status==="pending")??null}settle(t){const n=this.pending(t);n?this.setStatus(t,"needsInput",`Needs approval: ${n.data.title??""}`,n.botId):this.setStatus(t,"idle")}async answer(t,n,r,l){const h=(this.turns.get(t)??0)+1;this.turns.set(t,h),this.setStatus(t,"working","Typing…",n,r),await Zv(Gv+Math.random()*600),this.turns.get(t)===h&&(this.add({botId:n,threadId:r,kind:"agent",data:{text:l,final:!0,author:t}}),this.settle(t))}replyText(t){if(this.pending(t))return ab;const n=rb[t]??["Got it. I'll take a look and report back."],r=this.nextReply.get(t)??0;return this.nextReply.set(t,r+1),n[r%n.length]}async converse(t,n,r){let l=[t.id];if(t.kind==="group"){const h=t.members.filter(g=>this.bots.has(g)),d=h.filter(g=>r.toLowerCase().includes(`@${this.bots.get(g).name.toLowerCase()}`)),p=n?this.entries.find(g=>g.id===n)?.data.author:void 0;l=d.length?d:p&&h.includes(p)?[p]:h.slice(0,2)}for(const h of l)await this.answer(h,t.id,n,this.replyText(h))}async call(t,n){const r=l=>typeof n[l]=="string"?n[l]:"";switch(t){case"hello":return{hostId:this.hostId,computerId:Rh,signKey:"",boxKey:"",cloud:null,name:z3,version:this.version,minApp:this.version,os:"macos",device:"MacBookPro",home:"/Users/demo",rev:this.rev,urls:[],backends:[{id:"claude",name:"Claude Code",available:!0,installed:!0,signedIn:!0,command:"claude",installHint:""},{id:"codex",name:"Codex",available:!0,installed:!0,signedIn:!0,command:"codex",installHint:""}]};case"accessRequests":return{requests:[]};case"cloudStatus":return{enabled:!1};case"usage":return Yv(Date.now());case"history":return{entries:[]};case"thread":return{entries:this.entries.filter(l=>l.botId===r("botId")&&l.threadId===r("rootId"))};case"send":{const l=this.bots.get(r("botId"));if(!l)throw D0("That bot was deleted.");const h=r("threadId")||null,d=this.add({botId:l.id,threadId:h,kind:"user",data:{text:r("text"),status:"sent",clientNonce:r("clientNonce")}});return this.converse(l,h,r("text")),{entry:d}}case"markRead":{const l=this.bots.get(r("botId"));return l&&l.unread>0&&(l.unread=0,this.emitBot(l)),{}}case"respondPermission":return this.respond(r("entryId"),r("optionId")||null);case"react":{const l=this.entries.find(d=>d.id===r("entryId"));if(!l)throw D0("That message is gone.");const h=new Set(l.data.reactions??[]);return h.delete(r("emoji"))||h.add(r("emoji")),l.data={...l.data,reactions:[...h]},this.emitEntry(l),{entry:l}}case"stop":{const l=r("botId");return this.turns.set(l,(this.turns.get(l)??0)+1),this.settle(l),{}}case"newSession":return this.add({botId:r("botId"),threadId:null,kind:"notice",data:{text:"New session",style:"divider"}}),{};case"createBot":case"updateBot":return{bot:this.saveBot(n)};case"deleteBot":{const l=r("botId");return this.bots.delete(l),this.emit({type:"bot",rev:++this.rev,bot:{id:l,rev:this.rev,deleted:!0}}),{}}case"refreshBackends":return{backends:(await this.call("hello",{})).backends};case"listDirs":return{path:"/Users/demo/code",parent:"/Users/demo",isGit:!1,dirs:[{name:"pace",path:R0,isGit:!0}]};case"memory":return{location:"",facts:[]};case"routines":return{routines:[],runs:[]};case"skills":case"connectors":case"marketSkills":case"marketConnectors":case"credentialLogins":case"composioToolkits":return{items:[]};case"devices":return{devices:[]};case"voiceStatus":return{providers:[]};case"composioStatus":return{configured:!1,keyUrl:""};case"credentialStatus":return{provider:"",onePasswordConnected:!1};default:throw D0(Dh)}}async respond(t,n){const r=this.entries.find(p=>p.id===t);if(!r||r.data.status!=="pending")return{};const l=r.data.options?.find(p=>p.optionId===n),h=!!l&&l.kind.startsWith("allow");r.data={...r.data,status:n?"answered":"cancelled",selected:n??void 0},this.emitEntry(r);const d=r.data.author??r.botId;return(async()=>(this.setStatus(d,"working",h?"Editing src/pace.js":"Typing…",r.botId),await Zv(Gv),this.add({botId:r.botId,threadId:r.threadId??null,kind:"agent",data:{text:h?lb:ob,final:!0,author:d}}),this.settle(d)))(),{}}saveBot(t){const n=t.id?this.bots.get(t.id):void 0,r=Of({...n??{createdAt:Date.now(),cwd:"cwd"in t?t.cwd||R0:""},...t,id:n?.id??crypto.randomUUID()});n&&Object.assign(n,r);const l=n??r;return this.bots.set(l.id,l),this.emitBot(l),this.botJSON(l)}}function D0(e){return{status:400,message:e}}const Zv=e=>new Promise(t=>setTimeout(t,e)),I3="2.8.0",Xv=new cb(I3),Da=()=>()=>{},rh=()=>Promise.reject(new Error(Dh)),hb={state:{kind:"running"},local:{computerId:Rh,baseURL:"http://demo.invalid",token:"demo"},dev:!1,logPath:""},ub={ready:!0,configured:!1,busy:!1,error:null,user:null,cloudURL:null},db={supported:!1,canCheck:!1,checking:!1,availableVersion:null,staged:!1,autoCheck:!1,autoDownload:!1,lastCheck:null,error:null,waitingForApp:null},fb={platform:"darwin",appVersion:I3,computerName:z3,debugOpen:"Ship room",host:{snapshot:async()=>hb,onChange:Da,install(){},restart(){},uninstall(){},openLog(){},async call(e,t,n,r){await new Promise(l=>setTimeout(l,30));try{return await Xv.call(n,r??{})}catch(l){throw l.status?l:{status:500,message:String(l)}}},stream(e,t,n){const r=Number(new URL(e).searchParams.get("since")??0);return Xv.subscribe(r,n)},health:async()=>({computerId:Rh,busy:!1})},account:{state:async()=>ub,onChange:Da,signIn:rh,signOut:async()=>{},token:rh},speech:{available:!1,locales:()=>[],start(){},stop(){},onEvent:Da},ssh:{state:async()=>({profiles:[],status:{},attachments:[]}),onChange:Da,save:async()=>Dh,remove(){},connect(){},disconnect(){},trustHostKey(){},chooseKey:async()=>null},cloud:{request:async()=>({ok:!1,error:{status:503,code:"demo",message:Dh}})},updates:{state:async()=>db,onChange:Da,check(){},setAutoCheck(){},setAutoDownload(){}},app:{openExternal:e=>{window.open(e,"_blank","noopener")},copy:e=>{navigator.clipboard?.writeText(e).catch(()=>{})},pickFiles:async()=>[],readClipboardFiles:async()=>[],setTraySummary(){},onCommand:Da,openPairing(){},quit(){},resetAllData:async()=>{},setLaunchAtLogin:async()=>!1,showInDock:async()=>!0,setShowInDock:async()=>!0,launchAtLogin:async()=>!1,openSettings(){},authenticate:rh,setScreenAgent:rh,syncScreenAgent:async()=>({needsApproval:!1})}};try{for(const e of Object.keys(localStorage))e.startsWith("codync-")&&localStorage.removeItem(e);localStorage.setItem("macAccountOnboardingCompleted","true")}catch{}const pb=window.matchMedia.bind(window);window.matchMedia=e=>pb(e.includes("prefers-color-scheme: dark")?"all":e);window.codync=fb;function gb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var A0={exports:{}},Fl={};var Qv;function mb(){if(Qv)return Fl;Qv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,l,h){var d=null;if(h!==void 0&&(d=""+h),l.key!==void 0&&(d=""+l.key),"key"in l){h={};for(var p in l)p!=="key"&&(h[p]=l[p])}else h=l;return l=h.ref,{$$typeof:e,type:r,key:d,ref:l!==void 0?l:null,props:h}}return Fl.Fragment=t,Fl.jsx=n,Fl.jsxs=n,Fl}var Jv;function vb(){return Jv||(Jv=1,A0.exports=mb()),A0.exports}var c=vb(),N0={exports:{}},Kl={},L0={exports:{}},B0={};var e_;function _b(){return e_||(e_=1,(function(e){function t(P,te){var Q=P.length;P.push(te);e:for(;0<Q;){var ce=Q-1>>>1,re=P[ce];if(0<l(re,te))P[ce]=te,P[Q]=re,Q=ce;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var te=P[0],Q=P.pop();if(Q!==te){P[0]=Q;e:for(var ce=0,re=P.length,de=re>>>1;ce<de;){var Ce=2*(ce+1)-1,je=P[Ce],R=Ce+1,J=P[R];if(0>l(je,Q))R<re&&0>l(J,je)?(P[ce]=J,P[R]=Q,ce=R):(P[ce]=je,P[Ce]=Q,ce=Ce);else if(R<re&&0>l(J,Q))P[ce]=J,P[R]=Q,ce=R;else break e}}return te}function l(P,te){var Q=P.sortIndex-te.sortIndex;return Q!==0?Q:P.id-te.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;e.unstable_now=function(){return h.now()}}else{var d=Date,p=d.now();e.unstable_now=function(){return d.now()-p}}var g=[],m=[],v=1,_=null,S=3,w=!1,b=!1,k=!1,E=!1,j=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function z(P){for(var te=n(m);te!==null;){if(te.callback===null)r(m);else if(te.startTime<=P)r(m),te.sortIndex=te.expirationTime,t(g,te);else break;te=n(m)}}function F(P){if(k=!1,z(P),!b)if(n(g)!==null)b=!0,D||(D=!0,M());else{var te=n(m);te!==null&&O(F,te.startTime-P)}}var D=!1,I=-1,q=5,U=-1;function Y(){return E?!0:!(e.unstable_now()-U<q)}function $(){if(E=!1,D){var P=e.unstable_now();U=P;var te=!0;try{e:{b=!1,k&&(k=!1,V(I),I=-1),w=!0;var Q=S;try{t:{for(z(P),_=n(g);_!==null&&!(_.expirationTime>P&&Y());){var ce=_.callback;if(typeof ce=="function"){_.callback=null,S=_.priorityLevel;var re=ce(_.expirationTime<=P);if(P=e.unstable_now(),typeof re=="function"){_.callback=re,z(P),te=!0;break t}_===n(g)&&r(g),z(P)}else r(g);_=n(g)}if(_!==null)te=!0;else{var de=n(m);de!==null&&O(F,de.startTime-P),te=!1}}break e}finally{_=null,S=Q,w=!1}te=void 0}}finally{te?M():D=!1}}}var M;if(typeof A=="function")M=function(){A($)};else if(typeof MessageChannel<"u"){var N=new MessageChannel,L=N.port2;N.port1.onmessage=$,M=function(){L.postMessage(null)}}else M=function(){j($,0)};function O(P,te){I=j(function(){P(e.unstable_now())},te)}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(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(P){switch(S){case 1:case 2:case 3:var te=3;break;default:te=S}var Q=S;S=te;try{return P()}finally{S=Q}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(P,te){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var Q=S;S=P;try{return te()}finally{S=Q}},e.unstable_scheduleCallback=function(P,te,Q){var ce=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?ce+Q:ce):Q=ce,P){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=Q+re,P={id:v++,callback:te,priorityLevel:P,startTime:Q,expirationTime:re,sortIndex:-1},Q>ce?(P.sortIndex=Q,t(m,P),n(g)===null&&P===n(m)&&(k?(V(I),I=-1):k=!0,O(F,Q-ce))):(P.sortIndex=re,t(g,P),b||w||(b=!0,D||(D=!0,M()))),P},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(P){var te=S;return function(){var Q=S;S=te;try{return P.apply(this,arguments)}finally{S=Q}}}})(B0)),B0}var t_;function yb(){return t_||(t_=1,L0.exports=_b()),L0.exports}var O0={exports:{}},Re={};var i_;function Sb(){if(i_)return Re;i_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),d=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),S=Symbol.for("react.view_transition"),w=Symbol.iterator;function b(R){return R===null||typeof R!="object"?null:(R=w&&R[w]||R["@@iterator"],typeof R=="function"?R:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,j={};function V(R,J,le){this.props=R,this.context=J,this.refs=j,this.updater=le||k}V.prototype.isReactComponent={},V.prototype.setState=function(R,J){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,J,"setState")},V.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function A(){}A.prototype=V.prototype;function z(R,J,le){this.props=R,this.context=J,this.refs=j,this.updater=le||k}var F=z.prototype=new A;F.constructor=z,E(F,V.prototype),F.isPureReactComponent=!0;var D=Array.isArray;function I(){}var q={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function Y(R,J,le){var he=le.ref;return{$$typeof:e,type:R,key:J,ref:he!==void 0?he:null,props:le}}function $(R,J){return Y(R.type,J,R.props)}function M(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function N(R){var J={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(le){return J[le]})}var L=/\/+/g;function O(R,J){return typeof R=="object"&&R!==null&&R.key!=null?N(""+R.key):J.toString(36)}function P(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(I,I):(R.status="pending",R.then(function(J){R.status==="pending"&&(R.status="fulfilled",R.value=J)},function(J){R.status==="pending"&&(R.status="rejected",R.reason=J)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function te(R,J,le,he,we){var xe=typeof R;(xe==="undefined"||xe==="boolean")&&(R=null);var be=!1;if(R===null)be=!0;else switch(xe){case"bigint":case"string":case"number":be=!0;break;case"object":switch(R.$$typeof){case e:case t:be=!0;break;case v:return be=R._init,te(be(R._payload),J,le,he,we)}}if(be)return we=we(R),be=he===""?"."+O(R,0):he,D(we)?(le="",be!=null&&(le=be.replace(L,"$&/")+"/"),te(we,J,le,"",function(De){return De})):we!=null&&(M(we)&&(we=$(we,le+(we.key==null||R&&R.key===we.key?"":(""+we.key).replace(L,"$&/")+"/")+be)),J.push(we)),1;be=0;var pe=he===""?".":he+":";if(D(R))for(var _e=0;_e<R.length;_e++)he=R[_e],xe=pe+O(he,_e),be+=te(he,J,le,xe,we);else if(_e=b(R),typeof _e=="function")for(R=_e.call(R),_e=0;!(he=R.next()).done;)he=he.value,xe=pe+O(he,_e++),be+=te(he,J,le,xe,we);else if(xe==="object"){if(typeof R.then=="function")return te(P(R),J,le,he,we);throw J=String(R),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.")}return be}function Q(R,J,le){if(R==null)return R;var he=[],we=0;return te(R,he,"","",function(xe){return J.call(le,xe,we++)}),he}function ce(R){if(R._status===-1){var J=R._result,le=J();le.then(function(he){(R._status===0||R._status===-1)&&(R._status=1,R._result=he,le.status===void 0&&(le.status="fulfilled",le.value=he))},function(he){(R._status===0||R._status===-1)&&(R._status=2,R._result=he,le.status===void 0&&(le.status="rejected",le.reason=he))}),R._status===-1&&(R._status=0,R._result=le)}if(R._status===1)return R._result.default;throw R._result}var re=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var J=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(J))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)};function de(R){var J=q.T,le={};le.types=J!==null?J.types:null,q.T=le;try{var he=R(),we=q.S;we!==null&&we(le,he),typeof he=="object"&&he!==null&&typeof he.then=="function"&&he.then(I,re)}catch(xe){re(xe)}finally{J!==null&&le.types!==null&&(J.types=le.types),q.T=J}}function Ce(R){var J=q.T;if(J!==null){var le=J.types;le===null?J.types=[R]:le.indexOf(R)===-1&&le.push(R)}else de(Ce.bind(null,R))}var je={map:Q,forEach:function(R,J,le){Q(R,function(){J.apply(this,arguments)},le)},count:function(R){var J=0;return Q(R,function(){J++}),J},toArray:function(R){return Q(R,function(J){return J})||[]},only:function(R){if(!M(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Re.Activity=_,Re.Children=je,Re.Component=V,Re.Fragment=n,Re.Profiler=l,Re.PureComponent=z,Re.StrictMode=r,Re.Suspense=g,Re.ViewTransition=S,Re.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=q,Re.__COMPILER_RUNTIME={__proto__:null,c:function(R){return q.H.useMemoCache(R)}},Re.addTransitionType=Ce,Re.cache=function(R){return function(){return R.apply(null,arguments)}},Re.cacheSignal=function(){return null},Re.cloneElement=function(R,J,le){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var he=E({},R.props),we=R.key;if(J!=null)for(xe in J.key!==void 0&&(we=""+J.key),J)!U.call(J,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&J.ref===void 0||(he[xe]=J[xe]);var xe=arguments.length-2;if(xe===1)he.children=le;else if(1<xe){for(var be=Array(xe),pe=0;pe<xe;pe++)be[pe]=arguments[pe+2];he.children=be}return Y(R.type,we,he)},Re.createContext=function(R){return R={$$typeof:d,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:h,_context:R},R},Re.createElement=function(R,J,le){var he,we={},xe=null;if(J!=null)for(he in J.key!==void 0&&(xe=""+J.key),J)U.call(J,he)&&he!=="key"&&he!=="__self"&&he!=="__source"&&(we[he]=J[he]);var be=arguments.length-2;if(be===1)we.children=le;else if(1<be){for(var pe=Array(be),_e=0;_e<be;_e++)pe[_e]=arguments[_e+2];we.children=pe}if(R&&R.defaultProps)for(he in be=R.defaultProps,be)we[he]===void 0&&(we[he]=be[he]);return Y(R,xe,we)},Re.createRef=function(){return{current:null}},Re.forwardRef=function(R){return{$$typeof:p,render:R}},Re.isValidElement=M,Re.lazy=function(R){return{$$typeof:v,_payload:{_status:-1,_result:R},_init:ce}},Re.memo=function(R,J){return{$$typeof:m,type:R,compare:J===void 0?null:J}},Re.startTransition=de,Re.unstable_useCacheRefresh=function(){return q.H.useCacheRefresh()},Re.use=function(R){return q.H.use(R)},Re.useActionState=function(R,J,le){return q.H.useActionState(R,J,le)},Re.useCallback=function(R,J){return q.H.useCallback(R,J)},Re.useContext=function(R){return q.H.useContext(R)},Re.useDebugValue=function(){},Re.useDeferredValue=function(R,J){return q.H.useDeferredValue(R,J)},Re.useEffect=function(R,J){return q.H.useEffect(R,J)},Re.useEffectEvent=function(R){return q.H.useEffectEvent(R)},Re.useId=function(){return q.H.useId()},Re.useImperativeHandle=function(R,J,le){return q.H.useImperativeHandle(R,J,le)},Re.useInsertionEffect=function(R,J){return q.H.useInsertionEffect(R,J)},Re.useLayoutEffect=function(R,J){return q.H.useLayoutEffect(R,J)},Re.useMemo=function(R,J){return q.H.useMemo(R,J)},Re.useOptimistic=function(R,J){return q.H.useOptimistic(R,J)},Re.useReducer=function(R,J,le){return q.H.useReducer(R,J,le)},Re.useRef=function(R){return q.H.useRef(R)},Re.useState=function(R){return q.H.useState(R)},Re.useSyncExternalStore=function(R,J,le){return q.H.useSyncExternalStore(R,J,le)},Re.useTransition=function(){return q.H.useTransition()},Re.version="19.3.0",Re}var s_;function W2(){return s_||(s_=1,O0.exports=Sb()),O0.exports}var z0={exports:{}},Qt={};var n_;function xb(){if(n_)return Qt;n_=1;var e=W2();function t(v){var _="https://react.dev/errors/"+v;if(1<arguments.length){_+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)_+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+v+"; visit "+_+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},l=Symbol.for("react.portal"),h=Symbol.for("react.recoverable"),d=Symbol.for("react.optimistic_key");function p(v,_,S){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:w==null?null:w===d?d:""+w,children:v,containerInfo:_,implementation:S}}var g=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(v,_){if(v==="font")return"";if(typeof _=="string")return _==="use-credentials"?_:""}return Qt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Qt.browser=function(v){return{$$typeof:h,_reason:v}},Qt.createPortal=function(v,_){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!_||_.nodeType!==1&&_.nodeType!==9&&_.nodeType!==11)throw Error(t(299));return p(v,_,null,S)},Qt.flushSync=function(v){var _=g.T,S=r.p;try{if(g.T=null,r.p=2,v)return v()}finally{g.T=_,r.p=S,r.d.f()}},Qt.preconnect=function(v,_){typeof v=="string"&&(_?(_=_.crossOrigin,_=typeof _=="string"?_==="use-credentials"?_:"":void 0):_=null,r.d.C(v,_))},Qt.prefetchDNS=function(v){typeof v=="string"&&r.d.D(v)},Qt.preinit=function(v,_){if(typeof v=="string"&&_&&typeof _.as=="string"){var S=_.as,w=m(S,_.crossOrigin),b=typeof _.integrity=="string"?_.integrity:void 0,k=typeof _.fetchPriority=="string"?_.fetchPriority:void 0;S==="style"?r.d.S(v,typeof _.precedence=="string"?_.precedence:void 0,{crossOrigin:w,integrity:b,fetchPriority:k}):S==="script"&&r.d.X(v,{crossOrigin:w,integrity:b,fetchPriority:k,nonce:typeof _.nonce=="string"?_.nonce:void 0})}},Qt.preinitModule=function(v,_){if(typeof v=="string")if(typeof _=="object"&&_!==null){if(_.as==null||_.as==="script"){var S=m(_.as,_.crossOrigin);r.d.M(v,{crossOrigin:S,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0,fetchPriority:typeof _.fetchPriority=="string"?_.fetchPriority:void 0})}}else _==null&&r.d.M(v)},Qt.preload=function(v,_){if(typeof v=="string"&&typeof _=="object"&&_!==null&&typeof _.as=="string"){var S=_.as,w=m(S,_.crossOrigin);r.d.L(v,S,{crossOrigin:w,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0,type:typeof _.type=="string"?_.type:void 0,fetchPriority:typeof _.fetchPriority=="string"?_.fetchPriority:void 0,referrerPolicy:typeof _.referrerPolicy=="string"?_.referrerPolicy:void 0,imageSrcSet:typeof _.imageSrcSet=="string"?_.imageSrcSet:void 0,imageSizes:typeof _.imageSizes=="string"?_.imageSizes:void 0,media:typeof _.media=="string"?_.media:void 0})}},Qt.preloadModule=function(v,_){if(typeof v=="string")if(_){var S=m(_.as,_.crossOrigin);r.d.m(v,{as:typeof _.as=="string"&&_.as!=="script"?_.as:void 0,crossOrigin:S,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0,fetchPriority:typeof _.fetchPriority=="string"?_.fetchPriority:void 0})}else r.d.m(v)},Qt.requestFormReset=function(v){r.d.r(v)},Qt.unstable_batchedUpdates=function(v,_){return v(_)},Qt.useFormState=function(v,_,S){return g.H.useFormState(v,_,S)},Qt.useFormStatus=function(){return g.H.useHostTransitionStatus()},Qt.version="19.3.0",Qt}var r_;function U3(){if(r_)return z0.exports;r_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),z0.exports=xb(),z0.exports}var a_;function wb(){if(a_)return Kl;a_=1;var e=yb(),t=W2(),n=U3();function r(i){var s="https://react.dev/errors/"+i;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function h(i){for(var s=i,a=s;a&&!a.alternate;)s=a,(s.flags&4098)!==0&&(i=s.return),a=s.return;for(;s.return;)s=s.return;return s.tag===3?i:null}function d(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function p(i){if(i.tag===31){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function g(i){if(h(i)!==i)throw Error(r(188))}function m(i){var s=i.alternate;if(!s){if(s=h(i),s===null)throw Error(r(188));return s!==i?null:i}for(var a=i,o=s;;){var u=a.return;if(u===null)break;var f=u.alternate;if(f===null){if(o=u.return,o!==null){a=o;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===a)return g(u),i;if(f===o)return g(u),s;f=f.sibling}throw Error(r(188))}if(a.return!==o.return)a=u,o=f;else{for(var y=!1,C=u.child;C;){if(C===a){y=!0,a=u,o=f;break}if(C===o){y=!0,o=u,a=f;break}C=C.sibling}if(!y){for(C=f.child;C;){if(C===a){y=!0,a=f,o=u;break}if(C===o){y=!0,o=f,a=u;break}C=C.sibling}if(!y)throw Error(r(189))}}if(a.alternate!==o)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?i:s}function v(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=v(i),s!==null)return s;i=i.sibling}return null}function _(i,s,a,o,u,f){for(;i!==null;){if((i.tag===5||i.tag===27||i.tag===6)&&a(i,o,u,f)||(i.tag!==22||i.memoizedState===null)&&(s||i.tag!==5&&i.tag!==27)&&_(i.child,s,a,o,u,f))return!0;i=i.sibling}return!1}function S(i){for(i=i.return;i!==null;){if(i.tag===3||i.tag===5||i.tag===27)return i;i=i.return}return null}function w(i){var s=!1;for(i=i.return;i!==null&&(i.tag===4&&(s=!0),!(i.tag===3||i.tag===5||i.tag===27));)i=i.return;return s}function b(i){var s=[null,null],a=S(i);return a===null||k(s,i,a.child,{foundSelf:!1}),s}function k(i,s,a,o){for(;a!==null;){if(a===s)o.foundSelf=!0;else if(a.tag===5||a.tag===27||a.tag===6){if(o.foundSelf)return i[1]=a,!0;i[0]=a}else if((a.tag!==22||a.memoizedState===null)&&k(i,s,a.child,o))return!0;a=a.sibling}return!1}function E(i){switch(i.tag){case 5:case 27:case 6:return i.stateNode;case 3:return i.stateNode.containerInfo;default:throw Error(r(559))}}var j=null,V=null;function A(i,s,a){return i===a?!0:i===s?(j=i,!0):!1}function z(i,s,a){return i===a?(V=i,!1):i===s?(V!==null&&(j=i),!0):!1}function F(i){if(i===null)return null;do i=i===null?null:i.return;while(i&&i.tag!==5&&i.tag!==27&&i.tag!==3);return i||null}function D(i,s,a){for(var o=0,u=i;u;u=a(u))o++;u=0;for(var f=s;f;f=a(f))u++;for(;0<o-u;)i=a(i),o--;for(;0<u-o;)s=a(s),u--;for(;o--;){if(i===s||s!==null&&i===s.alternate)return i;i=a(i),s=a(s)}return null}var I=Object.assign,q=Symbol.for("react.element"),U=Symbol.for("react.transitional.element"),Y=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),O=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),te=Symbol.for("react.suspense"),Q=Symbol.for("react.suspense_list"),ce=Symbol.for("react.memo"),re=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),Ce=Symbol.for("react.legacy_hidden"),je=Symbol.for("react.memo_cache_sentinel"),R=Symbol.for("react.view_transition"),J=Symbol.for("react.recoverable"),le=Symbol.iterator;function he(i){return i===null||typeof i!="object"?null:(i=le&&i[le]||i["@@iterator"],typeof i=="function"?i:null)}var we=Symbol.for("react.client.reference");function xe(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===we?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case $:return"Fragment";case N:return"Profiler";case M:return"StrictMode";case te:return"Suspense";case Q:return"SuspenseList";case de:return"Activity";case R:return"ViewTransition"}if(typeof i=="object")switch(i.$$typeof){case Y:return"Portal";case O:return i.displayName||"Context";case L:return(i._context.displayName||"Context")+".Consumer";case P:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case ce:return s=i.displayName||null,s!==null?s:xe(i.type)||"Memo";case re:s=i._payload,i=i._init;try{return xe(i(s))}catch{}}return null}var be=Array.isArray,pe=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_e=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,De={pending:!1,data:null,method:null,action:null},fi=[],pi=-1;function Bt(i){return{current:i}}function pt(i){0>pi||(i.current=fi[pi],fi[pi]=null,pi--)}function $e(i,s){pi++,fi[pi]=i.current,i.current=s}var gi=Bt(null),ge=Bt(null),Ke=Bt(null),ki=Bt(null);function Ur(i,s){switch($e(Ke,s),$e(ge,i),$e(gi,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?iv(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=iv(s),i=sv(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}pt(gi),$e(gi,i)}function Bs(){pt(gi),pt(ge),pt(Ke)}function Pr(i){var s=i.memoizedState;s!==null&&(ja._currentValue=s.memoizedState,$e(ki,i)),s=gi.current;var a=sv(s,i.type);s!==a&&($e(ge,i),$e(gi,a))}function rs(i){ge.current===i&&(pt(gi),pt(ge)),ki.current===i&&(pt(ki),ja._currentValue=De)}var Qa,tr;function as(i){if(Qa===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);Qa=s&&s[1]||"",tr=-1<a.stack.indexOf(`+- Weeks are grouped in UTC, so a late evening run west of UTC can land in the next week.`),Er("l1","relay",41,"Summarize what changed in pace today for the team channel."),Un("l2","relay","relay",40,"Added `weeklyTotals` to group run distance and time by ISO week, with a test for the 2026 to 2027 rollover. Reviewer found no blockers. An invalid-date guard is being added in Ship room."),Er("l3","relay",38,"Make it one line for the changelog.","l2"),Un("l4","relay","relay",38,"Pace now shows your weekly distance and time totals.","l2"),Er("g1","ship",22,"Is weeklyTotals ready to ship? One short sentence each."),Un("g2","ship","reviewer",21,'Almost: the week math is right and all 4 tests pass, but a bad date gets bucketed as `"NaN-WNaN"` instead of raising an error. @Scout, can you add an invalid-date guard?'),Un("g3","ship","scout",19,"Added the guard: `weeklyTotals` now throws a `RangeError` on an invalid date, and all 5 tests pass. Weeks are still grouped in UTC, so say if they should follow the runner's local time instead."),Er("g4","ship",17,"UTC is right, keep it.","g3"),Un("g5","ship","scout",17,"Got it, UTC stays. I left a comment above `weeklyTotals` so nobody flips it later.","g3"),Un("g6","ship","pacer",15,"Ship it once my `isoWeek` New Year fix lands. Dec 30, 2024 still comes out as 2024-W01 instead of 2025-W01."),Er("p1","pacer",9,"Fix the isoWeek New Year bug you mentioned."),Kv("p2","pacer",9,"The year is read before moving to the Thursday of the week, so late December dates get the wrong ISO year."),nh("p3","pacer",8,"Read src/pace.js","read"),{id:"p4",botId:"pacer",kind:"agent",at:7,data:{text:"Found it: the year comes from the date itself, not from the Thursday of its week.",final:!1,author:"pacer"}},{id:"p5",botId:"pacer",kind:"permission",at:6,data:{title:"Edit src/pace.js",toolKind:"edit",cwd:H3,status:"pending",selected:void 0,author:"pacer",diffs:[{path:"src/pace.js",added:2,removed:1,isNew:!1,startLine:4,patch:sb}],options:[{optionId:"allow",name:"Allow",kind:"allow_once"},{optionId:"always",name:"Always allow",kind:"allow_always"},{optionId:"deny",name:"Deny",kind:"reject_once"}]}}],rb={pacer:["Sure. I'll keep it inside `src/pace.js` and rerun `npm test` when it's done.","Makes sense. The week math is the risky part, so I'll add a test for it first.","Good call. Nothing else imports that function, so it's a one-file change."],scout:["On it. I'll grep the repo first so we know what else touches it.","Done a quick pass: only `src/pace.js` and its test use it, so the change stays small.","Sure. I'll write the test first, then make it pass."],reviewer:["I'll look at the diff once it lands and flag anything that isn't a nit.","Looks fine to me. Just keep the test for the New Year week, that's where it broke before.","One thing to watch: dates without a time zone are read as UTC. Worth a comment."],relay:[`Here's a draft: "Pace now groups your runs by week, with totals for distance and time."`,"Noted. I'll fold that into the release notes for the next version.","Short version for the channel: weekly totals are in, a New Year week fix is next."]},ab="I'm still waiting on your approval for the `isoWeek` edit. Once you allow it, I'll keep going.",lb="Fixed: `isoWeek` now takes the year from the Thursday of the week, so Dec 30, 2024 is 2025-W01. I added a test for it and all 6 tests pass.",ob="OK, I left `src/pace.js` alone. Want me to explain the fix so you can make it yourself?";function Yv(e){const t=n=>e+n*36e5;return{providers:[{id:"claude",name:"Claude",source:"statusline",updatedAt:e,windows:[{id:"five_hour",label:"5-hour",percent:38,resetsAt:t(2.4)},{id:"seven_day",label:"Weekly",percent:61,resetsAt:t(70)}]},{id:"codex",name:"Codex",source:"sessions",updatedAt:e,windows:[{id:"primary",label:"5-hour",percent:22,resetsAt:t(3.1)},{id:"secondary",label:"Weekly",percent:47,resetsAt:t(95)}]}]}}const Gv=1500,Rh="Not available in the web demo. Install Codync to use this.";class cb{constructor(t,n=Date.now()){this.version=t;for(const r of tb)this.bots.set(r.id,Of({...r,cwd:r.kind==="group"?"":D0,createdAt:n-864e5,permission:r.permission??"auto"}));for(const r of nb)this.add({botId:r.botId,threadId:r.threadId??null,kind:r.kind,data:r.data},r.id,n-r.at*6e4,!1);for(const r of this.bots.values())this.refreshPreview(r),r.rev=++this.rev}version;hostId="demo-host";rev=0;seq=0;bots=new Map;entries=[];listeners=new Set;turns=new Map;nextReply=new Map;subscribe(t,n){const r=[...[...this.bots.values()].filter(p=>p.rev>t).map(p=>({rev:p.rev,line:{type:"bot",rev:p.rev,bot:this.botJSON(p)}})),...this.entries.filter(p=>p.rev>t).map(p=>({rev:p.rev,line:{type:"entry",rev:p.rev,entry:p}}))].sort((p,g)=>p.rev-g.rev),l={type:"hello",hostId:this.hostId,computerId:Dh,rev:this.rev,usage:Yv(Date.now()),screen:null};let h=!0;const d=p=>h&&n(p);return setTimeout(()=>{if(h){for(const p of[{line:l},...r])n(JSON.stringify(p.line));this.listeners.add(d)}},0),()=>{h=!1,this.listeners.delete(d)}}emit(t){const n=JSON.stringify(t);for(const r of this.listeners)r(n)}emitBot(t){if(t.rev=++this.rev,this.emit({type:"bot",rev:t.rev,bot:this.botJSON(t)}),t.kind!=="group")for(const n of this.bots.values())n.kind==="group"&&n.members.includes(t.id)&&this.emitBot(n)}emitEntry(t){t.rev=++this.rev,t.updatedAt=Date.now(),this.emit({type:"entry",rev:t.rev,entry:t})}botJSON(t){if(t.kind!=="group")return t;const n=t.members.map(r=>this.bots.get(r)).find(r=>r&&r.status!=="idle"&&r.workingChat===t.id);return n?{...t,status:n.status,activity:n.activity,startedAt:n.startedAt,workingChat:t.id,workingThread:n.workingThread}:t}add(t,n=crypto.randomUUID(),r=Date.now(),l=!0){const h={...t,id:n,seq:++this.seq,rev:++this.rev,turn:1,createdAt:r,updatedAt:r};if(this.entries.push(h),h.threadId&&this.summarize(h.botId,h.threadId,l),l){this.emit({type:"entry",rev:h.rev,entry:h});const d=this.bots.get(h.botId);d&&!h.threadId&&_o(h)&&(this.refreshPreview(d),h.kind!=="user"&&d.unread++,this.emitBot(d))}return h}summarize(t,n,r){const l=this.entries.find(p=>p.id===n);if(!l)return;const h=this.entries.filter(p=>p.botId===t&&p.threadId===n&&_o(p)),d=[];for(const p of h){const g=p.kind==="user"?"user":p.data.author??t;d.includes(g)||d.push(g)}l.data={...l.data,thread:{count:h.length,lastAt:h.at(-1)?.createdAt??0,authors:d,unread:0}},r&&this.emitEntry(l)}refreshPreview(t){const n=this.entries.filter(l=>l.botId===t.id&&!l.threadId&&(l.kind==="user"||l.kind==="agent"&&l.data.final)).at(-1);if(!n)return;const r=n.data.text??"";t.lastAt=n.createdAt,t.lastMessage=n.kind==="user"?`You: ${r}`:t.kind==="group"?`${this.bots.get(n.data.author??"")?.name??"A bot"}: ${r}`:r}setStatus(t,n,r="",l=null,h=null){const d=this.bots.get(t);d&&(Object.assign(d,{status:n,activity:r,startedAt:n==="idle"?null:Date.now(),workingChat:l,workingThread:h}),this.emitBot(d))}pending(t){return this.entries.find(n=>n.kind==="permission"&&n.data.author===t&&n.data.status==="pending")??null}settle(t){const n=this.pending(t);n?this.setStatus(t,"needsInput",`Needs approval: ${n.data.title??""}`,n.botId):this.setStatus(t,"idle")}async answer(t,n,r,l){const h=(this.turns.get(t)??0)+1;this.turns.set(t,h),this.setStatus(t,"working","Typing…",n,r),await Zv(Gv+Math.random()*600),this.turns.get(t)===h&&(this.add({botId:n,threadId:r,kind:"agent",data:{text:l,final:!0,author:t}}),this.settle(t))}replyText(t){if(this.pending(t))return ab;const n=rb[t]??["Got it. I'll take a look and report back."],r=this.nextReply.get(t)??0;return this.nextReply.set(t,r+1),n[r%n.length]}async converse(t,n,r){let l=[t.id];if(t.kind==="group"){const h=t.members.filter(g=>this.bots.has(g)),d=h.filter(g=>r.toLowerCase().includes(`@${this.bots.get(g).name.toLowerCase()}`)),p=n?this.entries.find(g=>g.id===n)?.data.author:void 0;l=d.length?d:p&&h.includes(p)?[p]:h.slice(0,2)}for(const h of l)await this.answer(h,t.id,n,this.replyText(h))}async call(t,n){const r=l=>typeof n[l]=="string"?n[l]:"";switch(t){case"hello":return{hostId:this.hostId,computerId:Dh,signKey:"",boxKey:"",cloud:null,name:z3,version:this.version,minApp:this.version,os:"macos",device:"MacBookPro",home:"/Users/demo",rev:this.rev,urls:[],backends:[{id:"claude",name:"Claude Code",available:!0,installed:!0,signedIn:!0,command:"claude",installHint:""},{id:"codex",name:"Codex",available:!0,installed:!0,signedIn:!0,command:"codex",installHint:""}]};case"accessRequests":return{requests:[]};case"cloudStatus":return{enabled:!1};case"usage":return Yv(Date.now());case"history":return{entries:[]};case"thread":return{entries:this.entries.filter(l=>l.botId===r("botId")&&l.threadId===r("rootId"))};case"send":{const l=this.bots.get(r("botId"));if(!l)throw R0("That bot was deleted.");const h=r("threadId")||null,d=this.add({botId:l.id,threadId:h,kind:"user",data:{text:r("text"),status:"sent",clientNonce:r("clientNonce")}});return this.converse(l,h,r("text")),{entry:d}}case"markRead":{const l=this.bots.get(r("botId"));return l&&l.unread>0&&(l.unread=0,this.emitBot(l)),{}}case"respondPermission":return this.respond(r("entryId"),r("optionId")||null);case"react":{const l=this.entries.find(d=>d.id===r("entryId"));if(!l)throw R0("That message is gone.");const h=new Set(l.data.reactions??[]);return h.delete(r("emoji"))||h.add(r("emoji")),l.data={...l.data,reactions:[...h]},this.emitEntry(l),{entry:l}}case"stop":{const l=r("botId");return this.turns.set(l,(this.turns.get(l)??0)+1),this.settle(l),{}}case"newSession":return this.add({botId:r("botId"),threadId:null,kind:"notice",data:{text:"New session",style:"divider"}}),{};case"createBot":case"updateBot":return{bot:this.saveBot(n)};case"deleteBot":{const l=r("botId");return this.bots.delete(l),this.emit({type:"bot",rev:++this.rev,bot:{id:l,rev:this.rev,deleted:!0}}),{}}case"refreshBackends":return{backends:(await this.call("hello",{})).backends};case"listDirs":return{path:"/Users/demo/code",parent:"/Users/demo",isGit:!1,dirs:[{name:"pace",path:D0,isGit:!0}]};case"memory":return{location:"",facts:[]};case"routines":return{routines:[],runs:[]};case"skills":case"connectors":case"marketSkills":case"marketConnectors":case"credentialLogins":case"composioToolkits":return{items:[]};case"devices":return{devices:[]};case"voiceStatus":return{providers:[]};case"composioStatus":return{configured:!1,keyUrl:""};case"credentialStatus":return{provider:"",onePasswordConnected:!1};default:throw R0(Rh)}}async respond(t,n){const r=this.entries.find(p=>p.id===t);if(!r||r.data.status!=="pending")return{};const l=r.data.options?.find(p=>p.optionId===n),h=!!l&&l.kind.startsWith("allow");r.data={...r.data,status:n?"answered":"cancelled",selected:n??void 0},this.emitEntry(r);const d=r.data.author??r.botId;return(async()=>(this.setStatus(d,"working",h?"Editing src/pace.js":"Typing…",r.botId),await Zv(Gv),this.add({botId:r.botId,threadId:r.threadId??null,kind:"agent",data:{text:h?lb:ob,final:!0,author:d}}),this.settle(d)))(),{}}saveBot(t){const n=t.id?this.bots.get(t.id):void 0,r=Of({...n??{createdAt:Date.now(),cwd:"cwd"in t?t.cwd||D0:""},...t,id:n?.id??crypto.randomUUID()});n&&Object.assign(n,r);const l=n??r;return this.bots.set(l.id,l),this.emitBot(l),this.botJSON(l)}}function R0(e){return{status:400,message:e}}const Zv=e=>new Promise(t=>setTimeout(t,e)),I3="2.8.0",Xv=new cb(I3),Ra=()=>()=>{},rh=()=>Promise.reject(new Error(Rh)),hb={state:{kind:"running"},local:{computerId:Dh,baseURL:"http://demo.invalid",token:"demo"},dev:!1,logPath:""},ub={ready:!0,configured:!1,busy:!1,error:null,user:null,cloudURL:null},db={supported:!1,canCheck:!1,checking:!1,availableVersion:null,staged:!1,autoCheck:!1,autoDownload:!1,lastCheck:null,error:null,waitingForApp:null},fb={platform:"darwin",appVersion:I3,computerName:z3,debugOpen:"Ship room",host:{snapshot:async()=>hb,onChange:Ra,install(){},restart(){},uninstall(){},openLog(){},async call(e,t,n,r){await new Promise(l=>setTimeout(l,30));try{return await Xv.call(n,r??{})}catch(l){throw l.status?l:{status:500,message:String(l)}}},stream(e,t,n){const r=Number(new URL(e).searchParams.get("since")??0);return Xv.subscribe(r,n)},health:async()=>({computerId:Dh,busy:!1})},account:{state:async()=>ub,onChange:Ra,signIn:rh,signOut:async()=>{},token:rh},speech:{available:!1,locales:()=>[],start(){},stop(){},onEvent:Ra},ssh:{state:async()=>({profiles:[],status:{},attachments:[]}),onChange:Ra,save:async()=>Rh,remove(){},connect(){},disconnect(){},trustHostKey(){},chooseKey:async()=>null},cloud:{request:async()=>({ok:!1,error:{status:503,code:"demo",message:Rh}})},updates:{state:async()=>db,onChange:Ra,check(){},setAutoCheck(){},setAutoDownload(){}},app:{openExternal:e=>{window.open(e,"_blank","noopener")},copy:e=>{navigator.clipboard?.writeText(e).catch(()=>{})},pickFiles:async()=>[],readClipboardFiles:async()=>[],setTraySummary(){},onCommand:Ra,openPairing(){},quit(){},resetAllData:async()=>{},setLaunchAtLogin:async()=>!1,showInDock:async()=>!0,setShowInDock:async()=>!0,launchAtLogin:async()=>!1,openSettings(){},authenticate:rh,setScreenAgent:rh,syncScreenAgent:async()=>({needsApproval:!1})}};try{for(const e of Object.keys(localStorage))e.startsWith("codync-")&&localStorage.removeItem(e);localStorage.setItem("macAccountOnboardingCompleted","true")}catch{}const pb=window.matchMedia.bind(window);window.matchMedia=e=>pb(e.includes("prefers-color-scheme: dark")?"all":e);window.codync=fb;function gb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var A0={exports:{}},Fl={};var Qv;function mb(){if(Qv)return Fl;Qv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,l,h){var d=null;if(h!==void 0&&(d=""+h),l.key!==void 0&&(d=""+l.key),"key"in l){h={};for(var p in l)p!=="key"&&(h[p]=l[p])}else h=l;return l=h.ref,{$$typeof:e,type:r,key:d,ref:l!==void 0?l:null,props:h}}return Fl.Fragment=t,Fl.jsx=n,Fl.jsxs=n,Fl}var Jv;function vb(){return Jv||(Jv=1,A0.exports=mb()),A0.exports}var c=vb(),N0={exports:{}},Kl={},L0={exports:{}},B0={};var e_;function _b(){return e_||(e_=1,(function(e){function t(P,te){var Q=P.length;P.push(te);e:for(;0<Q;){var ce=Q-1>>>1,re=P[ce];if(0<l(re,te))P[ce]=te,P[Q]=re,Q=ce;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var te=P[0],Q=P.pop();if(Q!==te){P[0]=Q;e:for(var ce=0,re=P.length,de=re>>>1;ce<de;){var Ce=2*(ce+1)-1,je=P[Ce],D=Ce+1,J=P[D];if(0>l(je,Q))D<re&&0>l(J,je)?(P[ce]=J,P[D]=Q,ce=D):(P[ce]=je,P[Ce]=Q,ce=Ce);else if(D<re&&0>l(J,Q))P[ce]=J,P[D]=Q,ce=D;else break e}}return te}function l(P,te){var Q=P.sortIndex-te.sortIndex;return Q!==0?Q:P.id-te.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;e.unstable_now=function(){return h.now()}}else{var d=Date,p=d.now();e.unstable_now=function(){return d.now()-p}}var g=[],m=[],v=1,_=null,S=3,w=!1,b=!1,k=!1,E=!1,j=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function z(P){for(var te=n(m);te!==null;){if(te.callback===null)r(m);else if(te.startTime<=P)r(m),te.sortIndex=te.expirationTime,t(g,te);else break;te=n(m)}}function F(P){if(k=!1,z(P),!b)if(n(g)!==null)b=!0,R||(R=!0,M());else{var te=n(m);te!==null&&O(F,te.startTime-P)}}var R=!1,I=-1,q=5,U=-1;function Y(){return E?!0:!(e.unstable_now()-U<q)}function $(){if(E=!1,R){var P=e.unstable_now();U=P;var te=!0;try{e:{b=!1,k&&(k=!1,V(I),I=-1),w=!0;var Q=S;try{t:{for(z(P),_=n(g);_!==null&&!(_.expirationTime>P&&Y());){var ce=_.callback;if(typeof ce=="function"){_.callback=null,S=_.priorityLevel;var re=ce(_.expirationTime<=P);if(P=e.unstable_now(),typeof re=="function"){_.callback=re,z(P),te=!0;break t}_===n(g)&&r(g),z(P)}else r(g);_=n(g)}if(_!==null)te=!0;else{var de=n(m);de!==null&&O(F,de.startTime-P),te=!1}}break e}finally{_=null,S=Q,w=!1}te=void 0}}finally{te?M():R=!1}}}var M;if(typeof A=="function")M=function(){A($)};else if(typeof MessageChannel<"u"){var N=new MessageChannel,L=N.port2;N.port1.onmessage=$,M=function(){L.postMessage(null)}}else M=function(){j($,0)};function O(P,te){I=j(function(){P(e.unstable_now())},te)}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(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(P){switch(S){case 1:case 2:case 3:var te=3;break;default:te=S}var Q=S;S=te;try{return P()}finally{S=Q}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(P,te){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var Q=S;S=P;try{return te()}finally{S=Q}},e.unstable_scheduleCallback=function(P,te,Q){var ce=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?ce+Q:ce):Q=ce,P){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=Q+re,P={id:v++,callback:te,priorityLevel:P,startTime:Q,expirationTime:re,sortIndex:-1},Q>ce?(P.sortIndex=Q,t(m,P),n(g)===null&&P===n(m)&&(k?(V(I),I=-1):k=!0,O(F,Q-ce))):(P.sortIndex=re,t(g,P),b||w||(b=!0,R||(R=!0,M()))),P},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(P){var te=S;return function(){var Q=S;S=te;try{return P.apply(this,arguments)}finally{S=Q}}}})(B0)),B0}var t_;function yb(){return t_||(t_=1,L0.exports=_b()),L0.exports}var O0={exports:{}},De={};var i_;function Sb(){if(i_)return De;i_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),d=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),S=Symbol.for("react.view_transition"),w=Symbol.iterator;function b(D){return D===null||typeof D!="object"?null:(D=w&&D[w]||D["@@iterator"],typeof D=="function"?D:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,j={};function V(D,J,le){this.props=D,this.context=J,this.refs=j,this.updater=le||k}V.prototype.isReactComponent={},V.prototype.setState=function(D,J){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,J,"setState")},V.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function A(){}A.prototype=V.prototype;function z(D,J,le){this.props=D,this.context=J,this.refs=j,this.updater=le||k}var F=z.prototype=new A;F.constructor=z,E(F,V.prototype),F.isPureReactComponent=!0;var R=Array.isArray;function I(){}var q={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function Y(D,J,le){var he=le.ref;return{$$typeof:e,type:D,key:J,ref:he!==void 0?he:null,props:le}}function $(D,J){return Y(D.type,J,D.props)}function M(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function N(D){var J={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(le){return J[le]})}var L=/\/+/g;function O(D,J){return typeof D=="object"&&D!==null&&D.key!=null?N(""+D.key):J.toString(36)}function P(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(I,I):(D.status="pending",D.then(function(J){D.status==="pending"&&(D.status="fulfilled",D.value=J)},function(J){D.status==="pending"&&(D.status="rejected",D.reason=J)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function te(D,J,le,he,we){var xe=typeof D;(xe==="undefined"||xe==="boolean")&&(D=null);var be=!1;if(D===null)be=!0;else switch(xe){case"bigint":case"string":case"number":be=!0;break;case"object":switch(D.$$typeof){case e:case t:be=!0;break;case v:return be=D._init,te(be(D._payload),J,le,he,we)}}if(be)return we=we(D),be=he===""?"."+O(D,0):he,R(we)?(le="",be!=null&&(le=be.replace(L,"$&/")+"/"),te(we,J,le,"",function(Re){return Re})):we!=null&&(M(we)&&(we=$(we,le+(we.key==null||D&&D.key===we.key?"":(""+we.key).replace(L,"$&/")+"/")+be)),J.push(we)),1;be=0;var pe=he===""?".":he+":";if(R(D))for(var _e=0;_e<D.length;_e++)he=D[_e],xe=pe+O(he,_e),be+=te(he,J,le,xe,we);else if(_e=b(D),typeof _e=="function")for(D=_e.call(D),_e=0;!(he=D.next()).done;)he=he.value,xe=pe+O(he,_e++),be+=te(he,J,le,xe,we);else if(xe==="object"){if(typeof D.then=="function")return te(P(D),J,le,he,we);throw J=String(D),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.")}return be}function Q(D,J,le){if(D==null)return D;var he=[],we=0;return te(D,he,"","",function(xe){return J.call(le,xe,we++)}),he}function ce(D){if(D._status===-1){var J=D._result,le=J();le.then(function(he){(D._status===0||D._status===-1)&&(D._status=1,D._result=he,le.status===void 0&&(le.status="fulfilled",le.value=he))},function(he){(D._status===0||D._status===-1)&&(D._status=2,D._result=he,le.status===void 0&&(le.status="rejected",le.reason=he))}),D._status===-1&&(D._status=0,D._result=le)}if(D._status===1)return D._result.default;throw D._result}var re=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var J=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(J))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)};function de(D){var J=q.T,le={};le.types=J!==null?J.types:null,q.T=le;try{var he=D(),we=q.S;we!==null&&we(le,he),typeof he=="object"&&he!==null&&typeof he.then=="function"&&he.then(I,re)}catch(xe){re(xe)}finally{J!==null&&le.types!==null&&(J.types=le.types),q.T=J}}function Ce(D){var J=q.T;if(J!==null){var le=J.types;le===null?J.types=[D]:le.indexOf(D)===-1&&le.push(D)}else de(Ce.bind(null,D))}var je={map:Q,forEach:function(D,J,le){Q(D,function(){J.apply(this,arguments)},le)},count:function(D){var J=0;return Q(D,function(){J++}),J},toArray:function(D){return Q(D,function(J){return J})||[]},only:function(D){if(!M(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return De.Activity=_,De.Children=je,De.Component=V,De.Fragment=n,De.Profiler=l,De.PureComponent=z,De.StrictMode=r,De.Suspense=g,De.ViewTransition=S,De.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=q,De.__COMPILER_RUNTIME={__proto__:null,c:function(D){return q.H.useMemoCache(D)}},De.addTransitionType=Ce,De.cache=function(D){return function(){return D.apply(null,arguments)}},De.cacheSignal=function(){return null},De.cloneElement=function(D,J,le){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var he=E({},D.props),we=D.key;if(J!=null)for(xe in J.key!==void 0&&(we=""+J.key),J)!U.call(J,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&J.ref===void 0||(he[xe]=J[xe]);var xe=arguments.length-2;if(xe===1)he.children=le;else if(1<xe){for(var be=Array(xe),pe=0;pe<xe;pe++)be[pe]=arguments[pe+2];he.children=be}return Y(D.type,we,he)},De.createContext=function(D){return D={$$typeof:d,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:h,_context:D},D},De.createElement=function(D,J,le){var he,we={},xe=null;if(J!=null)for(he in J.key!==void 0&&(xe=""+J.key),J)U.call(J,he)&&he!=="key"&&he!=="__self"&&he!=="__source"&&(we[he]=J[he]);var be=arguments.length-2;if(be===1)we.children=le;else if(1<be){for(var pe=Array(be),_e=0;_e<be;_e++)pe[_e]=arguments[_e+2];we.children=pe}if(D&&D.defaultProps)for(he in be=D.defaultProps,be)we[he]===void 0&&(we[he]=be[he]);return Y(D,xe,we)},De.createRef=function(){return{current:null}},De.forwardRef=function(D){return{$$typeof:p,render:D}},De.isValidElement=M,De.lazy=function(D){return{$$typeof:v,_payload:{_status:-1,_result:D},_init:ce}},De.memo=function(D,J){return{$$typeof:m,type:D,compare:J===void 0?null:J}},De.startTransition=de,De.unstable_useCacheRefresh=function(){return q.H.useCacheRefresh()},De.use=function(D){return q.H.use(D)},De.useActionState=function(D,J,le){return q.H.useActionState(D,J,le)},De.useCallback=function(D,J){return q.H.useCallback(D,J)},De.useContext=function(D){return q.H.useContext(D)},De.useDebugValue=function(){},De.useDeferredValue=function(D,J){return q.H.useDeferredValue(D,J)},De.useEffect=function(D,J){return q.H.useEffect(D,J)},De.useEffectEvent=function(D){return q.H.useEffectEvent(D)},De.useId=function(){return q.H.useId()},De.useImperativeHandle=function(D,J,le){return q.H.useImperativeHandle(D,J,le)},De.useInsertionEffect=function(D,J){return q.H.useInsertionEffect(D,J)},De.useLayoutEffect=function(D,J){return q.H.useLayoutEffect(D,J)},De.useMemo=function(D,J){return q.H.useMemo(D,J)},De.useOptimistic=function(D,J){return q.H.useOptimistic(D,J)},De.useReducer=function(D,J,le){return q.H.useReducer(D,J,le)},De.useRef=function(D){return q.H.useRef(D)},De.useState=function(D){return q.H.useState(D)},De.useSyncExternalStore=function(D,J,le){return q.H.useSyncExternalStore(D,J,le)},De.useTransition=function(){return q.H.useTransition()},De.version="19.3.0",De}var s_;function W2(){return s_||(s_=1,O0.exports=Sb()),O0.exports}var z0={exports:{}},Qt={};var n_;function xb(){if(n_)return Qt;n_=1;var e=W2();function t(v){var _="https://react.dev/errors/"+v;if(1<arguments.length){_+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)_+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+v+"; visit "+_+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},l=Symbol.for("react.portal"),h=Symbol.for("react.recoverable"),d=Symbol.for("react.optimistic_key");function p(v,_,S){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:w==null?null:w===d?d:""+w,children:v,containerInfo:_,implementation:S}}var g=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(v,_){if(v==="font")return"";if(typeof _=="string")return _==="use-credentials"?_:""}return Qt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Qt.browser=function(v){return{$$typeof:h,_reason:v}},Qt.createPortal=function(v,_){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!_||_.nodeType!==1&&_.nodeType!==9&&_.nodeType!==11)throw Error(t(299));return p(v,_,null,S)},Qt.flushSync=function(v){var _=g.T,S=r.p;try{if(g.T=null,r.p=2,v)return v()}finally{g.T=_,r.p=S,r.d.f()}},Qt.preconnect=function(v,_){typeof v=="string"&&(_?(_=_.crossOrigin,_=typeof _=="string"?_==="use-credentials"?_:"":void 0):_=null,r.d.C(v,_))},Qt.prefetchDNS=function(v){typeof v=="string"&&r.d.D(v)},Qt.preinit=function(v,_){if(typeof v=="string"&&_&&typeof _.as=="string"){var S=_.as,w=m(S,_.crossOrigin),b=typeof _.integrity=="string"?_.integrity:void 0,k=typeof _.fetchPriority=="string"?_.fetchPriority:void 0;S==="style"?r.d.S(v,typeof _.precedence=="string"?_.precedence:void 0,{crossOrigin:w,integrity:b,fetchPriority:k}):S==="script"&&r.d.X(v,{crossOrigin:w,integrity:b,fetchPriority:k,nonce:typeof _.nonce=="string"?_.nonce:void 0})}},Qt.preinitModule=function(v,_){if(typeof v=="string")if(typeof _=="object"&&_!==null){if(_.as==null||_.as==="script"){var S=m(_.as,_.crossOrigin);r.d.M(v,{crossOrigin:S,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0,fetchPriority:typeof _.fetchPriority=="string"?_.fetchPriority:void 0})}}else _==null&&r.d.M(v)},Qt.preload=function(v,_){if(typeof v=="string"&&typeof _=="object"&&_!==null&&typeof _.as=="string"){var S=_.as,w=m(S,_.crossOrigin);r.d.L(v,S,{crossOrigin:w,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0,type:typeof _.type=="string"?_.type:void 0,fetchPriority:typeof _.fetchPriority=="string"?_.fetchPriority:void 0,referrerPolicy:typeof _.referrerPolicy=="string"?_.referrerPolicy:void 0,imageSrcSet:typeof _.imageSrcSet=="string"?_.imageSrcSet:void 0,imageSizes:typeof _.imageSizes=="string"?_.imageSizes:void 0,media:typeof _.media=="string"?_.media:void 0})}},Qt.preloadModule=function(v,_){if(typeof v=="string")if(_){var S=m(_.as,_.crossOrigin);r.d.m(v,{as:typeof _.as=="string"&&_.as!=="script"?_.as:void 0,crossOrigin:S,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0,fetchPriority:typeof _.fetchPriority=="string"?_.fetchPriority:void 0})}else r.d.m(v)},Qt.requestFormReset=function(v){r.d.r(v)},Qt.unstable_batchedUpdates=function(v,_){return v(_)},Qt.useFormState=function(v,_,S){return g.H.useFormState(v,_,S)},Qt.useFormStatus=function(){return g.H.useHostTransitionStatus()},Qt.version="19.3.0",Qt}var r_;function U3(){if(r_)return z0.exports;r_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),z0.exports=xb(),z0.exports}var a_;function wb(){if(a_)return Kl;a_=1;var e=yb(),t=W2(),n=U3();function r(i){var s="https://react.dev/errors/"+i;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function h(i){for(var s=i,a=s;a&&!a.alternate;)s=a,(s.flags&4098)!==0&&(i=s.return),a=s.return;for(;s.return;)s=s.return;return s.tag===3?i:null}function d(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function p(i){if(i.tag===31){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function g(i){if(h(i)!==i)throw Error(r(188))}function m(i){var s=i.alternate;if(!s){if(s=h(i),s===null)throw Error(r(188));return s!==i?null:i}for(var a=i,o=s;;){var u=a.return;if(u===null)break;var f=u.alternate;if(f===null){if(o=u.return,o!==null){a=o;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===a)return g(u),i;if(f===o)return g(u),s;f=f.sibling}throw Error(r(188))}if(a.return!==o.return)a=u,o=f;else{for(var y=!1,C=u.child;C;){if(C===a){y=!0,a=u,o=f;break}if(C===o){y=!0,o=u,a=f;break}C=C.sibling}if(!y){for(C=f.child;C;){if(C===a){y=!0,a=f,o=u;break}if(C===o){y=!0,o=f,a=u;break}C=C.sibling}if(!y)throw Error(r(189))}}if(a.alternate!==o)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?i:s}function v(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=v(i),s!==null)return s;i=i.sibling}return null}function _(i,s,a,o,u,f){for(;i!==null;){if((i.tag===5||i.tag===27||i.tag===6)&&a(i,o,u,f)||(i.tag!==22||i.memoizedState===null)&&(s||i.tag!==5&&i.tag!==27)&&_(i.child,s,a,o,u,f))return!0;i=i.sibling}return!1}function S(i){for(i=i.return;i!==null;){if(i.tag===3||i.tag===5||i.tag===27)return i;i=i.return}return null}function w(i){var s=!1;for(i=i.return;i!==null&&(i.tag===4&&(s=!0),!(i.tag===3||i.tag===5||i.tag===27));)i=i.return;return s}function b(i){var s=[null,null],a=S(i);return a===null||k(s,i,a.child,{foundSelf:!1}),s}function k(i,s,a,o){for(;a!==null;){if(a===s)o.foundSelf=!0;else if(a.tag===5||a.tag===27||a.tag===6){if(o.foundSelf)return i[1]=a,!0;i[0]=a}else if((a.tag!==22||a.memoizedState===null)&&k(i,s,a.child,o))return!0;a=a.sibling}return!1}function E(i){switch(i.tag){case 5:case 27:case 6:return i.stateNode;case 3:return i.stateNode.containerInfo;default:throw Error(r(559))}}var j=null,V=null;function A(i,s,a){return i===a?!0:i===s?(j=i,!0):!1}function z(i,s,a){return i===a?(V=i,!1):i===s?(V!==null&&(j=i),!0):!1}function F(i){if(i===null)return null;do i=i===null?null:i.return;while(i&&i.tag!==5&&i.tag!==27&&i.tag!==3);return i||null}function R(i,s,a){for(var o=0,u=i;u;u=a(u))o++;u=0;for(var f=s;f;f=a(f))u++;for(;0<o-u;)i=a(i),o--;for(;0<u-o;)s=a(s),u--;for(;o--;){if(i===s||s!==null&&i===s.alternate)return i;i=a(i),s=a(s)}return null}var I=Object.assign,q=Symbol.for("react.element"),U=Symbol.for("react.transitional.element"),Y=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),O=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),te=Symbol.for("react.suspense"),Q=Symbol.for("react.suspense_list"),ce=Symbol.for("react.memo"),re=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),Ce=Symbol.for("react.legacy_hidden"),je=Symbol.for("react.memo_cache_sentinel"),D=Symbol.for("react.view_transition"),J=Symbol.for("react.recoverable"),le=Symbol.iterator;function he(i){return i===null||typeof i!="object"?null:(i=le&&i[le]||i["@@iterator"],typeof i=="function"?i:null)}var we=Symbol.for("react.client.reference");function xe(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===we?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case $:return"Fragment";case N:return"Profiler";case M:return"StrictMode";case te:return"Suspense";case Q:return"SuspenseList";case de:return"Activity";case D:return"ViewTransition"}if(typeof i=="object")switch(i.$$typeof){case Y:return"Portal";case O:return i.displayName||"Context";case L:return(i._context.displayName||"Context")+".Consumer";case P:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case ce:return s=i.displayName||null,s!==null?s:xe(i.type)||"Memo";case re:s=i._payload,i=i._init;try{return xe(i(s))}catch{}}return null}var be=Array.isArray,pe=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_e=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Re={pending:!1,data:null,method:null,action:null},fi=[],pi=-1;function Bt(i){return{current:i}}function pt(i){0>pi||(i.current=fi[pi],fi[pi]=null,pi--)}function $e(i,s){pi++,fi[pi]=i.current,i.current=s}var gi=Bt(null),ge=Bt(null),Ke=Bt(null),ki=Bt(null);function Ur(i,s){switch($e(Ke,s),$e(ge,i),$e(gi,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?iv(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=iv(s),i=sv(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}pt(gi),$e(gi,i)}function Bs(){pt(gi),pt(ge),pt(Ke)}function Pr(i){var s=i.memoizedState;s!==null&&(ja._currentValue=s.memoizedState,$e(ki,i)),s=gi.current;var a=sv(s,i.type);s!==a&&($e(ge,i),$e(gi,a))}function rs(i){ge.current===i&&(pt(gi),pt(ge)),ki.current===i&&(pt(ki),ja._currentValue=Re)}var Qa,tr;function as(i){if(Qa===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);Qa=s&&s[1]||"",tr=-1<a.stack.indexOf(`at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return``+Qa+i+tr}var oe=!1;function Ze(i,s){if(!i||oe)return"";oe=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(s){var se=function(){throw Error()};if(Object.defineProperty(se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(se,[])}catch(fe){var W=fe}Reflect.construct(i,[],se)}else{try{se.call()}catch(fe){W=fe}se=!1;try{var X=Object.getOwnPropertyDescriptor(i.prototype,"props");Object.defineProperty(i.prototype,"props",{configurable:!0,set:function(){throw Error()}}),se=!0,new i}finally{se&&(X!==void 0?Object.defineProperty(i.prototype,"props",X):delete i.prototype.props)}}}else{try{throw Error()}catch(fe){W=fe}(se=i())&&typeof se.catch=="function"&&se.catch(function(){})}}catch(fe){if(fe&&W&&typeof fe.stack=="string")return[fe.stack,W.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=o.DetermineComponentFrameRoot(),y=f[0],C=f[1];if(y&&C){var T=y.split(``),G=C.split(``);for(u=o=0;o<T.length&&!T[o].includes("DetermineComponentFrameRoot");)o++;for(;u<G.length&&!G[u].includes("DetermineComponentFrameRoot");)u++;if(o===T.length||u===G.length)for(o=T.length-1,u=G.length-1;1<=o&&0<=u&&T[o]!==G[u];)u--;for(;1<=o&&0<=u;o--,u--)if(T[o]!==G[u]){if(o!==1||u!==1)do if(o--,u--,0>u||T[o]!==G[u]){var ee=``+T[o].replace(" at new "," at ");return i.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",i.displayName)),ee}while(1<=o&&0<=u);break}}}finally{oe=!1,Error.prepareStackTrace=a}return(a=i?i.displayName||i.name:"")?as(a):""}function ti(i,s){switch(i.tag){case 26:case 27:case 5:return as(i.type);case 16:return as("Lazy");case 13:return i.child!==s&&s!==null?as("Suspense Fallback"):as("Suspense");case 19:return as("SuspenseList");case 0:case 15:return Ze(i.type,!1);case 11:return Ze(i.type.render,!1);case 1:return Ze(i.type,!0);case 31:return as("Activity");case 30:return as("ViewTransition");default:return""}}function ls(i){try{var s="",a=null;do s+=ti(i,a),a=i,i=i.return;while(i);return s}catch(o){return`Error generating stack: `+o.message+`-`+o.stack}}var ir=Object.prototype.hasOwnProperty,tu=e.unstable_scheduleCallback,iu=e.unstable_cancelCallback,aw=e.unstable_shouldYield,lw=e.unstable_requestPaint,Ei=e.unstable_now,ow=e.unstable_getCurrentPriorityLevel,k1=e.unstable_ImmediatePriority,E1=e.unstable_UserBlockingPriority,Do=e.unstable_NormalPriority,cw=e.unstable_LowPriority,M1=e.unstable_IdlePriority,hw=e.log,uw=e.unstable_setDisableYieldValue,Ja=null,Mi=null;function fn(i){if(typeof hw=="function"&&uw(i),Mi&&typeof Mi.setStrictMode=="function")try{Mi.setStrictMode(Ja,i)}catch{}}var ji=Math.clz32?Math.clz32:pw,dw=Math.log,fw=Math.LN2;function pw(i){return i>>>=0,i===0?32:31-(dw(i)/fw|0)|0}var Ao=256,No=262144,Lo=4194304;function sr(i){var s=i&42;if(s!==0)return s;switch(i&-i){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 i&-i;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Bo(i,s,a){var o=i.pendingLanes;if(o===0)return 0;var u=0,f=i.suspendedLanes,y=i.pingedLanes;i=i.warmLanes;var C=o&134217727;return C!==0?(o=C&~f,o!==0?u=sr(o):(y&=C,y!==0?u=sr(y):a||(a=C&~i,a!==0&&(u=sr(a))))):(C=o&~f,C!==0?u=sr(C):y!==0?u=sr(y):a||(a=o&~i,a!==0&&(u=sr(a)))),u===0?0:s!==0&&s!==u&&(s&f)===0&&(f=u&-u,a=s&-s,f>=a||f===32&&(a&4194048)!==0)?s:u}function el(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function j1(i,s){(s&8)!==0&&(s|=s&32);var a=i.entangledLanes;if(a!==0)for(i=i.entanglements,a&=s;0<a;){var o=31-ji(a),u=1<<o;s|=i[o],a&=~u}return s}function gw(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 T1(){var i=Lo;return Lo<<=1,(Lo&62914560)===0&&(Lo=4194304),i}function su(i){for(var s=[],a=0;31>a;a++)s.push(i);return s}function tl(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function mw(i,s,a,o,u,f){var y=i.pendingLanes;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=a,i.entangledLanes&=a,i.errorRecoveryDisabledLanes&=a,i.shellSuspendCounter=0;var C=i.entanglements,T=i.expirationTimes,G=i.hiddenUpdates;for(a=y&~a;0<a;){var ee=31-ji(a),se=1<<ee;C[ee]=0,T[ee]=-1;var W=G[ee];if(W!==null)for(G[ee]=null,ee=0;ee<W.length;ee++){var X=W[ee];X!==null&&(X.lane&=-536870913)}a&=~se}o!==0&&R1(i,o,0),f!==0&&u===0&&i.tag!==0&&(i.suspendedLanes|=f&~(y&~s))}function R1(i,s,a){i.pendingLanes|=s,i.suspendedLanes&=~s;var o=31-ji(s);i.entangledLanes|=s,i.entanglements[o]=i.entanglements[o]|1073741824|a&261930}function D1(i,s){var a=i.entangledLanes|=s;for(i=i.entanglements;a;){var o=31-ji(a),u=1<<o;u&s|i[o]&s&&(i[o]|=s),a&=~u}}function A1(i,s){var a=s&-s;return a=(a&42)!==0?1:nu(a),(a&(i.suspendedLanes|s))!==0?0:a}function nu(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function ru(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function N1(){var i=_e.p;return i!==0?i:(i=window.event,i===void 0?32:Uv(i.type))}function L1(i,s){var a=_e.p;try{return _e.p=i,s()}finally{_e.p=a}}var Os=Math.random().toString(36).slice(2),Ft="__reactFiber$"+Os,mi="__reactProps$"+Os,qr="__reactContainer$"+Os,B1="__reactEvents$"+Os,vw="__reactListeners$"+Os,_w="__reactHandles$"+Os,O1="__reactResources$"+Os,il="__reactMarker$"+Os,Oo="__reactLoad$"+Os;function zo(i){delete i[Ft],delete i[mi],delete i[vw],delete i[_w]}function nr(i){var s;if(s=i[Ft])return s;for(var a=i.parentNode;a;){if(s=a[qr]||a[Ft]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(i=Sv(i);i!==null;){if(a=i[Ft])return a;i=Sv(i)}return s}i=a,a=i.parentNode}return null}function Vr(i){if(i=i[Ft]||i[qr]){var s=i.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return i}return null}function sl(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(r(33))}function $r(i){var s=i[O1];return s||(s=i[O1]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Ot(i){i[il]=!0}function z1(i){i[Oo]=void 0}var H1=new Set,I1={};function rr(i,s){Wr(i,s),Wr(i+"Capture",s)}function Wr(i,s){for(I1[i]=s,i=0;i<s.length;i++)H1.add(s[i])}var yw=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]*$"),U1={},P1={};function Sw(i){return ir.call(P1,i)?!0:ir.call(U1,i)?!1:yw.test(i)?P1[i]=!0:(U1[i]=!0,!1)}var We=!1;function q1(){var i=We;return We=!1,i}function Ho(i,s,a){if(Sw(s))if(a===null)i.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":i.removeAttribute(s);return;case"boolean":var o=s.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){i.removeAttribute(s);return}}i.setAttribute(s,a)}}function Io(i,s,a){if(a===null)i.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(s);return}i.setAttribute(s,a)}}function zs(i,s,a,o){if(o===null)i.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttributeNS(s,a,o)}}function Ti(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function V1(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function xw(i,s,a){var o=Object.getOwnPropertyDescriptor(i.constructor.prototype,s);if(!i.hasOwnProperty(s)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var u=o.get,f=o.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return u.call(this)},set:function(y){a=""+y,f.call(this,y)}}),Object.defineProperty(i,s,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(y){a=""+y},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function au(i){if(!i._valueTracker){var s=V1(i)?"checked":"value";i._valueTracker=xw(i,s,""+i[s])}}function $1(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var a=s.getValue(),o="";return i&&(o=V1(i)?i.checked?"true":"false":i.value),i=o,i!==a?(s.setValue(i),!0):!1}var ww=/[\n"\\]/g;function Pi(i){return i.replace(ww,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function lu(i,s,a,o,u,f,y,C){i.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?i.type=y:i.removeAttribute("type"),s!=null?y==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+Ti(s)):i.value!==""+Ti(s)&&(i.value=""+Ti(s)):y!=="submit"&&y!=="reset"||i.removeAttribute("value"),s!=null?y==="number"&&i.value==s?ou(i,Ti(i.value)):ou(i,Ti(s)):a!=null?ou(i,Ti(a)):o!=null&&i.removeAttribute("value"),u==null&&f!=null&&(i.defaultChecked=!!f),u!=null&&(i.checked=u&&typeof u!="function"&&typeof u!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?i.name=""+Ti(C):i.removeAttribute("name")}function W1(i,s,a,o,u,f,y,C){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(i.type=f),s!=null||a!=null){if(!(f!=="submit"&&f!=="reset"||s!=null)){au(i);return}a=a!=null?""+Ti(a):"",s=s!=null?""+Ti(s):a,C||s===i.value||(i.value=s),i.defaultValue=s}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,i.checked=C?i.checked:!!o,i.defaultChecked=!!o,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(i.name=y),au(i)}function ou(i,s){i.defaultValue!==""+s&&(i.defaultValue=""+s)}function Fr(i,s,a,o){if(i=i.options,s){s={};for(var u=0;u<a.length;u++)s["$"+a[u]]=!0;for(a=0;a<i.length;a++)u=s.hasOwnProperty("$"+i[a].value),i[a].selected!==u&&(i[a].selected=u),u&&o&&(i[a].defaultSelected=!0)}else{for(a=""+Ti(a),s=null,u=0;u<i.length;u++){if(i[u].value===a){i[u].selected=!0,o&&(i[u].defaultSelected=!0);return}s!==null||i[u].disabled||(s=i[u])}s!==null&&(s.selected=!0)}}function F1(i,s,a){if(s!=null&&(s=""+Ti(s),s!==i.value&&(i.value=s),a==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=a!=null?""+Ti(a):""}function K1(i,s,a,o){if(s==null){if(o!=null){if(a!=null)throw Error(r(92));if(be(o)){if(1<o.length)throw Error(r(93));o=o[0]}a=o}a==null&&(a=""),s=a}a=Ti(s),i.defaultValue=a,o=i.textContent,o===a&&o!==""&&o!==null&&(i.value=o),au(i)}function Kr(i,s){if(s){var a=i.firstChild;if(a&&a===i.lastChild&&a.nodeType===3){a.nodeValue=s;return}}i.textContent=s}var bw=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 Y1(i,s,a){var o=s.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?i.setProperty(s,""):s==="float"?i.cssFloat="":i[s]="":o?i.setProperty(s,a):typeof a!="number"||a===0||bw.has(s)?s==="float"?i.cssFloat=a:i[s]=(""+a).trim():i[s]=a+"px"}function G1(i,s,a){if(s!=null&&typeof s!="object")throw Error(r(62));if(i=i.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||s!=null&&s.hasOwnProperty(o)||(o.indexOf("--")===0?i.setProperty(o,""):o==="float"?i.cssFloat="":i[o]="",We=!0);for(var u in s)o=s[u],s.hasOwnProperty(u)&&a[u]!==o&&(Y1(i,u,o),We=!0)}else for(var f in s)s.hasOwnProperty(f)&&Y1(i,f,s[f])}function cu(i){if(i.indexOf("-")===-1)return!1;switch(i){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 Cw=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"]]),kw=/^[\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 Uo(i){return kw.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function gs(){}var hu=null;function uu(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Yr=null,Gr=null;function Z1(i){var s=Vr(i);if(s&&(i=s.stateNode)){var a=i[mi]||null;e:switch(i=s.stateNode,s.type){case"input":if(lu(i,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),s=a.name,a.type==="radio"&&s!=null){for(a=i;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Pi(""+s)+'"][type="radio"]'),s=0;s<a.length;s++){var o=a[s];if(o!==i&&o.form===i.form){var u=o[mi]||null;if(!u)throw Error(r(90));lu(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(s=0;s<a.length;s++)o=a[s],o.form===i.form&&$1(o)}break e;case"textarea":F1(i,a.value,a.defaultValue);break e;case"select":s=a.value,s!=null&&Fr(i,!!a.multiple,s,!1)}}}var du=!1;function X1(i,s,a){if(du)return i(s,a);du=!0;try{var o=i(s);return o}finally{if(du=!1,(Yr!==null||Gr!==null)&&(Uc(),Yr&&(s=Yr,i=Gr,Gr=Yr=null,Z1(s),i)))for(s=0;s<i.length;s++)Z1(i[s])}}function nl(i,s){var a=i.stateNode;if(a===null)return null;var o=a[mi]||null;if(o===null)return null;a=o[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(i=i.type,o=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!o;break e;default:i=!1}if(i)return null;if(a&&typeof a!="function")throw Error(r(231,s,typeof a));return a}var Hs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fu=!1;if(Hs)try{var rl={};Object.defineProperty(rl,"passive",{get:function(){fu=!0}}),window.addEventListener("test",rl,rl),window.removeEventListener("test",rl,rl)}catch{fu=!1}var pn=null,pu=null,Po=null;function Q1(){if(Po)return Po;var i,s=pu,a=s.length,o,u="value"in pn?pn.value:pn.textContent,f=u.length;for(i=0;i<a&&s[i]===u[i];i++);var y=a-i;for(o=1;o<=y&&s[a-o]===u[f-o];o++);return Po=u.slice(i,1<o?1-o:void 0)}function qo(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function Vo(){return!0}function J1(){return!1}function ri(i){function s(a,o,u,f,y){this._reactName=a,this._targetInst=u,this.type=o,this.nativeEvent=f,this.target=y,this.currentTarget=null;for(var C in i)i.hasOwnProperty(C)&&(a=i[C],this[C]=a?a(f):f[C]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Vo:J1,this.isPropagationStopped=J1,this}return I(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Vo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Vo)},persist:function(){},isPersistent:Vo}),s}var gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$o=ri(gn),al=I({},gn,{view:0,detail:0}),Ew=ri(al),gu,mu,ll,Wo=I({},al,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_u,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==ll&&(ll&&i.type==="mousemove"?(gu=i.screenX-ll.screenX,mu=i.screenY-ll.screenY):mu=gu=0,ll=i),gu)},movementY:function(i){return"movementY"in i?i.movementY:mu}}),ep=ri(Wo),Mw=I({},Wo,{dataTransfer:0}),jw=ri(Mw),Tw=I({},al,{relatedTarget:0}),vu=ri(Tw),Rw=I({},gn,{animationName:0,elapsedTime:0,pseudoElement:0}),Dw=ri(Rw),Aw=I({},gn,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),Nw=ri(Aw),Lw=I({},gn,{data:0}),tp=ri(Lw),Bw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ow={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"},zw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Hw(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=zw[i])?!!s[i]:!1}function _u(){return Hw}var Iw=I({},al,{key:function(i){if(i.key){var s=Bw[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=qo(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Ow[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_u,charCode:function(i){return i.type==="keypress"?qo(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?qo(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),Uw=ri(Iw),Pw=I({},Wo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ip=ri(Pw),qw=I({},gn,{submitter:0}),Vw=ri(qw),$w=I({},al,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_u}),Ww=ri($w),Fw=I({},gn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Kw=ri(Fw),Yw=I({},Wo,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),Gw=ri(Yw),Zw=I({},gn,{newState:0,oldState:0,source:0}),Xw=ri(Zw),Qw=[9,13,27,32],yu=Hs&&"CompositionEvent"in window,ol=null;Hs&&"documentMode"in document&&(ol=document.documentMode);var Jw=Hs&&"TextEvent"in window&&!ol,sp=Hs&&(!yu||ol&&8<ol&&11>=ol),np=" ",rp=!1;function ap(i,s){switch(i){case"keyup":return Qw.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function lp(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Zr=!1;function e4(i,s){switch(i){case"compositionend":return lp(s);case"keypress":return s.which!==32?null:(rp=!0,np);case"textInput":return i=s.data,i===np&&rp?null:i;default:return null}}function t4(i,s){if(Zr)return i==="compositionend"||!yu&&ap(i,s)?(i=Q1(),Po=pu=pn=null,Zr=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return sp&&s.locale!=="ko"?null:s.data;default:return null}}var i4={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 op(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!i4[i.type]:s==="textarea"}function cp(i,s,a,o){Yr?Gr?Gr.push(o):Gr=[o]:Yr=o,s=Fc(s,"onChange"),0<s.length&&(a=new $o("onChange","change",null,a,o),i.push({event:a,listeners:s}))}var cl=null,hl=null;function s4(i){Zm(i,0)}function Fo(i){var s=sl(i);if($1(s))return i}function hp(i,s){if(i==="change")return s}var up=!1;if(Hs){var Su;if(Hs){var xu="oninput"in document;if(!xu){var dp=document.createElement("div");dp.setAttribute("oninput","return;"),xu=typeof dp.oninput=="function"}Su=xu}else Su=!1;up=Su&&(!document.documentMode||9<document.documentMode)}function fp(){cl&&(cl.detachEvent("onpropertychange",pp),hl=cl=null)}function pp(i){if(i.propertyName==="value"&&Fo(hl)){var s=[];cp(s,hl,i,uu(i)),X1(s4,s)}}function n4(i,s,a){i==="focusin"?(fp(),cl=s,hl=a,cl.attachEvent("onpropertychange",pp)):i==="focusout"&&fp()}function r4(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Fo(hl)}function a4(i,s){if(i==="click")return Fo(s)}function l4(i,s){if(i==="input"||i==="change")return Fo(s)}function o4(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var Ri=typeof Object.is=="function"?Object.is:o4;function ul(i,s){if(Ri(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var a=Object.keys(i),o=Object.keys(s);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var u=a[o];if(!ir.call(s,u)||!Ri(i[u],s[u]))return!1}return!0}function wu(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function gp(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function mp(i,s){var a=gp(i);i=0;for(var o;a;){if(a.nodeType===3){if(o=i+a.textContent.length,i<=s&&o>=s)return{node:a,offset:s-i};i=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=gp(a)}}function vp(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?vp(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function _p(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=wu(i.document);s instanceof i.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)i=s.contentWindow;else break;s=wu(i.document)}return s}function bu(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var c4=Hs&&"documentMode"in document&&11>=document.documentMode,Xr=null,Cu=null,dl=null,ku=!1;function yp(i,s,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;ku||Xr==null||Xr!==wu(o)||(o=Xr,"selectionStart"in o&&bu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),dl&&ul(dl,o)||(dl=o,o=Fc(Cu,"onSelect"),0<o.length&&(s=new $o("onSelect","select",null,s,a),i.push({event:s,listeners:o}),s.target=Xr)))}function ar(i,s){var a={};return a[i.toLowerCase()]=s.toLowerCase(),a["Webkit"+i]="webkit"+s,a["Moz"+i]="moz"+s,a}var Qr={animationend:ar("Animation","AnimationEnd"),animationiteration:ar("Animation","AnimationIteration"),animationstart:ar("Animation","AnimationStart"),transitionrun:ar("Transition","TransitionRun"),transitionstart:ar("Transition","TransitionStart"),transitioncancel:ar("Transition","TransitionCancel"),transitionend:ar("Transition","TransitionEnd")},Eu={},Sp={};Hs&&(Sp=document.createElement("div").style,"AnimationEvent"in window||(delete Qr.animationend.animation,delete Qr.animationiteration.animation,delete Qr.animationstart.animation),"TransitionEvent"in window||delete Qr.transitionend.transition);function lr(i){if(Eu[i])return Eu[i];if(!Qr[i])return i;var s=Qr[i],a;for(a in s)if(s.hasOwnProperty(a)&&a in Sp)return Eu[i]=s[a];return i}var xp=lr("animationend"),wp=lr("animationiteration"),bp=lr("animationstart"),h4=lr("transitionrun"),u4=lr("transitionstart"),d4=lr("transitioncancel"),Cp=lr("transitionend"),kp=new Map,Mu="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(" ");Mu.push("scrollEnd");function os(i,s){kp.set(i,s),rr(s,[i])}var f4=0;function Is(i,s){if(i.name!=null&&i.name!=="auto")return i.name;if(s.autoName!==null)return s.autoName;i=ds.identifierPrefix;var a=f4++;return i="_"+i+"t_"+a.toString(32)+"_",s.autoName=i}function Ep(i){if(i==null||typeof i=="string")return i;var s=null,a=_a;if(a!==null)for(var o=0;o<a.length;o++){var u=i[a[o]];if(u!=null){if(u==="none")return"none";s=s==null?u:s+(" "+u)}}return s??i.default}function Us(i,s){return i=Ep(i),s=Ep(s),s==null?i==="auto"?null:i:s==="auto"?null:s}var Ko=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},qi=[],Jr=0,ju=0;function Yo(){for(var i=Jr,s=ju=Jr=0;s<i;){var a=qi[s];qi[s++]=null;var o=qi[s];qi[s++]=null;var u=qi[s];qi[s++]=null;var f=qi[s];if(qi[s++]=null,o!==null&&u!==null){var y=o.pending;y===null?u.next=u:(u.next=y.next,y.next=u),o.pending=u}f!==0&&Mp(a,u,f)}}function Go(i,s,a,o){qi[Jr++]=i,qi[Jr++]=s,qi[Jr++]=a,qi[Jr++]=o,ju|=o,i.lanes|=o,i=i.alternate,i!==null&&(i.lanes|=o)}function Tu(i,s,a,o){return Go(i,s,a,o),Zo(i)}function or(i,s){return Go(i,null,null,s),Zo(i)}function Mp(i,s,a){i.lanes|=a;var o=i.alternate;o!==null&&(o.lanes|=a);for(var u=!1,f=i.return;f!==null;)f.childLanes|=a,o=f.alternate,o!==null&&(o.childLanes|=a),f.tag===22&&(i=f.stateNode,i===null||i._visibility&1||(u=!0)),i=f,f=f.return;return i.tag===3?(f=i.stateNode,u&&s!==null&&(u=31-ji(a),i=f.hiddenUpdates,o=i[u],o===null?i[u]=[s]:o.push(s),s.lane=a|536870912),f):null}function Zo(i){if(50<Ll)throw Ll=0,Ic=null,Error(r(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var ea={};function p4(i,s,a,o){this.tag=i,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vi(i,s,a,o){return new p4(i,s,a,o)}function Ru(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Ps(i,s){var a=i.alternate;return a===null?(a=vi(i.tag,s,i.key,i.mode),a.elementType=i.elementType,a.type=i.type,a.stateNode=i.stateNode,a.alternate=i,i.alternate=a):(a.pendingProps=s,a.type=i.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=i.flags&1206910976,a.childLanes=i.childLanes,a.lanes=i.lanes,a.child=i.child,a.memoizedProps=i.memoizedProps,a.memoizedState=i.memoizedState,a.updateQueue=i.updateQueue,s=i.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=i.sibling,a.index=i.index,a.ref=i.ref,a.refCleanup=i.refCleanup,a}function jp(i,s){i.flags&=1206910978;var a=i.alternate;return a===null?(i.childLanes=0,i.lanes=s,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,s=a.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),i}function Xo(i,s,a,o,u,f){var y=0;if(o=i,typeof o=="function")Ru(o)&&(y=1);else if(typeof o=="string")y=q5(i,a,gi.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(o){case de:return i=vi(31,a,s,u),i.elementType=de,i.lanes=f,i;case $:return cr(a.children,u,f,s);case M:y=8,u|=24;break;case N:return i=vi(12,a,s,u|2),i.elementType=N,i.lanes=f,i;case te:return i=vi(13,a,s,u),i.elementType=te,i.lanes=f,i;case Q:return i=vi(19,a,s,u),i.elementType=Q,i.lanes=f,i;case Ce:case R:return i=u|32,i=vi(30,a,s,i),i.elementType=R,i.lanes=f,i.stateNode={autoName:null,paired:null,clones:null,ref:null},i;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case O:y=10;break e;case L:y=9;break e;case P:y=11;break e;case ce:y=14;break e;case re:y=16,o=null;break e}y=29,a=Error(r(130,i===null?"null":typeof i,"")),o=null}return s=vi(y,a,s,u),s.elementType=i,s.type=o,s.lanes=f,s}function cr(i,s,a,o){return i=vi(7,i,o,s),i.lanes=a,i}function Du(i,s,a){return i=vi(6,i,null,s),i.lanes=a,i}function Tp(i){var s=vi(18,null,null,0);return s.stateNode=i,s}function Au(i,s,a){return s=vi(4,i.children!==null?i.children:[],i.key,s),s.lanes=a,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var Rp=new WeakMap;function Vi(i,s){if(typeof i=="object"&&i!==null){var a=Rp.get(i);return a!==void 0?a:(s={value:i,source:s,stack:ls(s)},Rp.set(i,s),s)}return{value:i,source:s,stack:ls(s)}}var ta=[],ia=0,Qo=null,fl=0,$i=[],Wi=0,mn=null,ms=1,vs="";function qs(i,s){ta[ia++]=fl,ta[ia++]=Qo,Qo=i,fl=s}function Dp(i,s,a){$i[Wi++]=ms,$i[Wi++]=vs,$i[Wi++]=mn,mn=i;var o=ms;i=vs;var u=32-ji(o)-1;o&=~(1<<u),a+=1;var f=32-ji(s)+u;if(30<f){var y=u-u%5;f=(o&(1<<y)-1).toString(32),o>>=y,u-=y,ms=1<<32-ji(s)+u|a<<u|o,vs=f+i}else ms=1<<f|a<<u|o,vs=i}function Jo(i){i.return!==null&&(qs(i,1),Dp(i,1,0))}function Nu(i){for(;i===Qo;)Qo=ta[--ia],ta[ia]=null,fl=ta[--ia],ta[ia]=null;for(;i===mn;)mn=$i[--Wi],$i[Wi]=null,vs=$i[--Wi],$i[Wi]=null,ms=$i[--Wi],$i[Wi]=null}function Ap(i,s){$i[Wi++]=ms,$i[Wi++]=vs,$i[Wi++]=mn,ms=s.id,vs=s.overflow,mn=i}var zt=null,nt=null,Oe=!1,vn=null,Fi=!1,Lu=Error(r(519));function _n(i){var s=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw pl(Vi(s,i)),Lu}function Np(i){var s=i.stateNode,a=i.type,o=i.memoizedProps;switch(s[Ft]=i,s[mi]=o,a){case"dialog":Ue("cancel",s),Ue("close",s);break;case"iframe":case"object":case"embed":Ue("load",s);break;case"video":case"audio":for(a=0;a<Ol.length;a++)Ue(Ol[a],s);break;case"source":Ue("error",s);break;case"img":case"image":case"link":Ue("error",s),Ue("load",s);break;case"details":Ue("toggle",s);break;case"input":Ue("invalid",s),W1(s,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Ue("invalid",s);break;case"textarea":Ue("invalid",s),K1(s,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||s.textContent===""+a||o.suppressHydrationWarning===!0||ev(s.textContent,a)?(o.popover!=null&&(Ue("beforetoggle",s),Ue("toggle",s)),o.onScroll!=null&&Ue("scroll",s),o.onScrollEnd!=null&&Ue("scrollend",s),o.onClick!=null&&(s.onclick=gs),s=!0):s=!1,s||_n(i,!0)}function ec(i){for(zt=i.return;zt;)switch(zt.tag){case 5:case 31:case 13:Fi=!1;return;case 27:case 3:Fi=!0;return;default:zt=zt.return}}function sa(i){if(i!==zt)return!1;if(!Oe)return ec(i),Oe=!0,!1;var s=i.tag,a;if((a=s!==3&&s!==27)&&((a=s===5)&&(a=i.type,a=!(a!=="form"&&a!=="button")||h0(i.type,i.memoizedProps)),a=!a),a&&nt&&_n(i),ec(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));nt=yv(i)}else if(s===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));nt=yv(i)}else s===27?(s=nt,Ln(i.type)?(i=y0,y0=null,nt=i):nt=s):nt=zt?Yi(i.stateNode.nextSibling):null;return!0}function hr(){nt=zt=null,Oe=!1}function Bu(){var i=vn;return i!==null&&(Si===null?Si=i:Si.push.apply(Si,i),vn=null),i}function pl(i){vn===null?vn=[i]:vn.push(i)}var Ou=Bt(null),ur=null,Vs=null;function yn(i,s,a){$e(Ou,s._currentValue),s._currentValue=a}function $s(i){i._currentValue=Ou.current,pt(Ou)}function tc(i,s,a){for(;i!==null;){var o=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,o!==null&&(o.childLanes|=s)):o!==null&&(o.childLanes&s)!==s&&(o.childLanes|=s),i===a)break;i=i.return}}function zu(i,s,a,o){var u=i.child;for(u!==null&&(u.return=i);u!==null;){var f=u.dependencies;if(f!==null){var y=u.child;f=f.firstContext;e:for(;f!==null;){var C=f;f=u;for(var T=0;T<s.length;T++)if(C.context===s[T]){f.lanes|=a,C=f.alternate,C!==null&&(C.lanes|=a),tc(f.return,a,i),o||(y=null);break e}f=C.next}}else if(u.tag===18){if(y=u.return,y===null)throw Error(r(341));y.lanes|=a,f=y.alternate,f!==null&&(f.lanes|=a),tc(y,a,i),y=null}else u.tag===13&&u.memoizedState!==null&&u.memoizedState.dehydrated===null?(u.lanes|=a,y=u.alternate,y!==null&&(y.lanes|=a),tc(u.return,a,i),y=u.child,y=y!==null?y.sibling:null):y=u.child;if(y!==null)y.return=u;else for(y=u;y!==null;){if(y===i){y=null;break}if(u=y.sibling,u!==null){u.return=y.return,y=u;break}y=y.return}u=y}}function dr(i,s,a,o){i=null;for(var u=s,f=!1;u!==null;){if(!f){if((u.flags&524288)!==0)f=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var y=u.alternate;if(y===null)throw Error(r(387));if(y=y.memoizedProps,y!==null){var C=u.type;Ri(u.pendingProps.value,y.value)||(i!==null?i.push(C):i=[C])}}else if(u===ki.current){if(y=u.alternate,y===null)throw Error(r(387));y.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(i!==null?i.push(ja):i=[ja])}u=u.return}return i!==null&&zu(s,i,a,o),s.flags|=262144,i!==null}function ic(i){for(i=i.firstContext;i!==null;){if(!Ri(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function fr(i){ur=i,Vs=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Kt(i){return Lp(ur,i)}function sc(i,s){return ur===null&&fr(i),Lp(i,s)}function Lp(i,s){var a=s._currentValue;if(s={context:s,memoizedValue:a,next:null},Vs===null){if(i===null)throw Error(r(308));Vs=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else Vs=Vs.next=s;return a}var g4=typeof AbortController<"u"?AbortController:function(){var i=[],s=this.signal={aborted:!1,addEventListener:function(a,o){i.push(o)}};this.abort=function(){s.aborted=!0,i.forEach(function(a){return a()})}},m4=e.unstable_scheduleCallback,v4=e.unstable_NormalPriority,xt={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Hu(){return{controller:new g4,data:new Map,refCount:0}}function gl(i){i.refCount--,i.refCount===0&&m4(v4,function(){i.controller.abort()})}function Bp(i,s){if((i.pendingLanes&4194048)!==0){var a=i.transitionTypes;for(a===null&&(a=i.transitionTypes=[]),i=0;i<s.length;i++){var o=s[i];a.indexOf(o)===-1&&a.push(o)}}}var ml=null;function _4(i){var s=i.transitionTypes;return i.transitionTypes=null,s}var vl=null,Iu=0,pr=0,na=null;function y4(i,s){if(vl===null){var a=vl=[];Iu=0,pr=t0(),na={status:"pending",value:void 0,then:function(o){a.push(o)}}}return Iu++,s.then(Op,Op),s}function Op(){if(--Iu===0&&(ml=null,vl!==null)){na!==null&&(na.status="fulfilled");var i=vl;vl=null,pr=0,na=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function S4(i,s){var a=[],o={status:"pending",value:null,reason:null,then:function(u){a.push(u)}};return i.then(function(){o.status="fulfilled",o.value=s;for(var u=0;u<a.length;u++)(0,a[u])(s)},function(u){for(o.status="rejected",o.reason=u,u=0;u<a.length;u++)(0,a[u])(void 0)}),o}var zp=pe.S;pe.S=function(i,s){if(Tm=Ei(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&y4(i,s),ml!==null)for(var a=wa;a!==null;)Bp(a,ml),a=a.next;if(a=i.types,a!==null){for(var o=wa;o!==null;)Bp(o,a),o=o.next;if(pr!==0){o=ml,o===null&&(o=ml=[]);for(var u=0;u<a.length;u++){var f=a[u];o.indexOf(f)===-1&&o.push(f)}}}zp!==null&&zp(i,s)};var gr=Bt(null);function Uu(){var i=gr.current;return i!==null?i:st.pooledCache}function nc(i,s){s===null?$e(gr,gr.current):$e(gr,s.pool)}function Hp(){var i=Uu();return i===null?null:{parent:xt._currentValue,pool:i}}var ra=Error(r(460)),Pu=Error(r(474)),rc=Error(r(542)),ac={then:function(){}};function Ip(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Up(i,s,a){switch(a=i[a],a===void 0?i.push(s):a!==s&&(s.then(gs,gs),s=a),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,qp(i),i===void 0&&!("reason"in s)?Error(r(600)):i;default:if(typeof s.status=="string")s.then(gs,gs);else{if(i=st,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=s,i.status="pending",i.then(function(o){if(s.status==="pending"){var u=s;u.status="fulfilled",u.value=o}},function(o){if(s.status==="pending"){var u=s;u.status="rejected",u.reason=o}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,qp(i),i}throw vr=s,ra}}function mr(i){try{var s=i._init;return s(i._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(vr=a,ra):a}}var vr=null;function Pp(){if(vr===null)throw Error(r(459));var i=vr;return vr=null,i}function qp(i){if(i===ra||i===rc)throw Error(r(483))}var aa=null,_l=0;function lc(i){var s=_l;return _l+=1,aa===null&&(aa=[]),Up(aa,i,s)}function Sn(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function oc(i,s){throw s.$$typeof===q?Error(r(525)):(i=Object.prototype.toString.call(s),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function Vp(i){function s(K,H){if(i){var Z=K.deletions;Z===null?(K.deletions=[H],K.flags|=16):Z.push(H)}}function a(K,H){if(!i)return null;for(;H!==null;)s(K,H),H=H.sibling;return null}function o(K){for(var H=new Map;K!==null;)K.key===null?H.set(K.index,K):H.set(K.key,K),K=K.sibling;return H}function u(K,H){return K=Ps(K,H),K.index=0,K.sibling=null,K}function f(K,H,Z){return K.index=Z,i?(Z=K.alternate,Z!==null?(Z=Z.index,Z<H?(K.flags|=2,H):Z):(K.flags|=134217730,H)):(K.flags|=1048576,H)}function y(K){return i&&K.alternate===null&&(K.flags|=134217730),K}function C(K,H,Z,ie){return H===null||H.tag!==6?(H=Du(Z,K.mode,ie),H.return=K,H):(H=u(H,Z),H.return=K,H)}function T(K,H,Z,ie){var ve=Z.type;return ve===$?(K=ee(K,H,Z.props.children,ie,Z.key),Sn(K,Z),K):H!==null&&(H.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===re&&mr(ve)===H.type)?(H=u(H,Z.props),Sn(H,Z),H.return=K,H):(H=Xo(Z.type,Z.key,Z.props,null,K.mode,ie),Sn(H,Z),H.return=K,H)}function G(K,H,Z,ie){return H===null||H.tag!==4||H.stateNode.containerInfo!==Z.containerInfo||H.stateNode.implementation!==Z.implementation?(H=Au(Z,K.mode,ie),H.return=K,H):(H=u(H,Z.children||[]),H.return=K,H)}function ee(K,H,Z,ie,ve){return H===null||H.tag!==7?(H=cr(Z,K.mode,ie,ve),H.return=K,H):(H=u(H,Z),H.return=K,H)}function se(K,H,Z){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=Du(""+H,K.mode,Z),H.return=K,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case U:return Z=Xo(H.type,H.key,H.props,null,K.mode,Z),Sn(Z,H),Z.return=K,Z;case Y:return H=Au(H,K.mode,Z),H.return=K,H;case re:return H=mr(H),se(K,H,Z)}if(be(H)||he(H))return H=cr(H,K.mode,Z,null),H.return=K,H;if(typeof H.then=="function")return se(K,lc(H),Z);if(H.$$typeof===O)return se(K,sc(K,H),Z);oc(K,H)}return null}function W(K,H,Z,ie){var ve=H!==null?H.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return ve!==null?null:C(K,H,""+Z,ie);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case U:return Z.key===ve?T(K,H,Z,ie):null;case Y:return Z.key===ve?G(K,H,Z,ie):null;case re:return Z=mr(Z),W(K,H,Z,ie)}if(be(Z)||he(Z))return ve!==null?null:ee(K,H,Z,ie,null);if(typeof Z.then=="function")return W(K,H,lc(Z),ie);if(Z.$$typeof===O)return W(K,H,sc(K,Z),ie);oc(K,Z)}return null}function X(K,H,Z,ie,ve){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return K=K.get(Z)||null,C(H,K,""+ie,ve);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case U:return K=K.get(ie.key===null?Z:ie.key)||null,T(H,K,ie,ve);case Y:return K=K.get(ie.key===null?Z:ie.key)||null,G(H,K,ie,ve);case re:return ie=mr(ie),X(K,H,Z,ie,ve)}if(be(ie)||he(ie))return K=K.get(Z)||null,ee(H,K,ie,ve,null);if(typeof ie.then=="function")return X(K,H,Z,lc(ie),ve);if(ie.$$typeof===O)return X(K,H,Z,sc(H,ie),ve);oc(H,ie)}return null}function fe(K,H,Z,ie){for(var ve=null,qe=null,Se=H,Me=H=0,Ct=null;Se!==null&&Me<Z.length;Me++){Se.index>Me?(Ct=Se,Se=null):Ct=Se.sibling;var Ve=W(K,Se,Z[Me],ie);if(Ve===null){Se===null&&(Se=Ct);break}i&&Se&&Ve.alternate===null&&s(K,Se),H=f(Ve,H,Me),qe===null?ve=Ve:qe.sibling=Ve,qe=Ve,Se=Ct}if(Me===Z.length)return a(K,Se),Oe&&qs(K,Me),ve;if(Se===null){for(;Me<Z.length;Me++)Se=se(K,Z[Me],ie),Se!==null&&(H=f(Se,H,Me),qe===null?ve=Se:qe.sibling=Se,qe=Se);return Oe&&qs(K,Me),ve}for(Se=o(Se);Me<Z.length;Me++)Ct=X(Se,K,Me,Z[Me],ie),Ct!==null&&(i&&(Ve=Ct.alternate,Ve!==null&&Se.delete(Ve.key===null?Me:Ve.key)),H=f(Ct,H,Me),qe===null?ve=Ct:qe.sibling=Ct,qe=Ct);return i&&Se.forEach(function(In){return s(K,In)}),Oe&&qs(K,Me),ve}function ye(K,H,Z,ie){if(Z==null)throw Error(r(151));for(var ve=null,qe=null,Se=H,Me=H=0,Ct=null,Ve=Z.next();Se!==null&&!Ve.done;Me++,Ve=Z.next()){Se.index>Me?(Ct=Se,Se=null):Ct=Se.sibling;var In=W(K,Se,Ve.value,ie);if(In===null){Se===null&&(Se=Ct);break}i&&Se&&In.alternate===null&&s(K,Se),H=f(In,H,Me),qe===null?ve=In:qe.sibling=In,qe=In,Se=Ct}if(Ve.done)return a(K,Se),Oe&&qs(K,Me),ve;if(Se===null){for(;!Ve.done;Me++,Ve=Z.next())Ve=se(K,Ve.value,ie),Ve!==null&&(H=f(Ve,H,Me),qe===null?ve=Ve:qe.sibling=Ve,qe=Ve);return Oe&&qs(K,Me),ve}for(Se=o(Se);!Ve.done;Me++,Ve=Z.next())Ve=X(Se,K,Me,Ve.value,ie),Ve!==null&&(i&&(Ct=Ve.alternate,Ct!==null&&Se.delete(Ct.key===null?Me:Ct.key)),H=f(Ve,H,Me),qe===null?ve=Ve:qe.sibling=Ve,qe=Ve);return i&&Se.forEach(function(eb){return s(K,eb)}),Oe&&qs(K,Me),ve}function Be(K,H,Z,ie){if(typeof Z=="object"&&Z!==null&&Z.type===$&&Z.key===null&&Z.props.ref===void 0&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case U:e:{for(var ve=Z.key;H!==null;){if(H.key===ve){if(ve=Z.type,ve===$){if(H.tag===7){a(K,H.sibling),ie=u(H,Z.props.children),Sn(ie,Z),ie.return=K,K=ie;break e}}else if(H.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===re&&mr(ve)===H.type){a(K,H.sibling),ie=u(H,Z.props),Sn(ie,Z),ie.return=K,K=ie;break e}a(K,H);break}else s(K,H);H=H.sibling}Z.type===$?(ie=cr(Z.props.children,K.mode,ie,Z.key),Sn(ie,Z),ie.return=K,K=ie):(ie=Xo(Z.type,Z.key,Z.props,null,K.mode,ie),Sn(ie,Z),ie.return=K,K=ie)}return y(K);case Y:e:{for(ve=Z.key;H!==null;){if(H.key===ve)if(H.tag===4&&H.stateNode.containerInfo===Z.containerInfo&&H.stateNode.implementation===Z.implementation){a(K,H.sibling),ie=u(H,Z.children||[]),ie.return=K,K=ie;break e}else{a(K,H);break}else s(K,H);H=H.sibling}ie=Au(Z,K.mode,ie),ie.return=K,K=ie}return y(K);case re:return Z=mr(Z),Be(K,H,Z,ie)}if(be(Z))return fe(K,H,Z,ie);if(he(Z)){if(ve=he(Z),typeof ve!="function")throw Error(r(150));return Z=ve.call(Z),ye(K,H,Z,ie)}if(typeof Z.then=="function")return Be(K,H,lc(Z),ie);if(Z.$$typeof===O)return Be(K,H,sc(K,Z),ie);oc(K,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,H!==null&&H.tag===6?(a(K,H.sibling),ie=u(H,Z),ie.return=K,K=ie):(a(K,H),ie=Du(Z,K.mode,ie),ie.return=K,K=ie),y(K)):a(K,H)}return function(K,H,Z,ie){try{_l=0;var ve=Be(K,H,Z,ie);return aa=null,ve}catch(Se){if(Se===ra||Se===rc)throw Se;var qe=vi(29,Se,null,K.mode);return qe.lanes=ie,qe.return=K,qe}}}var _r=Vp(!0),$p=Vp(!1),xn=!1;function qu(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vu(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function wn(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function bn(i,s,a){var o=i.updateQueue;if(o===null)return null;if(o=o.shared,(Ye&2)!==0){var u=o.pending;return u===null?s.next=s:(s.next=u.next,u.next=s),o.pending=s,s=Zo(i),Mp(i,null,a),s}return Go(i,o,s,a),Zo(i)}function yl(i,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194048)!==0)){var o=s.lanes;o&=i.pendingLanes,a|=o,s.lanes=a,D1(i,a)}}function $u(i,s){var a=i.updateQueue,o=i.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var u=null,f=null;if(a=a.firstBaseUpdate,a!==null){do{var y={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};f===null?u=f=y:f=f.next=y,a=a.next}while(a!==null);f===null?u=f=s:f=f.next=s}else u=f=s;a={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:o.shared,callbacks:o.callbacks},i.updateQueue=a;return}i=a.lastBaseUpdate,i===null?a.firstBaseUpdate=s:i.next=s,a.lastBaseUpdate=s}var Wu=!1;function Sl(){if(Wu){var i=na;if(i!==null)throw i}}function xl(i,s,a,o){Wu=!1;var u=i.updateQueue;xn=!1;var f=u.firstBaseUpdate,y=u.lastBaseUpdate,C=u.shared.pending;if(C!==null){u.shared.pending=null;var T=C,G=T.next;T.next=null,y===null?f=G:y.next=G,y=T;var ee=i.alternate;ee!==null&&(ee=ee.updateQueue,C=ee.lastBaseUpdate,C!==y&&(C===null?ee.firstBaseUpdate=G:C.next=G,ee.lastBaseUpdate=T))}if(f!==null){var se=u.baseState;y=0,ee=G=T=null,C=f;do{var W=C.lane&-536870913,X=W!==C.lane;if(X?(Pe&W)===W:(o&W)===W){W!==0&&W===pr&&(Wu=!0),ee!==null&&(ee=ee.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var fe=i,ye=C;W=s;var Be=a;switch(ye.tag){case 1:if(fe=ye.payload,typeof fe=="function"){se=fe.call(Be,se,W);break e}se=fe;break e;case 3:fe.flags=fe.flags&-65537|128;case 0:if(fe=ye.payload,W=typeof fe=="function"?fe.call(Be,se,W):fe,W==null)break e;se=I({},se,W);break e;case 2:xn=!0}}W=C.callback,W!==null&&(i.flags|=64,X&&(i.flags|=8192),X=u.callbacks,X===null?u.callbacks=[W]:X.push(W))}else X={lane:W,tag:C.tag,payload:C.payload,callback:C.callback,next:null},ee===null?(G=ee=X,T=se):ee=ee.next=X,y|=W;if(C=C.next,C===null){if(C=u.shared.pending,C===null)break;X=C,C=X.next,X.next=null,u.lastBaseUpdate=X,u.shared.pending=null}}while(!0);ee===null&&(T=se),u.baseState=T,u.firstBaseUpdate=G,u.lastBaseUpdate=ee,f===null&&(u.shared.lanes=0),Rn|=y,i.lanes=y,i.memoizedState=se}}function Wp(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function Fp(i,s){var a=i.callbacks;if(a!==null)for(i.callbacks=null,i=0;i<a.length;i++)Wp(a[i],s)}var Cn=Bt(null),cc=Bt(0);function Kp(i,s){i=Gs,$e(cc,i),$e(Cn,s),Gs=i|s.baseLanes}function Fu(){$e(cc,Gs),$e(Cn,Cn.current)}function Ku(){Gs=cc.current,pt(Cn),pt(cc)}var Yt=Bt(null),ii=null;function kn(i){var s=i.alternate;$e(Gt,Gt.current&1),$e(Yt,i),ii===null&&(s===null||Cn.current!==null||s.memoizedState!==null)&&(ii=i)}function Yu(i){$e(Gt,Gt.current),$e(Yt,i),ii===null&&(ii=i)}function Yp(i){i.tag===22?($e(Gt,Gt.current),$e(Yt,i),ii===null&&(ii=i)):En()}function En(){$e(Gt,Gt.current),$e(Yt,Yt.current)}function Di(i){pt(Yt),ii===i&&(ii=null),pt(Gt)}var Gt=Bt(0);function wl(i,s){$e(Yt,Yt.current),$e(Gt,s)}function Gu(i){pt(Gt),pt(Yt),ii===i&&(ii=null)}function hc(i){for(var s=i;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||v0(a)||_0(a)))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!=="independent"){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Ws=0,Le=null,tt=null,wt=null,uc=!1,la=!1,yr=!1,dc=0,bl=0,oa=null,x4=0;function gt(){throw Error(r(321))}function Zu(i,s){if(s===null)return!1;for(var a=0;a<s.length&&a<i.length;a++)if(!Ri(i[a],s[a]))return!1;return!0}function Xu(i,s,a,o,u,f){return Ws=f,Le=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,pe.H=i===null||i.memoizedState===null?Dg:Ag,yr=!1,f=a(o,u),yr=!1,la&&(f=Zp(s,a,o,u)),Gp(i),f}function Gp(i){pe.H=yc;var s=tt!==null&&tt.next!==null;if(Ws=0,wt=tt=Le=null,uc=!1,bl=0,oa=null,s)throw Error(r(300));i===null||bt||(i=i.dependencies,i!==null&&ic(i)&&(bt=!0))}function Zp(i,s,a,o){Le=i;var u=0;do{if(la&&(oa=null),bl=0,la=!1,25<=u)throw Error(r(301));if(u+=1,wt=tt=null,i.updateQueue!=null){var f=i.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}pe.H=T4,f=s(a,o)}while(la);return f}function w4(){var i=pe.H,s=i.useState()[0];return s=typeof s.then=="function"?Cl(s):s,i=i.useState()[0],(tt!==null?tt.memoizedState:null)!==i&&(Le.flags|=1024),s}function Qu(){var i=dc!==0;return dc=0,i}function Ju(i,s,a){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~a}function ed(i){if(uc){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}uc=!1}Ws=0,wt=tt=Le=null,la=!1,bl=dc=0,oa=null}function ai(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wt===null?Le.memoizedState=wt=i:wt=wt.next=i,wt}function yt(){if(tt===null){var i=Le.alternate;i=i!==null?i.memoizedState:null}else i=tt.next;var s=wt===null?Le.memoizedState:wt.next;if(s!==null)wt=s,tt=i;else{if(i===null)throw Le.alternate===null?Error(r(467)):Error(r(310));tt=i,i={memoizedState:tt.memoizedState,baseState:tt.baseState,baseQueue:tt.baseQueue,queue:tt.queue,next:null},wt===null?Le.memoizedState=wt=i:wt=wt.next=i}return wt}function fc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Cl(i){var s=bl;return bl+=1,oa===null&&(oa=[]),i=Up(oa,i,s),s=Le,(wt===null?s.memoizedState:wt.next)===null&&(s=s.alternate,pe.H=s===null||s.memoizedState===null?Dg:Ag),i}function pc(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Cl(i);if(i.$$typeof===J)return;if(i.$$typeof===O)return Kt(i)}throw Error(r(438,String(i)))}function td(i){var s=null,a=Le.updateQueue;if(a!==null&&(s=a.memoCache),s==null){var o=Le.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(s={data:o.data.map(function(u){return u.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),a===null&&(a=fc(),Le.updateQueue=a),a.memoCache=s,a=s.data[s.index],a===void 0)for(a=s.data[s.index]=Array(i),o=0;o<i;o++)a[o]=je;return s.index++,a}function Fs(i,s){return typeof s=="function"?s(i):s}function gc(i){var s=yt();return id(s,tt,i)}function id(i,s,a){var o=i.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=a;var u=i.baseQueue,f=o.pending;if(f!==null){if(u!==null){var y=u.next;u.next=f.next,f.next=y}s.baseQueue=u=f,o.pending=null}if(f=i.baseState,u===null)i.memoizedState=f;else{s=u.next;var C=y=null,T=null,G=s,ee=!1;do{var se=G.lane&-536870913;if(se!==G.lane?(Pe&se)===se:(Ws&se)===se){var W=G.revertLane;if(W===0)T!==null&&(T=T.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),se===pr&&(ee=!0);else if((Ws&W)===W){G=G.next,W===pr&&(ee=!0);continue}else se={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},T===null?(C=T=se,y=f):T=T.next=se,Le.lanes|=W,Rn|=W;se=G.action,yr&&a(f,se),f=G.hasEagerState?G.eagerState:a(f,se)}else W={lane:se,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},T===null?(C=T=W,y=f):T=T.next=W,Le.lanes|=se,Rn|=se;G=G.next}while(G!==null&&G!==s);if(T===null?y=f:T.next=C,!Ri(f,i.memoizedState)&&(bt=!0,ee&&(a=na,a!==null)))throw a;i.memoizedState=f,i.baseState=y,i.baseQueue=T,o.lastRenderedState=f}return u===null&&(o.lanes=0),[i.memoizedState,o.dispatch]}function sd(i){var s=yt(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=i;var o=a.dispatch,u=a.pending,f=s.memoizedState;if(u!==null){a.pending=null;var y=u=u.next;do f=i(f,y.action),y=y.next;while(y!==u);Ri(f,s.memoizedState)||(bt=!0),s.memoizedState=f,s.baseQueue===null&&(s.baseState=f),a.lastRenderedState=f}return[f,o]}function Xp(i,s,a){var o=Le,u=yt(),f=Oe;if(f){if(a===void 0)throw Error(r(407));a=a()}else a=s();var y=!Ri((tt||u).memoizedState,a);if(y&&(u.memoizedState=a,bt=!0),u=u.queue,ad(eg.bind(null,o,u,i),[i]),i=u.getSnapshot!==s||y||wt!==null&&(wt.memoizedState.tag&1)!==0,ca(i?9:8,{destroy:void 0},Jp.bind(null,o,u,a,s),null),i){if(o.flags|=2048,st===null)throw Error(r(349));f||(Ws&127)!==0||Qp(o,s,a)}return a}function Qp(i,s,a){i.flags|=16384,i={getSnapshot:s,value:a},s=Le.updateQueue,s===null?(s=fc(),Le.updateQueue=s,s.stores=[i]):(a=s.stores,a===null?s.stores=[i]:a.push(i))}function Jp(i,s,a,o){s.value=a,s.getSnapshot=o,tg(s)&&ig(i)}function eg(i,s,a){return a(function(){tg(s)&&ig(i)})}function tg(i){var s=i.getSnapshot;i=i.value;try{var a=s();return!Ri(i,a)}catch{return!0}}function ig(i){var s=or(i,2);s!==null&&xi(s,i,2)}function nd(i){var s=ai();if(typeof i=="function"){var a=i;if(i=a(),yr){fn(!0);try{a()}finally{fn(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:i},s}function sg(i,s,a,o){return i.baseState=a,id(i,tt,typeof o=="function"?o:Fs)}function b4(i,s,a,o,u){if(_c(i))throw Error(r(485));if(i=s.action,i!==null){var f={payload:u,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){f.listeners.push(y)}};pe.T!==null?a(!0):f.isTransition=!1,o(f),a=s.pending,a===null?(f.next=s.pending=f,ng(s,f)):(f.next=a.next,s.pending=a.next=f)}}function ng(i,s){var a=s.action,o=s.payload,u=i.state;if(s.isTransition){var f=pe.T,y={};y.types=f!==null?f.types:null,pe.T=y;try{var C=a(u,o),T=pe.S;T!==null&&T(y,C),rg(i,s,C)}catch(G){rd(i,s,G)}finally{f!==null&&y.types!==null&&(f.types=y.types),pe.T=f}}else try{f=a(u,o),rg(i,s,f)}catch(G){rd(i,s,G)}}function rg(i,s,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){ag(i,s,o)},function(o){return rd(i,s,o)}):ag(i,s,a)}function ag(i,s,a){s.status="fulfilled",s.value=a,lg(s),i.state=a,s=i.pending,s!==null&&(a=s.next,a===s?i.pending=null:(a=a.next,s.next=a,ng(i,a)))}function rd(i,s,a){var o=i.pending;if(i.pending=null,o!==null){o=o.next;do s.status="rejected",s.reason=a,lg(s),s=s.next;while(s!==o)}i.action=null}function lg(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function og(i,s){return s}function cg(i,s){if(Oe){var a=st.formState;if(a!==null){e:{var o=Le;if(Oe){if(nt){t:{for(var u=nt,f=Fi;u.nodeType!==8;){if(!f){u=null;break t}if(u=Yi(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){nt=Yi(u.nextSibling),o=u.data==="F!";break e}}_n(o)}o=!1}o&&(s=a[0])}}return a=ai(),a.memoizedState=a.baseState=s,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:og,lastRenderedState:s},a.queue=o,a=jg.bind(null,Le,o),o.dispatch=a,o=nd(!1),f=ud.bind(null,Le,!1,o.queue),o=ai(),u={state:s,dispatch:null,action:i,pending:null},o.queue=u,a=b4.bind(null,Le,u,f,a),u.dispatch=a,o.memoizedState=i,[s,a,!1]}function hg(i){var s=yt();return ug(s,tt,i)}function ug(i,s,a){if(s=id(i,s,og)[0],i=gc(Fs)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var o=Cl(s)}catch(y){throw y===ra?rc:y}else o=s;s=yt();var u=s.queue,f=u.dispatch;return a!==s.memoizedState&&(Le.flags|=2048,ca(9,{destroy:void 0},C4.bind(null,u,a),null)),[o,f,i]}function C4(i,s){i.action=s}function dg(i){var s=yt(),a=tt;if(a!==null)return ug(s,a,i);yt(),s=s.memoizedState,a=yt();var o=a.queue.dispatch;return a.memoizedState=i,[s,o,!1]}function ca(i,s,a,o){return i={tag:i,create:a,deps:o,inst:s,next:null},s=Le.updateQueue,s===null&&(s=fc(),Le.updateQueue=s),a=s.lastEffect,a===null?s.lastEffect=i.next=i:(o=a.next,a.next=i,i.next=o,s.lastEffect=i),i}function fg(){return yt().memoizedState}function mc(i,s,a,o){var u=ai();Le.flags|=i,u.memoizedState=ca(1|s,{destroy:void 0},a,o===void 0?null:o)}function vc(i,s,a,o){var u=yt();o=o===void 0?null:o;var f=u.memoizedState.inst;tt!==null&&o!==null&&Zu(o,tt.memoizedState.deps)?u.memoizedState=ca(s,f,a,o):(Le.flags|=i,u.memoizedState=ca(1|s,f,a,o))}function pg(i,s){mc(8390656,8,i,s)}function ad(i,s){vc(2048,8,i,s)}function k4(i){Le.flags|=4;var s=Le.updateQueue;if(s===null)s=fc(),Le.updateQueue=s,s.events=[i];else{var a=s.events;a===null?s.events=[i]:a.push(i)}}function gg(i){var s=yt().memoizedState;return k4({ref:s,nextImpl:i}),function(){if((Ye&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}function mg(i,s){return vc(4,2,i,s)}function vg(i,s){return vc(4,4,i,s)}function _g(i,s){if(typeof s=="function"){i=i();var a=s(i);return function(){typeof a=="function"?a():s(null)}}if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function yg(i,s,a){a=a!=null?a.concat([i]):null,vc(4,4,_g.bind(null,s,i),a)}function ld(){}function Sg(i,s){var a=yt();s=s===void 0?null:s;var o=a.memoizedState;return s!==null&&Zu(s,o[1])?o[0]:(a.memoizedState=[i,s],i)}function xg(i,s){var a=yt();s=s===void 0?null:s;var o=a.memoizedState;if(s!==null&&Zu(s,o[1]))return o[0];if(o=i(),yr){fn(!0);try{i()}finally{fn(!1)}}return a.memoizedState=[o,s],o}function od(i,s,a){return a===void 0||(Ws&1073741824)!==0&&(Pe&261930)===0?i.memoizedState=s:(i.memoizedState=a,i=Dm(),Le.lanes|=i,Rn|=i,a)}function wg(i,s,a,o){return Ri(a,s)?a:Cn.current!==null?(i=od(i,a,o),Ri(i,s)||(bt=!0),i):(Ws&106)===0||(Ws&1073741824)!==0&&(Pe&261930)===0?(bt=!0,i.memoizedState=a):(i=Dm(),Le.lanes|=i,Rn|=i,s)}function bg(i,s,a,o,u){var f=_e.p;_e.p=f!==0&&8>f?f:8;var y=pe.T,C={};C.types=y!==null?y.types:null,pe.T=C,ud(i,!1,s,a);try{var T=u(),G=pe.S;if(G!==null&&G(C,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var ee=S4(T,o);kl(i,s,ee,Bi(i))}else kl(i,s,o,Bi(i))}catch(se){kl(i,s,{then:function(){},status:"rejected",reason:se},Bi())}finally{_e.p=f,y!==null&&C.types!==null&&(y.types=C.types),pe.T=y}}function E4(){}function cd(i,s,a,o){if(i.tag!==5)throw Error(r(476));var u=Cg(i).queue;bg(i,u,s,De,a===null?E4:function(){return kg(i),a(o)})}function Cg(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:De,baseState:De,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:De},next:null};var a={};return s.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:a},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function kg(i){var s=Cg(i);s.next===null&&(s=i.alternate.memoizedState),kl(i,s.next.queue,{},Bi())}function hd(){return Kt(ja)}function Eg(){return yt().memoizedState}function Mg(){return yt().memoizedState}function M4(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var a=Bi();i=wn(a);var o=bn(s,i,a);o!==null&&(xi(o,s,a),yl(o,s,a)),s={cache:Hu()},i.payload=s;return}s=s.return}}function j4(i,s,a){var o=Bi();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},_c(i)?Tg(s,a):(a=Tu(i,s,a,o),a!==null&&(xi(a,i,o),Rg(a,s,o)))}function jg(i,s,a){var o=Bi();kl(i,s,a,o)}function kl(i,s,a,o){var u={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(_c(i))Tg(s,u);else{var f=i.alternate;if(i.lanes===0&&(f===null||f.lanes===0)&&(f=s.lastRenderedReducer,f!==null))try{var y=s.lastRenderedState,C=f(y,a);if(u.hasEagerState=!0,u.eagerState=C,Ri(C,y))return Go(i,s,u,0),st===null&&Yo(),!1}catch{}if(a=Tu(i,s,u,o),a!==null)return xi(a,i,o),Rg(a,s,o),!0}return!1}function ud(i,s,a,o){if(o={lane:2,revertLane:t0(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},_c(i)){if(s)throw Error(r(479))}else s=Tu(i,a,o,2),s!==null&&xi(s,i,2)}function _c(i){var s=i.alternate;return i===Le||s!==null&&s===Le}function Tg(i,s){la=uc=!0;var a=i.pending;a===null?s.next=s:(s.next=a.next,a.next=s),i.pending=s}function Rg(i,s,a){if((a&4194048)!==0){var o=s.lanes;o&=i.pendingLanes,a|=o,s.lanes=a,D1(i,a)}}var yc={readContext:Kt,use:pc,useCallback:gt,useContext:gt,useEffect:gt,useImperativeHandle:gt,useLayoutEffect:gt,useInsertionEffect:gt,useMemo:gt,useReducer:gt,useRef:gt,useState:gt,useDebugValue:gt,useDeferredValue:gt,useTransition:gt,useSyncExternalStore:gt,useId:gt,useHostTransitionStatus:gt,useFormState:gt,useActionState:gt,useOptimistic:gt,useMemoCache:gt,useCacheRefresh:gt,useEffectEvent:gt},Dg={readContext:Kt,use:pc,useCallback:function(i,s){return ai().memoizedState=[i,s===void 0?null:s],i},useContext:Kt,useEffect:pg,useImperativeHandle:function(i,s,a){a=a!=null?a.concat([i]):null,mc(4194308,4,_g.bind(null,s,i),a)},useLayoutEffect:function(i,s){return mc(4194308,4,i,s)},useInsertionEffect:function(i,s){mc(4,2,i,s)},useMemo:function(i,s){var a=ai();s=s===void 0?null:s;var o=i();if(yr){fn(!0);try{i()}finally{fn(!1)}}return a.memoizedState=[o,s],o},useReducer:function(i,s,a){var o=ai();if(a!==void 0){var u=a(s);if(yr){fn(!0);try{a(s)}finally{fn(!1)}}}else u=s;return o.memoizedState=o.baseState=u,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:u},o.queue=i,i=i.dispatch=j4.bind(null,Le,i),[o.memoizedState,i]},useRef:function(i){var s=ai();return i={current:i},s.memoizedState=i},useState:function(i){i=nd(i);var s=i.queue,a=jg.bind(null,Le,s);return s.dispatch=a,[i.memoizedState,a]},useDebugValue:ld,useDeferredValue:function(i,s){var a=ai();return od(a,i,s)},useTransition:function(){var i=nd(!1);return i=bg.bind(null,Le,i.queue,!0,!1),ai().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,a){var o=Le,u=ai();if(Oe){if(a===void 0)throw Error(r(407));a=a()}else{if(a=s(),st===null)throw Error(r(349));(Pe&127)!==0||Qp(o,s,a)}u.memoizedState=a;var f={value:a,getSnapshot:s};return u.queue=f,pg(eg.bind(null,o,f,i),[i]),o.flags|=2048,ca(9,{destroy:void 0},Jp.bind(null,o,f,a,s),null),a},useId:function(){var i=ai(),s=st.identifierPrefix;if(Oe){var a=vs,o=ms;a=(o&~(1<<32-ji(o)-1)).toString(32)+a,s="_"+s+"R_"+a,a=dc++,0<a&&(s+="H"+a.toString(32)),s+="_"}else a=x4++,s="_"+s+"r_"+a.toString(32)+"_";return i.memoizedState=s},useHostTransitionStatus:hd,useFormState:cg,useActionState:cg,useOptimistic:function(i){var s=ai();s.memoizedState=s.baseState=i;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=a,s=ud.bind(null,Le,!0,a),a.dispatch=s,[i,s]},useMemoCache:td,useCacheRefresh:function(){return ai().memoizedState=M4.bind(null,Le)},useEffectEvent:function(i){var s=ai(),a={impl:i};return s.memoizedState=a,function(){if((Ye&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Ag={readContext:Kt,use:pc,useCallback:Sg,useContext:Kt,useEffect:ad,useImperativeHandle:yg,useInsertionEffect:mg,useLayoutEffect:vg,useMemo:xg,useReducer:gc,useRef:fg,useState:function(){return gc(Fs)},useDebugValue:ld,useDeferredValue:function(i,s){var a=yt();return wg(a,tt.memoizedState,i,s)},useTransition:function(){var i=gc(Fs)[0],s=yt().memoizedState;return[typeof i=="boolean"?i:Cl(i),s]},useSyncExternalStore:Xp,useId:Eg,useHostTransitionStatus:hd,useFormState:hg,useActionState:hg,useOptimistic:function(i,s){var a=yt();return sg(a,tt,i,s)},useMemoCache:td,useCacheRefresh:Mg,useEffectEvent:gg},T4={readContext:Kt,use:pc,useCallback:Sg,useContext:Kt,useEffect:ad,useImperativeHandle:yg,useInsertionEffect:mg,useLayoutEffect:vg,useMemo:xg,useReducer:sd,useRef:fg,useState:function(){return sd(Fs)},useDebugValue:ld,useDeferredValue:function(i,s){var a=yt();return tt===null?od(a,i,s):wg(a,tt.memoizedState,i,s)},useTransition:function(){var i=sd(Fs)[0],s=yt().memoizedState;return[typeof i=="boolean"?i:Cl(i),s]},useSyncExternalStore:Xp,useId:Eg,useHostTransitionStatus:hd,useFormState:dg,useActionState:dg,useOptimistic:function(i,s){var a=yt();return tt!==null?sg(a,tt,i,s):(a.baseState=i,[i,a.queue.dispatch])},useMemoCache:td,useCacheRefresh:Mg,useEffectEvent:gg};function dd(i,s,a,o){s=i.memoizedState,a=a(o,s),a=a==null?s:I({},s,a),i.memoizedState=a,i.lanes===0&&(i.updateQueue.baseState=a)}var fd={enqueueSetState:function(i,s,a){i=i._reactInternals;var o=Bi(),u=wn(o);u.payload=s,a!=null&&(u.callback=a),s=bn(i,u,o),s!==null&&(xi(s,i,o),yl(s,i,o))},enqueueReplaceState:function(i,s,a){i=i._reactInternals;var o=Bi(),u=wn(o);u.tag=1,u.payload=s,a!=null&&(u.callback=a),s=bn(i,u,o),s!==null&&(xi(s,i,o),yl(s,i,o))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var a=Bi(),o=wn(a);o.tag=2,s!=null&&(o.callback=s),s=bn(i,o,a),s!==null&&(xi(s,i,a),yl(s,i,a))}};function Ng(i,s,a,o,u,f,y){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(o,f,y):s.prototype&&s.prototype.isPureReactComponent?!ul(a,o)||!ul(u,f):!0}function Lg(i,s,a,o){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,o),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,o),s.state!==i&&fd.enqueueReplaceState(s,s.state,null)}function Sr(i,s){var a=s;if("ref"in s){a={};for(var o in s)o!=="ref"&&(a[o]=s[o])}if(i=i.defaultProps){a===s&&(a=I({},a));for(var u in i)a[u]===void 0&&(a[u]=i[u])}return a}function Bg(i){Ko(i)}function Og(i){console.error(i)}function zg(i){Ko(i)}function Sc(i,s){try{var a=i.onUncaughtError;a(s.value,{componentStack:s.stack})}catch(o){setTimeout(function(){throw o})}}function Hg(i,s,a){try{var o=i.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function pd(i,s,a){return a=wn(a),a.tag=3,a.payload={element:null},a.callback=function(){Sc(i,s)},a}function Ig(i){return i=wn(i),i.tag=3,i}function Ug(i,s,a,o){var u=a.type.getDerivedStateFromError;if(typeof u=="function"){var f=o.value;i.payload=function(){return u(f)},i.callback=function(){Hg(s,a,o)}}var y=a.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(i.callback=function(){Hg(s,a,o),typeof u!="function"&&(Dn===null?Dn=new Set([this]):Dn.add(this));var C=o.stack;this.componentDidCatch(o.value,{componentStack:C!==null?C:""})})}function R4(i,s,a,o,u){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(s=a.alternate,s!==null&&dr(s,a,u,!0),a=Yt.current,a!==null){switch(a.tag){case 31:case 13:case 19:return ii===null?Pc():a.alternate===null&&mt===0&&(mt=3),a.flags&=-257,a.flags|=65536,a.lanes=u,o===ac?a.flags|=16384:(s=a.updateQueue,s===null?a.updateQueue=new Set([o]):s.add(o),Qd(i,o,u)),!1;case 22:return a.flags|=65536,o===ac?a.flags|=16384:(s=a.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=s):(a=s.retryQueue,a===null?s.retryQueue=new Set([o]):a.add(o)),Qd(i,o,u)),!1}throw Error(r(435,a.tag))}return Qd(i,o,u),Pc(),!1}if(Oe)return s=Yt.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=u,o!==Lu&&(i=Error(r(422),{cause:o}),pl(Vi(i,a)))):(o!==Lu&&(s=Error(r(423),{cause:o}),pl(Vi(s,a))),i=i.current.alternate,i.flags|=65536,u&=-u,i.lanes|=u,o=Vi(o,a),u=pd(i.stateNode,o,u),$u(i,u),mt!==4&&(mt=2)),!1;var f=Error(r(520),{cause:o});if(f=Vi(f,a),Nl===null?Nl=[f]:Nl.push(f),mt!==4&&(mt=2),s===null)return!0;o=Vi(o,a),a=s;do{switch(a.tag){case 3:return a.flags|=65536,i=u&-u,a.lanes|=i,i=pd(a.stateNode,o,i),$u(a,i),!1;case 1:if(s=a.type,f=a.stateNode,(a.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(Dn===null||!Dn.has(f))))return a.flags|=65536,u&=-u,a.lanes|=u,u=Ig(u),Ug(u,i,a,o),$u(a,u),!1;break;case 22:if(a.memoizedState!==null)return a.flags|=65536,!1}a=a.return}while(a!==null);return!1}var gd=Error(r(461)),bt=!1;function jt(i,s,a,o){s.child=i===null?$p(s,null,a,o):_r(s,i.child,a,o)}function Pg(i,s,a,o,u){a=a.render;var f=s.ref;if("ref"in o){var y={};for(var C in o)C!=="ref"&&(y[C]=o[C])}else y=o;return fr(s),o=Xu(i,s,a,y,f,u),C=Qu(),i!==null&&!bt?(Ju(i,s,u),Ks(i,s,u)):(Oe&&C&&Jo(s),s.flags|=1,jt(i,s,o,u),s.child)}function qg(i,s,a,o,u){if(i===null){var f=a.type;return typeof f=="function"&&!Ru(f)&&f.defaultProps===void 0&&a.compare===null?(s.tag=15,s.type=f,Vg(i,s,f,o,u)):(i=Xo(a.type,null,o,s,s.mode,u),i.ref=s.ref,i.return=s,s.child=i)}if(f=i.child,!bd(i,u)){var y=f.memoizedProps;if(a=a.compare,a=a!==null?a:ul,a(y,o)&&i.ref===s.ref)return Ks(i,s,u)}return s.flags|=1,i=Ps(f,o),i.ref=s.ref,i.return=s,s.child=i}function Vg(i,s,a,o,u){if(i!==null){var f=i.memoizedProps;if(ul(f,o)&&i.ref===s.ref)if(bt=!1,s.pendingProps=o=f,bd(i,u))(i.flags&131072)!==0&&(bt=!0);else return s.lanes=i.lanes,Ks(i,s,u)}return md(i,s,a,o,u)}function $g(i,s,a,o){var u=o.children,f=i!==null?i.memoizedState:null;if(i===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((s.flags&128)!==0){if(f=f!==null?f.baseLanes|a:a,i!==null){for(o=s.child=i.child,u=0;o!==null;)u=u|o.lanes|o.childLanes,o=o.sibling;o=u&~f}else o=0,s.child=null;return Wg(i,s,f,a,o)}if((a&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&nc(s,f!==null?f.cachePool:null),f!==null?Kp(s,f):Fu(),Yp(s);else return o=s.lanes=536870912,Wg(i,s,f!==null?f.baseLanes|a:a,a,o)}else f!==null?(nc(s,f.cachePool),Kp(s,f),En(),s.memoizedState=null):(i!==null&&nc(s,null),Fu(),En());return jt(i,s,u,a),s.child}function El(i,s){return i!==null&&i.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Wg(i,s,a,o,u){var f=Uu();return f=f===null?null:{parent:xt._currentValue,pool:f},s.memoizedState={baseLanes:a,cachePool:f},i!==null&&nc(s,null),Fu(),Yp(s),i!==null&&dr(i,s,o,!0),s.childLanes=u,null}function xc(i,s){return s=wc({mode:s.mode,children:s.children},i.mode),s.ref=i.ref,i.child=s,s.return=i,s}function Fg(i,s,a){return _r(s,i.child,null,a),i=xc(s,s.pendingProps),i.flags|=2,Di(s),s.memoizedState=null,i}function D4(i,s,a){var o=s.pendingProps,u=(s.flags&128)!==0;if(s.flags&=-129,i===null){if(Oe){if(o.mode==="hidden")return i=xc(s,o),s.lanes=536870912,i.memoizedState={baseLanes:0,cachePool:null},El(null,i);if(Yu(s),(i=nt)?(i=_v(i,Fi),i=i!==null&&i.data==="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:mn!==null?{id:ms,overflow:vs}:null,retryLane:536870912,hydrationErrors:null},a=Tp(i),a.return=s,s.child=a,zt=s,nt=null)):i=null,i===null)throw _n(s);return s.lanes=536870912,null}return xc(s,o)}var f=i.memoizedState;if(f!==null){var y=f.dehydrated;if(Yu(s),u)if(s.flags&256)s.flags&=-257,s=Fg(i,s,a);else if(s.memoizedState!==null)s.child=i.child,s.flags|=128,s=null;else throw Error(r(558));else if(bt||dr(i,s,a,!1),u=(a&i.childLanes)!==0,bt||u){if(Cn.current===null){if(o=st,o!==null&&(y=A1(o,a),y!==0&&y!==f.retryLane))throw f.retryLane=y,or(i,y),xi(o,i,y),gd;Pc()}s=Fg(i,s,a)}else i=f.treeContext,nt=Yi(y.nextSibling),zt=s,Oe=!0,vn=null,Fi=!1,i!==null&&Ap(s,i),s=xc(s,o),s.flags|=134221824;return s}return i=Ps(i.child,{mode:o.mode,children:o.children}),i.ref=s.ref,s.child=i,i.return=s,i}function ha(i,s){var a=s.ref;if(a===null)i!==null&&i.ref!==null&&(s.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(i===null||i.ref!==a)&&(s.flags|=4194816)}}function md(i,s,a,o,u){return fr(s),a=Xu(i,s,a,o,void 0,u),o=Qu(),i!==null&&!bt?(Ju(i,s,u),Ks(i,s,u)):(Oe&&o&&Jo(s),s.flags|=1,jt(i,s,a,u),s.child)}function Kg(i,s,a,o,u,f){return fr(s),s.updateQueue=null,a=Zp(s,o,a,u),Gp(i),o=Qu(),i!==null&&!bt?(Ju(i,s,f),Ks(i,s,f)):(Oe&&o&&Jo(s),s.flags|=1,jt(i,s,a,f),s.child)}function Yg(i,s,a,o,u){if(fr(s),s.stateNode===null){var f=ea,y=a.contextType;typeof y=="object"&&y!==null&&(f=Kt(y)),f=new a(o,f),s.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=fd,s.stateNode=f,f._reactInternals=s,f=s.stateNode,f.props=o,f.state=s.memoizedState,f.refs={},qu(s),y=a.contextType,f.context=typeof y=="object"&&y!==null?Kt(y):ea,f.state=s.memoizedState,y=a.getDerivedStateFromProps,typeof y=="function"&&(dd(s,a,y,o),f.state=s.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(y=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),y!==f.state&&fd.enqueueReplaceState(f,f.state,null),xl(s,o,f,u),Sl(),f.state=s.memoizedState),typeof f.componentDidMount=="function"&&(s.flags|=4194308),o=!0}else if(i===null){f=s.stateNode;var C=s.memoizedProps,T=Sr(a,C);f.props=T;var G=f.context,ee=a.contextType;y=ea,typeof ee=="object"&&ee!==null&&(y=Kt(ee));var se=a.getDerivedStateFromProps;ee=typeof se=="function"||typeof f.getSnapshotBeforeUpdate=="function",C=s.pendingProps!==C,ee||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(C||G!==y)&&Lg(s,f,o,y),xn=!1;var W=s.memoizedState;f.state=W,xl(s,o,f,u),Sl(),G=s.memoizedState,C||W!==G||xn?(typeof se=="function"&&(dd(s,a,se,o),G=s.memoizedState),(T=xn||Ng(s,a,T,o,W,G,y))?(ee||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(s.flags|=4194308)):(typeof f.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=o,s.memoizedState=G),f.props=o,f.state=G,f.context=y,o=T):(typeof f.componentDidMount=="function"&&(s.flags|=4194308),o=!1)}else{f=s.stateNode,Vu(i,s),y=s.memoizedProps,ee=Sr(a,y),f.props=ee,se=s.pendingProps,W=f.context,G=a.contextType,T=ea,typeof G=="object"&&G!==null&&(T=Kt(G)),C=a.getDerivedStateFromProps,(G=typeof C=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y!==se||W!==T)&&Lg(s,f,o,T),xn=!1,W=s.memoizedState,f.state=W,xl(s,o,f,u),Sl();var X=s.memoizedState;y!==se||W!==X||xn||i!==null&&i.dependencies!==null&&ic(i.dependencies)?(typeof C=="function"&&(dd(s,a,C,o),X=s.memoizedState),(ee=xn||Ng(s,a,ee,o,W,X,T)||i!==null&&i.dependencies!==null&&ic(i.dependencies))?(G||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(o,X,T),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(o,X,T)),typeof f.componentDidUpdate=="function"&&(s.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof f.componentDidUpdate!="function"||y===i.memoizedProps&&W===i.memoizedState||(s.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===i.memoizedProps&&W===i.memoizedState||(s.flags|=1024),s.memoizedProps=o,s.memoizedState=X),f.props=o,f.state=X,f.context=T,o=ee):(typeof f.componentDidUpdate!="function"||y===i.memoizedProps&&W===i.memoizedState||(s.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===i.memoizedProps&&W===i.memoizedState||(s.flags|=1024),o=!1)}return f=o,ha(i,s),o=(s.flags&128)!==0,f||o?(f=s.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:f.render(),s.flags|=1,i!==null&&o?(s.child=_r(s,i.child,null,u),s.child=_r(s,null,a,u)):jt(i,s,a,u),s.memoizedState=f.state,i=s.child):i=Ks(i,s,u),i}function Gg(i,s,a,o){return hr(),s.flags|=256,jt(i,s,a,o),s.child}var vd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _d(i){return{baseLanes:i,cachePool:Hp()}}function yd(i,s,a){return i=i!==null?i.childLanes&~a:0,s&&(i|=Li),i}function Zg(i,s,a){var o=s.pendingProps,u=!1,f=(s.flags&128)!==0,y;if((y=f)||(y=i!==null&&i.memoizedState===null?!1:(Gt.current&2)!==0),y&&(u=!0,s.flags&=-129),y=(s.flags&32)!==0,s.flags&=-33,i===null){if(Oe){if(u?kn(s):En(),(i=nt)?(i=_v(i,Fi),i=i!==null&&i.data!=="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:mn!==null?{id:ms,overflow:vs}:null,retryLane:536870912,hydrationErrors:null},a=Tp(i),a.return=s,s.child=a,zt=s,nt=null)):i=null,i===null)throw _n(s);return _0(i)?s.lanes=32:s.lanes=536870912,null}return f=o.children,o=o.fallback,u?(En(),u=s.mode,f=wc({mode:"hidden",children:f},u),o=cr(o,u,a,null),f.return=s,o.return=s,f.sibling=o,s.child=f,o=s.child,o.memoizedState=_d(a),o.childLanes=yd(i,y,a),s.memoizedState=vd,El(null,o)):(kn(s),Sd(s,f))}var C=i.memoizedState;if(C!==null){var T=C.dehydrated;if(T!==null)return A4(i,s,f,y,o,T,C,a)}return u?(En(),u=o.fallback,f=s.mode,C=i.child,T=C.sibling,o=Ps(C,{mode:"hidden",children:o.children}),o.subtreeFlags=C.subtreeFlags&1206910976,T!==null?u=Ps(T,u):(u=cr(u,f,a,null),u.flags|=2),u.return=s,o.return=s,o.sibling=u,s.child=o,El(null,o),o=s.child,u=i.child.memoizedState,u===null?u=_d(a):(f=u.cachePool,f!==null?(C=xt._currentValue,f=f.parent!==C?{parent:C,pool:C}:f):f=Hp(),u={baseLanes:u.baseLanes|a,cachePool:f}),o.memoizedState=u,o.childLanes=yd(i,y,a),s.memoizedState=vd,El(i.child,o)):(kn(s),a=i.child,i=a.sibling,a=Ps(a,{mode:"visible",children:o.children}),a.return=s,a.sibling=null,i!==null&&(y=s.deletions,y===null?(s.deletions=[i],s.flags|=16):y.push(i)),s.child=a,s.memoizedState=null,a)}function Sd(i,s){return s=wc({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function wc(i,s){return i=vi(22,i,null,s),i.lanes=0,i}function bc(i,s,a){return _r(s,i.child,null,a),i=Sd(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function A4(i,s,a,o,u,f,y,C){if(a)return s.flags&256?(kn(s),s.flags&=-257,bc(i,s,C)):s.memoizedState!==null?(En(),s.child=i.child,s.flags|=128,null):(En(),f=u.fallback,y=s.mode,u=wc({mode:"visible",children:u.children},y),f=cr(f,y,C,null),f.flags|=2,u.return=s,f.return=s,u.sibling=f,s.child=u,_r(s,i.child,null,C),u=s.child,u.memoizedState=_d(C),u.childLanes=yd(i,o,C),s.memoizedState=vd,El(null,u));if(kn(s),_0(f)){if(o=f.nextSibling&&f.nextSibling.dataset,o)var T=o.dgst;return o=T,o!==""&&(u=Error(r(419)),u.stack="",u.digest=o,pl({value:u,source:null,stack:null})),bc(i,s,C)}if(bt||dr(i,s,C,!1),o=(C&i.childLanes)!==0,bt||o){if(Cn.current!==null)return bc(i,s,C);if(o=st,o!==null&&(u=A1(o,C),u!==0&&u!==y.retryLane))throw y.retryLane=u,or(i,u),xi(o,i,u),gd;return v0(f)||Pc(),bc(i,s,C)}return v0(f)?(s.flags|=192,s.child=i.child,null):(i=y.treeContext,nt=Yi(f.nextSibling),zt=s,Oe=!0,vn=null,Fi=!1,i!==null&&Ap(s,i),s=Sd(s,u.children),s.flags|=134221824,s)}function Xg(i,s,a){i.lanes|=s;var o=i.alternate;o!==null&&(o.lanes|=s),tc(i.return,s,a)}function Qg(i){for(var s=null;i!==null;){var a=i.alternate;a!==null&&hc(a)===null&&(s=i),i=i.sibling}return s}function Cc(i,s,a,o,u,f){var y=i.memoizedState;y===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:u,treeForkCount:f}:(y.isBackwards=s,y.rendering=null,y.renderingStartTime=0,y.last=o,y.tail=a,y.tailMode=u,y.treeForkCount=f)}function xd(i){var s=i.child;for(i.child=null;s!==null;){var a=s.sibling;s.sibling=i.child,i.child=s,s=a}}function wd(i,s,a){var o=s.pendingProps,u=o.revealOrder,f=o.tail;o=o.children;var y=Gt.current;if(s.flags&128)return wl(s,y),null;var C=(y&2)!==0;if(C?(y=y&1|2,s.flags|=128):y&=1,wl(s,y),u==="backwards"&&i!==null?(xd(i),jt(i,s,o,a),xd(i)):jt(i,s,o,a),o=Oe?fl:0,!C&&i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Xg(i,a,s);else if(i.tag===19)Xg(i,a,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(u){case"backwards":a=Qg(s.child),a===null?(u=s.child,s.child=null):(u=a.sibling,a.sibling=null,xd(s)),Cc(s,!0,u,null,f,o);break;case"unstable_legacy-backwards":for(a=null,u=s.child,s.child=null;u!==null;){if(i=u.alternate,i!==null&&hc(i)===null){s.child=u;break}i=u.sibling,u.sibling=a,a=u,u=i}Cc(s,!0,a,null,f,o);break;case"together":Cc(s,!1,null,null,void 0,o);break;case"independent":s.memoizedState=null;break;default:a=Qg(s.child),a===null?(u=s.child,s.child=null):(u=a.sibling,a.sibling=null),Cc(s,!1,u,a,f,o)}return s.child}function Jg(i,s,a){var o=s.pendingProps;return yn(s,s.type,o.value),jt(i,s,o.children,a),s.child}function Ks(i,s,a){if(i!==null&&(s.dependencies=i.dependencies),Rn|=s.lanes,(a&s.childLanes)===0)if(i!==null){if(dr(i,s,a,!1),(a&s.childLanes)===0)return null}else return null;if(i!==null&&s.child!==i.child)throw Error(r(153));if(s.child!==null){for(i=s.child,a=Ps(i,i.pendingProps),s.child=a,a.return=s;i.sibling!==null;)i=i.sibling,a=a.sibling=Ps(i,i.pendingProps),a.return=s;a.sibling=null}return s.child}function bd(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&ic(i)))}function N4(i,s,a){switch(s.tag){case 3:Ur(s,s.stateNode.containerInfo),yn(s,xt,i.memoizedState.cache),hr();break;case 27:case 5:Pr(s);break;case 4:Ur(s,s.stateNode.containerInfo);break;case 10:yn(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Yu(s),null;break;case 13:var o=s.memoizedState;if(o!==null){if(o.dehydrated!==null)return kn(s),s.flags|=128,null;o=dr(i,s,a,!1);var u=s.child.childLanes;return o||(a&u)!==0?Zg(i,s,a):(kn(s),i=Ks(i,s,a),i!==null?i.sibling:null)}kn(s);break;case 19:if(s.flags&128)return wd(i,s,a);if(u=(i.flags&128)!==0,o=(a&s.childLanes)!==0,o||(dr(i,s,a,!1),o=(a&s.childLanes)!==0),u){if(o)return wd(i,s,a);s.flags|=128}if(u=s.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),wl(s,Gt.current),o)break;return null;case 22:return s.lanes=0,$g(i,s,a,s.pendingProps);case 24:yn(s,xt,i.memoizedState.cache)}return Ks(i,s,a)}function em(i,s,a){if(i!==null)if(i.memoizedProps!==s.pendingProps)bt=!0;else{if(!bd(i,a)&&(s.flags&128)===0)return bt=!1,N4(i,s,a);bt=(i.flags&131072)!==0}else bt=!1,Oe&&(s.flags&1048576)!==0&&Dp(s,fl,s.index);switch(s.lanes=0,s.tag){case 16:e:{var o=s.pendingProps;if(i=mr(s.elementType),s.type=i,typeof i=="function")Ru(i)?(o=Sr(i,o),s.tag=1,s=Yg(null,s,i,o,a)):(s.tag=0,s=md(null,s,i,o,a));else{if(i!=null){var u=i.$$typeof;if(u===P){s.tag=11,s=Pg(null,s,i,o,a);break e}else if(u===ce){s.tag=14,s=qg(null,s,i,o,a);break e}else if(u===O){s.tag=10,s.type=i,s=Jg(null,s,a);break e}}throw s=xe(i)||i,Error(r(306,s,""))}}return s;case 0:return md(i,s,s.type,s.pendingProps,a);case 1:return o=s.type,u=Sr(o,s.pendingProps),Yg(i,s,o,u,a);case 3:e:{if(Ur(s,s.stateNode.containerInfo),i===null)throw Error(r(387));o=s.pendingProps;var f=s.memoizedState;u=f.element,Vu(i,s),xl(s,o,null,a);var y=s.memoizedState;if(o=y.cache,yn(s,xt,o),o!==f.cache&&zu(s,[xt],a,!0),Sl(),o=y.element,f.isDehydrated)if(f={element:o,isDehydrated:!1,cache:y.cache},s.updateQueue.baseState=f,s.memoizedState=f,s.flags&256){s=Gg(i,s,o,a);break e}else if(o!==u){u=Vi(Error(r(424)),s),pl(u),s=Gg(i,s,o,a);break e}else for(i=s.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,nt=Yi(i.firstChild),zt=s,Oe=!0,vn=null,Fi=!0,a=$p(s,null,o,a),s.child=a;a;)a.flags=a.flags&-3|134221824,a=a.sibling;else{if(hr(),o===u){s=Ks(i,s,a);break e}jt(i,s,o,a)}s=s.child}return s;case 26:return ha(i,s),i===null?(a=kv(s.type,null,s.pendingProps,null))?s.memoizedState=a:Oe||(s.stateNode=nv(s.type,s.pendingProps,Ke.current,s)):s.memoizedState=kv(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return Pr(s),i===null&&Oe&&(o=s.stateNode=xv(s.type,s.pendingProps,Ke.current),zt=s,Fi=!0,u=nt,Ln(s.type)?(y0=u,nt=Yi(o.firstChild)):nt=u),jt(i,s,s.pendingProps.children,a),ha(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&Oe&&((u=o=nt)&&(o=M5(o,s.type,s.pendingProps,Fi),o!==null?(s.stateNode=o,zt=s,nt=Yi(o.firstChild),Fi=!1,u=!0):u=!1),u||_n(s)),Pr(s),u=s.type,f=s.pendingProps,y=i!==null?i.memoizedProps:null,o=f.children,h0(u,f)?o=null:y!==null&&h0(u,y)&&(s.flags|=32),s.memoizedState!==null&&(u=Xu(i,s,w4,null,null,a),ja._currentValue=u),ha(i,s),jt(i,s,o,a),s.child;case 6:return i===null&&Oe&&((i=a=nt)&&(a=j5(a,s.pendingProps,Fi),a!==null?(s.stateNode=a,zt=s,nt=null,i=!0):i=!1),i||_n(s)),null;case 13:return Zg(i,s,a);case 4:return Ur(s,s.stateNode.containerInfo),o=s.pendingProps,i===null?s.child=_r(s,null,o,a):jt(i,s,o,a),s.child;case 11:return Pg(i,s,s.type,s.pendingProps,a);case 7:return o=s.pendingProps,ha(i,s),jt(i,s,o,a),s.child;case 8:return jt(i,s,s.pendingProps.children,a),s.child;case 12:return jt(i,s,s.pendingProps.children,a),s.child;case 10:return Jg(i,s,a);case 9:return u=s.type._context,o=s.pendingProps.children,fr(s),u=Kt(u),o=o(u),s.flags|=1,jt(i,s,o,a),s.child;case 14:return qg(i,s,s.type,s.pendingProps,a);case 15:return Vg(i,s,s.type,s.pendingProps,a);case 19:return wd(i,s,a);case 31:return D4(i,s,a);case 22:return $g(i,s,a,s.pendingProps);case 24:return fr(s),o=Kt(xt),i===null?(u=Uu(),u===null&&(u=st,f=Hu(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=a),u=f),s.memoizedState={parent:o,cache:u},qu(s),yn(s,xt,u)):((i.lanes&a)!==0&&(Vu(i,s),xl(s,null,null,a),Sl()),u=i.memoizedState,f=s.memoizedState,u.parent!==o?(u={parent:o,cache:o},s.memoizedState=u,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=u),yn(s,xt,o)):(o=f.cache,yn(s,xt,o),o!==u.cache&&zu(s,[xt],a,!0))),jt(i,s,s.pendingProps.children,a),s.child;case 30:return s.stateNode===null&&(s.stateNode={autoName:null,paired:null,clones:null,ref:null}),o=s.pendingProps,o.name!=null&&o.name!=="auto"?s.flags|=i===null?18882560:18874368:Oe&&Jo(s),i!==null&&i.memoizedProps.name!==o.name?s.flags|=4194816:ha(i,s),jt(i,s,o.children,a),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function Ys(i){i.flags|=4}function Cd(i,s,a,o,u){var f;if((f=(i.mode&32)!==0)&&(f=a===null?Tv(s,o):Tv(s,o)&&(o.src!==a.src||o.srcSet!==a.srcSet)),f){if(i.flags|=16777216,(u&335544128)===u)if(i.stateNode.complete)i.flags|=8192;else if(Bm())i.flags|=8192;else throw vr=ac,Pu}else i.flags&=-16777217}function tm(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!Rv(s))if(Bm())i.flags|=8192;else throw vr=ac,Pu}function kc(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?T1():536870912,i.lanes|=s,ga|=s)}function Ml(i,s){if(!Oe)switch(i.tailMode){case"visible":break;case"collapsed":for(var a=i.tail,o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:o.sibling=null;break;default:for(s=i.tail,a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?i.tail=null:a.sibling=null}}function rt(i){var s=i.alternate!==null&&i.alternate.child===i.child,a=0,o=0;if(s)for(var u=i.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags&1206910976,o|=u.flags&1206910976,u.return=i,u=u.sibling;else for(u=i.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags,o|=u.flags,u.return=i,u=u.sibling;return i.subtreeFlags|=o,i.childLanes=a,s}function L4(i,s,a){var o=s.pendingProps;switch(Nu(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return rt(s),null;case 1:return rt(s),null;case 3:return a=s.stateNode,o=null,i!==null&&(o=i.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),$s(xt),Bs(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(i===null||i.child===null)&&(sa(s)?Ys(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Bu())),rt(s),null;case 26:var u=s.type,f=s.memoizedState;return i===null?(Ys(s),f!==null?(rt(s),tm(s,f)):(rt(s),Cd(s,u,null,o,a))):f?f!==i.memoizedState?(Ys(s),rt(s),tm(s,f)):(rt(s),s.flags&=-16777217):(i=i.memoizedProps,i!==o&&Ys(s),rt(s),Cd(s,u,i,o,a)),null;case 27:if(rs(s),a=Ke.current,u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==o&&Ys(s);else{if(!o){if(s.stateNode===null)throw Error(r(166));return rt(s),s.subtreeFlags&=-33554433,null}i=gi.current,sa(s)?Np(s):(i=xv(u,o,a),s.stateNode=i,Ys(s))}return rt(s),s.subtreeFlags&=-33554433,null;case 5:if(rs(s),u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==o&&Ys(s);else{if(!o){if(s.stateNode===null)throw Error(r(166));return rt(s),s.subtreeFlags&=-33554433,null}if(f=gi.current,sa(s))Np(s);else{var y=Hl(Ke.current);switch(f){case 1:f=y.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:f=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":f=y.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":f=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":f=y.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof o.is=="string"?y.createElement("select",{is:o.is}):y.createElement("select"),o.multiple?f.multiple=!0:o.size&&(f.size=o.size);break;default:f=typeof o.is=="string"?y.createElement(u,{is:o.is}):y.createElement(u)}}f[Ft]=s,f[mi]=o;e:for(y=s.child;y!==null;){if(y.tag===5||y.tag===6)f.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===s)break e;for(;y.sibling===null;){if(y.return===null||y.return===s)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}s.stateNode=f;e:switch(Xt(f,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Ys(s)}}return rt(s),s.subtreeFlags&=-33554433,Cd(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,a),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==o&&Ys(s);else{if(typeof o!="string"&&s.stateNode===null)throw Error(r(166));if(i=Ke.current,sa(s)){if(i=s.stateNode,a=s.memoizedProps,o=null,u=zt,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}i[Ft]=s,i=!!(i.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||ev(i.nodeValue,a)),i||_n(s,!0)}else i=Hl(i).createTextNode(o),i[Ft]=s,s.stateNode=i}return rt(s),null;case 31:if(a=s.memoizedState,i===null||i.memoizedState!==null){if(o=sa(s),a!==null){if(i===null){if(!o)throw Error(r(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[Ft]=s}else hr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;rt(s),i=!1}else a=Bu(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=a),i=!0;if(!i)return s.flags&256?(Di(s),s):(Di(s),null);if((s.flags&128)!==0)throw Error(r(558))}return rt(s),null;case 13:if(o=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(u=sa(s),o!==null&&o.dehydrated!==null){if(i===null){if(!u)throw Error(r(318));if(u=s.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));u[Ft]=s}else hr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;rt(s),u=!1}else u=Bu(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=u),u=!0;if(!u)return s.flags&256?(Di(s),s):(Di(s),null)}return Di(s),(s.flags&128)!==0?(s.lanes=a,s):(a=o!==null,i=i!==null&&i.memoizedState!==null,a&&(o=s.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),f=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),f!==u&&(o.flags|=2048)),a!==i&&a&&(s.child.flags|=8192),kc(s,s.updateQueue),rt(s),null);case 4:return Bs(),i===null&&r0(s.stateNode.containerInfo),s.flags|=67108864,rt(s),null;case 10:return $s(s.type),rt(s),null;case 19:if(Gu(s),o=s.memoizedState,o===null)return rt(s),null;if(u=(s.flags&128)!==0,f=o.rendering,f===null)if(u)Ml(o,!1);else{if(mt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(f=hc(i),f!==null){for(s.flags|=128,Ml(o,!1),i=f.updateQueue,s.updateQueue=i,kc(s,i),s.subtreeFlags=0,i=a,a=s.child;a!==null;)jp(a,i),a=a.sibling;return wl(s,Gt.current&1|2),Oe&&qs(s,o.treeForkCount),s.child}i=i.sibling}o.tail!==null&&Ei()>zc&&(s.flags|=128,u=!0,Ml(o,!1),s.lanes=4194304)}else{if(!u)if(i=hc(f),i!==null){if(s.flags|=128,u=!0,i=i.updateQueue,s.updateQueue=i,kc(s,i),Ml(o,!0),o.tail===null&&o.tailMode!=="collapsed"&&o.tailMode!=="visible"&&!f.alternate&&!Oe)return rt(s),null}else 2*Ei()-o.renderingStartTime>zc&&a!==536870912&&(s.flags|=128,u=!0,Ml(o,!1),s.lanes=4194304);o.isBackwards?(f.sibling=s.child,s.child=f):(i=o.last,i!==null?i.sibling=f:s.child=f,o.last=f)}if(o.tail!==null){i=o.tail;e:{for(a=i;a!==null;){if(a.alternate!==null){a=!1;break e}a=a.sibling}a=!0}return o.rendering=i,o.tail=i.sibling,o.renderingStartTime=Ei(),i.sibling=null,f=Gt.current,f=u?f&1|2:f&1,o.tailMode==="visible"||o.tailMode==="collapsed"||!a||Oe?wl(s,f):(a=f,$e(Yt,s),$e(Gt,a),ii===null&&(ii=s)),Oe&&qs(s,o.treeForkCount),i}return rt(s),null;case 22:case 23:return Di(s),Ku(),o=s.memoizedState!==null,i!==null?i.memoizedState!==null!==o&&(s.flags|=8192):o&&(s.flags|=8192),o?(a&536870912)!==0&&(s.flags&128)===0&&(rt(s),s.subtreeFlags&6&&(s.flags|=8192)):rt(s),a=s.updateQueue,a!==null&&kc(s,a.retryQueue),a=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),o=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),o!==a&&(s.flags|=2048),i!==null&&pt(gr),null;case 24:return a=null,i!==null&&(a=i.memoizedState.cache),s.memoizedState.cache!==a&&(s.flags|=2048),$s(xt),rt(s),null;case 25:return null;case 30:return s.flags|=33554432,rt(s),null}throw Error(r(156,s.tag))}function B4(i,s){switch(Nu(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return $s(xt),Bs(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return rs(s),null;case 31:if(s.memoizedState!==null){if(Di(s),s.alternate===null)throw Error(r(340));hr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(Di(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));hr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return Gu(s),i=s.flags,i&65536?(s.flags=i&-65537|128,i=s.memoizedState,i!==null&&(i.rendering=null,i.tail=null),s.flags|=4,s):null;case 4:return Bs(),null;case 10:return $s(s.type),null;case 22:case 23:return Di(s),Ku(),i!==null&&pt(gr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return $s(xt),null;case 25:return null;default:return null}}function im(i,s){switch(Nu(s),s.tag){case 3:$s(xt),Bs();break;case 26:case 27:case 5:rs(s);break;case 4:Bs();break;case 31:s.memoizedState!==null&&Di(s);break;case 13:Di(s);break;case 19:Gu(s);break;case 10:$s(s.type);break;case 22:case 23:Di(s),Ku(),i!==null&&pt(gr);break;case 24:$s(xt)}}function jl(i,s){try{var a=s.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var u=o.next;a=u;do{if((a.tag&i)===i){o=void 0;var f=a.create,y=a.inst;o=f(),y.destroy=o}a=a.next}while(a!==u)}}catch(C){Qe(s,s.return,C)}}function Mn(i,s,a){try{var o=s.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var f=u.next;o=f;do{if((o.tag&i)===i){var y=o.inst,C=y.destroy;if(C!==void 0){y.destroy=void 0,u=s;var T=a,G=C;try{G()}catch(ee){Qe(u,T,ee)}}}o=o.next}while(o!==f)}}catch(ee){Qe(s,s.return,ee)}}function sm(i){var s=i.updateQueue;if(s!==null){var a=i.stateNode;try{Fp(s,a)}catch(o){Qe(i,i.return,o)}}}function nm(i,s,a){a.props=Sr(i.type,i.memoizedProps),a.state=i.memoizedState;try{a.componentWillUnmount()}catch(o){Qe(i,s,o)}}function _s(i,s){try{var a=i.ref;if(a!==null){switch(i.tag){case 26:case 27:case 5:var o=i.stateNode;break;case 30:var u=i.stateNode,f=Is(i.memoizedProps,u);(u.ref===null||u.ref.name!==f)&&(u.ref=uv(f)),o=u.ref;break;case 7:if(i.stateNode===null){var y=new Oi(i);_(i.child,!1,k5,y,void 0,void 0),i.stateNode=y}o=i.stateNode;break;default:o=i.stateNode}typeof a=="function"?i.refCleanup=a(o):a.current=o}}catch(C){Qe(i,s,C)}}function Zt(i,s){var a=i.ref,o=i.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(u){Qe(i,s,u)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){Qe(i,s,u)}else a.current=null}function Ec(i,s){if((i.tag===5||i.tag===27||i.tag===6)&&i.alternate===null&&s!==null)for(var a=0;a<s.length;a++)vv(i.stateNode,s[a])}function rm(i){for(var s=i.return;s!==null&&(Ed(s)&&vv(i.stateNode,s.stateNode),!kd(s));)s=s.return}function Tl(i){for(var s=i.return;s!==null&&(Ed(s)&&E5(i.stateNode,s.stateNode),!kd(s));)s=s.return}function kd(i){return i.tag===5||i.tag===3||i.tag===27}function Ed(i){return i&&i.tag===7&&i.stateNode!==null}function Md(i){var s=i.type,a=i.memoizedProps,o=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(u){Qe(i,i.return,u)}}function jd(i,s,a){try{var o=i.stateNode;l5(o,i.type,a,s),o[mi]=s}catch(u){Qe(i,i.return,u)}}function am(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Ln(i.type)||i.tag===4}function Td(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||am(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Ln(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Rd(i,s,a,o){var u=i.tag;if(u===5||u===6)u=i.stateNode,s?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(u,s):(s=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,s.appendChild(u),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=gs)),Ec(i,o),We=!0;else if(u!==4&&(u===27&&(Ec(i,o),o=null,Ln(i.type)&&(a=i.stateNode,s=null)),i=i.child,i!==null))for(Rd(i,s,a,o),i=i.sibling;i!==null;)Rd(i,s,a,o),i=i.sibling}function Mc(i,s,a,o){var u=i.tag;if(u===5||u===6)u=i.stateNode,s?a.insertBefore(u,s):a.appendChild(u),Ec(i,o),We=!0;else if(u!==4&&(u===27&&(Ec(i,o),o=null,Ln(i.type)&&(a=i.stateNode)),i=i.child,i!==null))for(Mc(i,s,a,o),i=i.sibling;i!==null;)Mc(i,s,a,o),i=i.sibling}function lm(i){var s=i.stateNode,a=i.memoizedProps;try{for(var o=i.type,u=s.attributes;u.length;)s.removeAttributeNode(u[0]);Xt(s,o,a),s[Ft]=i,s[mi]=a}catch(f){Qe(i,i.return,f)}}var jc=!1,Ai=null;function om(i){(i.tag===30||(i.subtreeFlags&33554432)!==0)&&(jc=!0)}var ys=null;function cm(){var i=ys;return ys=null,i}var _i=0;function ua(i,s,a,o,u){return _i=0,hm(i.child,s,a,o,u)}function hm(i,s,a,o,u){for(var f=!1;i!==null;){if(i.tag===5){var y=i.stateNode;if(o!==null){var C=f0(y);o.push(C),C.view&&(f=!0)}else f||f0(y).view&&(f=!0);jc=!0,cv(y,_i===0?s:s+"_"+_i,a),_i++}else(i.tag!==22||i.memoizedState===null)&&(i.tag===30&&u||hm(i.child,s,a,o,u)&&(f=!0));i=i.sibling}return f}function Ss(i,s){for(;i!==null;)i.tag===5?hv(i.stateNode,i.memoizedProps):(i.tag!==22||i.memoizedState===null)&&(i.tag===30&&s||Ss(i.child,s)),i=i.sibling}function Tc(i){if((i.subtreeFlags&18874368)!==0)for(i=i.child;i!==null;){if((i.tag!==22||i.memoizedState===null)&&(Tc(i),i.tag===30&&(i.flags&18874368)!==0&&i.stateNode.paired)){var s=i.memoizedProps;if(s.name==null||s.name==="auto")throw Error(r(544));var a=s.name;s=Us(s.default,s.share),s!=="none"&&(ua(i,a,s,null,!1)||Ss(i.child,!1))}i=i.sibling}}function Dd(i,s){if(i.tag===30){var a=i.stateNode,o=i.memoizedProps,u=Is(o,a),f=Us(o.default,a.paired?o.share:o.enter);f!=="none"?ua(i,u,f,null,!1)?(Tc(i),a.paired||s||ya(i,o.onEnter)):Ss(i.child,!1):Tc(i)}else if((i.subtreeFlags&33554432)!==0)for(i=i.child;i!==null;)Dd(i,s),i=i.sibling;else Tc(i)}function Ad(i){if(Ai!==null&&Ai.size!==0){var s=Ai;if((i.subtreeFlags&18874368)!==0)for(i=i.child;i!==null;){if(i.tag!==22||i.memoizedState===null){if(i.tag===30&&(i.flags&18874368)!==0){var a=i.memoizedProps,o=a.name;if(o!=null&&o!=="auto"){var u=s.get(o);if(u!==void 0){var f=Us(a.default,a.share);if(f!=="none"&&(ua(i,o,f,null,!1)?(f=i.stateNode,u.paired=f,f.paired=u,ya(i,a.onShare)):Ss(i.child,!1)),s.delete(o),s.size===0)break}}}Ad(i)}i=i.sibling}}}function Nd(i){if(i.tag===30){var s=i.memoizedProps,a=Is(s,i.stateNode),o=Ai!==null?Ai.get(a):void 0,u=Us(s.default,o!==void 0?s.share:s.exit);u!=="none"&&(ua(i,a,u,null,!1)?o!==void 0?(u=i.stateNode,o.paired=u,u.paired=o,Ai.delete(a),ya(i,s.onShare)):ya(i,s.onExit):Ss(i.child,!1)),Ai!==null&&Ad(i)}else if((i.subtreeFlags&33554432)!==0)for(i=i.child;i!==null;)Nd(i),i=i.sibling;else Ai!==null&&Ad(i)}function um(i){for(i=i.child;i!==null;){if(i.tag===30){var s=i.memoizedProps,a=Is(s,i.stateNode);s=Us(s.default,s.update),i.flags&=-5,s!=="none"&&ua(i,a,s,i.memoizedState=[],!1)}else(i.subtreeFlags&33554432)!==0&&um(i);i=i.sibling}}function Ld(i){if((i.subtreeFlags&18874368)!==0)for(i=i.child;i!==null;){if(i.tag!==22||i.memoizedState===null){if(i.tag===30&&(i.flags&18874368)!==0){var s=i.stateNode;s.paired!==null&&(s.paired=null,Ss(i.child,!1))}Ld(i)}i=i.sibling}}function Rc(i){if(i.tag===30)i.stateNode.paired=null,Ss(i.child,!1),Ld(i);else if((i.subtreeFlags&33554432)!==0)for(i=i.child;i!==null;)Rc(i),i=i.sibling;else Ld(i)}function dm(i){for(i=i.child;i!==null;)i.tag===30?Ss(i.child,!1):(i.subtreeFlags&33554432)!==0&&dm(i),i=i.sibling}function Bd(i,s,a,o,u,f,y){for(var C=!1;s!==null;){if(s.tag===5){var T=s.stateNode;if(f!==null&&_i<f.length){var G=f[_i],ee=f0(T);(G.view||ee.view)&&(C=!0);var se;if(se=(i.flags&4)===0)if(ee.clip)se=!0;else{se=G.rect;var W=ee.rect;se=se.y!==W.y||se.x!==W.x||se.height!==W.height||se.width!==W.width}se&&(i.flags|=4),ee.abs?ee=!G.abs:(G=G.rect,ee=ee.rect,ee=G.height!==ee.height||G.width!==ee.width),ee&&(i.flags|=32)}else i.flags|=32;(i.flags&4)!==0&&cv(T,_i===0?a:a+"_"+_i,u),C&&(i.flags&4)!==0||(ys===null&&(ys=[]),ys.push(T,_i===0?o:o+"_"+_i,s.memoizedProps)),_i++}else(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&y?i.flags|=s.flags&32:Bd(i,s.child,a,o,u,f,y)&&(C=!0));s=s.sibling}return C}function fm(i,s){for(i=i.child;i!==null;){if(i.tag===30){var a=i.memoizedProps,o=i.stateNode,u=Is(a,o),f=Us(a.default,a.update),y;y=i.memoizedState,i.memoizedState=null,o=i;var C=i.child;_i=0,u=Bd(o,C,u,u,f,y,!1),(i.flags&4)!==0&&u&&ya(i,a.onUpdate)}else(i.subtreeFlags&33554432)!==0&&fm(i);i=i.sibling}}var Ht=!1,Ge=!1,xs=!1,Od=!1,pm=typeof WeakSet=="function"?WeakSet:Set,It=null,ws=!1,Rl=!1,Dc=!1,zd=!1;function O4(i,s,a){if(i=i.containerInfo,o0=Ta,i=_p(i),bu(i)){if("selectionStart"in i)var o={start:i.selectionStart,end:i.selectionEnd};else e:{o=(o=i.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var f=u.anchorOffset,y=u.focusNode;u=u.focusOffset;try{o.nodeType,y.nodeType}catch{o=null;break e}var C=0,T=-1,G=-1,ee=0,se=0,W=i,X=null;t:for(;;){for(var fe;W!==o||f!==0&&W.nodeType!==3||(T=C+f),W!==y||u!==0&&W.nodeType!==3||(G=C+u),W.nodeType===3&&(C+=W.nodeValue.length),(fe=W.firstChild)!==null;)X=W,W=fe;for(;;){if(W===i)break t;if(X===o&&++ee===f&&(T=C),X===y&&++se===u&&(G=C),(fe=W.nextSibling)!==null)break;W=X,X=W.parentNode}W=fe}o=T===-1||G===-1?null:{start:T,end:G}}else o=null}o=o||{start:0,end:0}}else o=null;for(c0={focusedElem:i,selectionRange:o},Ta=!1,a=(a&335544064)===a,It=s,s=a?9270:1024;It!==null;){if(i=It,a&&(o=i.deletions,o!==null))for(f=0;f<o.length;f++)a&&Nd(o[f]);if(i.alternate===null&&(i.flags&2)!==0)a&&om(i),Ac(a);else{if(i.tag===22){if(o=i.alternate,i.memoizedState!==null){o!==null&&o.memoizedState===null&&a&&Nd(o),Ac(a);continue}else if(o!==null&&o.memoizedState!==null){a&&om(i),Ac(a);continue}}o=i.child,(i.subtreeFlags&s)!==0&&o!==null?(o.return=i,It=o):(a&&um(i),Ac(a))}}Ai=null}function Ac(i){for(;It!==null;){var s=It,a=i,o=s.alternate,u=s.flags;switch(s.tag){case 0:case 11:case 15:break;case 1:if((u&1024)!==0&&o!==null){a=void 0,u=o.memoizedProps,o=o.memoizedState;var f=s.stateNode;try{var y=Sr(s.type,u);a=f.getSnapshotBeforeUpdate(y,o),f.__reactInternalSnapshotBeforeUpdate=a}catch(C){Qe(s,s.return,C)}}break;case 3:if((u&1024)!==0){if(o=s.stateNode.containerInfo,a=o.nodeType,a===9)m0(o);else if(a===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":m0(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:a&&o!==null&&(a=Is(o.memoizedProps,o.stateNode),u=s.memoizedProps,u=Us(u.default,u.update),u!=="none"&&ua(o,a,u,o.memoizedState=[],!0));break;default:if((u&1024)!==0)throw Error(r(163))}if(o=s.sibling,o!==null){o.return=s.return,It=o;break}It=s.return}}function gm(i,s,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:bs(i,a),o&4&&jl(5,a);break;case 1:if(bs(i,a),o&4)if(i=a.stateNode,s===null)try{i.componentDidMount()}catch(y){Qe(a,a.return,y)}else{var u=Sr(a.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(u,s,i.__reactInternalSnapshotBeforeUpdate)}catch(y){Qe(a,a.return,y)}}o&64&&sm(a),o&512&&_s(a,a.return);break;case 3:if(bs(i,a),o&64&&(i=a.updateQueue,i!==null)){if(s=null,a.child!==null)switch(a.child.tag){case 27:case 5:s=a.child.stateNode;break;case 1:s=a.child.stateNode}try{Fp(i,s)}catch(y){Qe(a,a.return,y)}}break;case 27:s===null&&o&4&&lm(a);case 26:case 5:bs(i,a),s===null&&o&4&&Md(a),o&512&&_s(a,a.return);break;case 12:bs(i,a);break;case 31:bs(i,a),o&4&&ym(i,a);break;case 13:bs(i,a),o&4&&Sm(i,a),o&64&&(i=a.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(a=Y4.bind(null,a),T5(i,a))));break;case 22:if(o=a.memoizedState!==null||Ht,!o){var f=s!==null&&s.memoizedState!==null||Ge;s=Ht,u=Ge,Ht=o,(Ge=f)&&!u?(o=2,(a.subtreeFlags&8772)!==0&&(o|=1),us(i,a,o)):bs(i,a),Ht=s,Ge=u}break;case 30:bs(i,a),o&512&&_s(a,a.return);break;case 7:o&512&&_s(a,a.return);default:bs(i,a)}}function Hd(i,s){for(i=i.child;i!==null;)mm(i,s),i=i.sibling}function mm(i,s){switch(i.tag){case 5:case 26:try{var a=i.stateNode;if(s){var o=a.style;typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"}else{var u=i.stateNode,f=i.memoizedProps.style,y=f!=null&&f.hasOwnProperty("display")?f.display:null;u.style.display=y==null||typeof y=="boolean"?"":(""+y).trim()}}catch(T){Qe(i,i.return,T)}Id(i,s);break;case 6:try{i.stateNode.nodeValue=s?"":i.memoizedProps,We=!0}catch(T){Qe(i,i.return,T)}break;case 18:try{var C=i.stateNode;s?ov(C,!0):ov(i.stateNode,!1)}catch(T){Qe(i,i.return,T)}break;case 22:case 23:i.memoizedState===null&&Hd(i,s);break;default:Hd(i,s)}}function Id(i,s){if(i.subtreeFlags&67108864)for(i=i.child;i!==null;){e:{var a=i,o=s;switch(a.tag){case 4:mm(a,o);break e;case 22:a.memoizedState===null&&Id(a,o);break e;default:Id(a,o)}}i=i.sibling}}function vm(i){var s=i.alternate;s!==null&&(i.alternate=null,vm(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&zo(s)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var ct=null,yi=!1;function cs(i,s,a){for(a=a.child;a!==null;)_m(i,s,a),a=a.sibling}function _m(i,s,a){if(Mi&&typeof Mi.onCommitFiberUnmount=="function")try{Mi.onCommitFiberUnmount(Ja,a)}catch{}switch(a.tag){case 26:Ge||Zt(a,s),cs(i,s,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&!Ge&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ge||Zt(a,s),Tl(a);var o=ct,u=yi;Ln(a.type)&&(ct=a.stateNode,yi=!1),cs(i,s,a),wv(a.stateNode,a.type,a.memoizedProps),ct=o,yi=u;break;case 5:Ge||Zt(a,s),Tl(a);case 6:if(a.tag===6&&Tl(a),o=ct,u=yi,ct=null,cs(i,s,a),ct=o,yi=u,ct!==null)if(yi)try{(ct.nodeType===9?ct.body:ct.nodeName==="HTML"?ct.ownerDocument.body:ct).removeChild(a.stateNode),We=!0}catch(f){Qe(a,s,f)}else try{ct.removeChild(a.stateNode),We=!0}catch(f){Qe(a,s,f)}break;case 18:ct!==null&&(yi?(i=ct,lv(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.stateNode),Ra(i)):lv(ct,a.stateNode));break;case 4:o=ct,u=yi,ct=a.stateNode.containerInfo,yi=!0,cs(i,s,a),ct=o,yi=u;break;case 0:case 11:case 14:case 15:Mn(2,a,s),Ge||Mn(4,a,s),cs(i,s,a);break;case 1:Ge||(Zt(a,s),o=a.stateNode,typeof o.componentWillUnmount=="function"&&nm(a,s,o)),cs(i,s,a);break;case 21:cs(i,s,a);break;case 22:Ge=(o=Ge)||a.memoizedState!==null,cs(i,s,a),Ge=o;break;case 30:Zt(a,s),cs(i,s,a);break;case 7:Ge||Zt(a,s),cs(i,s,a);break;default:cs(i,s,a)}}function ym(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Ra(i)}catch(a){Qe(s,s.return,a)}}}function Sm(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Ra(i)}catch(a){Qe(s,s.return,a)}}function z4(i){switch(i.tag){case 31:case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new pm),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new pm),s;default:throw Error(r(435,i.tag))}}function Nc(i,s){var a=z4(i);s.forEach(function(o){if(!a.has(o)){a.add(o);var u=G4.bind(null,i,o);o.then(u,u)}})}function li(i,s,a){var o=s.deletions;if(o!==null)for(var u=0;u<o.length;u++){var f=o[u],y=i,C=s,T=C;e:for(;T!==null;){switch(T.tag){case 27:if(Ln(T.type)){ct=T.stateNode,yi=!1;break e}break;case 5:ct=T.stateNode,yi=!1;break e;case 3:case 4:ct=T.stateNode.containerInfo,yi=!0;break e}T=T.return}if(ct===null)throw Error(r(160));_m(y,C,f),ct=null,yi=!1,y=f.alternate,y!==null&&(y.return=null),f.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)xm(s,i,a),s=s.sibling}var hs=null;function xm(i,s,a){var o=i.alternate,u=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(u&4&&(o=i.updateQueue,o=o!==null?o.events:null,o!==null))for(var f=0;f<o.length;f++){var y=o[f];y.ref.impl=y.nextImpl}li(s,i,a),oi(i),u&4&&(Mn(3,i,i.return),jl(3,i),Mn(5,i,i.return));break;case 1:li(s,i,a),oi(i),u&512&&(Ge||o===null||Zt(o,o.return)),u&64&&Ht&&(i=i.updateQueue,i!==null&&(s=i.callbacks,s!==null&&(a=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=a===null?s:a.concat(s))));break;case 26:if(f=hs,li(s,i,a),oi(i),u&512&&(Ge||o===null||Zt(o,o.return)),u&4)if(u=o!==null?o.memoizedState:null,a=i.memoizedState,o===null)if(a===null)if(i.stateNode===null)if(Ht)i.stateNode=nv(i.type,i.memoizedProps,s.containerInfo,i);else{e:{s=i.type,a=i.memoizedProps,u=f.ownerDocument||f;t:switch(s){case"title":o=u.getElementsByTagName("title")[0],(!o||o[il]||o[Ft]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=u.createElement(s),u.head.insertBefore(o,u.querySelector("head > title"))),Xt(o,s,a),o[Ft]=i,Ot(o),s=o;break e;case"link":if(f=jv("link","href",u).get(s+(a.href||""))){for(y=0;y<f.length;y++)if(o=f[y],o.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&o.getAttribute("rel")===(a.rel==null?null:a.rel)&&o.getAttribute("title")===(a.title==null?null:a.title)&&o.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){f.splice(y,1);break t}}o=u.createElement(s),Xt(o,s,a),u.head.appendChild(o);break;case"meta":if(f=jv("meta","content",u).get(s+(a.content||""))){for(y=0;y<f.length;y++)if(o=f[y],o.getAttribute("content")===(a.content==null?null:""+a.content)&&o.getAttribute("name")===(a.name==null?null:a.name)&&o.getAttribute("property")===(a.property==null?null:a.property)&&o.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&o.getAttribute("charset")===(a.charSet==null?null:a.charSet)){f.splice(y,1);break t}}o=u.createElement(s),Xt(o,s,a),u.head.appendChild(o);break;default:throw Error(r(468,s))}o[Ft]=i,Ot(o),s=o}i.stateNode=s}else Ht||b0(f,i.type,i.stateNode);else i.stateNode=Mv(f,a,i.memoizedProps);else u!==a?(u===null?(s=o.stateNode,s===null||Ge||s.parentNode.removeChild(s)):u.count--,a===null?Ht||b0(f,i.type,i.stateNode):Mv(f,a,i.memoizedProps)):a===null&&i.stateNode!==null&&jd(i,i.memoizedProps,o.memoizedProps);break;case 27:li(s,i,a),oi(i),u&512&&(Ge||o===null||Zt(o,o.return)),o!==null&&u&4&&jd(i,i.memoizedProps,o.memoizedProps);break;case 5:if(f=xs,xs=!1,li(s,i,a),xs=f,oi(i),u&512&&(Ge||o===null||Zt(o,o.return)),i.flags&32){s=i.stateNode;try{Kr(s,""),We=!0}catch(ee){Qe(i,i.return,ee)}}u&4&&i.stateNode!=null&&(s=i.memoizedProps,jd(i,s,o!==null?o.memoizedProps:s)),u&1024&&(Od=!0);break;case 6:if(li(s,i,a),oi(i),u&4){if(i.stateNode===null)throw Error(r(162));s=i.memoizedProps,a=i.stateNode;try{a.nodeValue=s,We=!0}catch(ee){Qe(i,i.return,ee)}}break;case 3:if(We=!1,Yc=null,f=hs,hs=Il(s.containerInfo),li(s,i,a),hs=f,oi(i),u&4&&o!==null&&o.memoizedState.isDehydrated)try{Ra(s.containerInfo)}catch(ee){Qe(i,i.return,ee)}Od&&(Od=!1,wm(i)),We=!1;break;case 4:u=xs,xs=Ht,o=q1(),f=hs,hs=Il(i.stateNode.containerInfo),li(s,i,a),oi(i),hs=f,We&&Rl&&(Dc=!0),We=o,xs=u;break;case 12:li(s,i,a),oi(i);break;case 31:li(s,i,a),oi(i),u&4&&(s=i.updateQueue,s!==null&&(i.updateQueue=null,Nc(i,s)));break;case 13:li(s,i,a),oi(i),i.child.flags&8192&&i.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Oc=Ei()),u&4&&(s=i.updateQueue,s!==null&&(i.updateQueue=null,Nc(i,s)));break;case 22:f=i.memoizedState!==null,y=o!==null&&o.memoizedState!==null;var C=Ht,T=Ge,G=xs;Ht=C||f,xs=G||f,Ge=T||y,li(s,i,a),Ge=T,xs=G,Ht=C,oi(i),u&8192&&(s=i.stateNode,s._visibility=f?s._visibility&-2:s._visibility|1,!f||o===null||y||Ht||Ge||(s=y||Ge,a=Ht,o=Ge,Ht=f||Ht,Ge=s,jn(i,2),Ht=a,Ge=o),!f&&xs||Hd(i,f)),u&4&&(s=i.updateQueue,s!==null&&(a=s.retryQueue,a!==null&&(s.retryQueue=null,Nc(i,a))));break;case 19:li(s,i,a),oi(i),u&4&&(s=i.updateQueue,s!==null&&(i.updateQueue=null,Nc(i,s)));break;case 30:u&512&&(Ge||o===null||Zt(o,o.return)),u=q1(),f=Rl,y=(a&335544064)===a,C=i.memoizedProps,Rl=y&&Us(C.default,C.update)!=="none",li(s,i,a),oi(i),y&&o!==null&&We&&(i.flags|=4),Rl=f,We=u;break;case 21:break;case 7:u&512&&(Ge||o===null||Zt(o,o.return)),o&&o.stateNode!==null&&(o.stateNode._fragmentFiber=i);default:li(s,i,a),oi(i)}}function oi(i){var s=i.flags;if(s&2){try{for(var a,o=i.return;o!==null;){if(am(o)){a=o;break}o=o.return}o=null;for(var u=i.return;u!==null;){if(Ed(u)){var f=u.stateNode;o===null?o=[f]:o.push(f)}if(kd(u))break;u=u.return}var y=o;if(a==null)throw Error(r(160));switch(a.tag){case 27:var C=a.stateNode,T=Td(i);Mc(i,T,C,y);break;case 5:var G=a.stateNode;a.flags&32&&(Kr(G,""),a.flags&=-33);var ee=Td(i);Mc(i,ee,G,y);break;case 3:case 4:var se=a.stateNode.containerInfo,W=Td(i);Rd(i,W,se,y);break;default:throw Error(r(161))}}catch(X){Qe(i,i.return,X)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function wm(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;wm(s),s.tag===5&&s.flags&1024&&(s=s.stateNode,Ta=!0,s.reset(),Ta=!1),i=i.sibling}}function da(i,s){if(s.subtreeFlags&9270)for(s=s.child;s!==null;)bm(s,i),s=s.sibling;else fm(s)}function bm(i,s){var a=i.alternate;if(a===null)Dd(i,!1);else switch(i.tag){case 3:if(zd=ws=!1,cm(),da(s,i),!ws&&!Dc){if(i=ys,i!==null)for(var o=0;o<i.length;o+=3){a=i[o];var u=i[o+1];hv(a,i[o+2]),a=a.ownerDocument.documentElement,a!==null&&a.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+u+")"})}i=s.containerInfo,i=i.nodeType===9?i.documentElement:i.ownerDocument.documentElement,i!==null&&i.style.viewTransitionName===""&&(i.style.viewTransitionName="none",i.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),i.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),zd=!0}ys=null;break;case 5:da(s,i);break;case 4:o=ws,ws=!1,da(s,i),ws&&(Dc=!0),ws=o;break;case 22:i.memoizedState===null&&(a.memoizedState!==null?Dd(i,!1):da(s,i));break;case 30:o=ws,u=cm(),ws=!1,da(s,i),ws&&(i.flags|=4);var f=i.memoizedProps,y=i.stateNode;s=Is(f,y),y=Is(a.memoizedProps,y);var C=Us(f.default,f.update);C==="none"?s=!1:(f=a.memoizedState,a.memoizedState=null,a=i.child,_i=0,s=Bd(i,a,s,y,C,f,!0),_i!==(f===null?0:f.length)&&(i.flags|=32)),(i.flags&4)!==0&&s?(ya(i,i.memoizedProps.onUpdate),ys=u):u!==null&&(u.push.apply(u,ys),ys=u),ws=(i.flags&32)!==0?!0:o;break;default:da(s,i)}}function bs(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)gm(i,s.alternate,s),s=s.sibling}function jn(i,s){for(i=i.child;i!==null;){var a=i,o=s;switch(a.tag){case 0:case 11:case 14:case 15:Mn(4,a,a.return),jn(a,o);break;case 1:Zt(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&nm(a,a.return,u),jn(a,o);break;case 27:(o&2)!==0&&wv(a.stateNode,a.type,a.memoizedProps);case 5:Zt(a,a.return),a.tag!==5&&a.tag!==27||Tl(a),jn(a,o);break;case 6:Tl(a);break;case 26:Zt(a,a.return),u=a.stateNode,a.memoizedState!==null||u===null||Ge||u.parentNode.removeChild(u),jn(a,o);break;case 22:a.memoizedState===null&&jn(a,o);break;case 30:Zt(a,a.return),jn(a,o);break;case 7:Zt(a,a.return);default:jn(a,o)}i=i.sibling}}function us(i,s,a){for(a=(s.subtreeFlags&8772)!==0?a:a&-2,s=s.child;s!==null;){var o=s.alternate,u=i,f=s,y=f.flags,C=(a&1)!==0;switch(f.tag){case 0:case 11:case 15:us(u,f,a),jl(4,f);break;case 1:if(us(u,f,a),o=f,u=o.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(ee){Qe(o,o.return,ee)}if(o=f,u=o.updateQueue,u!==null){var T=o.stateNode;try{var G=u.shared.hiddenCallbacks;if(G!==null)for(u.shared.hiddenCallbacks=null,u=0;u<G.length;u++)Wp(G[u],T)}catch(ee){Qe(o,o.return,ee)}}C&&y&64&&sm(f),_s(f,f.return);break;case 27:(a&2)!==0&&lm(f);case 5:f.tag!==5&&f.tag!==27||rm(f),us(u,f,a),C&&o===null&&y&4&&Md(f),_s(f,f.return);break;case 6:rm(f);break;case 26:T=f.stateNode,f.memoizedState!==null||T===null||Ht||b0(Il(T.ownerDocument),f.type,T),us(u,f,a),C&&o===null&&y&4&&Md(f),_s(f,f.return);break;case 12:us(u,f,a);break;case 31:us(u,f,a),C&&y&4&&ym(u,f);break;case 13:us(u,f,a),C&&y&4&&Sm(u,f);break;case 22:f.memoizedState===null&&us(u,f,a),_s(f,f.return);break;case 30:us(u,f,a),_s(f,f.return);break;case 7:_s(f,f.return);default:us(u,f,a)}s=s.sibling}}function Ud(i,s){var a=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==a&&(i!=null&&i.refCount++,a!=null&&gl(a))}function Pd(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&gl(i))}function Ki(i,s,a,o){var u=(a&335544064)===a;if(s.subtreeFlags&(u?10262:10256))for(s=s.child;s!==null;)Cm(i,s,a,o),s=s.sibling;else u&&dm(s)}function Cm(i,s,a,o){var u=(a&335544064)===a;u&&s.alternate===null&&s.return!==null&&s.return.alternate!==null&&Rc(s);var f=s.flags;switch(s.tag){case 0:case 11:case 15:Ki(i,s,a,o),f&2048&&jl(9,s);break;case 1:Ki(i,s,a,o);break;case 3:Ki(i,s,a,o),u&&zd&&(i=i.containerInfo,i=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,i.style.viewTransitionName==="root"&&(i.style.viewTransitionName=""),i=i.ownerDocument.documentElement,i!==null&&i.style.viewTransitionName==="none"&&(i.style.viewTransitionName="")),f&2048&&(f=null,s.alternate!==null&&(f=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==f&&(s.refCount++,f!=null&&gl(f)));break;case 12:if(f&2048){Ki(i,s,a,o),f=s.stateNode;try{var y=s.memoizedProps,C=y.id,T=y.onPostCommit;typeof T=="function"&&T(C,s.alternate===null?"mount":"update",f.passiveEffectDuration,-0)}catch(G){Qe(s,s.return,G)}}else Ki(i,s,a,o);break;case 31:Ki(i,s,a,o);break;case 13:Ki(i,s,a,o);break;case 23:break;case 22:y=s.stateNode,C=s.alternate,s.memoizedState!==null?(u&&C!==null&&C.memoizedState===null&&Rc(C),y._visibility&2?Ki(i,s,a,o):Dl(i,s)):(u&&C!==null&&C.memoizedState!==null&&Rc(s),y._visibility&2?Ki(i,s,a,o):(y._visibility|=2,fa(i,s,a,o,(s.subtreeFlags&10256)!==0||!1))),f&2048&&Ud(C,s);break;case 24:Ki(i,s,a,o),f&2048&&Pd(s.alternate,s);break;case 30:u&&(f=s.alternate,f!==null&&(Ss(f.child,!0),Ss(s.child,!0))),Ki(i,s,a,o);break;default:Ki(i,s,a,o)}}function fa(i,s,a,o,u){for(u=u&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var f=i,y=s,C=a,T=o,G=y.flags;switch(y.tag){case 0:case 11:case 15:fa(f,y,C,T,u),jl(8,y);break;case 23:break;case 22:var ee=y.stateNode;y.memoizedState!==null?ee._visibility&2?fa(f,y,C,T,u):Dl(f,y):(ee._visibility|=2,fa(f,y,C,T,u)),u&&G&2048&&Ud(y.alternate,y);break;case 24:fa(f,y,C,T,u),u&&G&2048&&Pd(y.alternate,y);break;default:fa(f,y,C,T,u)}s=s.sibling}}function Dl(i,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var a=i,o=s,u=o.flags;switch(o.tag){case 22:Dl(a,o),u&2048&&Ud(o.alternate,o);break;case 24:Dl(a,o),u&2048&&Pd(o.alternate,o);break;default:Dl(a,o)}s=s.sibling}}var xr=8192;function wr(i,s,a){if(i.subtreeFlags&xr)for(i=i.child;i!==null;)km(i,s,a),i=i.sibling}function km(i,s,a){switch(i.tag){case 26:wr(i,s,a),i.flags&xr&&(i.memoizedState!==null?V5(a,hs,i.memoizedState,i.memoizedProps):(i=i.stateNode,(s&335544128)===s&&Av(a,i)));break;case 5:wr(i,s,a),i.flags&xr&&(i=i.stateNode,(s&335544128)===s&&Av(a,i));break;case 3:case 4:var o=hs;hs=Il(i.stateNode.containerInfo),wr(i,s,a),hs=o;break;case 22:i.memoizedState===null&&(o=i.alternate,o!==null&&o.memoizedState!==null?(o=xr,xr=16777216,wr(i,s,a),xr=o):wr(i,s,a));break;case 30:if((i.flags&xr)!==0&&(o=i.memoizedProps.name,o!=null&&o!=="auto")){var u=i.stateNode;u.paired=null,Ai===null&&(Ai=new Map),Ai.set(o,u)}wr(i,s,a);break;default:wr(i,s,a)}}function Em(i){var s=i.alternate;if(s!==null&&(i=s.child,i!==null)){s.child=null;do s=i.sibling,i.sibling=null,i=s;while(i!==null)}}function Al(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var o=s[a];It=o,jm(o,i)}Em(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Mm(i),i=i.sibling}function Mm(i){switch(i.tag){case 0:case 11:case 15:Al(i),i.flags&2048&&Mn(9,i,i.return);break;case 3:Al(i);break;case 12:Al(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,Lc(i)):Al(i);break;default:Al(i)}}function Lc(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var o=s[a];It=o,jm(o,i)}Em(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:Mn(8,s,s.return),Lc(s);break;case 22:a=s.stateNode,a._visibility&2&&(a._visibility&=-3,Lc(s));break;default:Lc(s)}i=i.sibling}}function jm(i,s){for(;It!==null;){var a=It;switch(a.tag){case 0:case 11:case 15:Mn(8,a,s);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:gl(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,It=o;else e:for(a=i;It!==null;){o=It;var u=o.sibling,f=o.return;if(vm(o),o===a){It=null;break e}if(u!==null){u.return=f,It=u;break e}It=f}}}var H4={getCacheForType:function(i){var s=Kt(xt),a=s.data.get(i);return a===void 0&&(a=i(),s.data.set(i,a)),a},cacheSignal:function(){return Kt(xt).controller.signal}},I4=typeof WeakMap=="function"?WeakMap:Map,Ye=0,st=null,Ie=null,Pe=0,Xe=0,Ni=null,Tn=!1,pa=!1,qd=!1,Gs=0,mt=0,Rn=0,br=0,Bc=0,Li=0,ga=0,Nl=null,Si=null,Vd=!1,Oc=0,Tm=0,zc=1/0,Hc=null,Dn=null,ut=0,ds=null,Cr=null,Cs=0,$d=0,Wd=null,Rm=null,ma=null,va=null,_a=null,Ll=0,Ic=null;function Bi(){return(Ye&2)!==0&&Pe!==0?Pe&-Pe:pe.T!==null?t0():N1()}function Dm(){if(Li===0)if((Pe&536870912)===0||Oe){var i=No;No<<=1,(No&3932160)===0&&(No=262144),Li=i}else Li=536870912;return i=Yt.current,i!==null&&(i.flags|=32),Li}function ya(i,s){if(s!=null){var a=i.stateNode,o=a.ref;o===null&&(o=a.ref=uv(Is(i.memoizedProps,a))),va===null&&(va=[]),va.push(s.bind(null,o))}}function xi(i,s,a){(i===st&&(Xe===2||Xe===9)||i.cancelPendingCommit!==null)&&(Sa(i,0),An(i,Pe,Li,!1)),tl(i,a),((Ye&2)===0||i!==st)&&(i===st&&((Ye&2)===0&&(br|=a),mt===4&&An(i,Pe,Li,!1)),ks(i))}function Am(i,s,a){if((Ye&6)!==0)throw Error(r(327));var o=!a&&(s&127)===0&&(s&i.expiredLanes)===0||el(i,s),u=o?q4(i,s):Kd(i,s,!0),f=o;do{if(u===0){pa&&!o&&An(i,s,0,!1);break}else{if(a=i.current.alternate,f&&!U4(a)){u=Kd(i,s,!1),f=!1;continue}if(u===2){if(f=s,i.errorRecoveryDisabledLanes&f)var y=0;else y=i.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){s=y;e:{var C=i;u=Nl;var T=C.current.memoizedState.isDehydrated;if(T&&(Sa(C,y).flags|=256),y=Kd(C,y,!1),y!==2&&y!==6){if(qd&&!T){C.errorRecoveryDisabledLanes|=f,br|=f,u=4;break e}f=Si,Si=u,f!==null&&(Si===null?Si=f:Si.push.apply(Si,f))}u=y}if(f=!1,u!==2)continue}}if(u===1){Sa(i,0),An(i,s,0,!0);break}e:{switch(o=i,f=u,f){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s&&(s&62914560)!==s)break;case 6:An(o,s,Li,!Tn);break e;case 2:Si=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(u=Oc+300-Ei(),10<u)){if(An(o,s,Li,!Tn),Bo(o,0,!0)!==0)break e;Cs=s,o.timeoutHandle=d0(Nm.bind(null,o,a,Si,Hc,Vd,s,Li,br,ga,Tn,f,"Throttled",-0,0),u);break e}Nm(o,a,Si,Hc,Vd,s,Li,br,ga,Tn,f,null,-0,0)}}break}while(!0);ks(i)}function Nm(i,s,a,o,u,f,y,C,T,G,ee,se,W,X){i.timeoutHandle=-1;var fe=s.subtreeFlags,ye=(f&335544064)===f;if(se=null,(ye||fe&8192||(fe&16785408)===16785408)&&(se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:gs},Ai=null,km(s,f,se),ye&&(fe=se,ye=i.containerInfo,ye=(ye.nodeType===9?ye:ye.ownerDocument).__reactViewTransition,ye!=null&&(fe.count++,fe.waitingForViewTransition=!0,fe=ql.bind(fe),ye.finished.then(fe,fe))),fe=(f&62914560)===f?Oc-Ei():(f&4194048)===f?Tm-Ei():0,fe=$5(se,fe),fe!==null)){Cs=f,i.cancelPendingCommit=fe(Pm.bind(null,i,s,f,a,o,u,y,C,T,G,ee,se,null,W,X)),An(i,f,y,!G);return}Pm(i,s,f,a,o,u,y,C,T,G,ee,se)}function U4(i){for(var s=i;;){var a=s.tag;if((a===0||a===11||a===15)&&s.flags&16384&&(a=s.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var o=0;o<a.length;o++){var u=a[o],f=u.getSnapshot;u=u.value;try{if(!Ri(f(),u))return!1}catch{return!1}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function An(i,s,a,o){s=j1(i,s),s&=~Bc,s&=~br,i.suspendedLanes|=s,i.pingedLanes&=~s,o&&(i.warmLanes|=s),o=i.expirationTimes;for(var u=s;0<u;){var f=31-ji(u),y=1<<f;o[f]=-1,u&=~y}a!==0&&R1(i,a,s)}function Uc(){return(Ye&6)===0?(Bl(0),!1):!0}function Fd(){if(Ie!==null){if(Xe===0)var i=Ie.return;else i=Ie,Vs=ur=null,ed(i),aa=null,_l=0,i=Ie;for(;i!==null;)im(i.alternate,i),i=i.return;Ie=null}}function Sa(i,s){var a=i.timeoutHandle;return a!==-1&&(i.timeoutHandle=-1,h5(a)),a=i.cancelPendingCommit,a!==null&&(i.cancelPendingCommit=null,a()),Cs=0,Fd(),st=i,Ie=a=Ps(i.current,null),Pe=s,Xe=0,Ni=null,Tn=!1,pa=el(i,s),qd=!1,ga=Li=Bc=br=Rn=mt=0,Si=Nl=null,Vd=!1,Gs=j1(i,s),Yo(),a}function Lm(i,s){Le=null,pe.H=yc,s===ra||s===rc?(s=Pp(),Xe=3):s===Pu?(s=Pp(),Xe=4):Xe=s===gd?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Ni=s,Ie===null&&(mt=1,Sc(i,Vi(s,i.current)))}function Bm(){var i=Yt.current;return i===null?!0:(Pe&4194048)===Pe?ii===null:(Pe&62914560)===Pe||(Pe&536870912)!==0?i===ii:!1}function Om(){var i=pe.H;return pe.H=yc,i===null?yc:i}function zm(){var i=pe.A;return pe.A=H4,i}function Pc(){mt=4,Tn||(Pe&4194048)!==Pe&&Yt.current!==null||(pa=!0),(Rn&134217727)===0&&(br&134217727)===0||st===null||An(st,Pe,Li,!1)}function Kd(i,s,a){var o=Ye;Ye|=2;var u=Om(),f=zm();(st!==i||Pe!==s)&&(Hc=null,Sa(i,s)),s=!1;var y=mt;e:do try{if(Xe!==0&&Ie!==null){var C=Ie,T=Ni;switch(Xe){case 8:Fd(),y=6;break e;case 3:case 2:case 9:case 6:Yt.current===null&&(s=!0);var G=Xe;if(Xe=0,Ni=null,xa(i,C,T,G),a&&pa){y=0;break e}break;default:G=Xe,Xe=0,Ni=null,xa(i,C,T,G)}}P4(),y=mt;break}catch(ee){Lm(i,ee)}while(!0);return s&&i.shellSuspendCounter++,Vs=ur=null,Ye=o,pe.H=u,pe.A=f,Ie===null&&(st=null,Pe=0,Yo()),y}function P4(){for(;Ie!==null;)Hm(Ie)}function q4(i,s){var a=Ye;Ye|=2;var o=Om(),u=zm();st!==i||Pe!==s?(Hc=null,zc=Ei()+500,Sa(i,s)):pa=el(i,s);e:do try{if(Xe!==0&&Ie!==null){s=Ie;var f=Ni;t:switch(Xe){case 1:Xe=0,Ni=null,xa(i,s,f,1);break;case 2:case 9:if(Ip(f)){Xe=0,Ni=null,Im(s);break}s=function(){Xe!==2&&Xe!==9||st!==i||(Xe=7),ks(i)},f.then(s,s);break e;case 3:Xe=7;break e;case 4:Xe=5;break e;case 7:Ip(f)?(Xe=0,Ni=null,Im(s)):(Xe=0,Ni=null,xa(i,s,f,7));break;case 5:var y=null;switch(Ie.tag){case 26:y=Ie.memoizedState;case 5:case 27:var C=Ie;if(y?Rv(y):C.stateNode.complete){Xe=0,Ni=null;var T=C.sibling;if(T!==null)Ie=T;else{var G=C.return;G!==null?(Ie=G,qc(G)):Ie=null}break t}}Xe=0,Ni=null,xa(i,s,f,5);break;case 6:Xe=0,Ni=null,xa(i,s,f,6);break;case 8:Fd(),mt=6;break e;default:throw Error(r(462))}}V4();break}catch(ee){Lm(i,ee)}while(!0);return Vs=ur=null,pe.H=o,pe.A=u,Ye=a,Ie!==null?0:(st=null,Pe=0,Yo(),mt)}function V4(){for(;Ie!==null&&!aw();)Hm(Ie)}function Hm(i){var s=em(i.alternate,i,Gs);i.memoizedProps=i.pendingProps,s===null?qc(i):Ie=s}function Im(i){var s=i,a=s.alternate;switch(s.tag){case 15:case 0:s=Kg(a,s,s.pendingProps,s.type,void 0,Pe);break;case 11:s=Kg(a,s,s.pendingProps,s.type.render,s.ref,Pe);break;case 5:ed(s);var o=s;o===zt&&(Oe?(ec(o),o.tag===5&&o.stateNode!=null&&(nt=o.stateNode)):(ec(o),Oe=!0));default:im(a,s),s=Ie=jp(s,Gs),s=em(a,s,Gs)}i.memoizedProps=i.pendingProps,s===null?qc(i):Ie=s}function xa(i,s,a,o){Vs=ur=null,ed(s),aa=null,_l=0;var u=s.return;try{if(R4(i,u,s,a,Pe)){mt=1,Sc(i,Vi(a,i.current)),Ie=null;return}}catch(f){if(u!==null)throw Ie=u,f;mt=1,Sc(i,Vi(a,i.current)),Ie=null;return}s.flags&32768?(Oe||o===1?i=!0:pa||(Pe&536870912)!==0?i=!1:(Tn=i=!0,(o===2||o===9||o===3||o===6)&&(o=Yt.current,o!==null&&o.tag===13&&(o.flags|=16384))),Um(s,i)):qc(s)}function qc(i){var s=i;do{if((s.flags&32768)!==0){Um(s,Tn);return}i=s.return;var a=L4(s.alternate,s,Gs);if(a!==null){Ie=a;return}if(s=s.sibling,s!==null){Ie=s;return}Ie=s=i}while(s!==null);mt===0&&(mt=5)}function Um(i,s){do{var a=B4(i.alternate,i);if(a!==null){a.flags&=32767,Ie=a;return}if(a=i.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!s&&(i=i.sibling,i!==null)){Ie=i;return}Ie=i=a}while(i!==null);mt=6,Ie=null}function Pm(i,s,a,o,u,f,y,C,T,G,ee,se){i.cancelPendingCommit=null;do Vc();while(ut!==0);if((Ye&6)!==0)throw Error(r(327));if(s!==null){if(s===i.current)throw Error(r(177));i===st&&(Ie=st=null,Pe=0),Cr=s,ds=i,Cs=a,Wd=u,Rm=o,$4(i,s,a,y,C,T,se)}}function $4(i,s,a,o,u,f,y){var C=s.lanes|s.childLanes;if($d=C,C|=ju,mw(i,a,C,o,u,f),va=null,(a&335544064)===a?(_a=_4(i),o=10262):(_a=null,o=10256),(s.subtreeFlags&o)!==0||(s.flags&o)!==0?(i.callbackNode=null,i.callbackPriority=0,Z4(Do,function(){return Xd(),null})):(i.callbackNode=null,i.callbackPriority=0),jc=!1,o=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||o){o=pe.T,pe.T=null,u=_e.p,_e.p=2,f=Ye,Ye|=4;try{O4(i,s,a)}finally{Ye=f,_e.p=u,pe.T=o}}ut=1,jc?ma=m5(y,i.containerInfo,_a,Yd,Gd,F4,Zd,Xd,W4):(Yd(),Gd(),Zd())}function W4(i){if(ut!==0){var s=ds.onRecoverableError;s(i,{componentStack:null})}}function F4(){ut===3&&(ut=0,bm(Cr,ds),ut=4)}function Yd(){if(ut===1){ut=0;var i=ds,s=Cr,a=Cs,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=pe.T,pe.T=null;var u=_e.p;_e.p=2;var f=Ye;Ye|=4;try{Rl=Dc=!1,xm(s,i,a),a=c0;var y=_p(i.containerInfo),C=a.focusedElem,T=a.selectionRange;if(y!==C&&C&&C.ownerDocument&&vp(C.ownerDocument.documentElement,C)){if(T!==null&&bu(C)){var G=T.start,ee=T.end;if(ee===void 0&&(ee=G),"selectionStart"in C)C.selectionStart=G,C.selectionEnd=Math.min(ee,C.value.length);else{var se=C.ownerDocument||document,W=se&&se.defaultView||window;if(W.getSelection){var X=W.getSelection(),fe=C.textContent.length,ye=Math.min(T.start,fe),Be=T.end===void 0?ye:Math.min(T.end,fe);!X.extend&&ye>Be&&(y=Be,Be=ye,ye=y);var K=mp(C,ye),H=mp(C,Be);if(K&&H&&(X.rangeCount!==1||X.anchorNode!==K.node||X.anchorOffset!==K.offset||X.focusNode!==H.node||X.focusOffset!==H.offset)){var Z=se.createRange();Z.setStart(K.node,K.offset),X.removeAllRanges(),ye>Be?(X.addRange(Z),X.extend(H.node,H.offset)):(Z.setEnd(H.node,H.offset),X.addRange(Z))}}}}for(se=[],X=C;X=X.parentNode;)X.nodeType===1&&se.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<se.length;C++){var ie=se[C];ie.element.scrollLeft=ie.left,ie.element.scrollTop=ie.top}}Ta=!!o0,c0=o0=null}finally{Ye=f,_e.p=u,pe.T=o}}i.current=s,ut=2}}function Gd(){if(ut===2){ut=0;var i=ds,s=Cr,a=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||a){a=pe.T,pe.T=null;var o=_e.p;_e.p=2;var u=Ye;Ye|=4;try{gm(i,s.alternate,s)}finally{Ye=u,_e.p=o,pe.T=a}}ut=3}}function Zd(){if(ut===4||ut===3){ut=0;var i=ma;ma=null,lw();var s=ds,a=Cr,o=Cs,u=Rm,f=(o&335544064)===o?10262:10256;if((a.subtreeFlags&f)!==0||(a.flags&f)!==0?ut=5:(ut=0,Cr=ds=null,qm(s,s.pendingLanes)),f=s.pendingLanes,f===0&&(Dn=null),ru(o),a=a.stateNode,Mi&&typeof Mi.onCommitFiberRoot=="function")try{Mi.onCommitFiberRoot(Ja,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=pe.T,f=_e.p,_e.p=2,pe.T=null;try{for(var y=s.onRecoverableError,C=0;C<u.length;C++){var T=u[C];y(T.value,{componentStack:T.stack})}}finally{pe.T=a,_e.p=f}}if(u=va,y=_a,_a=null,u!==null&&(va=null,y===null&&(y=[]),i!==null))for(T=0;T<u.length;T++)a=(0,u[T])(y),a!==void 0&&i.finished.finally(a);(Cs&3)!==0&&Vc(),ks(s),f=s.pendingLanes,(o&261930)!==0&&(f&42)!==0?s===Ic?Ll++:(Ll=0,Ic=s):(Ll=0,Ic=null),Bl(0)}}function qm(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,gl(s)))}function Vc(){return ma!==null&&(ma.skipTransition(),ma=null),Yd(),Gd(),Zd(),Xd()}function Xd(){if(ut!==5)return!1;var i=ds,s=$d;$d=0;var a=ru(Cs),o=pe.T,u=_e.p;try{_e.p=32>a?32:a,pe.T=null,a=Wd,Wd=null;var f=ds,y=Cs;if(ut=0,Cr=ds=null,Cs=0,(Ye&6)!==0)throw Error(r(331));var C=Ye;if(Ye|=4,Mm(f.current),Cm(f,f.current,y,a),Ye=C,Bl(0,!1),Mi&&typeof Mi.onPostCommitFiberRoot=="function")try{Mi.onPostCommitFiberRoot(Ja,f)}catch{}return!0}finally{_e.p=u,pe.T=o,qm(i,s)}}function Vm(i,s,a){s=Vi(a,s),s=pd(i.stateNode,s,2),i=bn(i,s,2),i!==null&&(tl(i,2),ks(i))}function Qe(i,s,a){if(i.tag===3)Vm(i,i,a);else for(;s!==null;){if(s.tag===3){Vm(s,i,a);break}else if(s.tag===1){var o=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Dn===null||!Dn.has(o))){i=Vi(a,i),a=Ig(2),o=bn(s,a,2),o!==null&&(Ug(a,o,s,i),tl(o,2),ks(o));break}}s=s.return}}function Qd(i,s,a){var o=i.pingCache;if(o===null){o=i.pingCache=new I4;var u=new Set;o.set(s,u)}else u=o.get(s),u===void 0&&(u=new Set,o.set(s,u));u.has(a)||(qd=!0,u.add(a),i=K4.bind(null,i,s,a),s.then(i,i))}function K4(i,s,a){var o=i.pingCache;o!==null&&o.delete(s),i.pingedLanes|=i.suspendedLanes&a,i.warmLanes&=~a,st===i&&(Pe&a)===a&&((mt===4||mt===3&&(Pe&62914560)===Pe&&300>Ei()-Oc)&&(Ye&2)===0?Sa(i,0):Bc|=a,ga===Pe&&(ga=0)),ks(i)}function $m(i,s){s===0&&(s=T1()),i=or(i,s),i!==null&&(tl(i,s),ks(i))}function Y4(i){var s=i.memoizedState,a=0;s!==null&&(a=s.retryLane),$m(i,a)}function G4(i,s){var a=0;switch(i.tag){case 31:case 13:var o=i.stateNode,u=i.memoizedState;u!==null&&(a=u.retryLane);break;case 19:o=i.stateNode;break;case 22:o=i.stateNode._retryCache;break;default:throw Error(r(314))}o!==null&&o.delete(s),$m(i,a)}function Z4(i,s){return tu(i,s)}var wa=null,ba=null,Jd=!1,$c=!1,e0=!1,Nn=0;function ks(i){i!==ba&&i.next===null&&(ba===null?wa=ba=i:ba=ba.next=i),$c=!0,Jd||(Jd=!0,Q4())}function Bl(i,s){if(!e0&&$c){e0=!0;do for(var a=!1,o=wa;o!==null;){if(i!==0){var u=o.pendingLanes;if(u===0)var f=0;else{var y=o.suspendedLanes,C=o.pingedLanes;f=(1<<31-ji(42|i)+1)-1,f&=u&~(y&~C),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(a=!0,Ym(o,f))}else f=Pe,f=Bo(o,o===st?f:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(f&3)===0||el(o,f)||(a=!0,Ym(o,f));o=o.next}while(a);e0=!1}}function X4(){Wm()}function Wm(){$c=Jd=!1;var i=0;Nn!==0&&c5()&&(i=Nn);for(var s=Ei(),a=null,o=wa;o!==null;){var u=o.next,f=Fm(o,s);f===0?(o.next=null,a===null?wa=u:a.next=u,u===null&&(ba=a)):(a=o,(i!==0||(f&3)!==0)&&($c=!0)),o=u}ut!==0&&ut!==5||Bl(i),Nn!==0&&(Nn=0)}function Fm(i,s){for(var a=i.suspendedLanes,o=i.pingedLanes,u=i.expirationTimes,f=i.pendingLanes&-62914561;0<f;){var y=31-ji(f),C=1<<y,T=u[y];T===-1?((C&a)===0||(C&o)!==0)&&(u[y]=gw(C,s)):T<=s&&(i.expiredLanes|=C),f&=~C}if(s=st,a=Pe,a=Bo(i,i===s?a:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),o=i.callbackNode,a===0||i===s&&(Xe===2||Xe===9)||i.cancelPendingCommit!==null)return o!==null&&o!==null&&iu(o),i.callbackNode=null,i.callbackPriority=0;if((a&3)===0||el(i,a)){if(s=a&-a,s===i.callbackPriority)return s;switch(o!==null&&iu(o),ru(a)){case 2:case 8:a=E1;break;case 32:a=Do;break;case 268435456:a=M1;break;default:a=Do}return o=Km.bind(null,i),a=tu(a,o),i.callbackPriority=s,i.callbackNode=a,s}return o!==null&&o!==null&&iu(o),i.callbackPriority=2,i.callbackNode=null,2}function Km(i,s){if(ut!==0&&ut!==5)return i.callbackNode=null,i.callbackPriority=0,null;var a=i.callbackNode;if(Vc()&&i.callbackNode!==a)return null;var o=Pe;return o=Bo(i,i===st?o:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),o===0?null:(Am(i,o,s),Fm(i,Ei()),i.callbackNode!=null&&i.callbackNode===a?Km.bind(null,i):null)}function Ym(i,s){if(Vc())return null;Am(i,s,!0)}function Q4(){u5(function(){(Ye&6)!==0?tu(k1,X4):Wm()})}function t0(){if(Nn===0){var i=pr;i===0&&(i=Ao,Ao<<=1,(Ao&261888)===0&&(Ao=256)),Nn=i}return Nn}function Gm(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Uo(i)}function J4(i,s,a,o,u){if(s==="submit"&&a&&a.stateNode===u){var f=Gm((u[mi]||null).action),y=o.submitter;y&&(s=(s=y[mi]||null)?Gm(s.formAction):y.getAttribute("formAction"),s!==null&&(f=s,y=null));var C=new $o("action","action",null,o,u);i.push({event:C,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Nn!==0){var T=new FormData(u,y);cd(a,{pending:!0,data:T,method:u.method,action:f},null,T)}}else typeof f=="function"&&(C.preventDefault(),T=new FormData(u,y),cd(a,{pending:!0,data:T,method:u.method,action:f},f,T))},currentTarget:u}]})}}for(var i0=0;i0<Mu.length;i0++){var s0=Mu[i0],e5=s0.toLowerCase(),t5=s0[0].toUpperCase()+s0.slice(1);os(e5,"on"+t5)}os(xp,"onAnimationEnd"),os(wp,"onAnimationIteration"),os(bp,"onAnimationStart"),os("dblclick","onDoubleClick"),os("focusin","onFocus"),os("focusout","onBlur"),os(h4,"onTransitionRun"),os(u4,"onTransitionStart"),os(d4,"onTransitionCancel"),os(Cp,"onTransitionEnd"),Wr("onMouseEnter",["mouseout","mouseover"]),Wr("onMouseLeave",["mouseout","mouseover"]),Wr("onPointerEnter",["pointerout","pointerover"]),Wr("onPointerLeave",["pointerout","pointerover"]),rr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),rr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),rr("onBeforeInput",["compositionend","keypress","textInput","paste"]),rr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),rr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),rr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ol="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(" "),i5=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ol));function Zm(i,s){s=(s&4)!==0;for(var a=0;a<i.length;a++){var o=i[a],u=o.event;o=o.listeners;e:{var f=void 0;if(s)for(var y=o.length-1;0<=y;y--){var C=o[y],T=C.instance,G=C.currentTarget;if(C=C.listener,T!==f&&u.isPropagationStopped())break e;f=C,u.currentTarget=G;try{f(u)}catch(ee){Ko(ee)}u.currentTarget=null,f=T}else for(y=0;y<o.length;y++){if(C=o[y],T=C.instance,G=C.currentTarget,C=C.listener,T!==f&&u.isPropagationStopped())break e;f=C,u.currentTarget=G;try{f(u)}catch(ee){Ko(ee)}u.currentTarget=null,f=T}}}}function Ue(i,s){var a=s[B1];a===void 0&&(a=s[B1]=new Set);var o=i+"__bubble";a.has(o)||(Xm(s,i,2,!1),a.add(o))}function n0(i,s,a){var o=0;s&&(o|=4),Xm(a,i,o,s)}var Wc="_reactListening"+Math.random().toString(36).slice(2);function r0(i){if(!i[Wc]){i[Wc]=!0,H1.forEach(function(a){a!=="selectionchange"&&(i5.has(a)||n0(a,!1,i),n0(a,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[Wc]||(s[Wc]=!0,n0("selectionchange",!1,s))}}function Xm(i,s,a,o){switch(Uv(s)){case 2:var u=Y5;break;case 8:u=G5;break;default:u=k0}a=u.bind(null,s,a,i),u=void 0,!fu||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(u=!0),o?u!==void 0?i.addEventListener(s,a,{capture:!0,passive:u}):i.addEventListener(s,a,!0):u!==void 0?i.addEventListener(s,a,{passive:u}):i.addEventListener(s,a,!1)}function a0(i,s,a,o,u){var f=o;if((s&1)===0&&(s&2)===0&&o!==null)e:for(;;){if(o===null)return;var y=o.tag;if(y===3||y===4){var C=o.stateNode.containerInfo;if(C===u)break;if(y===4)for(y=o.return;y!==null;){var T=y.tag;if((T===3||T===4)&&y.stateNode.containerInfo===u)return;y=y.return}for(;C!==null;){if(y=nr(C),y===null)return;if(T=y.tag,T===5||T===6||T===26||T===27){o=f=y;continue e}C=C.parentNode}}o=o.return}X1(function(){var G=f,ee=uu(a),se=[];e:{var W=kp.get(i);if(W!==void 0){var X=$o,fe=i;switch(i){case"keypress":if(qo(a)===0)break e;case"keydown":case"keyup":X=Uw;break;case"focusin":fe="focus",X=vu;break;case"focusout":fe="blur",X=vu;break;case"beforeblur":case"afterblur":X=vu;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=ep;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=jw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=Ww;break;case xp:case wp:case bp:X=Dw;break;case Cp:X=Kw;break;case"scroll":case"scrollend":X=Ew;break;case"wheel":X=Gw;break;case"copy":case"cut":case"paste":X=Nw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=ip;break;case"submit":X=Vw;break;case"toggle":case"beforetoggle":X=Xw}var ye=(s&4)!==0,Be=!ye&&(i==="scroll"||i==="scrollend"),K=ye?W!==null?W+"Capture":null:W;ye=[];for(var H=G,Z;H!==null;){var ie=H;if(Z=ie.stateNode,ie=ie.tag,ie!==5&&ie!==26&&ie!==27||Z===null||K===null||(ie=nl(H,K),ie!=null&&ye.push(zl(H,ie,Z))),Be)break;H=H.return}0<ye.length&&(W=new X(W,fe,null,a,ee),se.push({event:W,listeners:ye}))}}if((s&7)===0){e:{if(X=i==="mouseover"||i==="pointerover",W=i==="mouseout"||i==="pointerout",X&&a!==hu&&(fe=a.relatedTarget||a.fromElement)&&(nr(fe)||fe[qr]))break e;(W||X)&&(fe=ee.window===ee?ee:(X=ee.ownerDocument)?X.defaultView||X.parentWindow:window,W?(X=a.relatedTarget||a.toElement,W=G,X=X?nr(X):null,X!==null&&(Be=h(X),ye=X.tag,X!==Be||ye!==5&&ye!==27&&ye!==6)&&(X=null)):(W=null,X=G),W!==X&&(ye=ep,ie="onMouseLeave",K="onMouseEnter",H="mouse",(i==="pointerout"||i==="pointerover")&&(ye=ip,ie="onPointerLeave",K="onPointerEnter",H="pointer"),Be=W==null?fe:sl(W),Z=X==null?fe:sl(X),fe=new ye(ie,H+"leave",W,a,ee),fe.target=Be,fe.relatedTarget=Z,ie=null,nr(ee)===G&&(ye=new ye(K,H+"enter",X,a,ee),ye.target=Z,ye.relatedTarget=Be,ie=ye),Be=ie,ye=W&&X?D(W,X,s5):null,W!==null&&Qm(se,fe,W,ye,!1),X!==null&&Be!==null&&Qm(se,Be,X,ye,!0)))}e:{if(W=G?sl(G):window,X=W.nodeName&&W.nodeName.toLowerCase(),X==="select"||X==="input"&&W.type==="file")var ve=hp;else if(op(W))if(up)ve=l4;else{ve=r4;var qe=n4}else X=W.nodeName,!X||X.toLowerCase()!=="input"||W.type!=="checkbox"&&W.type!=="radio"?G&&cu(G.elementType)&&(ve=hp):ve=a4;if(ve&&(ve=ve(i,G))){cp(se,ve,a,ee);break e}qe&&qe(i,W,G)}switch(qe=G?sl(G):window,i){case"focusin":(op(qe)||qe.contentEditable==="true")&&(Xr=qe,Cu=G,dl=null);break;case"focusout":dl=Cu=Xr=null;break;case"mousedown":ku=!0;break;case"contextmenu":case"mouseup":case"dragend":ku=!1,yp(se,a,ee);break;case"selectionchange":if(c4)break;case"keydown":case"keyup":yp(se,a,ee)}var Se;if(yu)e:{switch(i){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else Zr?ap(i,a)&&(Me="onCompositionEnd"):i==="keydown"&&a.keyCode===229&&(Me="onCompositionStart");Me&&(sp&&a.locale!=="ko"&&(Zr||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&Zr&&(Se=Q1()):(pn=ee,pu="value"in pn?pn.value:pn.textContent,Zr=!0)),qe=Fc(G,Me),0<qe.length&&(Me=new tp(Me,i,null,a,ee),se.push({event:Me,listeners:qe}),Se?Me.data=Se:(Se=lp(a),Se!==null&&(Me.data=Se)))),(Se=Jw?e4(i,a):t4(i,a))&&(Me=Fc(G,"onBeforeInput"),0<Me.length&&(qe=new tp("onBeforeInput","beforeinput",null,a,ee),se.push({event:qe,listeners:Me}),qe.data=Se)),J4(se,i,G,a,ee)}Zm(se,s)})}function zl(i,s,a){return{instance:i,listener:s,currentTarget:a}}function Fc(i,s){for(var a=s+"Capture",o=[];i!==null;){var u=i,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=nl(i,a),u!=null&&o.unshift(zl(i,u,f)),u=nl(i,s),u!=null&&o.push(zl(i,u,f))),i.tag===3)return o;i=i.return}return[]}function s5(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function Qm(i,s,a,o,u){for(var f=s._reactName,y=[];a!==null&&a!==o;){var C=a,T=C.alternate,G=C.stateNode;if(C=C.tag,T!==null&&T===o)break;C!==5&&C!==26&&C!==27||G===null||(T=G,u?(G=nl(a,f),G!=null&&y.unshift(zl(a,G,T))):u||(G=nl(a,f),G!=null&&y.push(zl(a,G,T)))),a=a.return}y.length!==0&&i.push({event:s,listeners:y})}var n5=/\r\n?/g,r5=/\u0000|\uFFFD/g;function Jm(i){return(typeof i=="string"?i:""+i).replace(n5,`-`).replace(r5,"")}function ev(i,s){return s=Jm(s),Jm(i)===s}function Je(i,s,a,o,u,f){switch(a){case"children":if(typeof o=="string")s==="body"||s==="textarea"&&o===""||Kr(i,o);else if(typeof o=="number"||typeof o=="bigint")s!=="body"&&Kr(i,""+o);else return;break;case"className":Io(i,"class",o);break;case"tabIndex":Io(i,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Io(i,a,o);break;case"style":G1(i,o,f);return;case"data":if(s!=="object"){Io(i,"data",o);break}case"src":case"href":if(o===""&&(s!=="a"||a!=="href")){i.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){i.removeAttribute(a);break}o=Uo(o),i.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){i.setAttribute(a,"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}else typeof f=="function"&&(a==="formAction"?(s!=="input"&&Je(i,s,"name",u.name,u,null),Je(i,s,"formEncType",u.formEncType,u,null),Je(i,s,"formMethod",u.formMethod,u,null),Je(i,s,"formTarget",u.formTarget,u,null)):(Je(i,s,"encType",u.encType,u,null),Je(i,s,"method",u.method,u,null),Je(i,s,"target",u.target,u,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){i.removeAttribute(a);break}o=Uo(o),i.setAttribute(a,o);break;case"onClick":o!=null&&(i.onclick=gs);return;case"onScroll":o!=null&&Ue("scroll",i);return;case"onScrollEnd":o!=null&&Ue("scrollend",i);return;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(r(60));f?.__html!==a&&(i.innerHTML=a)}}break;case"multiple":i.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":i.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){i.removeAttribute("xlink:href");break}a=Uo(o),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?i.setAttribute(a,o):i.removeAttribute(a);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":o&&typeof o!="function"&&typeof o!="symbol"?i.setAttribute(a,""):i.removeAttribute(a);break;case"capture":case"download":o===!0?i.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?i.setAttribute(a,o):i.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?i.setAttribute(a,o):i.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?i.removeAttribute(a):i.setAttribute(a,o);break;case"popover":Ue("beforetoggle",i),Ue("toggle",i),Ho(i,"popover",o);break;case"xlinkActuate":zs(i,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":zs(i,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":zs(i,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":zs(i,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":zs(i,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":zs(i,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":zs(i,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":zs(i,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":zs(i,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Ho(i,"is",o);break;case"innerText":case"textContent":return;default:if(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")a=Cw.get(a)||a,Ho(i,a,o);else return}We=!0}function l0(i,s,a,o,u,f){switch(a){case"style":G1(i,o,f);return;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(r(60));f?.__html!==a&&(i.innerHTML=a)}}break;case"children":if(typeof o=="string")Kr(i,o);else if(typeof o=="number"||typeof o=="bigint")Kr(i,""+o);else return;break;case"onScroll":o!=null&&Ue("scroll",i);return;case"onScrollEnd":o!=null&&Ue("scrollend",i);return;case"onClick":o!=null&&(i.onclick=gs);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!I1.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(u=a.endsWith("Capture"),f=a.slice(2,u?a.length-7:void 0),s=i[mi]||null,s=s!=null?s[a]:null,typeof s=="function"&&i.removeEventListener(f,s,u),typeof o=="function")){typeof s!="function"&&s!==null&&(a in i?i[a]=null:i.hasAttribute(a)&&i.removeAttribute(a)),i.addEventListener(f,o,u);break e}We=!0,a in i?i[a]=o:o===!0?i.setAttribute(a,""):Ho(i,a,o)}return}We=!0}function Xt(i,s,a){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ue("error",i),Ue("load",i);var o=!1,u=!1,f;for(f in a)if(a.hasOwnProperty(f)){var y=a[f];if(y!=null)switch(f){case"src":o=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:Je(i,s,f,y,a,null)}}u&&Je(i,s,"srcSet",a.srcSet,a,null),o&&Je(i,s,"src",a.src,a,null);return;case"input":Ue("invalid",i);var C=f=y=u=null,T=null,G=null;for(o in a)if(a.hasOwnProperty(o)){var ee=a[o];if(ee!=null)switch(o){case"name":u=ee;break;case"type":y=ee;break;case"checked":T=ee;break;case"defaultChecked":G=ee;break;case"value":f=ee;break;case"defaultValue":C=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(r(137,s));break;default:Je(i,s,o,ee,a,null)}}W1(i,f,C,T,G,y,u,!1);return;case"select":Ue("invalid",i),o=y=f=null;for(u in a)if(a.hasOwnProperty(u)&&(C=a[u],C!=null))switch(u){case"value":f=C;break;case"defaultValue":y=C;break;case"multiple":o=C;default:Je(i,s,u,C,a,null)}s=f,a=y,i.multiple=!!o,s!=null?Fr(i,!!o,s,!1):a!=null&&Fr(i,!!o,a,!0);return;case"textarea":Ue("invalid",i),f=u=o=null;for(y in a)if(a.hasOwnProperty(y)&&(C=a[y],C!=null))switch(y){case"value":o=C;break;case"defaultValue":u=C;break;case"children":f=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(r(91));break;default:Je(i,s,y,C,a,null)}K1(i,o,u,f);return;case"option":for(T in a)a.hasOwnProperty(T)&&(o=a[T],o!=null)&&(T==="selected"?i.selected=o&&typeof o!="function"&&typeof o!="symbol":Je(i,s,T,o,a,null));return;case"dialog":Ue("beforetoggle",i),Ue("toggle",i),Ue("cancel",i),Ue("close",i);break;case"iframe":case"object":Ue("load",i);break;case"video":case"audio":for(o=0;o<Ol.length;o++)Ue(Ol[o],i);break;case"image":Ue("error",i),Ue("load",i);break;case"details":Ue("toggle",i);break;case"embed":case"source":case"link":Ue("error",i),Ue("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(G in a)if(a.hasOwnProperty(G)&&(o=a[G],o!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:Je(i,s,G,o,a,null)}return;default:if(cu(s)){for(ee in a)a.hasOwnProperty(ee)&&(o=a[ee],o!==void 0&&l0(i,s,ee,o,a,void 0));return}}for(C in a)a.hasOwnProperty(C)&&(o=a[C],o!=null&&Je(i,s,C,o,a,null))}var a5={};function l5(i,s,a,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,f=null,y=null,C=null,T=null,G=null,ee=null;for(X in a){var se=a[X];if(a.hasOwnProperty(X)&&se!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":T=se;default:o.hasOwnProperty(X)||Je(i,s,X,null,o,se)}}for(var W in o){var X=o[W];if(se=a[W],o.hasOwnProperty(W)&&(X!=null||se!=null))switch(W){case"type":X!==se&&(We=!0),f=X;break;case"name":X!==se&&(We=!0),u=X;break;case"checked":X!==se&&(We=!0),G=X;break;case"defaultChecked":X!==se&&(We=!0),ee=X;break;case"value":X!==se&&(We=!0),y=X;break;case"defaultValue":X!==se&&(We=!0),C=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,s));break;default:X!==se&&Je(i,s,W,X,o,se)}}lu(i,y,C,T,G,ee,f,u);return;case"select":X=y=C=W=null;for(f in a)if(T=a[f],a.hasOwnProperty(f)&&T!=null)switch(f){case"value":break;case"multiple":X=T;default:o.hasOwnProperty(f)||Je(i,s,f,null,o,T)}for(u in o)if(f=o[u],T=a[u],o.hasOwnProperty(u)&&(f!=null||T!=null))switch(u){case"value":f!==T&&(We=!0),W=f;break;case"defaultValue":f!==T&&(We=!0),C=f;break;case"multiple":f!==T&&(We=!0),y=f;default:f!==T&&Je(i,s,u,f,o,T)}s=C,a=y,o=X,W!=null?Fr(i,!!a,W,!1):!!o!=!!a&&(s!=null?Fr(i,!!a,s,!0):Fr(i,!!a,a?[]:"",!1));return;case"textarea":X=W=null;for(C in a)if(u=a[C],a.hasOwnProperty(C)&&u!=null&&!o.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:Je(i,s,C,null,o,u)}for(y in o)if(u=o[y],f=a[y],o.hasOwnProperty(y)&&(u!=null||f!=null))switch(y){case"value":u!==f&&(We=!0),W=u;break;case"defaultValue":u!==f&&(We=!0),X=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(r(91));break;default:u!==f&&Je(i,s,y,u,o,f)}F1(i,W,X);return;case"option":for(var fe in a)W=a[fe],a.hasOwnProperty(fe)&&W!=null&&!o.hasOwnProperty(fe)&&(fe==="selected"?i.selected=!1:Je(i,s,fe,null,o,W));for(T in o)W=o[T],X=a[T],o.hasOwnProperty(T)&&W!==X&&(W!=null||X!=null)&&(T==="selected"?(W!==X&&(We=!0),i.selected=W&&typeof W!="function"&&typeof W!="symbol"):Je(i,s,T,W,o,X));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 ye in a)W=a[ye],a.hasOwnProperty(ye)&&W!=null&&!o.hasOwnProperty(ye)&&Je(i,s,ye,null,o,W);for(G in o)if(W=o[G],X=a[G],o.hasOwnProperty(G)&&W!==X&&(W!=null||X!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(r(137,s));break;default:Je(i,s,G,W,o,X)}return;default:if(cu(s)){for(var Be in a)W=a[Be],a.hasOwnProperty(Be)&&W!==void 0&&!o.hasOwnProperty(Be)&&l0(i,s,Be,void 0,o,W);for(ee in o)W=o[ee],X=a[ee],!o.hasOwnProperty(ee)||W===X||W===void 0&&X===void 0||l0(i,s,ee,W,o,X);return}}for(var K in a)W=a[K],a.hasOwnProperty(K)&&W!=null&&!o.hasOwnProperty(K)&&Je(i,s,K,null,o,W);for(se in o)W=o[se],X=a[se],!o.hasOwnProperty(se)||W===X||W==null&&X==null||Je(i,s,se,W,o,X)}function tv(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function o5(){if(typeof performance.getEntriesByType=="function"){for(var i=0,s=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var u=a[o],f=u.transferSize,y=u.initiatorType,C=u.duration;if(f&&C&&tv(y)){for(y=0,C=u.responseEnd,o+=1;o<a.length;o++){var T=a[o],G=T.startTime;if(G>C)break;var ee=T.transferSize,se=T.initiatorType;ee&&tv(se)&&(T=T.responseEnd,y+=ee*(T<C?1:(C-G)/(T-G)))}if(--o,s+=8*(f+y)/(u.duration/1e3),i++,10<i)break}}if(0<i)return s/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var o0=null,c0=null;function Hl(i){return i.nodeType===9?i:i.ownerDocument}function iv(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function sv(i,s){if(i===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&s==="foreignObject"?0:i}function nv(i,s,a,o){return a=Hl(a).createElement(i),a[Ft]=o,a[mi]=s,Xt(a,i,s),Ot(a),a}function h0(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var u0=null;function c5(){var i=window.event;return i&&i.type==="popstate"?i===u0?!1:(u0=i,!0):(u0=null,!1)}var d0=typeof setTimeout=="function"?setTimeout:void 0,h5=typeof clearTimeout=="function"?clearTimeout:void 0,rv=typeof Promise=="function"?Promise:void 0,av=typeof requestAnimationFrame=="function"?requestAnimationFrame:d0,u5=typeof queueMicrotask=="function"?queueMicrotask:typeof rv<"u"?function(i){return rv.resolve(null).then(i).catch(d5)}:d0;function d5(i){setTimeout(function(){throw i})}function Ln(i){return i==="head"}function lv(i,s){var a=s,o=0;do{var u=a.nextSibling;if(i.removeChild(a),u&&u.nodeType===8)if(a=u.data,a==="/$"||a==="/&"){if(o===0){i.removeChild(u),Ra(s);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")S0(i.ownerDocument.documentElement);else if(a==="head"){a=i.ownerDocument.head,S0(a);for(var f=a.firstChild;f;){var y=f.nextSibling,C=f.nodeName;f[il]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&f.rel.toLowerCase()==="stylesheet"||a.removeChild(f),f=y}}else a==="body"&&S0(i.ownerDocument.body);a=u}while(a);Ra(s)}function ov(i,s){var a=i;i=0;do{var o=a.nextSibling;if(a.nodeType===1?s?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(s?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(i===0)break;i--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||i++;a=o}while(a)}function cv(i,s,a){if(s=CSS.escape(s)!==s?"r-"+btoa(s).replace(/=/g,""):s,i.style.viewTransitionName=s,a!=null&&(i.style.viewTransitionClass=a),a=getComputedStyle(i),a.display==="inline"){if(s=i.getClientRects(),s.length===1)var o=1;else for(var u=o=0;u<s.length;u++){var f=s[u];0<f.width&&0<f.height&&o++}o===1&&(i=i.style,i.display=s.length===1?"inline-block":"block",i.marginTop="-"+a.paddingTop,i.marginBottom="-"+a.paddingBottom)}}function hv(i,s){i=i.style,s=s.style;var a=s!=null?s.hasOwnProperty("viewTransitionName")?s.viewTransitionName:s.hasOwnProperty("view-transition-name")?s["view-transition-name"]:null:null;i.viewTransitionName=a==null||typeof a=="boolean"?"":(""+a).trim(),a=s!=null?s.hasOwnProperty("viewTransitionClass")?s.viewTransitionClass:s.hasOwnProperty("view-transition-class")?s["view-transition-class"]:null:null,i.viewTransitionClass=a==null||typeof a=="boolean"?"":(""+a).trim(),i.display==="inline-block"&&(s==null?i.display=i.margin="":(a=s.display,i.display=a==null||typeof a=="boolean"?"":a,a=s.margin,a!=null?i.margin=a:(a=s.hasOwnProperty("marginTop")?s.marginTop:s["margin-top"],i.marginTop=a==null||typeof a=="boolean"?"":a,s=s.hasOwnProperty("marginBottom")?s.marginBottom:s["margin-bottom"],i.marginBottom=s==null||typeof s=="boolean"?"":s)))}function f5(i,s,a){return a=a.ownerDocument.defaultView,{rect:i,abs:s.position==="absolute"||s.position==="fixed",clip:s.clipPath!=="none"||s.overflow!=="visible"||s.filter!=="none"||s.mask!=="none"||s.mask!=="none"||s.borderRadius!=="0px",view:0<=i.bottom&&0<=i.right&&i.top<=a.innerHeight&&i.left<=a.innerWidth}}function f0(i){var s=i.getBoundingClientRect(),a=getComputedStyle(i);return f5(s,a,i)}function p5(i){return i.documentElement.clientHeight}function g5(i){this.addEventListener("load",i),this.addEventListener("error",i)}function m5(i,s,a,o,u,f,y,C,T){var G=s.nodeType===9?s:s.ownerDocument;try{var ee=G.startViewTransition({update:function(){var W=G.defaultView,X=W.navigation&&W.navigation.transition,fe=G.fonts.status;o();var ye=[];if(fe==="loaded"&&(p5(G),G.fonts.status==="loading"&&ye.push(G.fonts.ready)),fe=ye.length,i!==null)for(var Be=i.suspenseyImages,K=0,H=0;H<Be.length;H++){var Z=Be[H];if(!Z.complete){var ie=Z.getBoundingClientRect();if(0<ie.bottom&&0<ie.right&&ie.top<W.innerHeight&&ie.left<W.innerWidth){if(K+=Dv(Z),K>Gc){ye.length=fe;break}Z=new Promise(g5.bind(Z)),ye.push(Z)}}}if(0<ye.length)return W=Promise.race([Promise.all(ye),new Promise(function(ve){return setTimeout(ve,500)})]).then(u,u),(X?Promise.allSettled([X.finished,W]):W).then(f,f);if(u(),X)return X.finished.then(f,f);f()},types:a});G.__reactViewTransition=ee;var se=[];return ee.ready.then(function(){for(var W=G.documentElement.getAnimations({subtree:!0}),X=0;X<W.length;X++){var fe=W[X],ye=fe.effect,Be=ye.pseudoElement;if(Be!=null&&Be.startsWith("::view-transition")){se.push(fe),fe=ye.getKeyframes();for(var K=Be=void 0,H=!0,Z=0;Z<fe.length;Z++){var ie=fe[Z],ve=ie.width;if(Be===void 0)Be=ve;else if(Be!==ve){H=!1;break}if(ve=ie.height,K===void 0)K=ve;else if(K!==ve){H=!1;break}delete ie.width,delete ie.height,ie.transform==="none"&&delete ie.transform}H&&Be!==void 0&&K!==void 0&&(ye.setKeyframes(fe),H=getComputedStyle(ye.target,ye.pseudoElement),H.width!==Be||H.height!==K)&&(H=fe[0],H.width=Be,H.height=K,H=fe[fe.length-1],H.width=Be,H.height=K,ye.setKeyframes(fe))}}y()},function(W){G.__reactViewTransition===ee&&(G.__reactViewTransition=null);try{typeof W=="object"&&W!==null&&W.name==="InvalidStateError"&&(W.message==="View transition was skipped because document visibility state is hidden."||W.message==="Skipping view transition because document visibility state has become hidden."||W.message==="Skipping view transition because viewport size changed."||W.message==="Transition was aborted because of invalid state")&&(W=null),W!==null&&T(W)}finally{o(),u(),y()}}),ee.finished.finally(function(){for(var W=0;W<se.length;W++)se[W].cancel();G.__reactViewTransition===ee&&(G.__reactViewTransition=null),C()}),ee}catch{return o(),u(),y(),null}}function kr(i,s){this._scope=document.documentElement,this._selector="::view-transition-"+i+"("+s+")"}kr.prototype.animate=function(i,s){return s=typeof s=="number"?{duration:s}:I({},s),s.pseudoElement=this._selector,this._scope.animate(i,s)},kr.prototype.getAnimations=function(){for(var i=this._scope,s=this._selector,a=i.getAnimations({subtree:!0}),o=[],u=0;u<a.length;u++){var f=a[u].effect;f!==null&&f.target===i&&f.pseudoElement===s&&o.push(a[u])}return o},kr.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function uv(i){return{name:i,group:new kr("group",i),imagePair:new kr("image-pair",i),old:new kr("old",i),new:new kr("new",i)}}function Oi(i){this._fragmentFiber=i,this._observers=this._eventListeners=null}Oi.prototype.addEventListener=function(i,s,a){var o=null,u=null;if(!(a!=null&&typeof a!="boolean"&&(o=a.signal||null,o!==null&&o.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var f=this._eventListeners;if(fv(f,i,s,a)===-1){var y=this,C=s;a!=null&&typeof a!="boolean"&&a.once===!0&&(C=function(T){y.removeEventListener(i,s,a),typeof s=="function"?s.call(this,T):s.handleEvent(T)}),o!==null&&(u=y.removeEventListener.bind(y,i,s,a),o.addEventListener("abort",u,{once:!0}),u=o.removeEventListener.bind(o,"abort",u)),o=Ca(a),f.push({type:i,listener:s,optionsOrUseCapture:a,attachedListener:C,cleanup:u}),_(this._fragmentFiber.child,!1,v5,i,C,o)}this._eventListeners=f}};function v5(i,s,a,o){return E(i).addEventListener(s,a,o),!1}Oi.prototype.removeEventListener=function(i,s,a){var o=this._eventListeners;if(o!==null&&(s=fv(o,i,s,a),s!==-1)){var u=o[s];a=u.attachedListener;var f=u.cleanup;u=Ca(u.optionsOrUseCapture),_(this._fragmentFiber.child,!1,_5,i,a,u),o.splice(s,1),f!==null&&f()}};function _5(i,s,a,o){return E(i).removeEventListener(s,a,o),!1}function Ca(i){return i!=null&&typeof i!="boolean"&&(i.once===!0||i.signal instanceof AbortSignal)?{capture:i.capture,passive:i.passive}:i}function dv(i){return i==null?"c=0":typeof i=="boolean"?"c="+(i?"1":"0"):"c="+(i.capture?"1":"0")}function fv(i,s,a,o){if(i.length===0)return-1;o=dv(o);for(var u=0;u<i.length;u++){var f=i[u];if(f.type===s&&f.listener===a&&dv(f.optionsOrUseCapture)===o)return u}return-1}Oi.prototype.dispatchEvent=function(i){var s=S(this._fragmentFiber);if(s===null)return!0;s=E(s);var a=this._eventListeners;if(a!==null&&0<a.length||!i.bubbles){var o=s.nodeType===9?s.createComment(""):document.createTextNode("");if(a)for(var u=0;u<a.length;u++){var f=a[u];o.addEventListener(f.type,f.attachedListener,Ca(f.optionsOrUseCapture))}if(s.appendChild(o),i=o.dispatchEvent(i),a)for(u=0;u<a.length;u++)f=a[u],o.removeEventListener(f.type,f.attachedListener,Ca(f.optionsOrUseCapture));return s.removeChild(o),i}return s.dispatchEvent(i)},Oi.prototype.focus=function(i){_(this._fragmentFiber.child,!0,pv,i,void 0,void 0)};function pv(i,s){return i.tag===6?!1:(i=E(i),R5(i,s))}Oi.prototype.focusLast=function(i){var s=[];_(this._fragmentFiber.child,!0,p0,s,void 0,void 0);for(var a=s.length-1;0<=a&&!pv(s[a],i);a--);};function p0(i,s){return s.push(i),!1}Oi.prototype.blur=function(){var i=S(this._fragmentFiber);i!==null&&(i=E(i),i=Hl(i).activeElement,i!==null&&_(this._fragmentFiber.child,!1,y5,i,void 0,void 0))};function y5(i,s){return i.tag===6?!1:(i=E(i),i===s||i.contains(s)?(s.blur(),!0):!1)}Oi.prototype.observeUsing=function(i){this._observers===null&&(this._observers=new Set),this._observers.add(i),_(this._fragmentFiber.child,!1,S5,i,void 0,void 0)};function S5(i,s){return i.tag===6||(i=E(i),s.observe(i)),!1}Oi.prototype.unobserveUsing=function(i){var s=this._observers;if(s!==null&&s.has(i)){s.delete(i),_(this._fragmentFiber.child,!1,x5,i,void 0,void 0);for(var a=s=0;a<fs.length;a++){var o=fs[a];o.fragmentInstance===this&&o.observer===i?i.unobserve(o.instance):fs[s++]=o}fs.length=s}};function x5(i,s){return i.tag===6||(i=E(i),s.unobserve(i)),!1}var fs=[],g0=!1;function w5(i,s,a){fs.push({fragmentInstance:i,observer:s,instance:a}),g0||(g0=!0,D5(function(){g0=!1;var o=fs;fs=[];for(var u=0;u<o.length;u++){var f=o[u];f.observer.unobserve(f.instance)}}))}Oi.prototype.getClientRects=function(){var i=[];return _(this._fragmentFiber.child,!1,b5,i,void 0,void 0),i};function b5(i,s){if(i.tag===6){i=i.stateNode;var a=i.ownerDocument.createRange();a.selectNodeContents(i),s.push.apply(s,a.getClientRects())}else i=E(i),s.push.apply(s,i.getClientRects());return!1}Oi.prototype.getRootNode=function(i){var s=S(this._fragmentFiber);return s===null?this:E(s).getRootNode(i)},Oi.prototype.compareDocumentPosition=function(i){var s=S(this._fragmentFiber);if(s===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var a=[];_(this._fragmentFiber.child,!1,p0,a,void 0,void 0);var o=E(s);if(a.length===0){if(a=o,w(this._fragmentFiber)){e:{for(s=this._fragmentFiber.return;s!==null;){if(s.tag===4){s=s.stateNode.containerInfo;break e}if(s.tag===3||s.tag===5||s.tag===27)break;s=s.return}s=null}s!=null&&(a=s)}s=this._fragmentFiber;var u=o=a.compareDocumentPosition(i);return a===i?u=Node.DOCUMENT_POSITION_CONTAINS:o&Node.DOCUMENT_POSITION_CONTAINED_BY&&(a=b(s)[1],a===null?u=Node.DOCUMENT_POSITION_PRECEDING:(i=E(a).compareDocumentPosition(i),u=i===0||i&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),u|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}s=E(a[0]),u=E(a[a.length-1]);var f=w(this._fragmentFiber)?s.parentElement:o;if(f==null)return Node.DOCUMENT_POSITION_DISCONNECTED;o=f.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_CONTAINED_BY,f=f.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_CONTAINED_BY;var y=s.compareDocumentPosition(i),C=u.compareDocumentPosition(i),T=y&Node.DOCUMENT_POSITION_CONTAINED_BY||C&Node.DOCUMENT_POSITION_CONTAINED_BY;return C=o&&f&&y&Node.DOCUMENT_POSITION_FOLLOWING&&C&Node.DOCUMENT_POSITION_PRECEDING,s=o&&s===i||f&&u===i||T||C?Node.DOCUMENT_POSITION_CONTAINED_BY:!o&&s===i||!f&&u===i?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:y,s&Node.DOCUMENT_POSITION_DISCONNECTED||s&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||C5(s,this._fragmentFiber,a[0],a[a.length-1],i)?s:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function C5(i,s,a,o,u){var f=nr(u);if(i&Node.DOCUMENT_POSITION_CONTAINED_BY){if(a=!!f)e:{for(;f!==null;){if(f.tag===7&&(f===s||f.alternate===s)){a=!0;break e}f=f.return}a=!1}return a}if(i&Node.DOCUMENT_POSITION_CONTAINS){if(f===null)return f=u.ownerDocument,u===f||u===f.documentElement||u===f.body;e:{for(f=s,s=S(s);f!==null;){if(!(f.tag!==5&&f.tag!==3&&f.tag!==27||f!==s&&f.alternate!==s)){f=!0;break e}f=f.return}f=!1}return f}return i&Node.DOCUMENT_POSITION_PRECEDING?((s=!!f)&&!(s=f===a)&&(s=D(a,f,F),s===null?s=!1:(_(s,!0,A,f,a),f=j,j=null,s=f!==null)),s):i&Node.DOCUMENT_POSITION_FOLLOWING?((s=!!f)&&!(s=f===o)&&(s=D(o,f,F),s===null?s=!1:(_(s,!0,z,f,o),f=j,V=j=null,s=f!==null)),s):!1}function gv(i,s){var a=i.ownerDocument.createRange();a.selectNodeContents(i),i=a.getBoundingClientRect(),window.scrollTo(window.scrollX+i.left,s?window.scrollY+i.top:window.scrollY+i.bottom-window.innerHeight)}Oi.prototype.scrollIntoView=function(i){if(typeof i=="object")throw Error(r(566));var s=[];_(this._fragmentFiber.child,!1,p0,s,void 0,void 0);var a=i!==!1;if(s.length===0){var o=b(this._fragmentFiber);if(o=a?o[1]||o[0]||S(this._fragmentFiber):o[0]||o[1],o===null)return;if(o.tag===6){i=E(o),gv(i,a);return}if(o=E(o),o.nodeType!==9){if(o.nodeType===11){a="host"in o?o.host:null,a!==null&&a.scrollIntoView(i);return}o.scrollIntoView(i)}}for(o=a?s.length-1:0;o!==(a?-1:s.length);){var u=s[o];u.tag===6?(u=E(u),gv(u,a)):E(u).scrollIntoView(i),o+=a?-1:1}};function k5(i,s){return i=E(i),mv(i,s),!1}function mv(i,s){i.reactFragments==null&&(i.reactFragments=new Set),i.reactFragments.add(s)}function vv(i,s){var a=s._eventListeners;if(a!==null)for(var o=0;o<a.length;o++){var u=a[o];i.addEventListener(u.type,u.attachedListener,Ca(u.optionsOrUseCapture))}i.nodeType!==3&&(a=s._observers,a!==null&&a.forEach(function(f){for(var y=0,C=0;C<fs.length;C++){var T=fs[C];(T.fragmentInstance!==s||T.observer!==f||T.instance!==i)&&(fs[y++]=T)}fs.length=y,f.observe(i)}),mv(i,s))}function E5(i,s){var a=s._eventListeners;if(a!==null)for(var o=0;o<a.length;o++){var u=a[o];i.removeEventListener(u.type,u.attachedListener,Ca(u.optionsOrUseCapture))}i.nodeType!==3&&(a=s._observers,a!==null&&a.forEach(function(f){typeof f.rootMargin=="string"?w5(s,f,i):f.unobserve(i)}),i.reactFragments!=null&&i.reactFragments.delete(s))}function m0(i){var s=i.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var a=s;switch(s=s.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":m0(a),zo(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}i.removeChild(a)}}function M5(i,s,a,o){for(;i.nodeType===1;){var u=a;if(i.nodeName.toLowerCase()!==s.toLowerCase()){if(!o&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(o){if(!i[il])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(f=i.getAttribute("rel"),f==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(f!==u.rel||i.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||i.getAttribute("title")!==(u.title==null?null:u.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(f=i.getAttribute("src"),(f!==(u.src==null?null:u.src)||i.getAttribute("type")!==(u.type==null?null:u.type)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&f&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var f=u.name==null?null:""+u.name;if(u.type==="hidden"&&i.getAttribute("name")===f)return i}else return i;if(i=Yi(i.nextSibling),i===null)break}return null}function j5(i,s,a){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=Yi(i.nextSibling),i===null))return null;return i}function _v(i,s){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!s||(i=Yi(i.nextSibling),i===null))return null;return i}function v0(i){return i.data==="$?"||i.data==="$~"}function _0(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function T5(i,s){var a=i.ownerDocument;if(i.data==="$~")i._reactRetry=s;else if(i.data!=="$?"||a.readyState!=="loading")s();else{var o=function(){s(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),i._reactRetry=o}}function Yi(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return i}var y0=null;function yv(i){i=i.nextSibling;for(var s=0;i;){if(i.nodeType===8){var a=i.data;if(a==="/$"||a==="/&"){if(s===0)return Yi(i.nextSibling);s--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||s++}i=i.nextSibling}return null}function Sv(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var a=i.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(s===0)return i;s--}else a!=="/$"&&a!=="/&"||s++}i=i.previousSibling}return null}function R5(i,s){function a(){o=!0}if(i.ownerDocument.activeElement===i)return!0;var o=!1;try{i.ownerDocument.addEventListener("focus",a,!0),(i.focus||HTMLElement.prototype.focus).call(i,s)}finally{i.ownerDocument.removeEventListener("focus",a,!0)}return o}function D5(i){av(function(){av(function(s){return i(s)})})}function xv(i,s,a){switch(s=Hl(a),i){case"html":if(i=s.documentElement,!i)throw Error(r(452));return i;case"head":if(i=s.head,!i)throw Error(r(453));return i;case"body":if(i=s.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function wv(i,s,a){for(var o in a){var u=a[o];a.hasOwnProperty(o)&&u!=null&&Je(i,s,o,null,a5,u)}a.dangerouslySetInnerHTML!=null&&(i.textContent=""),i.onclick===gs&&(i.onclick=null),zo(i)}function S0(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);zo(i)}var Gi=new Map,bv=new Set;function Il(i){if(typeof i.getRootNode=="function"){var s=i.getRootNode();if(s.nodeType===9||s.nodeType===11)return s}return i.nodeType===9?i:i.ownerDocument}var Zs=_e.d;_e.d={f:A5,r:N5,D:L5,C:B5,L:O5,m:z5,X:I5,S:H5,M:U5};function A5(){var i=Zs.f(),s=Uc();return i||s}function N5(i){var s=Vr(i);s!==null&&s.tag===5&&s.type==="form"?kg(s):Zs.r(i)}var ka=typeof document>"u"?null:document;function Cv(i,s,a){var o=ka;if(o&&typeof s=="string"&&s){var u=Pi(s);u='link[rel="'+i+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),bv.has(u)||(bv.add(u),i={rel:i,crossOrigin:a,href:s},o.querySelector(u)===null&&(s=o.createElement("link"),Xt(s,"link",i),Ot(s),o.head.appendChild(s)))}}function L5(i){Zs.D(i),Cv("dns-prefetch",i,null)}function B5(i,s){Zs.C(i,s),Cv("preconnect",i,s)}function O5(i,s,a){Zs.L(i,s,a);var o=ka;if(o&&i&&s){var u='link[rel="preload"][as="'+Pi(s)+'"]';s==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+Pi(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+Pi(a.imageSizes)+'"]')):u+='[href="'+Pi(i)+'"]';var f=u;switch(s){case"style":f=Ea(i);break;case"script":f=Ma(i)}if(!(Gi.has(f)||(i=I({rel:"preload",href:s==="image"&&a&&a.imageSrcSet?void 0:i,as:s},a),Gi.set(f,i),o.querySelector(u)!==null||s==="style"&&o.querySelector(Ul(f))||s==="script"&&o.querySelector(Pl(f))))){var y=o.createElement("link");Xt(y,"link",i),s==="style"&&(y[Oo]=!0,y.onload=y.onerror=function(){z1(y)}),Ot(y),o.head.appendChild(y)}}}function z5(i,s){Zs.m(i,s);var a=ka;if(a&&i){var o=s&&typeof s.as=="string"?s.as:"script",u='link[rel="modulepreload"][as="'+Pi(o)+'"][href="'+Pi(i)+'"]',f=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Ma(i)}if(!Gi.has(f)&&(i=I({rel:"modulepreload",href:i},s),Gi.set(f,i),a.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Pl(f)))return}o=a.createElement("link"),Xt(o,"link",i),Ot(o),a.head.appendChild(o)}}}function H5(i,s,a){Zs.S(i,s,a);var o=ka;if(o&&i){var u=$r(o).hoistableStyles,f=Ea(i);s=s||"default";var y=u.get(f);if(!y){var C={loading:0,preload:null};if(y=o.querySelector(Ul(f)))C.loading=5;else{i=I({rel:"stylesheet",href:i,"data-precedence":s},a),(a=Gi.get(f))&&x0(i,a);var T=y=o.createElement("link");Ot(T),Xt(T,"link",i),T._p=new Promise(function(G,ee){T.onload=G,T.onerror=ee}),T.addEventListener("load",function(){C.loading|=1}),T.addEventListener("error",function(){C.loading|=2}),C.loading|=4,Kc(y,s,o)}y={type:"stylesheet",instance:y,count:1,state:C},u.set(f,y)}}}function I5(i,s){Zs.X(i,s);var a=ka;if(a&&i){var o=$r(a).hoistableScripts,u=Ma(i),f=o.get(u);f||(f=a.querySelector(Pl(u)),f||(i=I({src:i,async:!0},s),(s=Gi.get(u))&&w0(i,s),f=a.createElement("script"),Ot(f),Xt(f,"link",i),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(u,f))}}function U5(i,s){Zs.M(i,s);var a=ka;if(a&&i){var o=$r(a).hoistableScripts,u=Ma(i),f=o.get(u);f||(f=a.querySelector(Pl(u)),f||(i=I({src:i,async:!0,type:"module"},s),(s=Gi.get(u))&&w0(i,s),f=a.createElement("script"),Ot(f),Xt(f,"link",i),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(u,f))}}function kv(i,s,a,o){var u=(u=Ke.current)?Il(u):null;if(!u)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(a=Ea(a.href),s=$r(u).hoistableStyles,o=s.get(a),o||(o={type:"style",instance:null,count:0,state:null},s.set(a,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){i=Ea(a.href);var f=$r(u).hoistableStyles,y=f.get(i);if(y||(u=u.ownerDocument||u,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(i,y),(f=u.querySelector(Ul(i)))?f._p||(y.instance=f,y.state.loading=5):(f=Gi.get(i),f||(f={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Gi.set(i,f)),P5(u,i,f,y.state))),s&&o===null)throw Error(r(528,""));return y}if(s&&o!==null)throw Error(r(529,""));return null;case"script":return s=a.async,a=a.src,typeof a=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(a=Ma(a),s=$r(u).hoistableScripts,o=s.get(a),o||(o={type:"script",instance:null,count:0,state:null},s.set(a,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function Ea(i){return'href="'+Pi(i)+'"'}function Ul(i){return'link[rel="stylesheet"]['+i+"]"}function Ev(i){return I({},i,{"data-precedence":i.precedence,precedence:null})}function P5(i,s,a,o){if(s=i.querySelector('link[rel="preload"][as="style"]['+s+"]")){if(s[Oo]!==!0){o.loading=1;return}}else s=i.createElement("link"),s[Oo]=!0,s.onload=s.onerror=z1.bind(null,s),Xt(s,"link",a),Ot(s),i.head.appendChild(s);o.preload=s,s.addEventListener("load",function(){return o.loading|=1}),s.addEventListener("error",function(){return o.loading|=2})}function Ma(i){return'[src="'+Pi(i)+'"]'}function Pl(i){return"script[async]"+i}function Mv(i,s,a){if(s.count++,s.instance===null)switch(s.type){case"style":var o=i.querySelector('style[data-href~="'+Pi(a.href)+'"]');if(o)return s.instance=o,Ot(o),o;var u=I({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(i.ownerDocument||i).createElement("style"),Ot(o),Xt(o,"style",u),Kc(o,a.precedence,i),s.instance=o;case"stylesheet":u=Ea(a.href);var f=i.querySelector(Ul(u));if(f)return s.state.loading|=4,s.instance=f,Ot(f),f;o=Ev(a),(u=Gi.get(u))&&x0(o,u),f=(i.ownerDocument||i).createElement("link"),Ot(f);var y=f;return y._p=new Promise(function(C,T){y.onload=C,y.onerror=T}),Xt(f,"link",o),s.state.loading|=4,Kc(f,a.precedence,i),s.instance=f;case"script":return f=Ma(a.src),(u=i.querySelector(Pl(f)))?(s.instance=u,Ot(u),u):(o=a,(u=Gi.get(f))&&(o=I({},a),w0(o,u)),i=i.ownerDocument||i,u=i.createElement("script"),Ot(u),Xt(u,"link",o),i.head.appendChild(u),s.instance=u);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(o=s.instance,s.state.loading|=4,Kc(o,a.precedence,i));return s.instance}function Kc(i,s,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,f=u,y=0;y<o.length;y++){var C=o[y];if(C.dataset.precedence===s)f=C;else if(f!==u)break}f?f.parentNode.insertBefore(i,f.nextSibling):(s=a.nodeType===9?a.head:a,s.insertBefore(i,s.firstChild))}function x0(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function w0(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var Yc=null;function jv(i,s,a){if(Yc===null){var o=new Map,u=Yc=new Map;u.set(a,o)}else u=Yc,o=u.get(a),o||(o=new Map,u.set(a,o));if(o.has(i))return o;for(o.set(i,null),a=a.getElementsByTagName(i),u=0;u<a.length;u++){var f=a[u];if(!(f[il]||f[Ft]||i==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var y=f.getAttribute(s)||"";y=i+y;var C=o.get(y);C?C.push(f):o.set(y,[f])}}return o}function b0(i,s,a){i=i.ownerDocument||i,i.head.insertBefore(a,s==="title"?i.querySelector("head > title"):null)}function q5(i,s,a){if(a===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(i=s.disabled,typeof s.precedence=="string"&&i==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function Tv(i,s){return i==="img"&&s.src!=null&&s.src!==""&&s.onLoad==null&&s.loading!=="lazy"}function Rv(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function Dv(i){return(i.width||100)*(i.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Av(i,s){typeof s.decode=="function"&&(i.imgCount++,s.complete||(i.imgBytes+=Dv(s),i.suspenseyImages.push(s)),i=W5.bind(i),s.decode().then(i,i))}function V5(i,s,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=Ea(o.href),f=s.querySelector(Ul(u));if(f){s=f._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=ql.bind(i),s.then(i,i)),a.state.loading|=4,a.instance=f,Ot(f);return}f=s.ownerDocument||s,o=Ev(o),(u=Gi.get(u))&&x0(o,u),f=f.createElement("link"),Ot(f);var y=f;y._p=new Promise(function(C,T){y.onload=C,y.onerror=T}),Xt(f,"link",o),a.instance=f}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(a,s),(s=a.state.preload)&&(a.state.loading&3)===0&&(i.count++,a=ql.bind(i),s.addEventListener("load",a),s.addEventListener("error",a))}}var Gc=0;function $5(i,s){return i.stylesheets&&i.count===0&&Xc(i,i.stylesheets),0<i.count||0<i.imgCount?function(a){var o=setTimeout(function(){if(i.stylesheets&&Xc(i,i.stylesheets),i.unsuspend){var f=i.unsuspend;i.unsuspend=null,f()}},6e4+s);0<i.imgBytes&&Gc===0&&(Gc=62500*o5());var u=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Xc(i,i.stylesheets),i.unsuspend)){var f=i.unsuspend;i.unsuspend=null,f()}},(i.imgBytes>Gc?50:800)+s);return i.unsuspend=a,function(){i.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function Nv(i){if(i.count===0&&(i.imgCount===0||!i.waitingForImages)){if(i.stylesheets)Xc(i,i.stylesheets);else if(i.unsuspend){var s=i.unsuspend;i.unsuspend=null,s()}}}function ql(){this.count--,Nv(this)}function W5(){this.imgCount--,Nv(this)}var Zc=null;function Xc(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Zc=new Map,s.forEach(F5,i),Zc=null,ql.call(i))}function F5(i,s){if(!(s.state.loading&4)){var a=Zc.get(i);if(a)var o=a.get(null);else{a=new Map,Zc.set(i,a);for(var u=i.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var y=u[f];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(a.set(y.dataset.precedence,y),o=y)}o&&a.set(null,o)}u=s.instance,y=u.getAttribute("data-precedence"),f=a.get(y)||o,f===o&&a.set(null,u),a.set(y,u),this.count++,o=ql.bind(this),u.addEventListener("load",o),u.addEventListener("error",o),f?f.parentNode.insertBefore(u,f.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(u,i.firstChild)),s.state.loading|=4}}var ja={$$typeof:O,Provider:null,Consumer:null,_currentValue:De,_currentValue2:De,_threadCount:0};function K5(i,s,a,o,u,f,y,C,T){this.tag=1,this.containerInfo=i,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=su(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=su(0),this.hiddenUpdates=su(null),this.identifierPrefix=o,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.transitionTypes=null,this.incompleteTransitions=new Map}function Lv(i,s,a,o,u,f,y,C,T,G,ee,se){return i=new K5(i,s,a,y,T,G,ee,se,C),s=1,f===!0&&(s|=24),f=vi(3,null,null,s),i.current=f,f.stateNode=i,s=Hu(),s.refCount++,i.pooledCache=s,s.refCount++,f.memoizedState={element:o,isDehydrated:a,cache:s},qu(f),i}function Bv(i){return i?(i=ea,i):ea}function Ov(i,s,a,o,u,f){u=Bv(u),o.context===null?o.context=u:o.pendingContext=u,o=wn(s),o.payload={element:a},f=f===void 0?null:f,f!==null&&(o.callback=f),a=bn(i,o,s),a!==null&&(xi(a,i,s),yl(a,i,s))}function zv(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var a=i.retryLane;i.retryLane=a!==0&&a<s?a:s}}function C0(i,s){zv(i,s),(i=i.alternate)&&zv(i,s)}function Hv(i){if(i.tag===13||i.tag===31){var s=or(i,67108864);s!==null&&xi(s,i,67108864),C0(i,67108864)}}function Iv(i){if(i.tag===13||i.tag===31){var s=Bi();s=nu(s);var a=or(i,s);a!==null&&xi(a,i,s),C0(i,s)}}var Ta=!0;function Y5(i,s,a,o){var u=pe.T;pe.T=null;var f=_e.p;try{_e.p=2,k0(i,s,a,o)}finally{_e.p=f,pe.T=u}}function G5(i,s,a,o){var u=pe.T;pe.T=null;var f=_e.p;try{_e.p=8,k0(i,s,a,o)}finally{_e.p=f,pe.T=u}}function k0(i,s,a,o){if(Ta){var u=E0(o);if(u===null)a0(i,s,o,Qc,a),Pv(i,o);else if(X5(u,i,s,a,o))o.stopPropagation();else if(Pv(i,o),s&4&&-1<Z5.indexOf(i)){for(;u!==null;){var f=Vr(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var y=sr(f.pendingLanes);if(y!==0){var C=f;for(C.pendingLanes|=2,C.entangledLanes|=2;y;){var T=1<<31-ji(y);C.entanglements[1]|=T,y&=~T}ks(f),(Ye&6)===0&&(zc=Ei()+500,Bl(0))}}break;case 31:case 13:C=or(f,2),C!==null&&xi(C,f,2),Uc(),C0(f,2)}if(f=E0(o),f===null&&a0(i,s,o,Qc,a),f===u)break;u=f}u!==null&&o.stopPropagation()}else a0(i,s,o,null,a)}}function E0(i){return i=uu(i),M0(i)}var Qc=null;function M0(i){if(Qc=null,i=nr(i),i!==null){var s=h(i);if(s===null)i=null;else{var a=s.tag;if(a===13){if(i=d(s),i!==null)return i;i=null}else if(a===31){if(i=p(s),i!==null)return i;i=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null)}}return Qc=i,null}function Uv(i){switch(i){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(ow()){case k1:return 2;case E1:return 8;case Do:case cw:return 32;case M1:return 268435456;default:return 32}default:return 32}}var j0=!1,Bn=null,On=null,zn=null,Vl=new Map,$l=new Map,Hn=[],Z5="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 Pv(i,s){switch(i){case"focusin":case"focusout":Bn=null;break;case"dragenter":case"dragleave":On=null;break;case"mouseover":case"mouseout":zn=null;break;case"pointerover":case"pointerout":Vl.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":$l.delete(s.pointerId)}}function Wl(i,s,a,o,u,f){return i===null||i.nativeEvent!==f?(i={blockedOn:s,domEventName:a,eventSystemFlags:o,nativeEvent:f,targetContainers:[u]},s!==null&&(s=Vr(s),s!==null&&Hv(s)),i):(i.eventSystemFlags|=o,s=i.targetContainers,u!==null&&s.indexOf(u)===-1&&s.push(u),i)}function X5(i,s,a,o,u){switch(s){case"focusin":return Bn=Wl(Bn,i,s,a,o,u),!0;case"dragenter":return On=Wl(On,i,s,a,o,u),!0;case"mouseover":return zn=Wl(zn,i,s,a,o,u),!0;case"pointerover":var f=u.pointerId;return Vl.set(f,Wl(Vl.get(f)||null,i,s,a,o,u)),!0;case"gotpointercapture":return f=u.pointerId,$l.set(f,Wl($l.get(f)||null,i,s,a,o,u)),!0}return!1}function qv(i){var s=nr(i.target);if(s!==null){var a=h(s);if(a!==null){if(s=a.tag,s===13){if(s=d(a),s!==null){i.blockedOn=s,L1(i.priority,function(){Iv(a)});return}}else if(s===31){if(s=p(a),s!==null){i.blockedOn=s,L1(i.priority,function(){Iv(a)});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){i.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Jc(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var a=E0(i.nativeEvent);if(a===null){a=i.nativeEvent;var o=new a.constructor(a.type,a);hu=o,a.target.dispatchEvent(o),hu=null}else return s=Vr(a),s!==null&&Hv(s),i.blockedOn=a,!1;s.shift()}return!0}function Vv(i,s,a){Jc(i)&&a.delete(s)}function Q5(){j0=!1,Bn!==null&&Jc(Bn)&&(Bn=null),On!==null&&Jc(On)&&(On=null),zn!==null&&Jc(zn)&&(zn=null),Vl.forEach(Vv),$l.forEach(Vv)}function eh(i,s){i.blockedOn===s&&(i.blockedOn=null,j0||(j0=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Q5)))}var th=null;function $v(i){th!==i&&(th=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){th===i&&(th=null);for(var s=0;s<i.length;s+=3){var a=i[s],o=i[s+1],u=i[s+2];if(typeof o!="function"){if(M0(o||a)===null)continue;break}var f=Vr(a);f!==null&&(i.splice(s,3),s-=3,cd(f,{pending:!0,data:u,method:a.method,action:o},o,u))}}))}function Ra(i){function s(T){return eh(T,i)}Bn!==null&&eh(Bn,i),On!==null&&eh(On,i),zn!==null&&eh(zn,i),Vl.forEach(s),$l.forEach(s);for(var a=0;a<Hn.length;a++){var o=Hn[a];o.blockedOn===i&&(o.blockedOn=null)}for(;0<Hn.length&&(a=Hn[0],a.blockedOn===null);)qv(a),a.blockedOn===null&&Hn.shift();if(a=(i.ownerDocument||i).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var u=a[o],f=a[o+1],y=u[mi]||null;if(typeof f=="function")y||$v(a);else if(y){var C=null;if(f&&f.hasAttribute("formAction")){if(u=f,y=f[mi]||null)C=y.formAction;else if(M0(u)!==null)continue}else C=y.action;typeof C=="function"?a[o+1]=C:(a.splice(o,3),o-=3),$v(a)}}}function Wv(){function i(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(y){return u=y})},focusReset:"manual",scroll:"manual"})}function s(){u!==null&&(u(),u=null),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,u=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),u!==null&&(u(),u=null)}}}function T0(i){this._internalRoot=i}ih.prototype.render=T0.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(r(409));var a=s.current,o=Bi();Ov(a,o,i,s,null,null)},ih.prototype.unmount=T0.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;Ov(i.current,2,null,i,null,null),Uc(),s[qr]=null}};function ih(i){this._internalRoot=i}ih.prototype.unstable_scheduleHydration=function(i){if(i){var s=N1();i={blockedOn:null,target:i,priority:s};for(var a=0;a<Hn.length&&s!==0&&s<Hn[a].priority;a++);Hn.splice(a,0,i),a===0&&qv(i)}};var Fv=t.version;if(Fv!=="19.3.0")throw Error(r(527,Fv,"19.3.0"));_e.findDOMNode=function(i){var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=m(s),i=i!==null?v(i):null,i=i===null?null:i.stateNode,i};var J5={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:pe,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var sh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sh.isDisabled&&sh.supportsFiber)try{Ja=sh.inject(J5),Mi=sh}catch{}}return Kl.createRoot=function(i,s){if(!l(i))throw Error(r(299));var a=!1,o="",u=Bg,f=Og,y=zg;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(o=s.identifierPrefix),s.onUncaughtError!==void 0&&(u=s.onUncaughtError),s.onCaughtError!==void 0&&(f=s.onCaughtError),s.onRecoverableError!==void 0&&(y=s.onRecoverableError)),s=Lv(i,1,!1,null,null,a,o,null,u,f,y,Wv),i[qr]=s.current,r0(i),new T0(s)},Kl.hydrateRoot=function(i,s,a){if(!l(i))throw Error(r(299));var o=!1,u="",f=Bg,y=Og,C=zg,T=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(f=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(C=a.onRecoverableError),a.formState!==void 0&&(T=a.formState)),s=Lv(i,1,!0,s,a??null,o,u,T,f,y,C,Wv),s.context=Bv(null),a=s.current,o=Bi(),o=nu(o),u=wn(o),u.callback=null,bn(a,u,o),a=o,s.current.lanes=a,tl(s,a),ks(s),i[qr]=s.current,r0(i),new ih(s)},Kl.version="19.3.0",Kl}var l_;function bb(){if(l_)return N0.exports;l_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),N0.exports=wb(),N0.exports}var Cb=bb(),x=W2();const Hf=window.matchMedia("(prefers-color-scheme: dark)"),If=window.matchMedia("(prefers-reduced-motion: reduce)"),P3=e=>t=>(e.addEventListener("change",t),()=>e.removeEventListener("change",t));function F2(){return x.useSyncExternalStore(P3(Hf),()=>Hf.matches)}function Ka(){return x.useSyncExternalStore(P3(If),()=>If.matches)}const Co=()=>Hf.matches,o_=()=>If.matches,kb=e=>({text:e?[242,242,242]:[20,20,20],secondary:e?"#9a9a9a":"#6b6b6b",background:e?"#0a0a0a":"#ffffff"}),Ah=[{id:"black",label:"Black",hex:"#2B2B2B"},{id:"brown",label:"Brown",hex:"#936439"},{id:"red",label:"Red",hex:"#FF263C"},{id:"orange",label:"Orange",hex:"#FF6700"},{id:"yellow",label:"Yellow",hex:"#FF9800"},{id:"green",label:"Green",hex:"#00C972"},{id:"cyan",label:"Cyan",hex:"#00BCA6"},{id:"blue",label:"Blue",hex:"#1084FE"},{id:"violet",label:"Violet",hex:"#9159FE"},{id:"magenta",label:"Magenta",hex:"#FF309B"},{id:"gray",label:"Gray",hex:"#777777"}],q3=["blob","pebble","squircle","tablet","wedge","hex","cloud","teardrop"];function ko(e){return(Ah.find(t=>t.id===e)??Ah[7]).hex}function Eb(e,t){const n=parseInt(e.slice(1),16);return`rgba(${n>>16&255}, ${n>>8&255}, ${n&255}, ${t})`}const Mb=[["path",{d:"M12 6.528V3a1 1 0 0 1 1-1h0"}],["path",{d:"M18.237 21A15 15 0 0 0 22 11a6 6 0 0 0-10-4.472A6 6 0 0 0 2 11a15.1 15.1 0 0 0 3.763 10 3 3 0 0 0 3.648.648 5.5 5.5 0 0 1 5.178 0A3 3 0 0 0 18.237 21"}]];const jb=[["path",{d:"M12 5v14"}],["path",{d:"m19 12-7 7-7-7"}]];const Tb=[["path",{d:"m12 19-7-7 7-7"}],["path",{d:"M19 12H5"}]];const Rb=[["path",{d:"M17 12H3"}],["path",{d:"m11 18 6-6-6-6"}],["path",{d:"M21 5v14"}]];const Db=[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]];const Ab=[["path",{d:"m5 12 7-7 7 7"}],["path",{d:"M12 19V5"}]];const Nb=[["path",{d:"M2 10v3"}],["path",{d:"M6 6v11"}],["path",{d:"M10 3v18"}],["path",{d:"M14 8v7"}],["path",{d:"M18 5v13"}],["path",{d:"M22 10v3"}]];const Lb=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"}],["path",{d:"m16 9-5.5 5.5L8 12"}]];const Bb=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0"}],["path",{d:"M11.68 2.009A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673c-.824-.85-1.678-1.731-2.21-3.348"}],["circle",{cx:"18",cy:"5",r:"3"}]];const Ob=[["path",{d:"M12 5v16"}],["path",{d:"M16 13h2"}],["path",{d:"M16 9h2"}],["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"}],["path",{d:"M6 13h2"}],["path",{d:"M6 9h2"}]];const zb=[["path",{d:"M12 5v16"}],["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"}]];const Hb=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20"}]];const Ib=[["path",{d:"M8 2v3"}],["path",{d:"M16 2v3"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}],["path",{d:"M3 9h18"}]];const Ub=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}],["path",{d:"M18 17V9"}],["path",{d:"M13 17V5"}],["path",{d:"M8 17v-3"}]];const Pb=[["path",{d:"M20 6 9 17l-5-5"}]];const qb=[["path",{d:"m6 9 6 6 6-6"}]];const Vb=[["path",{d:"m15 18-6-6 6-6"}]];const $b=[["path",{d:"m18 15-6-6-6 6"}]];const Wb=[["path",{d:"m9 18 6-6-6-6"}]];const Fb=[["path",{d:"m11 17-5-5 5-5"}],["path",{d:"m18 17-5-5 5-5"}]];const Kb=[["path",{d:"m6 17 5-5-5-5"}],["path",{d:"m13 17 5-5-5-5"}]];const Yb=[["path",{d:"m7 15 5 5 5-5"}],["path",{d:"m7 9 5-5 5 5"}]];const c_=[["circle",{cx:"12",cy:"12",r:"10"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16"}]];const Gb=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 8v8"}],["path",{d:"m8 12 4 4 4-4"}]];const h_=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m16 9-5.5 5.5L8 12"}]];const Zb=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7"}]];const Xb=[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"12",cy:"12",r:"10"}]];const Qb=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M17 12h.01"}],["path",{d:"M12 12h.01"}],["path",{d:"M7 12h.01"}]];const Jb=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M8 12h8"}]];const e6=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z"}],["circle",{cx:"12",cy:"12",r:"10"}]];const t6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M8 12h8"}],["path",{d:"M12 8v8"}]];const i6=[["circle",{cx:"12",cy:"12",r:"10"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1"}]];const s6=[["circle",{cx:"12",cy:"12",r:"10"}],["circle",{cx:"12",cy:"10",r:"3"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662"}]];const u_=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m15 9-6 6"}],["path",{d:"m9 9 6 6"}]];const V3=[["circle",{cx:"12",cy:"12",r:"10"}]];const n6=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4"}],["path",{d:"M21 14H11"}],["path",{d:"m15 10-4 4 4 4"}]];const r6=[["path",{d:"M11 14h10"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344"}],["path",{d:"m17 18 4-4-4-4"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1"}]];const d_=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}]];const a6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]];const l6=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"}]];const o6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z"}]];const f_=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]];const c6=[["path",{d:"M12 20v2"}],["path",{d:"M12 2v2"}],["path",{d:"M17 20v2"}],["path",{d:"M17 2v2"}],["path",{d:"M2 12h2"}],["path",{d:"M2 17h2"}],["path",{d:"M2 7h2"}],["path",{d:"M20 12h2"}],["path",{d:"M20 17h2"}],["path",{d:"M20 7h2"}],["path",{d:"M7 20v2"}],["path",{d:"M7 2v2"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1"}]];const h6=[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"19",cy:"12",r:"1"}],["circle",{cx:"5",cy:"12",r:"1"}]];const u6=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]];const d6=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}],["circle",{cx:"12",cy:"12",r:"3"}]];const f6=[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M8 12v-1"}],["path",{d:"M8 18v-2"}],["path",{d:"M8 7V6"}],["circle",{cx:"8",cy:"20",r:"2"}]];const p6=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M9 15h6"}],["path",{d:"M12 18v-6"}]];const H0=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 9H8"}],["path",{d:"M16 13H8"}],["path",{d:"M16 17H8"}]];const g6=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}]];const m6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M7 3v18"}],["path",{d:"M3 7.5h4"}],["path",{d:"M3 12h18"}],["path",{d:"M3 16.5h4"}],["path",{d:"M17 3v18"}],["path",{d:"M17 7.5h4"}],["path",{d:"M17 16.5h4"}]];const v6=[["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"}]];const _6=[["path",{d:"m12 14 4-4"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0"}]];const y6=[["path",{d:"M15 6a9 9 0 0 0-9 9V3"}],["circle",{cx:"18",cy:"6",r:"3"}],["circle",{cx:"6",cy:"18",r:"3"}]];const S6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}],["path",{d:"M2 12h20"}]];const x6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M3 15h18"}],["path",{d:"M9 3v18"}],["path",{d:"M15 3v18"}]];const w6=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9"}],["path",{d:"m18 15 4-4"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5"}]];const b6=[["path",{d:"M18 12.5V10a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4"}],["path",{d:"M14 11V9a2 2 0 1 0-4 0v2"}],["path",{d:"M10 10.5V5a2 2 0 1 0-4 0v9"}],["path",{d:"m7 15-1.76-1.76a2 2 0 0 0-2.83 2.82l3.6 3.6C7.5 21.14 9.2 22 12 22h2a8 8 0 0 0 8-8V7a2 2 0 1 0-4 0v5"}]];const C6=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"}]];const k6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}],["circle",{cx:"9",cy:"9",r:"2"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}]];const E6=[["path",{d:"m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16"}],["path",{d:"M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2"}],["circle",{cx:"13",cy:"7",r:"1",fill:"currentColor"}],["rect",{x:"8",y:"2",width:"14",height:"14",rx:"2"}]];const M6=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}],["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"}]];const j6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 16v-4"}],["path",{d:"M12 8h.01"}]];const T6=[["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"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor"}]];const R6=[["path",{d:"m2 21 9.6-9.6"}],["path",{d:"m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19"}],["circle",{cx:"15.5",cy:"7.5",r:"5.5"}]];const D6=[["path",{d:"M10 8h.01"}],["path",{d:"M12 12h.01"}],["path",{d:"M14 8h.01"}],["path",{d:"M16 12h.01"}],["path",{d:"M18 8h.01"}],["path",{d:"M6 8h.01"}],["path",{d:"M7 16h10"}],["path",{d:"M8 12h.01"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}]];const A6=[["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"}],["path",{d:"M20.054 15.987H3.946"}]];const N6=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1"}]];const L6=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}]];const B6=[["path",{d:"M13 5h8"}],["path",{d:"M13 12h8"}],["path",{d:"M13 19h8"}],["path",{d:"m3 17 2 2 4-4"}],["path",{d:"m3 7 2 2 4-4"}]];const O6=[["path",{d:"M3 5h.01"}],["path",{d:"M3 12h.01"}],["path",{d:"M3 19h.01"}],["path",{d:"M8 5h13"}],["path",{d:"M8 12h13"}],["path",{d:"M8 19h13"}]];const z6=[["path",{d:"m16 17 5-5-5-5"}],["path",{d:"M21 12H9"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}]];const H6=[["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"}],["path",{d:"M7 11h10"}],["path",{d:"M7 15h6"}],["path",{d:"M7 7h8"}]];const I6=[["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"}]];const U6=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1"}]];const p_=[["path",{d:"M12 19v3"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2"}],["path",{d:"m2 2 20 20"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12"}]];const g_=[["path",{d:"M12 19v3"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3"}]];const P6=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const q6=[["path",{d:"M12 17v4"}],["path",{d:"M22 12.307V15a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8.693"}],["path",{d:"M8 21h8"}],["circle",{cx:"19",cy:"6",r:"3"}]];const V6=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8"}],["path",{d:"M10 19v-3.96 3.15"}],["path",{d:"M7 19h5"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2"}]];const m_=[["path",{d:"m14.5 12.5-5-5"}],["path",{d:"m9.5 12.5 5-5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}],["path",{d:"M12 17v4"}],["path",{d:"M8 21h8"}]];const v_=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21"}]];const $6=[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"}]];const W6=[["path",{d:"M14 4.1 12 6"}],["path",{d:"m5.1 8-2.9-.8"}],["path",{d:"m6 12-1.9 2"}],["path",{d:"M7.2 2.2 8 5.1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z"}]];const F6=[["path",{d:"M9 18V5l12-2v13"}],["circle",{cx:"6",cy:"18",r:"3"}],["circle",{cx:"18",cy:"16",r:"3"}]];const K6=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"}],["path",{d:"M12 12V8"}]];const Y6=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"}],["path",{d:"M12 22V12"}],["polyline",{points:"3.29 7 12 12 20.71 7"}],["path",{d:"m7.5 4.27 9 5.15"}]];const G6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M9 3v18"}]];const Z6=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}],["path",{d:"m15 5 4 4"}]];const X6=[["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"}],["path",{d:"M22 2 2 22"}],["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"}]];const Q6=[["path",{d:"M12 17v5"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89"}],["path",{d:"m2 2 20 20"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11"}]];const __=[["path",{d:"M12 17v5"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"}]];const J6=[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]];const eC=[["path",{d:"M22 14a8 8 0 0 1-8 8"}],["path",{d:"M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2"}],["path",{d:"M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1"}],["path",{d:"M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"}]];const tC=[["path",{d:"M12 2v10"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04"}]];const iC=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3"}],["path",{d:"M21 21v.01"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7"}],["path",{d:"M3 12h.01"}],["path",{d:"M12 3h.01"}],["path",{d:"M12 16v.01"}],["path",{d:"M16 12h1"}],["path",{d:"M21 12v.01"}],["path",{d:"M12 21v-1"}]];const sC=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]];const nC=[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4"}],["path",{d:"m9 17-5-5 5-5"}]];const rC=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}],["path",{d:"M12 7v5l4 2"}]];const aC=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}]];const y_=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}]];const lC=[["path",{d:"M15 12h-5"}],["path",{d:"M15 8h-5"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4"}],["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"}]];const oC=[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]];const ah=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18"}]];const cC=[["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"}],["circle",{cx:"12",cy:"12",r:"3"}]];const hC=[["path",{d:"M12 2v13"}],["path",{d:"m16 6-4-4-4 4"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}]];const uC=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}],["path",{d:"m9 12 2 2 4-4"}]];const dC=[["path",{d:"M10 5H3"}],["path",{d:"M12 19H3"}],["path",{d:"M14 3v4"}],["path",{d:"M16 17v4"}],["path",{d:"M21 12h-9"}],["path",{d:"M21 19h-5"}],["path",{d:"M21 5h-7"}],["path",{d:"M8 10v4"}],["path",{d:"M8 12H3"}]];const fC=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2"}],["path",{d:"M12 18h.01"}]];const pC=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"}],["path",{d:"M20 2v4"}],["path",{d:"M22 4h-4"}],["circle",{cx:"4",cy:"20",r:"2"}]];const gC=[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6"}],["path",{d:"m21 3-9 9"}],["path",{d:"M15 3h6v6"}]];const mC=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}],["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"}]];const vC=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}]];const _C=[["path",{d:"M12 19h8"}],["path",{d:"m4 17 6-6-6-6"}]];const yC=[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]];const I0=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}],["path",{d:"M12 9v4"}],["path",{d:"M12 17h.01"}]];const SC=[["path",{d:"m16 11 2 2 4-4"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}],["circle",{cx:"9",cy:"7",r:"4"}]];const xC=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}],["circle",{cx:"9",cy:"7",r:"4"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11"}]];const S_=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}],["circle",{cx:"12",cy:"7",r:"4"}]];const wC=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}],["circle",{cx:"9",cy:"7",r:"4"}]];const x_=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"}],["path",{d:"M16 9a5 5 0 0 1 0 6"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728"}]];const bC=[["path",{d:"M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z"}],["path",{d:"m16.5 14.5 5-5"}],["path",{d:"m16.5 9.5 5 5"}]];const CC=[["path",{d:"m10.586 5.414-5.172 5.172"}],["path",{d:"m18.586 13.414-5.172 5.172"}],["path",{d:"M6 12h12"}],["circle",{cx:"12",cy:"20",r:"2"}],["circle",{cx:"12",cy:"4",r:"2"}],["circle",{cx:"20",cy:"12",r:"2"}],["circle",{cx:"4",cy:"12",r:"2"}]];const kC=[["path",{d:"M12 20h.01"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764"}],["path",{d:"m2 2 20 20"}]];const EC=[["path",{d:"M12 20h.01"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0"}]];const MC=[["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"}]];const jC=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const TC=[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z"}]],RC={"arrow.clockwise":y_,"arrow.counterclockwise":aC,"arrow.down":jb,"arrow.down.circle":Gb,"arrow.down.right.and.arrow.up.left":P6,"arrow.left":Tb,"arrow.right":Db,"arrow.right.doc.on.clipboard":n6,"arrow.up.doc.on.clipboard":r6,"arrow.right.to.line":Rb,"arrow.triangle.2.circlepath":sC,"arrow.triangle.branch":y6,"arrow.up":Ab,"arrow.up.right.square":gC,"arrowshape.turn.up.left":nC,"apple.logo":Mb,"bell.badge":Bb,bolt:TC,book:zb,"book.closed":Hb,"book.pages":Ob,"bubble.left":I6,"bubble.left.and.bubble.right":U6,calendar:Ib,"chart.bar":Ub,checklist:B6,checkmark:Pb,"checkmark.circle":h_,"checkmark.circle.fill":h_,"checkmark.seal":Lb,"chevron.down":qb,"chevron.left":Vb,"chevron.left.2":Fb,"chevron.right":Wb,"chevron.right.2":Kb,"chevron.up":$b,"chevron.up.chevron.down":Yb,circle:V3,"circle.dotted":Zb,clock:a6,"clock.arrow.circlepath":rC,cloud:l6,cpu:c6,"cursorarrow.motionlines":W6,desktopcomputer:v_,"desktopcomputer.trianglebadge.exclamationmark":m_,display:v_,"display.2":V6,"display.trianglebadge.exclamationmark":m_,doc:g6,"doc.badge.plus":p6,"doc.on.clipboard":d_,"doc.on.clipboard.fill":d_,"doc.on.doc":f_,"doc.plaintext":H0,"doc.richtext":H0,"doc.text":H0,"doc.zipper":f6,ellipsis:h6,"ellipsis.circle":Qb,exclamationmark:I0,"exclamationmark.circle":c_,"exclamationmark.circle.fill":c_,"exclamationmark.triangle":I0,"exclamationmark.triangle.fill":I0,eye:d6,"eye.slash":u6,film:m6,folder:v6,"gauge.with.dots.needle.33percent":_6,gearshape:cC,globe:S6,hammer:w6,"hand.point.up.left":eC,"hand.raised":C6,"hand.raised.slash":b6,"info.circle":j6,iphone:fC,key:R6,"key.fill":T6,"keyboard.chevron.compact.down":D6,laptopcomputer:A6,link:L6,"list.bullet":O6,"list.bullet.rectangle":lC,"lock.display":q6,"lock.shield":uC,macmini:ah,"macpro.gen3":ah,macstudio:ah,magnifyingglass:oC,mic:g_,"mic.fill":g_,"mic.slash":p_,"mic.slash.fill":p_,"minus.circle":Jb,"music.note":F6,network:K6,pencil:Z6,person:S_,"person.2":wC,"person.crop.circle":s6,"person.crop.circle.badge.checkmark":SC,"person.crop.circle.badge.plus":xC,"person.fill":S_,"phone.down.fill":X6,photo:k6,"photo.on.rectangle":E6,pin:__,"pin.fill":__,"pin.slash":Q6,"play.circle":e6,plus:J6,"plus.circle":t6,"point.3.connected.trianglepath.dotted":CC,power:tC,qrcode:iC,"record.circle":Xb,"rectangle.and.hand.point.up.left":$6,"rectangle.portrait.and.arrow.right":z6,"rotate.right":y_,safari:o6,"server.rack":ah,shippingbox:Y6,"sidebar.left":G6,"slider.horizontal.3":dC,sparkles:pC,"speaker.slash.fill":bC,"speaker.wave.2":x_,"speaker.wave.2.fill":x_,"square.and.arrow.up":hC,"square.and.pencil":mC,"square.grid.2x2":N6,"square.grid.3x3":x6,"square.on.square":f_,"stop.circle":i6,"stop.fill":vC,terminal:_C,"text.bubble":H6,tray:M6,trash:yC,waveform:Nb,wifi:EC,"wifi.slash":kC,"wrench.and.screwdriver":MC,xmark:jC,"xmark.circle":u_,"xmark.circle.fill":u_},w_=new Map;function DC(e){const t=w_.get(e);if(t!==void 0)return t;const r=(RC[e]??V3).map(([l,h])=>`<${l} ${Object.entries(h).filter(([,d])=>d!==void 0).map(([d,p])=>`${d}="${p}"`).join(" ")}/>`).join("");return w_.set(e,r),r}let xh=null;const Nh=new Set;window.codync?.platform==="darwin"?fetch("./symbols/manifest.json").then(e=>e.ok?e.json():{}).then(e=>{xh=e;for(const t of Nh)t()}).catch(()=>{xh={};for(const e of Nh)e()}):xh={};function AC(){return x.useSyncExternalStore(e=>(Nh.add(e),()=>{Nh.delete(e)}),()=>xh)}function ae({name:e,size:t,weight:n="regular",color:r,style:l,className:h,scaled:d=!0,title:p}){const m=AC()?.[e],v=d?`${t}px * var(--scale)`:`${t}px`;if(m){const S=`url("./symbols/${e}.${n}.png")`;return c.jsx("span",{className:h,title:p,"aria-hidden":p?void 0:!0,style:{display:"inline-block",flex:"none",width:`calc(${m.w} * ${v})`,height:`calc(${m.h} * ${v})`,backgroundColor:r??"currentColor",WebkitMaskImage:S,maskImage:S,WebkitMaskSize:"100% 100%",maskSize:"100% 100%",WebkitMaskRepeat:"no-repeat",...l}})}const _={light:1.5,regular:1.75,medium:2,semibold:2.25,bold:2.5,black:2.75}[n];return c.jsx("svg",{className:h,"aria-hidden":p?void 0:!0,viewBox:"0 0 24 24",fill:"none",stroke:r??"currentColor",strokeWidth:_,strokeLinecap:"round",strokeLinejoin:"round",style:{width:`calc(1.2 * ${v})`,height:`calc(1.2 * ${v})`,flex:"none",...l},dangerouslySetInnerHTML:{__html:(p?`<title>${p}</title>`:"")+DC(e)}})}function NC(e,t,n){const r=new Path2D;let l=0;switch(e){case"pebble":r.ellipse(t/2,n/2,t/2,n*.4,0,0,Math.PI*2);break;case"squircle":r.roundRect(t*.04,n*.04,t*.92,n*.92,t*.3);break;case"tablet":r.roundRect(t*.14,0,t*.72,n,t*.22);break;case"wedge":r.moveTo(t*.5,n*.04),r.quadraticCurveTo(t*.9,n*.4,t*.98,n*.86),r.quadraticCurveTo(t*.5,n*1.04,t*.02,n*.86),r.quadraticCurveTo(t*.1,n*.4,t*.5,n*.04);break;case"hex":for(let h=0;h<6;h++){const d=h*Math.PI/3-Math.PI/2,p=t/2+Math.cos(d)*t*.49,g=n/2+Math.sin(d)*n*.49;h===0?r.moveTo(p,g):r.lineTo(p,g)}r.closePath(),l=t*.08;break;case"cloud":r.ellipse(t*.275,n*.575,t*.275,n*.275,0,0,Math.PI*2),r.moveTo(t,n*.575),r.ellipse(t*.725,n*.575,t*.275,n*.275,0,0,Math.PI*2),r.moveTo(t*.82,n*.4),r.ellipse(t*.5,n*.4,t*.32,n*.32,0,0,Math.PI*2),r.roundRect(t*.1,n*.5,t*.8,n*.35,t*.15);break;case"teardrop":r.moveTo(t*.5,0),r.bezierCurveTo(t*.62,n*.2,t*.94,n*.38,t*.94,n*.62),r.arc(t*.5,n*.62,t*.44,0,Math.PI,!1),r.bezierCurveTo(t*.06,n*.38,t*.38,n*.2,t*.5,0);break;default:{for(let d=0;d<=64;d++){const p=d/64*2*Math.PI,g=.46+.035*Math.sin(p*3+.6),m=t/2+Math.cos(p)*t*g,v=n/2+Math.sin(p)*n*g;d===0?r.moveTo(m,v):r.lineTo(m,v)}r.closePath()}}return{path:r,stroke:l}}const lh=document.createElement("canvas").getContext("2d"),b_=new Map;function LC(e,t,n){const r=`${e}|${t}|${n}`,l=b_.get(r);if(l)return l;const{path:h,stroke:d}=NC(e,t,t),p=t/n,g=[];lh.lineWidth=d,lh.lineJoin="round";for(let m=0;m<n;m++)for(let v=0;v<n;v++){const _=(v+.5)*p,S=(m+.5)*p;(lh.isPointInPath(h,_,S,"nonzero")||d>0&&lh.isPointInStroke(h,_,S))&&g.push({row:m,col:v,x:_,y:S})}return b_.set(r,g),g}const nn=x.memo(function({shape:t,color:n,tint:r,size:l=40,mood:h="idle",style:d}){const p=x.useRef(null),g=F2(),m=Ka(),v=r??ko(n);return x.useEffect(()=>{const _=p.current;if(!_)return;const S=window.devicePixelRatio||1;_.width=Math.round(l*S),_.height=Math.round(l*S);const w=_.getContext("2d"),b=h==="idle"||m;let k=0;const E=j=>{w.setTransform(S,0,0,S,0,0),w.clearRect(0,0,l,l),K2(w,{shape:t,fill:v,size:l,mood:h,dark:g,t:b?0:j/1e3%3600,still:b}),b||(k=requestAnimationFrame(E))};return E(performance.now()),()=>cancelAnimationFrame(k)},[t,v,l,h,g,m]),c.jsx("canvas",{ref:p,"aria-hidden":!0,style:{width:l,height:l,display:"block",flex:"none",...d}})});function K2(e,{shape:t,fill:n,size:r,mood:l,dark:h,t:d,still:p}){const g=r<18?7:r<28?9:13,m=g===7?[2,4]:g===9?[3,6]:[4,8],v=g===13?[4,5,6]:g===9?[3,4]:[2,3],_=r/g,S=LC(t,r,g),[w,b,k]=kb(h).text,E=parseInt(n.slice(1),16),[j,V,A]=[E>>16&255,E>>8&255,E&255],z=l==="working"?Math.round(Math.sin(d*2*Math.PI/3.2)*1.4):0,D=!p&&d/4.7%1<.035?v.slice(-1):v,I=m.map(L=>L+z),q=r/2,U=l==="working"?d*1.4:-.7,Y=Math.sin(U)*.8,$=.55,M=Math.cos(U)*.5+.6,N=Math.hypot(Y,$,M);for(const L of S){if(I.includes(L.col)&&D.includes(L.row))continue;const O=(L.x-q)/q,P=(q-L.y)/q,te=Math.sqrt(Math.max(.2,1-O*O-P*P)),Q=Math.hypot(O,P,te);let ce=.3+.7*Math.max(0,(O*Y+P*$+te*M)/(Q*N));if(l==="needsInput"){const Ce=.5+.5*Math.sin(Math.hypot(O,P)*9-d*5);ce*=.6+.4*Ce}const re=_*.42*(.55+.45*ce),de=g<13?.4+.4*ce:.2+.4*Math.min(1,ce/.7);e.beginPath(),e.arc(L.x,L.y,re,0,Math.PI*2),e.fillStyle=`rgba(${w},${b},${k},${de})`,e.fill(),ce>.6&&(e.fillStyle=`rgba(${j},${V},${A},${(ce-.6)/.4})`,e.fill())}}function $3(e,t=!0){return t?ln(e)?"needsInput":Jn(e)?"working":"idle":"idle"}function Ui({bot:e,size:t=40,animated:n=!0}){return c.jsx(nn,{shape:e.avatarShape,color:e.avatarColor,size:t,mood:$3(e,n)})}function Eo({members:e,size:t=40,animated:n=!0}){const r=(h,d,p)=>c.jsx("div",{style:{position:"absolute",...p},children:c.jsx(Ui,{bot:h,size:d,animated:n})},h.id);let l;switch(e.length){case 0:l=c.jsx("div",{style:{display:"grid",placeItems:"center",width:"100%",height:"100%",color:"var(--secondary)"},children:c.jsx(ae,{name:"person.2",size:t*.4})});break;case 1:l=c.jsx(Ui,{bot:e[0],size:t,animated:n});break;case 2:l=[r(e[1],t*.66,{top:0,right:0}),r(e[0],t*.66,{bottom:0,left:0})];break;case 3:l=[r(e[0],t*.55,{top:0,left:(t-t*.55)/2}),r(e[1],t*.55,{bottom:0,left:0}),r(e[2],t*.55,{bottom:0,right:0})];break;default:l=[r(e[0],t*.5,{top:0,left:0}),r(e[1],t*.5,{top:0,right:0}),r(e[2],t*.5,{bottom:0,left:0}),e.length===4?r(e[3],t*.5,{bottom:0,right:0}):c.jsxs("div",{style:{position:"absolute",right:0,bottom:0,width:t*.5,height:t*.5,display:"grid",placeItems:"center",fontSize:t*.24,fontWeight:700,color:"var(--secondary)",fontFamily:"ui-rounded, var(--font)"},children:["+",e.length-3]},"more")]}return c.jsx("div",{"aria-hidden":!0,style:{position:"relative",width:t,height:t,flex:"none"},children:l})}function BC({bot:e,members:t=[],size:n=44}){return c.jsxs("div",{style:{position:"relative",width:n,height:n,flex:"none"},children:[At(e)?c.jsx(Eo,{members:t,size:n}):c.jsx(Ui,{bot:e,size:n}),ln(e)?c.jsx("div",{style:{position:"absolute",right:0,bottom:0,width:n*.36,height:n*.36,borderRadius:"50%",background:"var(--warning)",boxShadow:"0 0 0 2px var(--background)",display:"grid",placeItems:"center",color:"#fff"},children:c.jsx(ae,{name:"exclamationmark",size:n*.2,weight:"black",scaled:!1})}):e.unread>0?c.jsx("div",{style:{position:"absolute",right:0,bottom:0,width:n*.28,height:n*.28,borderRadius:"50%",background:"var(--accent-fill)",boxShadow:"0 0 0 2px var(--background)"}}):null]})}const OC={largeTitle:26,title:22,title2:17,title3:15,headline:13,body:13,callout:12,subheadline:11,footnote:10,caption:10,caption2:10,compactBody:12,compactSecondary:11},Fh=e=>`calc(${e}px * var(--scale))`,zC={light:300,regular:400,medium:500,semibold:600,bold:700,black:900};function B(e,t,n){const r=typeof e=="number"?e:OC[e],l=t??(e==="headline"?"bold":"regular");return{fontSize:Fh(r),fontWeight:zC[l],...n==="monospaced"?{fontFamily:"var(--mono)"}:n==="rounded"?{fontFamily:"ui-rounded, var(--font)"}:{}}}var Kh=U3();function er(e,t=300,n=!0){const[r,l]=x.useState(e),[h,d]=x.useState(e&&!n);return x.useLayoutEffect(()=>{if(o_()){l(e),d(e);return}if(e){l(!0);let g=0;const m=requestAnimationFrame(()=>{g=requestAnimationFrame(()=>d(!0))});return()=>{cancelAnimationFrame(m),cancelAnimationFrame(g)}}d(!1);const p=setTimeout(()=>l(!1),o_()?0:t);return()=>clearTimeout(p)},[e,t]),{mounted:r,shown:h}}const W3=x.createContext(()=>{}),ss=()=>x.useContext(W3),Yl=[];let HC=0;function Y2(e,t){const n=x.useRef(t);n.current=t,x.useEffect(()=>{if(!e)return;const r=++HC;Yl.push(r);const l=h=>{h.key==="Escape"&&Yl[Yl.length-1]===r&&(h.preventDefault(),h.stopPropagation(),n.current())};return window.addEventListener("keydown",l,!0),()=>{window.removeEventListener("keydown",l,!0),Yl.splice(Yl.indexOf(r),1)}},[e])}function $t({open:e,onClose:t,width:n,height:r,children:l}){const{mounted:h,shown:d}=er(e),p=x.useRef(l);return e&&(p.current=l),Y2(e,t),h?Kh.createPortal(c.jsx(W3.Provider,{value:t,children:c.jsxs("div",{className:`modal-card ${d?"shown":""}`,role:"dialog","aria-modal":!0,children:[c.jsx("div",{className:"modal-dim"}),c.jsx("div",{className:"modal-content",style:{width:n,height:r,maxWidth:"calc(100vw - 48px)",maxHeight:"calc(100vh - 48px)"},children:e?l:p.current})]})}),document.body):null}function ts({open:e,title:t,message:n,actions:r,cancel:l="Cancel",onClose:h}){const{mounted:d,shown:p}=er(e,120),g=x.useRef({title:t,message:n,actions:r});if(e&&(g.current={title:t,message:n,actions:r}),Y2(e&&l!==null,h),!d)return null;const m=g.current;return Kh.createPortal(c.jsxs("div",{className:`dialog ${p?"shown":""}`,role:"alertdialog","aria-modal":!0,children:[c.jsx("div",{className:"dialog-dim",onClick:()=>l!==null&&h()}),c.jsxs("div",{className:"dialog-card",children:[c.jsxs("div",{className:"dialog-text",children:[c.jsx("div",{style:B("headline"),children:m.title}),m.message?c.jsx("div",{style:{...B("compactSecondary"),color:"var(--secondary)"},children:m.message}):null]}),c.jsxs("div",{className:"dialog-buttons",children:[m.actions.map(v=>c.jsx("button",{className:`dialog-button ${v.destructive?"destructive":"prominent"}`,onClick:()=>{h(),v.action()},children:v.title},v.title)),l!==null?c.jsx("button",{className:"dialog-button",onClick:h,children:l}):null]})]})]}),document.body)}function IC({pick:e,dismiss:t,size:n=26}){return c.jsx("div",{style:{display:"flex"},children:e.emoji.map(r=>{const l=e.chosen.includes(r);return c.jsx("button",{className:`reaction-button ${l?"chosen":""}`,style:{width:n,height:n,borderRadius:n*.28},title:l?`Remove ${r}`:`React ${r}`,"aria-label":l?`Remove reaction ${r}`:`React ${r}`,onClick:()=>{t?.(),e.toggle(r)},children:c.jsx("span",{style:B(14),children:r})},r)})})}function UC({items:e,reactions:t,dismiss:n,maxHeight:r}){const[l,h]=x.useState(-1);return x.useEffect(()=>{const d=p=>{p.key==="ArrowDown"||p.key==="ArrowUp"?(p.preventDefault(),h(g=>(g+(p.key==="ArrowDown"?1:-1)+e.length)%e.length)):p.key==="Enter"&&l>=0&&(p.preventDefault(),n(),e[l]?.action())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,l,n]),c.jsxs("div",{className:"menu-panel",style:{maxHeight:r},children:[t?c.jsx("div",{style:{paddingBottom:e.length?4:0},children:c.jsx(IC,{pick:t,dismiss:n})}):null,e.map((d,p)=>c.jsxs("div",{children:[d.divider?c.jsx("div",{className:"menu-divider"}):null,c.jsxs("button",{className:`menu-row ${d.destructive?"destructive":""} ${l===p?"highlight":""}`,title:d.title,onMouseEnter:()=>h(p),onClick:()=>{n(),d.action()},children:[d.icon?c.jsx("span",{className:"menu-icon",children:c.jsx(ae,{name:d.icon,size:12})}):null,c.jsx("span",{className:"menu-title",children:d.title}),d.selected!==void 0?c.jsx("span",{style:{opacity:d.selected?1:0,display:"flex"},children:c.jsx(ae,{name:"checkmark",size:10,weight:"semibold"})}):null]})]},`${d.title}-${p}`))]})}function Pa({open:e,onClose:t,anchor:n,point:r,items:l,reactions:h}){const{mounted:d,shown:p}=er(e,120),[g,m]=x.useState(null),v=x.useRef([]);if(e&&(v.current=l()),x.useLayoutEffect(()=>{e&&(r?m(new DOMRect(r.x,r.y,0,0)):n?.current&&m(n.current.getBoundingClientRect()))},[e,r,n]),Y2(e,t),!d||!g)return null;const _=window.innerWidth,S=window.innerHeight,w=Math.max(0,S-g.bottom-14),b=Math.max(0,g.top-14),k=w>=b,E=g.left+g.width/2<_*.6,j=Math.min(320,_-16),V=Math.max(8,_-j-8),A={position:"absolute",[k?"top":"bottom"]:k?g.bottom+6:S-g.top+6,...E?{left:Math.min(Math.max(8,g.left),V)}:{right:Math.min(Math.max(8,_-g.right),V)},maxWidth:j,transformOrigin:`${k?"top":"bottom"} ${E?"left":"right"}`};return Kh.createPortal(c.jsx("div",{className:`anchored ${p?"shown":""}`,onMouseDown:z=>z.target===z.currentTarget&&t(),onContextMenu:z=>{z.preventDefault(),t()},children:c.jsx("div",{className:"anchored-panel",style:A,children:c.jsx(UC,{items:v.current,reactions:h,dismiss:t,maxHeight:Math.min(420,k?w:b)})})}),document.body)}function PC(){const[e,t]=x.useState(null);return{point:e,open:e!==null,onContextMenu:n=>{n.preventDefault(),n.stopPropagation(),t({x:n.clientX,y:n.clientY})},close:()=>t(null)}}function Lt({title:e,trailing:t}){const n=ss();return c.jsxs("div",{className:"modal-header",children:[c.jsx("div",{style:{...B("compactBody","semibold"),flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),t,c.jsx(F3,{title:"Close",icon:"xmark",onClick:n})]})}function F3({title:e,icon:t,onClick:n,selected:r=!1,size:l=28,disabled:h,className:d,buttonRef:p}){return c.jsx("button",{ref:p,className:`icon-button ${r?"selected":""} ${d??""}`,style:{width:l,height:l,borderRadius:l*.28},title:e,"aria-label":e,disabled:h,onClick:n,children:c.jsx(ae,{name:t,size:l/2,weight:"medium"})})}const ke=F3;function Fe({kind:e="primary",children:t,onClick:n,disabled:r,style:l,className:h,title:d}){return c.jsx("button",{className:`styled-button ${e} ${h??""}`,onClick:n,disabled:r,style:l,title:d,children:t})}function et({size:e=14}){const t=Math.max(1.5,e/9),n=(e-t)/2,r=2*Math.PI*n;return c.jsx("svg",{className:"spinner",width:e,height:e,viewBox:`0 0 ${e} ${e}`,"aria-label":"Loading",role:"img",children:c.jsx("circle",{cx:e/2,cy:e/2,r:n,fill:"none",stroke:"var(--secondary)",strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${r*.7} ${r}`})})}function rn({on:e,onChange:t,children:n,disabled:r,style:l}){return c.jsxs("button",{className:"switch",role:"switch","aria-checked":e,disabled:r,onClick:()=>t(!e),style:l,children:[n!==void 0?c.jsx("span",{className:"switch-label",children:n}):null,c.jsx("span",{className:`switch-track ${e?"on":""}`,children:c.jsx("span",{className:"switch-knob"})})]})}function Yh({items:e,children:t,className:n,style:r,title:l}){const[h,d]=x.useState(!1),p=x.useRef(null);return c.jsxs(c.Fragment,{children:[c.jsx("button",{ref:p,className:n,style:r,title:l,onClick:()=>d(g=>!g),children:t}),c.jsx(Pa,{open:h,onClose:()=>d(!1),anchor:p,items:e})]})}function Ci({selection:e,options:t,onChange:n,fill:r,fits:l=!1}){const h=t.find(d=>d.id===e)?.label??"Choose";return c.jsxs(Yh,{title:h,className:`choice-picker ${r?"":"outlined"}`,style:{background:r,width:l?"100%":void 0},items:()=>t.map(d=>({title:d.label,selected:d.id===e,action:()=>n(d.id)})),children:[c.jsx("span",{className:"choice-label",children:h}),c.jsx(ae,{name:"chevron.down",size:10,weight:"semibold",color:"var(--secondary)"})]})}function qC({selection:e,options:t,onChange:n}){const r=Math.max(0,t.findIndex(l=>l.id===e));return c.jsxs("div",{className:"segmented",children:[c.jsx("div",{className:"segmented-thumb",style:{width:`calc((100% - 6px - ${(t.length-1)*2}px) / ${t.length})`,transform:`translateX(calc(${r} * (100% + 2px)))`}}),t.map(l=>c.jsx("button",{className:`segmented-option ${l.id===e?"on":""}`,onClick:()=>n(l.id),"aria-pressed":l.id===e,children:l.label},l.id))]})}function VC({selection:e,options:t,onChange:n}){return c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:t.map(r=>c.jsxs("button",{className:"choice-row",onClick:()=>n(r.id),children:[c.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:2},children:[c.jsx("span",{style:{color:"var(--text)"},children:r.label}),r.detail?c.jsx("span",{style:{...B("compactSecondary"),color:"var(--secondary)"},children:r.detail}):null]}),c.jsx("span",{style:{opacity:r.id===e?1:0,display:"flex"},children:c.jsx(ae,{name:"checkmark",size:10,weight:"semibold"})})]},r.id))})}function hi({children:e,style:t}){return c.jsx("div",{className:"card-form",style:t,children:c.jsx("div",{className:"card-form-content",children:e})})}function Ee({title:e,footer:t,accessory:n,children:r}){const l=x.Children.toArray(r);return c.jsxs("section",{className:"card-section",children:[e?c.jsxs("div",{className:"card-section-title",children:[c.jsx("span",{style:{...B(13,"semibold"),color:"var(--text)"},children:e}),c.jsx("span",{style:{flex:1}}),n]}):null,c.jsx("div",{className:"card-section-rows",children:l.map((h,d)=>c.jsxs(x.Fragment,{children:[c.jsx("div",{className:"card-row",children:h}),d<l.length-1?c.jsx("div",{className:"hairline inset"}):null]},d))}),t?c.jsx("div",{className:"card-section-footer",children:t}):null]})}function $C({style:e}){return c.jsx("div",{className:"hairline",style:e})}function Jt({label:e,detail:t,children:n}){return c.jsxs("div",{className:"value-row",children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3,minWidth:0},children:[c.jsx("span",{style:{color:"var(--text)"},children:e}),t?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",lineHeight:1.35},children:t}):null]}),c.jsx("span",{style:{flex:1,minWidth:12}}),c.jsx("span",{style:{color:"var(--secondary)",display:"flex",alignItems:"center"},children:n})]})}function WC({value:e,onChange:t,prompt:n="Search",inputRef:r}){return c.jsxs("div",{className:"search-field",children:[c.jsx(ae,{name:"magnifyingglass",size:12,color:"var(--secondary)"}),c.jsx("input",{ref:r,value:e,placeholder:n,spellCheck:!1,onChange:l=>t(l.target.value)}),e?c.jsx("button",{"aria-label":"Clear search",onClick:()=>t(""),style:{display:"flex",color:"var(--tertiary)"},children:c.jsx(ae,{name:"xmark.circle.fill",size:12})}):null]})}function G2({expanded:e,onToggle:t,label:n,children:r}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("button",{className:"disclosure-label",onClick:t,"aria-expanded":e,children:[n,c.jsx("span",{style:{flex:1,minWidth:8}}),c.jsx("span",{style:{display:"flex",transform:`rotate(${e?90:0}deg)`,transition:"transform var(--layout)",color:"var(--secondary)"},children:c.jsx(ae,{name:"chevron.right",size:10,weight:"semibold"})})]}),e?r:null]})}function K3({children:e,fill:t="var(--background)",outlined:n=!1,style:r}){return c.jsx("span",{className:"pill",style:{background:n?"transparent":t,boxShadow:n?"inset 0 0 0 1px var(--border)":void 0,...r},children:e})}class Br{#e=new Set;#i=0;#t=!1;changed(){this.#t||(this.#t=!0,queueMicrotask(()=>{this.#t=!1,this.#i++;for(const t of[...this.#e])t()}))}subscribe=t=>(this.#e.add(t),()=>{this.#e.delete(t)});getVersion=()=>this.#i}function cn(e){return x.useSyncExternalStore(e?e.subscribe:FC,e?e.getVersion:KC),e}const FC=()=>()=>{},KC=()=>0;function Y3(e){const t=x.useRef({models:e,version:0});t.current.models=e,x.useSyncExternalStore(x.useCallback(n=>{const r=t.current.models.map(l=>l.subscribe(()=>{t.current.version++,n()}));return()=>r.forEach(l=>l())},[e.length,...e]),()=>t.current.version)}function bi(e,t){const n=new Set;let r=(()=>{try{const l=localStorage.getItem(e);return l===null?t:JSON.parse(l)}catch{return t}})();return window.addEventListener("storage",l=>{if(l.key===e){try{r=l.newValue===null?t:JSON.parse(l.newValue)}catch{r=t}for(const h of n)h()}}),{get:()=>r,set(l){r=l;try{localStorage.setItem(e,JSON.stringify(l))}catch{}for(const h of n)h()},subscribe(l){return n.add(l),()=>{n.delete(l)}}}}function ni(e){return[x.useSyncExternalStore(e.subscribe,e.get),e.set]}const Uf=[11,12,13,14,15,16,18],Ua=12;function YC(e,t){return(t?Uf.find(n=>n>e):[...Uf].reverse().find(n=>n<e))??e}const Dt={textSize:bi("conversationFontSize",Ua),sidebarCompact:bi("sidebarCompact",!1),sidebarWidth:bi("desktopSidebarWidth",296),hiddenComputers:bi("hiddenComputers",""),usageIconStyle:bi("usageIconStyle","character"),onboardingDone:bi("macAccountOnboardingCompleted",!1)};function G3(e){const t=Number.isFinite(e)?Math.min(Math.max(e,11),18):Ua;document.documentElement.style.setProperty("--scale",String(t/Ua)),document.documentElement.style.setProperty("--conversation",`${t}px`),document.documentElement.style.setProperty("--chat",`${t+2}px`),document.documentElement.style.setProperty("--chat-scale",String((t+2)/Ua))}Dt.textSize.subscribe(()=>G3(Dt.textSize.get()));const Z3=x.createContext(null);function ns(){const e=x.useContext(Z3);if(!e)throw new Error("AppContext missing");return cn(e)}const en=x.createContext(null);function Ne(){const e=x.useContext(en);if(!e)throw new Error("StoreContext missing");return cn(e)}function Or(){const e=x.useContext(en);if(!e)throw new Error("StoreContext missing");return e}class Ji extends Error{constructor(t,n){super(n),this.status=t}status;static unreachable(){return new Ji(0,"Can't reach your computer. Is it on and connected to the internet?")}get isTransient(){return this.status===0}}class Z2{constructor(t,n){this.baseURL=t,this.token=n}baseURL;token;async call(t,n,r){try{return await window.codync.host.call(this.baseURL,this.token,t,n,r)}catch(l){const h=l;throw new Ji(h.status??0,h.status===401?"This device isn't allowed on that computer anymore.":h.message)}}stream(t,n,r){return window.codync.host.stream(`${this.baseURL}${t}`,this.token,n,l=>r(l?new Ji(l.status,l.message):null))}}function GC(e){let t;try{t=JSON.parse(e)}catch{return null}const n=t.type;switch(n){case"hello":return{type:n,hostId:t.hostId??"",rev:t.rev??0,usage:t.usage??{providers:[]},screen:zf(t.screen)};case"bot":{const r=t.bot;return!r||typeof r.id!="string"?{type:"undecodable",kind:"bot"}:r.deleted?{type:"botDeleted",id:r.id,rev:r.rev??0}:{type:n,bot:Of(r)}}case"entry":{const r=t.entry;return!r||typeof r.id!="string"||typeof r.botId!="string"?{type:"undecodable",kind:"entry"}:{type:n,entry:{...r,data:r.data??{}}}}case"usage":return t.usage?{type:n,usage:t.usage}:null;case"screen":{const r=zf(t.screen);return r?{type:n,screen:r}:null}case"accessRequests":return{type:n,requests:t.requests??[]};case"cloud":return t.cloud?{type:n,cloud:t.cloud}:null;case"resync":return{type:n};default:return null}}class X2{constructor(t){this.transport=t}transport;call(t,n={},r=2e4){return this.transport.call(t,n,r)}events(t,n,r,l){const h=new URLSearchParams({since:String(t),client:n});return this.transport.stream(`/events?${h}`,d=>{const p=GC(d);p&&r(p)},l)}hello(){return this.call("hello").then(t=>({...t,backends:t.backends??[],screen:zf(t.screen)??void 0}))}async history(t,n,r=100){return(await this.call("history",{botId:t,beforeSeq:n,limit:r})).entries}async thread(t,n){return(await this.call("thread",{botId:t,rootId:n})).entries}async send(t,n,r,l,h){return(await this.call("send",{botId:t,text:n,clientNonce:r,threadId:l,attachments:h})).entry}static uploadChunk=384*1024;async upload(t,n,r,l){let h=0;do{const d=Math.min(h+X2.uploadChunk,l.length);await this.call("upload",{botId:t,uploadId:n,name:r,data:X3(l.subarray(h,d)),offset:h,done:d===l.length},6e4),h=d}while(h<l.length)}async readUpload(t,n){const r=[];let l=0;for(;;){const p=await this.call("readUpload",{botId:t,uploadId:n,offset:l},6e4),g=Q3(p.data);if(!g.length||(r.push(g),l+=g.length,l>=p.size))break}const h=new Uint8Array(l);let d=0;for(const p of r)h.set(p,d),d+=p.length;return h}}function X3(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function Q3(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const C_="2.3.0";function k_(e){let t=e.trim();t.startsWith("v")&&(t=t.slice(1)),t=t.split("-")[0].split("+")[0];const n=t.split(".");if(n.length<1||n.length>3)return null;const r=[];for(const l of n){if(!/^[0-9]+$/.test(l))return null;r.push(Number(l))}for(;r.length<3;)r.push(0);return r}function Pf(e,t){const n=k_(e),r=k_(t);if(!n||!r)return!1;for(let l=0;l<3;l++)if(n[l]!==r[l])return n[l]<r[l];return!1}function ZC(e,t,n){return n&&Pf(e,n)?{kind:"updateApp",minimum:n}:Pf(t,C_)?{kind:"updateHost",version:t,minimum:C_}:null}class XC{values=new Map;listeners=new Set;retired=!1;storage;key;onSaveError;constructor(t,n,r){this.storage=t,this.key=n,this.onSaveError=r;try{const l=JSON.parse(t.getItem(n)??"null");if(Array.isArray(l))for(const h of l)Array.isArray(h)&&h.length===2&&typeof h[0]=="string"&&typeof h[1]=="string"&&this.values.set(h[0],h[1])}catch{}}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});get(t,n=null){return this.values.get(JSON.stringify([t,n]))??""}set(t,n,r){if(this.retired)return;const l=JSON.stringify([t,n]);r?this.values.set(l,r):this.values.delete(l),this.save()}removeBot(t){if(!this.retired){for(const n of this.values.keys())try{JSON.parse(n)[0]===t&&this.values.delete(n)}catch{this.values.delete(n)}this.save()}}clear(){this.retired||(this.values.clear(),this.save())}retire(){this.retired=!0}save(){try{this.storage.setItem(this.key,JSON.stringify([...this.values]))}catch{this.onSaveError?.()}for(const t of this.listeners)t()}}class QC extends Br{constructor(t,n,r,l="mac",h=window.codync.appVersion,d="local"){super(),this.isLoopback=n,this.makeTransport=r,this.clientKind=l,this.appVersion=h,this.contextId=d,this.computer=t,this.composerDrafts=new XC(localStorage,`codync-drafts-v1-${JSON.stringify([d,t.id])}`,()=>this.setError("Couldn't save the draft on this device. Your text is still here; keep this window open until you send or copy it.")),this.loadCache()}isLoopback;makeTransport;clientKind;appVersion;contextId;computer;connection={kind:"connecting"};hostRoute=null;client=null;hello=null;hostVersion=null;bots=new Map;entries=new Map;usage={providers:[]};screen=null;accessRequests=[];cloud=null;historyComplete=new Set;routineDrafts=new Map;composerDrafts;lastError=null;selection=null;answering=new Map;onRosterChanged=null;onComputerChanged=null;waiting=0;rev=0;hostId=null;retired=!1;unreadable=!1;saveTimer=null;cacheStamp=null;get isOffline(){const t=this.connection.kind;return t==="computerOffline"||t==="offline"||t==="unauthorized"}get canQueue(){return!1}get shownConnection(){return this.waiting>0&&this.connection.kind==="online"?{kind:"connecting"}:this.connection}get hostName(){return this.hello?.name??this.computer.name}get mismatch(){if(!this.hostVersion)return null;const t=ZC(this.appVersion,this.hostVersion.version,this.hostVersion.minApp);return t||(this.unreadable&&Pf(this.appVersion,this.hostVersion.version)?{kind:"updateApp",minimum:this.hostVersion.version}:null)}get roster(){return[...this.bots.values()].filter(t=>!t.hidden).sort((t,n)=>t.pinned!==n.pinned?t.pinned?-1:1:n.lastAt-t.lastAt)}get hiddenBots(){return[...this.bots.values()].filter(t=>t.hidden).sort((t,n)=>t.name.localeCompare(n.name))}backendName(t){return this.hello?.backends.find(n=>n.id===t)?.name??JC(t)}chat(t){return(this.entries.get(t)??[]).filter(n=>!n.threadId)}allEntries(t){return this.entries.get(t)??[]}replies(t,n){return(this.entries.get(t)??[]).filter(r=>r.threadId===n)}members(t){return t.members.map(n=>this.bots.get(n)).filter(n=>!!n)}authorName(t){return t&&this.bots.get(t)?.name||"A deleted bot"}currentThinking(t,n){const r=this.allEntries(t);for(let l=r.length-1;l>=0;l--){const h=r[l];if((h.threadId??null)===n){if(h.kind==="user"||h.kind==="agent"&&h.data.final===!0)return null;if(h.kind==="thought"&&h.data.text)return h.data.text}}return null}get connectionLabel(){switch(this.shownConnection.kind){case"online":return this.mismatch?"Needs update":"Connected";case"connecting":return"Connecting…";case"computerOffline":case"offline":return"Offline";case"unauthorized":return"No access";case"unpaired":return"Not paired"}}updateComputer(t){const n=t({...this.computer});JSON.stringify(n)!==JSON.stringify(this.computer)&&(this.computer=n,this.onComputerChanged?.(n),this.changed())}upsert(t){const n=[...this.entries.get(t.botId)??[]],r=n.findIndex(l=>l.id===t.id);if(r>=0){if(t.rev<n[r].rev)return;n[r]=t}else{const l=t.kind==="user"?t.data.clientNonce:void 0,h=l?n.filter(p=>p.id!==`local-${l}`):n,d=h[h.length-1];if(d&&d.seq>t.seq&&t.seq>0){const p=h.findIndex(g=>g.seq>t.seq);h.splice(p<0?h.length:p,0,t)}else h.push(t);this.entries.set(t.botId,h);return}this.entries.set(t.botId,n)}setError(t){this.lastError=t,this.changed()}get cacheKey(){return`codync-mirror-${this.contextId}-${this.computer.id}`}loadCache(){try{const t=localStorage.getItem(this.cacheKey);if(!t)return;const n=JSON.parse(t);this.cacheStamp=n.stamp??"",this.hostId=n.hostId??null,this.rev=n.rev,this.bots=new Map(n.bots.map(l=>[l.id,l]));const r=new Map;for(const l of n.entries)r.set(l.botId,[...r.get(l.botId)??[],l]);this.entries=r}catch{}}scheduleSave(){this.retired||(this.saveTimer&&clearTimeout(this.saveTimer),this.saveTimer=setTimeout(()=>this.saveCache(),2e3))}saveCache(){if(this.retired)return;const t=[];for(const r of this.entries.values())t.push(...r.filter(l=>!l.id.startsWith("local-")).slice(-200)),t.push(...r.filter(l=>l.id.startsWith("local-")&&l.data.status==="failed"));const n={stamp:`${this.appVersion}/${this.hello?.version??""}`,hostId:this.hostId,rev:this.rev,bots:[...this.bots.values()],entries:t};try{localStorage.setItem(this.cacheKey,JSON.stringify(n))}catch{}}}function JC(e){switch(e){case"claude":return"Claude Code";case"codex":return"Codex";case"opencode":return"OpenCode";case"grok":return"Grok Build";case"gemini":return"Gemini CLI";default:return"Custom agent"}}const e8=5e3,E_=1e3,M_=2e4,t8=3e4,za=e=>new Promise(t=>setTimeout(t,e)),i8=(e,t)=>e.kind===t.kind&&JSON.stringify(e)===JSON.stringify(t);class s8 extends QC{heldDrop=null;dropTimer=null;closeEvents=null;eventsLoop=0;rewound=!1;readingViews=new Map;retire(){this.retired=!0,this.composerDrafts.retire(),this.stopTransport(),this.saveTimer&&clearTimeout(this.saveTimer),this.onRosterChanged=null,this.onComputerChanged=null,this.client=null,this.selection=null}start(){this.restartStream()}restartStream(){if(this.retired)return;this.stopTransport(),this.connection.kind!=="online"&&this.setConnection({kind:"connecting"});const t=this.makeTransport();this.client=new X2(t),this.hostRoute=this.isLoopback?"loopback":null,this.runEvents(this.client)}stopTransport(){this.eventsLoop++,this.closeEvents?.(),this.closeEvents=null,this.dropTimer&&clearTimeout(this.dropTimer),this.dropTimer=null,this.heldDrop=null}setConnection(t){const n=t.kind==="connecting"||t.kind==="offline"||t.kind==="computerOffline",r=t.kind==="online"&&(this.connection.kind!=="online"||this.heldDrop!==null),l=this.connection.kind==="connecting"&&n&&t.kind!=="connecting";if(n&&(this.connection.kind==="online"||l)){const h=this.connection.kind==="online"?e8:E_;this.heldDrop=t,this.dropTimer||(this.dropTimer=setTimeout(()=>{this.dropTimer=null;const d=this.heldDrop;this.heldDrop=null,d&&!this.retired&&(this.connection=d,this.changed())},h));return}if(this.dropTimer&&clearTimeout(this.dropTimer),this.dropTimer=null,this.heldDrop=null,i8(t,this.connection)||(this.connection=t,this.changed()),r)for(const h of this.readingViews.values())this.markRead(h.botId,h.thread)}runEvents(t){const n=++this.eventsLoop;let r=1e3;const l=()=>n===this.eventsLoop&&!this.retired,h=async()=>{if(l()){try{if(await this.refreshHello(t),!l())return;if(this.mismatch)return this.setConnection({kind:"online"}),await za(t8),void h();if(this.isLoopback){try{this.accessRequests=(await t.call("accessRequests")).requests}catch{}try{this.cloud=await t.call("cloudStatus")}catch{}this.changed()}if(!l())return;await new Promise((d,p)=>{this.closeEvents=t.events(this.rev,this.clientKind,g=>{l()&&(this.setConnection({kind:"online"}),r=1e3,this.apply(g))},g=>g?p(g):d())})}catch(d){if(!l())return;const p=d instanceof Error?d.message:String(d);if(this.setConnection({kind:"offline",message:p}),d instanceof Ji&&d.status===401)return}l()&&(await za(r),r=Math.min(r*2,2e4),h())}};h()}restartEvents(){this.client&&(this.closeEvents?.(),this.runEvents(this.client))}async refreshHello(t){const n=await t.hello();this.retired||(this.hello=n,this.noteHostVersion({version:n.version,minApp:n.minApp}),this.isLoopback&&this.updateComputer(r=>({...r,name:n.name,device:n.device??r.device})),this.changed())}noteHostVersion(t){(this.cacheStamp!==null&&this.cacheStamp!==`${this.appVersion}/${t.version}`||this.hostVersion&&this.hostVersion.version!==t.version)&&(this.rev=0,this.rewound=!1,this.unreadable=!1),this.cacheStamp=null,this.hostVersion=t}apply(t){switch(t.type){case"hello":this.hostId&&this.hostId!==t.hostId&&this.resetMirror(),this.hostId=t.hostId,this.usage=t.usage,this.screen=t.screen,t.rev<this.rev&&(this.rev=0);break;case"bot":this.bots.set(t.bot.id,t.bot),this.bump(t.bot.rev),this.onRosterChanged?.(),t.bot.unread>0&&this.acknowledgeVisible(t.bot.id);break;case"botDeleted":this.composerDrafts.removeBot(t.id),this.bots.delete(t.id),this.entries.delete(t.id),this.bump(t.rev),this.selection===t.id&&(this.selection=null),this.onRosterChanged?.();break;case"entry":this.upsert(t.entry),this.bump(t.entry.rev),this.acknowledgeVisible(t.entry.botId,t.entry);break;case"usage":this.usage=t.usage;break;case"screen":this.screen=t.screen;break;case"accessRequests":this.accessRequests=t.requests;break;case"cloud":this.cloud=t.cloud;break;case"resync":this.restartEvents();break;case"undecodable":this.rewound?this.unreadable||(this.unreadable=!0,this.mismatch&&this.restartEvents()):(this.rewound=!0,this.rev=0,this.restartEvents());break}this.changed(),this.scheduleSave()}resetMirror(){this.composerDrafts.clear(),this.bots=new Map;const t=new Map;for(const[n,r]of this.entries){const l=r.filter(h=>h.id.startsWith("local-"));l.length&&t.set(n,l)}this.entries=t,this.selection=null,this.onRosterChanged?.(),this.rev=0,this.hostId=null,this.historyComplete=new Set,this.screen=null,this.saveCache()}bump(t){this.rev=Math.max(this.rev,t)}get live(){return this.connection.kind==="online"&&!this.heldDrop&&!this.retired?this.client:null}async ready(t=Date.now()+M_){let n=!1,r=!1;try{for(;!this.retired;){if(this.live)return this.live;switch(this.connection.kind){case"online":case"connecting":break;case"offline":if(!r){r=!0,this.restartStream();break}throw Ji.unreachable();case"unpaired":throw Ji.unreachable();case"computerOffline":throw new Ji(0,"Your computer is offline.");case"unauthorized":throw new Ji(401,this.connection.message)}if(Date.now()>=t)break;n||(n=!0,this.waiting++,this.changed()),await za(100)}throw Ji.unreachable()}finally{n&&(this.waiting--,this.changed())}}async withLink(t,n=!1){const r=Date.now()+M_;for(;;){const l=await this.ready(r);try{return await t(l)}catch(h){if(n&&h instanceof Ji&&h.isTransient&&Date.now()<r){await za(500);continue}throw h}}}perform(t,n=!1){this.withLink(t,n).catch(r=>{this.lastError=r instanceof Error?r.message:String(r),this.changed()})}setReading(t,n,r,l){l?(this.readingViews.set(t,{botId:n,thread:r}),this.connection.kind==="online"&&this.markRead(n,r)):this.readingViews.delete(t)}acknowledgeVisible(t,n){if(this.connection.kind!=="online")return;const r=new Set;for(const l of this.readingViews.values()){if(l.botId!==t||n&&(!_o(n)||(n.threadId??null)!==l.thread))continue;const h=`${l.botId}/${l.thread}`;r.has(h)||(r.add(h),this.markRead(t,l.thread))}}markRead(t,n=null){(async()=>{this.live||await za(E_);const r=this.live;if(r)try{await r.call("markRead",{botId:t,threadId:n,all:!1})}catch{}})()}}const n8=100*1024*1024,r8=["👍","❤️","😂","🎉","👀","✅"];class J3 extends s8{outgoingFiles=new Map;send(t,n,r=null,l=[],h=crypto.randomUUID()){const d=t.trim();if(!d&&!l.length||this.retired)return;const p={text:d,status:"sending",clientNonce:h};l.length&&(p.attachments=l.map(g=>({id:g.id,name:g.name,size:g.data.length})),this.outgoingFiles.set(h,l)),this.upsert({id:`local-${h}`,seq:Number.MAX_SAFE_INTEGER,botId:n,threadId:r,rev:0,kind:"user",turn:0,data:p,createdAt:Date.now(),updatedAt:0}),this.changed(),(async()=>{try{const g=await this.withLink(async m=>{let v=null;const _=this.outgoingFiles.get(h);if(_){v=[];for(const S of _){const w=crypto.randomUUID();await m.upload(n,w,S.name,S.data),j_(w,S.data),v.push(w)}}return m.send(n,d,h,r,v)},!0);this.outgoingFiles.delete(h),this.upsert(g),this.changed()}catch(g){this.outgoingFiles.has(h)&&(this.lastError=`Couldn't send the files: ${g instanceof Error?g.message:g}`),this.markLocal(h,n,"failed")}})()}retry(t){const n=t.data.clientNonce&&this.outgoingFiles.get(t.data.clientNonce)||[],r=t.data.text??"";!r&&!n.length||(this.entries.set(t.botId,this.allEntries(t.botId).filter(l=>l.id!==t.id)),this.send(r,t.botId,t.threadId??null,n,t.data.clientNonce??crypto.randomUUID()))}discard(t){t.data.clientNonce&&this.outgoingFiles.delete(t.data.clientNonce),this.entries.set(t.botId,this.allEntries(t.botId).filter(n=>n.id!==t.id)),this.changed(),this.scheduleSave()}cancelQueued(t){}markLocal(t,n,r){const l=this.entries.get(n),h=l?.findIndex(p=>p.id===`local-${t}`)??-1;if(!l||h<0)return;const d=[...l];d[h]={...d[h],data:{...d[h].data,status:r}},this.entries.set(n,d),this.changed(),this.scheduleSave()}async attachmentData(t,n){const r=eS.get(t);if(r)return r;const l=this.live;if(!l)return null;try{const h=await l.readUpload(n,t);return j_(t,h),h}catch{return null}}stop(t){this.perform(n=>n.call("stop",{botId:t}),!0)}newSession(t){this.perform(n=>n.call("newSession",{botId:t}))}logCall(t,n){this.perform(r=>r.call("logCall",{botId:t,seconds:n}))}screenTakeover(t){this.perform(async n=>{this.screen=await n.call("screenTakeover",{on:t}),this.changed()},!0)}async setScreenEnabled(t){this.screen=await(await this.ready()).call("setScreenEnabled",{enabled:t}),this.changed()}react(t,n){const r=this.entries.get(t.botId),l=r?.findIndex(g=>g.id===t.id)??-1;if(!r||l<0)return;const h=[...r[l].data.reactions??[]],d=h.indexOf(n);d>=0?h.splice(d,1):h.push(n);const p=[...r];p[l]={...p[l],data:{...p[l].data,reactions:h}},this.entries.set(t.botId,p),this.changed(),this.perform(async g=>{const m=await g.call("react",{entryId:t.id,emoji:n});this.upsert(m.entry),this.changed()})}respond(t,n){this.answering.has(t.id)||(this.answering.set(t.id,n??""),this.changed(),(async()=>{try{await this.withLink(r=>r.call("respondPermission",{entryId:t.id,optionId:n}),!0),await za(2e3)}catch(r){this.lastError=r instanceof Error?r.message:String(r)}this.answering.delete(t.id),this.changed()})())}markAllRead(t){const n=this.bots.get(t);!n||n.unread<=0||(this.bots.set(t,{...n,unread:0}),this.changed(),this.perform(r=>r.call("markRead",{botId:t,threadId:null,all:!0}),!0))}patchBot(t,n){const r=this.bots.get(t.id);r&&this.bots.set(t.id,{...r,...n}),this.changed(),this.perform(l=>l.call("updateBot",{...a8(t),...n}),!0)}setPinned(t,n){this.patchBot(t,{pinned:n})}setHidden(t,n){this.patchBot(t,{hidden:n})}delete(t){this.composerDrafts.removeBot(t.id),this.bots.delete(t.id),this.entries.delete(t.id),this.onRosterChanged?.(),this.changed(),this.perform(n=>n.call("deleteBot",{botId:t.id}),!0)}async createGroup(t,n,r){const l={kind:"group",name:t,description:n,members:r},h=await(await this.ready()).call("createBot",l);return this.bots.set(h.bot.id,h.bot),this.selection=h.bot.id,this.onRosterChanged?.(),this.changed(),h.bot}async updateGroup(t){const n=await(await this.ready()).call("updateBot",t);this.bots.set(n.bot.id,n.bot),this.changed()}async loadThread(t,n){if(this.client)try{for(const r of await this.client.thread(t,n))this.upsert(r);this.changed()}catch{}}async save(t){const n=await this.ready(),r=t.id?await n.call("updateBot",{...t,model:t.model??null}):await n.call("createBot",t);return this.bots.set(r.bot.id,r.bot),this.onRosterChanged?.(),this.changed(),r.bot}async refreshBackends(){if(!(!this.client||!this.hello))try{const t=await this.client.call("refreshBackends",{},6e4);this.hello={...this.hello,backends:t.backends},this.changed()}catch{}}async listDirs(t){return(await this.ready()).call("listDirs",{path:t})}async refreshUsage(){if(!(this.retired||!this.client))try{this.usage=await this.client.call("usage",{refresh:!0}),this.changed()}catch{}}async loadOlder(t){if(!this.client||this.historyComplete.has(t))return;const n=this.chat(t).find(r=>r.seq>0&&r.seq!==Number.MAX_SAFE_INTEGER)?.seq??Number.MAX_SAFE_INTEGER;try{const r=await this.client.history(t,n,100);r.length<100&&this.historyComplete.add(t);for(const l of r)this.upsert(l);this.changed()}catch{}}setSelection(t){this.selection=t,this.changed()}consumeRoutineDraft(t){const n=this.routineDrafts.get(t);return n!==void 0&&(this.routineDrafts.delete(t),this.changed()),n}setRoutineDraft(t,n){this.routineDrafts.set(t,n),this.changed()}}function a8(e){return{id:e.id,name:e.name,description:e.description,avatarColor:e.avatarColor,avatarShape:e.avatarShape,backend:e.backend,command:e.command??null,cwd:e.managedWorkspace?"":e.cwd,permission:e.permission,model:e.model??null,pinned:e.pinned,hidden:e.hidden,notify:e.notify??null,connectors:e.connectors,skills:e.skills,computer:e.computer}}const eS=new Map;function j_(e,t){eS.set(e,t)}class l8 extends Br{isBusy=!1;isReady=!0;isConfigured=!1;errorMessage=null;user=null;cloudURL=null;get isSignedIn(){return this.user!==null}async start(){const t=await window.codync.account.state();this.apply(t),window.codync.account.onChange(n=>this.apply(n))}apply(t){this.isReady=t.ready,this.isConfigured=t.configured,this.isBusy=t.busy,this.errorMessage=t.error,this.user=t.user,this.cloudURL=t.cloudURL,this.changed()}async signIn(t){await window.codync.account.signIn(t)}async signOut(){await window.codync.account.signOut()}sessionToken(){return window.codync.account.token()}}const Zn=new l8;function Ya(){return cn(Zn)}class tS extends Error{constructor(t,n,r){super(n==="requestExpired"?"The request expired. Ask again.":n==="accountDeleted"?"This account was deleted.":n==="rateLimited"?"Too many requests. Try again in a little while.":r??`Codync cloud error (${n})`),this.status=t,this.code=n}status;code;get isTransient(){return this.status===0||this.status>=500||this.status===429||this.status===401}}async function Es(e,t,n,r=!1){const l=await window.codync.cloud.request(e,t,n,r);if(!l.ok)throw new tS(l.error.status,l.error.code,l.error.message);return l.value}const Aa=bi("cloudDefaultApplied",[]),U0=bi("claimedComputerIds",[]),P0=e=>bi(`keptOutOfAccount.${e}`,[]);class o8 extends Br{constructor(t){super(),this.app=t,Zn.subscribe(()=>this.tick()),t.subscribe(()=>this.tick())}app;computers=[];registeredFor=null;enablingCloud=!1;autoClaiming=!1;fail(t,n=!1){n||t instanceof tS&&t.isTransient||this.app.setError(t instanceof Error?t.message:String(t))}get userId(){return Zn.user?.userId??null}tick(){const t=this.userId;if(!t){this.computers.length&&(this.computers=[],this.changed()),this.registeredFor=null;return}this.registeredFor!==t&&(this.registeredFor=t,(async()=>{try{await Es("POST","v1/devices",{name:await c8(),platform:window.codync.platform==="darwin"?"macos":"linux"},!0)}catch(n){this.fail(n)}await this.refresh()})()),this.applyCloudDefault(),this.autoClaim()}async refresh(){if(this.userId)try{const t=await Es("GET","v1/computers",void 0,!0);this.computers=t.computers,this.changed()}catch(t){this.fail(t)}}applyCloudDefault(){const t=this.app.local;if(!Zn.cloudURL||!t||t.connection.kind!=="online"||!t.cloud)return;const n=t.computer.id;Aa.get().includes(n)||(Aa.set([...Aa.get(),n]),!(t.cloud.enabled||this.enablingCloud)&&(this.enablingCloud=!0,this.enableCloud(t).catch(()=>{}).finally(()=>this.enablingCloud=!1)))}autoClaim(){const t=this.userId,n=this.app.local;t&&n&&n.cloud?.owner?.userId===t&&U0.set([n.computer.id]);const r=this.autoClaimTarget;!r||this.autoClaiming||(this.autoClaiming=!0,(async()=>{let l=3e4;for(;!await this.claim(r,!0)&&(await new Promise(h=>setTimeout(h,l)),l=Math.min(l*2,6e5),this.autoClaimTarget?.computer.id===r.computer.id););this.autoClaiming=!1})())}get autoClaimTarget(){const t=this.userId,n=this.app.local;if(!t||!n||n.connection.kind!=="online")return null;const r=n.cloud;return!r?.enabled||r.owner||P0(t).get().includes(n.computer.id)?null:n}async claim(t,n=!1){const r=this.userId;if(!r||!t.client)return n||this.app.setError("Sign in first."),!1;const l=P0(r);l.set(l.get().filter(h=>h!==t.computer.id));try{const h=await t.ready();t.cloud?.enabled||await this.enableCloud(t);const d=await Es("POST","v1/claims",{}),p=await h.call("claimSign",{claimId:d.claimId,nonce:d.nonce,userId:r});return await Es("POST",`v1/claims/${d.claimId}/complete`,p),await this.refresh(),t===this.app.local&&await this.forgetEarlierIdentities(t.computer.id),!0}catch(h){return this.fail(h,n),!1}}async forgetEarlierIdentities(t){const n=new Set(U0.get().filter(r=>r!==t));for(const r of this.computers)n.has(r.computerId)&&!r.online&&await this.removeFromAccount(r.computerId);U0.set([t])}async unclaim(t){const n=this.userId;if(n){const r=P0(n);r.get().includes(t.computer.id)||r.set([...r.get(),t.computer.id])}try{await(await t.ready()).call("unclaim",{},3e4),await this.refresh()}catch(r){this.fail(r)}}async setCloud(t,n){Aa.get().includes(t.computer.id)||Aa.set([...Aa.get(),t.computer.id]);try{n?await this.enableCloud(t):await(await t.ready()).call("setCloud",{enabled:!1},3e4)}catch(r){this.fail(r)}}async enableCloud(t){return(await t.ready()).call("setCloud",{enabled:!0},3e4)}async removeFromAccount(t){try{await Es("DELETE",`v1/computers/${t}`),await this.refresh()}catch(n){this.fail(n)}}isOlderCopy(t){return t.online?!1:this.app.computers.some(n=>n.id!==t.computerId&&n.name===t.name)||this.computers.some(n=>n.computerId!==t.computerId&&n.name===t.name&&(this.app.store(n.computerId)!==null||!!n.online))}devices(){return Es("GET","v1/devices").then(t=>t.devices)}revokeDevice(t){return Es("DELETE",`v1/devices/${t}`)}grants(t){return Es("GET",`v1/computers/${t}/grants`).then(n=>n.grants)}revokeGrant(t,n){return Es("DELETE",`v1/computers/${t}/grants/${n}`)}async renameComputer(t,n){await Es("PATCH",`v1/computers/${t}`,{name:n}),await this.refresh()}}async function c8(){return window.codync.computerName||(window.codync.platform==="darwin"?"Mac":"Linux")}const T_=e=>`${e.computerId}/${e.botId}`,R_=e=>{const t=e.indexOf("/");return t<0?null:{computerId:e.slice(0,t),botId:e.slice(t+1)}},D_=(e,t)=>!!e&&!!t&&e.computerId===t.computerId&&e.botId===t.botId;class h8 extends Br{constructor(t=!0){super(),this.mirrors=t,this.cloud=new o8(this)}mirrors;host={state:{kind:"starting"},local:null,dev:!1,logPath:""};computers=[];stores=new Map;selection=null;lastError=null;screenNeedsApproval=!1;screenError=null;screenSynced=!1;deferred=new Set;storeSubscriptions=new Map;cloud;setError(t){this.lastError=t,this.changed()}async start(){window.codync.host.onChange(t=>this.setHost(t)),this.setHost(await window.codync.host.snapshot())}setHost(t){const n=this.host.local;this.host=t;const r=t.local;if(!this.mirrors)return this.changed();if(r&&(n?.computerId!==r.computerId||n.token!==r.token||!this.stores.has(r.computerId))){n&&n.computerId!==r.computerId&&this.detach(n.computerId);const h=this.computers.find(p=>p.id===r.computerId)??{id:r.computerId,name:"This computer",signKey:"",urls:[]},d=new J3(h,!0,()=>new Z2(r.baseURL,r.token));this.attach(h,d),d.subscribe(()=>this.syncScreen(d))}else!r&&n&&this.detach(n.computerId);this.changed()}get local(){return this.host.local?this.stores.get(this.host.local.computerId)??null:null}attach(t,n){this.detach(t.id),this.computers=[...this.computers.filter(r=>r.id!==t.id),t],this.stores.set(t.id,n),n.onComputerChanged=r=>{this.computers=this.computers.map(l=>l.id===r.id?r:l),this.changed()},n.onRosterChanged=()=>this.changed(),this.storeSubscriptions.set(t.id,n.subscribe(()=>{if(n.selection){const r=n.selection;n.selection=null,this.select({computerId:t.id,botId:r})}})),n.start(),this.changed()}detach(t){this.storeSubscriptions.get(t)?.(),this.storeSubscriptions.delete(t),this.stores.get(t)?.retire(),this.stores.delete(t),this.computers=this.computers.filter(n=>n.id!==t),this.selection?.computerId===t&&(this.selection=null),this.changed()}store(t){return this.stores.get(t)??null}get roster(){const t=[];for(const n of this.computers){const r=this.stores.get(n.id);if(r)for(const l of r.roster)t.push({ref:{computerId:n.id,botId:l.id},bot:l,computer:r.computer,store:r})}return t.sort((n,r)=>n.bot.pinned!==r.bot.pinned?n.bot.pinned?-1:1:r.bot.lastAt-n.bot.lastAt)}select(t){this.selection=t,this.changed()}get selectedStore(){return this.selection?this.store(this.selection.computerId):null}get managedStores(){return[...this.stores.values()].filter(t=>t.isLoopback)}get approvals(){return this.managedStores.flatMap(t=>t.accessRequests.map(n=>({id:`${t.computer.id}/${n.requestId}`,store:t,request:n})))}get currentApproval(){return this.approvals.find(t=>!this.deferred.has(A_(t)))??null}deferApproval(t){this.deferred.add(A_(t)),this.changed()}reviewApprovals(){this.deferred.clear(),this.changed()}async decide(t,n){await(await t.store.ready()).call("decideAccessRequest",{requestId:t.request.requestId,approve:n},3e4)}get needsAttention(){return this.roster.some(t=>t.bot.status==="needsInput")||this.approvals.length>0}get working(){return this.roster.filter(t=>t.bot.status==="working"||t.bot.status==="needsInput").length}get errorMessage(){if(this.lastError)return this.lastError;for(const t of this.stores.values())if(t.lastError)return t.lastError;return null}async setRemoteScreen(t){const n=this.local;if(n){try{this.screenNeedsApproval=(await window.codync.app.setScreenAgent(t)).needsApproval,await n.setScreenEnabled(t),this.screenError=null}catch(r){this.screenError=r instanceof Error?r.message:String(r)}this.changed()}}syncScreen(t){this.screenSynced||!t.screen||(this.screenSynced=!0,window.codync.app.syncScreenAgent(t.screen.enabled).then(n=>{this.screenNeedsApproval=n.needsApproval,this.changed()}))}clearErrors(){this.lastError=null;for(const t of this.stores.values())t.lastError=null;this.changed()}}const A_=e=>`${e.id}/${e.request.code??""}`;function u8(e,t){const n=t<40;switch(e){case"working":return n?3.9:1.885;case"searching":return n?2.665:2.015;case"listening":return n?3.998:4.388;case"connecting":return n?6.63:3.315}}function Q2(e,t,n,r){const l=Math.sin(e),h=Math.cos(e),d=Math.sin(t),p=Math.cos(t);return g=>{const m=g[0]*h+g[2]*l,v=-g[0]*l+g[2]*h;return[n/2+m*r,n/2-(g[1]*p-v*d)*r,g[1]*d+v*p]}}const tn=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)};function q0(e,t){const n=Math.floor(e),r=Math.floor(t),l=e-n,h=t-r,d=l*l*(3-2*l),p=h*h*(3-2*h),g=tn(n,r),m=tn(n+1,r),v=tn(n,r+1),_=tn(n+1,r+1);return g+(m-g)*d+(v-g)*p+(g-m-v+_)*d*p}const wh=e=>Math.hypot(e[0],e[1],e[2]),ps=(e,t)=>[e[0]*t,e[1]*t,e[2]*t],qf=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]],N_=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]];function d8(e,t){const n=e<40,r=e/2*.82,l=Q2(t*.12,.3,e,1),h=Math.pow(e/300,.6),d=n?2.4:1,p=n?3:12,g=n?10:40,m=[];for(let v=0;v<p;v++){const _=tn(v,1.7),S=tn(v,5.2),w=tn(v,8.9),b=r*(.45+.52*_),k=_*2*Math.PI,E=Math.acos(2*S-1),j=[Math.sin(E)*Math.cos(k),Math.cos(E),Math.sin(E)*Math.sin(k)];let V=[-j[1],j[0],0];V=ps(V,1/Math.max(1e-6,wh(V)));const A=[-j[2]*V[1],j[2]*V[0],j[0]*V[1]-j[1]*V[0]],z=(.25+.55*w)*(w>.5?1:-1);for(let F=0;F<g;F++){const D=F/g*2*Math.PI,I=l(ps(qf(ps(V,Math.cos(D)),ps(A,Math.sin(D))),b)),q=(I[2]/b+1)/2;m.push({x:I[0],y:I[1],z:I[2],radius:.9*d*h,white:.72,alpha:.5*(.4+.6*q)})}for(let F=0;F<3;F++){const D=t*z+F/3*2*Math.PI+S*6,I=l(ps(qf(ps(V,Math.cos(D)),ps(A,Math.sin(D))),b)),q=(I[2]/b+1)/2;m.push({x:I[0],y:I[1],z:I[2],radius:(1.2+1.6*q)*d*h,white:.3-.22*q,alpha:1})}}return{dots:m,lines:[]}}function f8(e,t,n){const r=e<40,l=Math.pow(e/300,.6),h=n?r?5:9:r?6:11,d=n?r?13:23:r?14:29,p=n?r?1.6:1:r?1.75:1.15,g=e/2*(n?.874:.82),m=n?.38:.4+.06*Math.sin(t*.35),v=Q2(t*(n?.18:.5),m,e,n?1:g),_=t*(.5+1.2*(r?4.335:4.08)),S=[];for(let w=0;w<=h;w++){const b=-Math.PI/2+w/h*Math.PI,k=Math.cos(b),E=Math.sin(b),j=.62*Math.sin(t*2.1-w*.52)+.38*Math.sin(t*1.27+w*.83),V=n?g*(.88+.105*j):1,A=Math.max(1,Math.round(Math.abs(k)*d));for(let z=0;z<A;z++){const F=z/A*2*Math.PI,D=v(ps([k*Math.cos(F),E,k*Math.sin(F)],V)),I=(D[2]/(n?g:1)+1)/2;if(n){const q=Math.max(0,j);S.push({x:D[0],y:D[1],z:D[2],radius:(.6+1.7*I)*p*(1+.4*q)*l,white:.66-.56*I-.1*q,alpha:1})}else{const q=F+t*.5-_,U=Math.atan2(Math.sin(q),Math.cos(q)),Y=Math.exp(-(U*U)/.18)*Math.max(0,D[2]);S.push({x:D[0],y:D[1],z:D[2],radius:((.6+1.7*I)*p+Y)*l,white:.62-.54*I,alpha:.45+.55*Math.min(1,Y)})}}}return{dots:S,lines:[]}}function p8(e,t){const n=e<40,r=Math.pow(e/300,.6),l=n?8:41,h=n?1:7,d=n?1.52:.95,p=.72,g=Q2(t*.12,.32,e,e/2*.8),m=Math.PI*(3-Math.sqrt(5)),v=[];for(let w=0;w<l;w++){const b=1-2*(w+.5)/l,k=Math.sqrt(1-b*b),E=w*m,j=[k*Math.cos(E),b,k*Math.sin(E)];j[0]+=.3*(q0(w*.31+9,t*.24)-.5)*2,j[1]+=.3*(q0(w*.53+27,t*.21)-.5)*2,j[2]+=.3*(q0(w*.77+55,t*.27)-.5)*2,v.push(ps(j,1/wh(j)))}const _=[],S=[];for(let w=0;w<l;w++){for(let j=w+1;j<l;j++){const V=wh(N_(v[w],v[j]));if(V>=p)continue;const A=g(v[w]),z=g(v[j]),F=((A[2]+z[2])/2+1)/2;S.push({x1:A[0],y1:A[1],x2:z[0],y2:z[1],white:.42,alpha:(1-V/p)*(.3+.55*F),width:Math.max(.6,.8*r)})}const b=g(v[w]),k=(b[2]+1)/2,E=1+.25*Math.sin(t*1.4+w*2.7);_.push({x:b[0],y:b[1],z:b[2],radius:(1.4+1.8*k)*d*E*r,white:.55-.45*k,alpha:1})}for(let w=0;w<h;w++){const b=Math.floor(t*.55+w*7.31),k=Math.floor(tn(b,w*3.1+1.7)*l),E=Math.floor(tn(b,w*5.7+4.2)*l);if(k===E)continue;const j=t*.55+w*7.31,V=j-Math.floor(j),A=qf(v[k],ps(N_(v[E],v[k]),V)),z=g(ps(A,1/Math.max(1e-6,wh(A)))),F=(z[2]+1)/2;_.push({x:z[0],y:z[1],z:z[2],radius:(1.4*1.5+1.8*F)*d*r,white:.05,alpha:.5+.5*F})}return{dots:_,lines:S}}function g8(e,t,n){const r=e==="working"?d8(t,n):e==="connecting"?p8(t,n):f8(t,n,e==="listening");return{dots:r.dots.filter(l=>l.alpha>=.02).map(l=>({...l,radius:Math.max(.3,l.radius)})).sort((l,h)=>l.z-h.z),lines:r.lines.filter(l=>l.alpha>=.02)}}const L_=(e,t)=>(1-Math.min(1,Math.max(0,e)))*t;function on({state:e="working",size:t=16,color:n="var(--text)",animated:r=!0}){const l=x.useRef(null),h=Ka(),d=F2();return x.useEffect(()=>{const p=l.current;if(!p)return;const g=window.devicePixelRatio||1;p.width=Math.round(t*g),p.height=Math.round(t*g);const m=p.getContext("2d"),v=getComputedStyle(p).color,_=r&&!h,S=performance.now();let w=0,b=0;const k=E=>{if(_&&E-b<1e3/30){w=requestAnimationFrame(k);return}b=E;const j=.6+(_?(E-S)/1e3*u8(e,t):0),V=g8(e,t,j);m.setTransform(g,0,0,g,0,0),m.clearRect(0,0,t,t),m.strokeStyle=v,m.fillStyle=v;for(const A of V.lines)m.globalAlpha=L_(A.white,A.alpha),m.lineWidth=A.width,m.beginPath(),m.moveTo(A.x1,A.y1),m.lineTo(A.x2,A.y2),m.stroke();for(const A of V.dots)m.globalAlpha=L_(A.white,A.alpha),m.beginPath(),m.arc(A.x,A.y,A.radius,0,Math.PI*2),m.fill();m.globalAlpha=1,_&&(w=requestAnimationFrame(k))};return w=requestAnimationFrame(k),()=>cancelAnimationFrame(w)},[e,t,r,h,n,d]),c.jsx("canvas",{ref:l,"aria-hidden":!0,style:{width:t,height:t,color:n,display:"block",flex:"none"}})}const m8=x.memo(function({bot:t,store:n,compact:r,usingComputer:l,members:h}){return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:r?0:8,padding:"6px 0",width:"100%",justifyContent:r?"center":"flex-start"},children:[c.jsx(BC,{bot:t,members:h,size:30}),c.jsxs("div",{"aria-hidden":r,style:{display:"flex",flexDirection:"column",gap:1,minWidth:0,overflow:"hidden",width:r?0:void 0,flex:r?"none":1,opacity:r?0:1,transition:"opacity var(--layout)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:4,minWidth:0},children:[t.pinned?c.jsx(ae,{name:"pin.fill",size:10,color:"var(--tertiary)"}):null,c.jsx("span",{style:{...B("compactBody","semibold"),color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.name}),l?c.jsx(ae,{name:"cursorarrow.motionlines",size:10,color:"var(--accent)",title:"Using the computer"}):null]}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0},children:[c.jsx("div",{style:{flex:1,minWidth:0,display:"flex"},children:c.jsx(v8,{bot:t,store:n})}),t.unread>0?c.jsx("span",{style:{...B("caption2","semibold"),color:"var(--on-accent)",background:"var(--accent-fill)",borderRadius:999,padding:"0 6px",minWidth:18,height:18,display:"grid",placeItems:"center",flex:"none"},children:t.unread}):null]})]})]})}),B_=e=>{const t=e.indexOf(`+`+o.stack}}var ir=Object.prototype.hasOwnProperty,tu=e.unstable_scheduleCallback,iu=e.unstable_cancelCallback,aw=e.unstable_shouldYield,lw=e.unstable_requestPaint,Ei=e.unstable_now,ow=e.unstable_getCurrentPriorityLevel,k1=e.unstable_ImmediatePriority,E1=e.unstable_UserBlockingPriority,Ro=e.unstable_NormalPriority,cw=e.unstable_LowPriority,M1=e.unstable_IdlePriority,hw=e.log,uw=e.unstable_setDisableYieldValue,Ja=null,Mi=null;function fn(i){if(typeof hw=="function"&&uw(i),Mi&&typeof Mi.setStrictMode=="function")try{Mi.setStrictMode(Ja,i)}catch{}}var ji=Math.clz32?Math.clz32:pw,dw=Math.log,fw=Math.LN2;function pw(i){return i>>>=0,i===0?32:31-(dw(i)/fw|0)|0}var Ao=256,No=262144,Lo=4194304;function sr(i){var s=i&42;if(s!==0)return s;switch(i&-i){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 i&-i;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Bo(i,s,a){var o=i.pendingLanes;if(o===0)return 0;var u=0,f=i.suspendedLanes,y=i.pingedLanes;i=i.warmLanes;var C=o&134217727;return C!==0?(o=C&~f,o!==0?u=sr(o):(y&=C,y!==0?u=sr(y):a||(a=C&~i,a!==0&&(u=sr(a))))):(C=o&~f,C!==0?u=sr(C):y!==0?u=sr(y):a||(a=o&~i,a!==0&&(u=sr(a)))),u===0?0:s!==0&&s!==u&&(s&f)===0&&(f=u&-u,a=s&-s,f>=a||f===32&&(a&4194048)!==0)?s:u}function el(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function j1(i,s){(s&8)!==0&&(s|=s&32);var a=i.entangledLanes;if(a!==0)for(i=i.entanglements,a&=s;0<a;){var o=31-ji(a),u=1<<o;s|=i[o],a&=~u}return s}function gw(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 T1(){var i=Lo;return Lo<<=1,(Lo&62914560)===0&&(Lo=4194304),i}function su(i){for(var s=[],a=0;31>a;a++)s.push(i);return s}function tl(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function mw(i,s,a,o,u,f){var y=i.pendingLanes;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=a,i.entangledLanes&=a,i.errorRecoveryDisabledLanes&=a,i.shellSuspendCounter=0;var C=i.entanglements,T=i.expirationTimes,G=i.hiddenUpdates;for(a=y&~a;0<a;){var ee=31-ji(a),se=1<<ee;C[ee]=0,T[ee]=-1;var W=G[ee];if(W!==null)for(G[ee]=null,ee=0;ee<W.length;ee++){var X=W[ee];X!==null&&(X.lane&=-536870913)}a&=~se}o!==0&&D1(i,o,0),f!==0&&u===0&&i.tag!==0&&(i.suspendedLanes|=f&~(y&~s))}function D1(i,s,a){i.pendingLanes|=s,i.suspendedLanes&=~s;var o=31-ji(s);i.entangledLanes|=s,i.entanglements[o]=i.entanglements[o]|1073741824|a&261930}function R1(i,s){var a=i.entangledLanes|=s;for(i=i.entanglements;a;){var o=31-ji(a),u=1<<o;u&s|i[o]&s&&(i[o]|=s),a&=~u}}function A1(i,s){var a=s&-s;return a=(a&42)!==0?1:nu(a),(a&(i.suspendedLanes|s))!==0?0:a}function nu(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function ru(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function N1(){var i=_e.p;return i!==0?i:(i=window.event,i===void 0?32:Uv(i.type))}function L1(i,s){var a=_e.p;try{return _e.p=i,s()}finally{_e.p=a}}var Os=Math.random().toString(36).slice(2),Ft="__reactFiber$"+Os,mi="__reactProps$"+Os,qr="__reactContainer$"+Os,B1="__reactEvents$"+Os,vw="__reactListeners$"+Os,_w="__reactHandles$"+Os,O1="__reactResources$"+Os,il="__reactMarker$"+Os,Oo="__reactLoad$"+Os;function zo(i){delete i[Ft],delete i[mi],delete i[vw],delete i[_w]}function nr(i){var s;if(s=i[Ft])return s;for(var a=i.parentNode;a;){if(s=a[qr]||a[Ft]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(i=Sv(i);i!==null;){if(a=i[Ft])return a;i=Sv(i)}return s}i=a,a=i.parentNode}return null}function Vr(i){if(i=i[Ft]||i[qr]){var s=i.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return i}return null}function sl(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(r(33))}function $r(i){var s=i[O1];return s||(s=i[O1]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Ot(i){i[il]=!0}function z1(i){i[Oo]=void 0}var H1=new Set,I1={};function rr(i,s){Wr(i,s),Wr(i+"Capture",s)}function Wr(i,s){for(I1[i]=s,i=0;i<s.length;i++)H1.add(s[i])}var yw=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]*$"),U1={},P1={};function Sw(i){return ir.call(P1,i)?!0:ir.call(U1,i)?!1:yw.test(i)?P1[i]=!0:(U1[i]=!0,!1)}var We=!1;function q1(){var i=We;return We=!1,i}function Ho(i,s,a){if(Sw(s))if(a===null)i.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":i.removeAttribute(s);return;case"boolean":var o=s.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){i.removeAttribute(s);return}}i.setAttribute(s,a)}}function Io(i,s,a){if(a===null)i.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(s);return}i.setAttribute(s,a)}}function zs(i,s,a,o){if(o===null)i.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttributeNS(s,a,o)}}function Ti(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function V1(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function xw(i,s,a){var o=Object.getOwnPropertyDescriptor(i.constructor.prototype,s);if(!i.hasOwnProperty(s)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var u=o.get,f=o.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return u.call(this)},set:function(y){a=""+y,f.call(this,y)}}),Object.defineProperty(i,s,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(y){a=""+y},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function au(i){if(!i._valueTracker){var s=V1(i)?"checked":"value";i._valueTracker=xw(i,s,""+i[s])}}function $1(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var a=s.getValue(),o="";return i&&(o=V1(i)?i.checked?"true":"false":i.value),i=o,i!==a?(s.setValue(i),!0):!1}var ww=/[\n"\\]/g;function Pi(i){return i.replace(ww,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function lu(i,s,a,o,u,f,y,C){i.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?i.type=y:i.removeAttribute("type"),s!=null?y==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+Ti(s)):i.value!==""+Ti(s)&&(i.value=""+Ti(s)):y!=="submit"&&y!=="reset"||i.removeAttribute("value"),s!=null?y==="number"&&i.value==s?ou(i,Ti(i.value)):ou(i,Ti(s)):a!=null?ou(i,Ti(a)):o!=null&&i.removeAttribute("value"),u==null&&f!=null&&(i.defaultChecked=!!f),u!=null&&(i.checked=u&&typeof u!="function"&&typeof u!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?i.name=""+Ti(C):i.removeAttribute("name")}function W1(i,s,a,o,u,f,y,C){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(i.type=f),s!=null||a!=null){if(!(f!=="submit"&&f!=="reset"||s!=null)){au(i);return}a=a!=null?""+Ti(a):"",s=s!=null?""+Ti(s):a,C||s===i.value||(i.value=s),i.defaultValue=s}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,i.checked=C?i.checked:!!o,i.defaultChecked=!!o,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(i.name=y),au(i)}function ou(i,s){i.defaultValue!==""+s&&(i.defaultValue=""+s)}function Fr(i,s,a,o){if(i=i.options,s){s={};for(var u=0;u<a.length;u++)s["$"+a[u]]=!0;for(a=0;a<i.length;a++)u=s.hasOwnProperty("$"+i[a].value),i[a].selected!==u&&(i[a].selected=u),u&&o&&(i[a].defaultSelected=!0)}else{for(a=""+Ti(a),s=null,u=0;u<i.length;u++){if(i[u].value===a){i[u].selected=!0,o&&(i[u].defaultSelected=!0);return}s!==null||i[u].disabled||(s=i[u])}s!==null&&(s.selected=!0)}}function F1(i,s,a){if(s!=null&&(s=""+Ti(s),s!==i.value&&(i.value=s),a==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=a!=null?""+Ti(a):""}function K1(i,s,a,o){if(s==null){if(o!=null){if(a!=null)throw Error(r(92));if(be(o)){if(1<o.length)throw Error(r(93));o=o[0]}a=o}a==null&&(a=""),s=a}a=Ti(s),i.defaultValue=a,o=i.textContent,o===a&&o!==""&&o!==null&&(i.value=o),au(i)}function Kr(i,s){if(s){var a=i.firstChild;if(a&&a===i.lastChild&&a.nodeType===3){a.nodeValue=s;return}}i.textContent=s}var bw=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 Y1(i,s,a){var o=s.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?i.setProperty(s,""):s==="float"?i.cssFloat="":i[s]="":o?i.setProperty(s,a):typeof a!="number"||a===0||bw.has(s)?s==="float"?i.cssFloat=a:i[s]=(""+a).trim():i[s]=a+"px"}function G1(i,s,a){if(s!=null&&typeof s!="object")throw Error(r(62));if(i=i.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||s!=null&&s.hasOwnProperty(o)||(o.indexOf("--")===0?i.setProperty(o,""):o==="float"?i.cssFloat="":i[o]="",We=!0);for(var u in s)o=s[u],s.hasOwnProperty(u)&&a[u]!==o&&(Y1(i,u,o),We=!0)}else for(var f in s)s.hasOwnProperty(f)&&Y1(i,f,s[f])}function cu(i){if(i.indexOf("-")===-1)return!1;switch(i){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 Cw=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"]]),kw=/^[\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 Uo(i){return kw.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function gs(){}var hu=null;function uu(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Yr=null,Gr=null;function Z1(i){var s=Vr(i);if(s&&(i=s.stateNode)){var a=i[mi]||null;e:switch(i=s.stateNode,s.type){case"input":if(lu(i,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),s=a.name,a.type==="radio"&&s!=null){for(a=i;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Pi(""+s)+'"][type="radio"]'),s=0;s<a.length;s++){var o=a[s];if(o!==i&&o.form===i.form){var u=o[mi]||null;if(!u)throw Error(r(90));lu(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(s=0;s<a.length;s++)o=a[s],o.form===i.form&&$1(o)}break e;case"textarea":F1(i,a.value,a.defaultValue);break e;case"select":s=a.value,s!=null&&Fr(i,!!a.multiple,s,!1)}}}var du=!1;function X1(i,s,a){if(du)return i(s,a);du=!0;try{var o=i(s);return o}finally{if(du=!1,(Yr!==null||Gr!==null)&&(Uc(),Yr&&(s=Yr,i=Gr,Gr=Yr=null,Z1(s),i)))for(s=0;s<i.length;s++)Z1(i[s])}}function nl(i,s){var a=i.stateNode;if(a===null)return null;var o=a[mi]||null;if(o===null)return null;a=o[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(i=i.type,o=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!o;break e;default:i=!1}if(i)return null;if(a&&typeof a!="function")throw Error(r(231,s,typeof a));return a}var Hs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fu=!1;if(Hs)try{var rl={};Object.defineProperty(rl,"passive",{get:function(){fu=!0}}),window.addEventListener("test",rl,rl),window.removeEventListener("test",rl,rl)}catch{fu=!1}var pn=null,pu=null,Po=null;function Q1(){if(Po)return Po;var i,s=pu,a=s.length,o,u="value"in pn?pn.value:pn.textContent,f=u.length;for(i=0;i<a&&s[i]===u[i];i++);var y=a-i;for(o=1;o<=y&&s[a-o]===u[f-o];o++);return Po=u.slice(i,1<o?1-o:void 0)}function qo(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function Vo(){return!0}function J1(){return!1}function ri(i){function s(a,o,u,f,y){this._reactName=a,this._targetInst=u,this.type=o,this.nativeEvent=f,this.target=y,this.currentTarget=null;for(var C in i)i.hasOwnProperty(C)&&(a=i[C],this[C]=a?a(f):f[C]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Vo:J1,this.isPropagationStopped=J1,this}return I(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Vo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Vo)},persist:function(){},isPersistent:Vo}),s}var gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$o=ri(gn),al=I({},gn,{view:0,detail:0}),Ew=ri(al),gu,mu,ll,Wo=I({},al,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_u,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==ll&&(ll&&i.type==="mousemove"?(gu=i.screenX-ll.screenX,mu=i.screenY-ll.screenY):mu=gu=0,ll=i),gu)},movementY:function(i){return"movementY"in i?i.movementY:mu}}),ep=ri(Wo),Mw=I({},Wo,{dataTransfer:0}),jw=ri(Mw),Tw=I({},al,{relatedTarget:0}),vu=ri(Tw),Dw=I({},gn,{animationName:0,elapsedTime:0,pseudoElement:0}),Rw=ri(Dw),Aw=I({},gn,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),Nw=ri(Aw),Lw=I({},gn,{data:0}),tp=ri(Lw),Bw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ow={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"},zw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Hw(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=zw[i])?!!s[i]:!1}function _u(){return Hw}var Iw=I({},al,{key:function(i){if(i.key){var s=Bw[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=qo(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Ow[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_u,charCode:function(i){return i.type==="keypress"?qo(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?qo(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),Uw=ri(Iw),Pw=I({},Wo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ip=ri(Pw),qw=I({},gn,{submitter:0}),Vw=ri(qw),$w=I({},al,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_u}),Ww=ri($w),Fw=I({},gn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Kw=ri(Fw),Yw=I({},Wo,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),Gw=ri(Yw),Zw=I({},gn,{newState:0,oldState:0,source:0}),Xw=ri(Zw),Qw=[9,13,27,32],yu=Hs&&"CompositionEvent"in window,ol=null;Hs&&"documentMode"in document&&(ol=document.documentMode);var Jw=Hs&&"TextEvent"in window&&!ol,sp=Hs&&(!yu||ol&&8<ol&&11>=ol),np=" ",rp=!1;function ap(i,s){switch(i){case"keyup":return Qw.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function lp(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Zr=!1;function e4(i,s){switch(i){case"compositionend":return lp(s);case"keypress":return s.which!==32?null:(rp=!0,np);case"textInput":return i=s.data,i===np&&rp?null:i;default:return null}}function t4(i,s){if(Zr)return i==="compositionend"||!yu&&ap(i,s)?(i=Q1(),Po=pu=pn=null,Zr=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return sp&&s.locale!=="ko"?null:s.data;default:return null}}var i4={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 op(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!i4[i.type]:s==="textarea"}function cp(i,s,a,o){Yr?Gr?Gr.push(o):Gr=[o]:Yr=o,s=Fc(s,"onChange"),0<s.length&&(a=new $o("onChange","change",null,a,o),i.push({event:a,listeners:s}))}var cl=null,hl=null;function s4(i){Zm(i,0)}function Fo(i){var s=sl(i);if($1(s))return i}function hp(i,s){if(i==="change")return s}var up=!1;if(Hs){var Su;if(Hs){var xu="oninput"in document;if(!xu){var dp=document.createElement("div");dp.setAttribute("oninput","return;"),xu=typeof dp.oninput=="function"}Su=xu}else Su=!1;up=Su&&(!document.documentMode||9<document.documentMode)}function fp(){cl&&(cl.detachEvent("onpropertychange",pp),hl=cl=null)}function pp(i){if(i.propertyName==="value"&&Fo(hl)){var s=[];cp(s,hl,i,uu(i)),X1(s4,s)}}function n4(i,s,a){i==="focusin"?(fp(),cl=s,hl=a,cl.attachEvent("onpropertychange",pp)):i==="focusout"&&fp()}function r4(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Fo(hl)}function a4(i,s){if(i==="click")return Fo(s)}function l4(i,s){if(i==="input"||i==="change")return Fo(s)}function o4(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var Di=typeof Object.is=="function"?Object.is:o4;function ul(i,s){if(Di(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var a=Object.keys(i),o=Object.keys(s);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var u=a[o];if(!ir.call(s,u)||!Di(i[u],s[u]))return!1}return!0}function wu(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function gp(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function mp(i,s){var a=gp(i);i=0;for(var o;a;){if(a.nodeType===3){if(o=i+a.textContent.length,i<=s&&o>=s)return{node:a,offset:s-i};i=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=gp(a)}}function vp(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?vp(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function _p(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=wu(i.document);s instanceof i.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)i=s.contentWindow;else break;s=wu(i.document)}return s}function bu(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var c4=Hs&&"documentMode"in document&&11>=document.documentMode,Xr=null,Cu=null,dl=null,ku=!1;function yp(i,s,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;ku||Xr==null||Xr!==wu(o)||(o=Xr,"selectionStart"in o&&bu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),dl&&ul(dl,o)||(dl=o,o=Fc(Cu,"onSelect"),0<o.length&&(s=new $o("onSelect","select",null,s,a),i.push({event:s,listeners:o}),s.target=Xr)))}function ar(i,s){var a={};return a[i.toLowerCase()]=s.toLowerCase(),a["Webkit"+i]="webkit"+s,a["Moz"+i]="moz"+s,a}var Qr={animationend:ar("Animation","AnimationEnd"),animationiteration:ar("Animation","AnimationIteration"),animationstart:ar("Animation","AnimationStart"),transitionrun:ar("Transition","TransitionRun"),transitionstart:ar("Transition","TransitionStart"),transitioncancel:ar("Transition","TransitionCancel"),transitionend:ar("Transition","TransitionEnd")},Eu={},Sp={};Hs&&(Sp=document.createElement("div").style,"AnimationEvent"in window||(delete Qr.animationend.animation,delete Qr.animationiteration.animation,delete Qr.animationstart.animation),"TransitionEvent"in window||delete Qr.transitionend.transition);function lr(i){if(Eu[i])return Eu[i];if(!Qr[i])return i;var s=Qr[i],a;for(a in s)if(s.hasOwnProperty(a)&&a in Sp)return Eu[i]=s[a];return i}var xp=lr("animationend"),wp=lr("animationiteration"),bp=lr("animationstart"),h4=lr("transitionrun"),u4=lr("transitionstart"),d4=lr("transitioncancel"),Cp=lr("transitionend"),kp=new Map,Mu="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(" ");Mu.push("scrollEnd");function os(i,s){kp.set(i,s),rr(s,[i])}var f4=0;function Is(i,s){if(i.name!=null&&i.name!=="auto")return i.name;if(s.autoName!==null)return s.autoName;i=ds.identifierPrefix;var a=f4++;return i="_"+i+"t_"+a.toString(32)+"_",s.autoName=i}function Ep(i){if(i==null||typeof i=="string")return i;var s=null,a=_a;if(a!==null)for(var o=0;o<a.length;o++){var u=i[a[o]];if(u!=null){if(u==="none")return"none";s=s==null?u:s+(" "+u)}}return s??i.default}function Us(i,s){return i=Ep(i),s=Ep(s),s==null?i==="auto"?null:i:s==="auto"?null:s}var Ko=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},qi=[],Jr=0,ju=0;function Yo(){for(var i=Jr,s=ju=Jr=0;s<i;){var a=qi[s];qi[s++]=null;var o=qi[s];qi[s++]=null;var u=qi[s];qi[s++]=null;var f=qi[s];if(qi[s++]=null,o!==null&&u!==null){var y=o.pending;y===null?u.next=u:(u.next=y.next,y.next=u),o.pending=u}f!==0&&Mp(a,u,f)}}function Go(i,s,a,o){qi[Jr++]=i,qi[Jr++]=s,qi[Jr++]=a,qi[Jr++]=o,ju|=o,i.lanes|=o,i=i.alternate,i!==null&&(i.lanes|=o)}function Tu(i,s,a,o){return Go(i,s,a,o),Zo(i)}function or(i,s){return Go(i,null,null,s),Zo(i)}function Mp(i,s,a){i.lanes|=a;var o=i.alternate;o!==null&&(o.lanes|=a);for(var u=!1,f=i.return;f!==null;)f.childLanes|=a,o=f.alternate,o!==null&&(o.childLanes|=a),f.tag===22&&(i=f.stateNode,i===null||i._visibility&1||(u=!0)),i=f,f=f.return;return i.tag===3?(f=i.stateNode,u&&s!==null&&(u=31-ji(a),i=f.hiddenUpdates,o=i[u],o===null?i[u]=[s]:o.push(s),s.lane=a|536870912),f):null}function Zo(i){if(50<Ll)throw Ll=0,Ic=null,Error(r(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var ea={};function p4(i,s,a,o){this.tag=i,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vi(i,s,a,o){return new p4(i,s,a,o)}function Du(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Ps(i,s){var a=i.alternate;return a===null?(a=vi(i.tag,s,i.key,i.mode),a.elementType=i.elementType,a.type=i.type,a.stateNode=i.stateNode,a.alternate=i,i.alternate=a):(a.pendingProps=s,a.type=i.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=i.flags&1206910976,a.childLanes=i.childLanes,a.lanes=i.lanes,a.child=i.child,a.memoizedProps=i.memoizedProps,a.memoizedState=i.memoizedState,a.updateQueue=i.updateQueue,s=i.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=i.sibling,a.index=i.index,a.ref=i.ref,a.refCleanup=i.refCleanup,a}function jp(i,s){i.flags&=1206910978;var a=i.alternate;return a===null?(i.childLanes=0,i.lanes=s,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,s=a.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),i}function Xo(i,s,a,o,u,f){var y=0;if(o=i,typeof o=="function")Du(o)&&(y=1);else if(typeof o=="string")y=q5(i,a,gi.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(o){case de:return i=vi(31,a,s,u),i.elementType=de,i.lanes=f,i;case $:return cr(a.children,u,f,s);case M:y=8,u|=24;break;case N:return i=vi(12,a,s,u|2),i.elementType=N,i.lanes=f,i;case te:return i=vi(13,a,s,u),i.elementType=te,i.lanes=f,i;case Q:return i=vi(19,a,s,u),i.elementType=Q,i.lanes=f,i;case Ce:case D:return i=u|32,i=vi(30,a,s,i),i.elementType=D,i.lanes=f,i.stateNode={autoName:null,paired:null,clones:null,ref:null},i;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case O:y=10;break e;case L:y=9;break e;case P:y=11;break e;case ce:y=14;break e;case re:y=16,o=null;break e}y=29,a=Error(r(130,i===null?"null":typeof i,"")),o=null}return s=vi(y,a,s,u),s.elementType=i,s.type=o,s.lanes=f,s}function cr(i,s,a,o){return i=vi(7,i,o,s),i.lanes=a,i}function Ru(i,s,a){return i=vi(6,i,null,s),i.lanes=a,i}function Tp(i){var s=vi(18,null,null,0);return s.stateNode=i,s}function Au(i,s,a){return s=vi(4,i.children!==null?i.children:[],i.key,s),s.lanes=a,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var Dp=new WeakMap;function Vi(i,s){if(typeof i=="object"&&i!==null){var a=Dp.get(i);return a!==void 0?a:(s={value:i,source:s,stack:ls(s)},Dp.set(i,s),s)}return{value:i,source:s,stack:ls(s)}}var ta=[],ia=0,Qo=null,fl=0,$i=[],Wi=0,mn=null,ms=1,vs="";function qs(i,s){ta[ia++]=fl,ta[ia++]=Qo,Qo=i,fl=s}function Rp(i,s,a){$i[Wi++]=ms,$i[Wi++]=vs,$i[Wi++]=mn,mn=i;var o=ms;i=vs;var u=32-ji(o)-1;o&=~(1<<u),a+=1;var f=32-ji(s)+u;if(30<f){var y=u-u%5;f=(o&(1<<y)-1).toString(32),o>>=y,u-=y,ms=1<<32-ji(s)+u|a<<u|o,vs=f+i}else ms=1<<f|a<<u|o,vs=i}function Jo(i){i.return!==null&&(qs(i,1),Rp(i,1,0))}function Nu(i){for(;i===Qo;)Qo=ta[--ia],ta[ia]=null,fl=ta[--ia],ta[ia]=null;for(;i===mn;)mn=$i[--Wi],$i[Wi]=null,vs=$i[--Wi],$i[Wi]=null,ms=$i[--Wi],$i[Wi]=null}function Ap(i,s){$i[Wi++]=ms,$i[Wi++]=vs,$i[Wi++]=mn,ms=s.id,vs=s.overflow,mn=i}var zt=null,nt=null,Oe=!1,vn=null,Fi=!1,Lu=Error(r(519));function _n(i){var s=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw pl(Vi(s,i)),Lu}function Np(i){var s=i.stateNode,a=i.type,o=i.memoizedProps;switch(s[Ft]=i,s[mi]=o,a){case"dialog":Ue("cancel",s),Ue("close",s);break;case"iframe":case"object":case"embed":Ue("load",s);break;case"video":case"audio":for(a=0;a<Ol.length;a++)Ue(Ol[a],s);break;case"source":Ue("error",s);break;case"img":case"image":case"link":Ue("error",s),Ue("load",s);break;case"details":Ue("toggle",s);break;case"input":Ue("invalid",s),W1(s,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Ue("invalid",s);break;case"textarea":Ue("invalid",s),K1(s,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||s.textContent===""+a||o.suppressHydrationWarning===!0||ev(s.textContent,a)?(o.popover!=null&&(Ue("beforetoggle",s),Ue("toggle",s)),o.onScroll!=null&&Ue("scroll",s),o.onScrollEnd!=null&&Ue("scrollend",s),o.onClick!=null&&(s.onclick=gs),s=!0):s=!1,s||_n(i,!0)}function ec(i){for(zt=i.return;zt;)switch(zt.tag){case 5:case 31:case 13:Fi=!1;return;case 27:case 3:Fi=!0;return;default:zt=zt.return}}function sa(i){if(i!==zt)return!1;if(!Oe)return ec(i),Oe=!0,!1;var s=i.tag,a;if((a=s!==3&&s!==27)&&((a=s===5)&&(a=i.type,a=!(a!=="form"&&a!=="button")||h0(i.type,i.memoizedProps)),a=!a),a&&nt&&_n(i),ec(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));nt=yv(i)}else if(s===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));nt=yv(i)}else s===27?(s=nt,Ln(i.type)?(i=y0,y0=null,nt=i):nt=s):nt=zt?Yi(i.stateNode.nextSibling):null;return!0}function hr(){nt=zt=null,Oe=!1}function Bu(){var i=vn;return i!==null&&(Si===null?Si=i:Si.push.apply(Si,i),vn=null),i}function pl(i){vn===null?vn=[i]:vn.push(i)}var Ou=Bt(null),ur=null,Vs=null;function yn(i,s,a){$e(Ou,s._currentValue),s._currentValue=a}function $s(i){i._currentValue=Ou.current,pt(Ou)}function tc(i,s,a){for(;i!==null;){var o=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,o!==null&&(o.childLanes|=s)):o!==null&&(o.childLanes&s)!==s&&(o.childLanes|=s),i===a)break;i=i.return}}function zu(i,s,a,o){var u=i.child;for(u!==null&&(u.return=i);u!==null;){var f=u.dependencies;if(f!==null){var y=u.child;f=f.firstContext;e:for(;f!==null;){var C=f;f=u;for(var T=0;T<s.length;T++)if(C.context===s[T]){f.lanes|=a,C=f.alternate,C!==null&&(C.lanes|=a),tc(f.return,a,i),o||(y=null);break e}f=C.next}}else if(u.tag===18){if(y=u.return,y===null)throw Error(r(341));y.lanes|=a,f=y.alternate,f!==null&&(f.lanes|=a),tc(y,a,i),y=null}else u.tag===13&&u.memoizedState!==null&&u.memoizedState.dehydrated===null?(u.lanes|=a,y=u.alternate,y!==null&&(y.lanes|=a),tc(u.return,a,i),y=u.child,y=y!==null?y.sibling:null):y=u.child;if(y!==null)y.return=u;else for(y=u;y!==null;){if(y===i){y=null;break}if(u=y.sibling,u!==null){u.return=y.return,y=u;break}y=y.return}u=y}}function dr(i,s,a,o){i=null;for(var u=s,f=!1;u!==null;){if(!f){if((u.flags&524288)!==0)f=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var y=u.alternate;if(y===null)throw Error(r(387));if(y=y.memoizedProps,y!==null){var C=u.type;Di(u.pendingProps.value,y.value)||(i!==null?i.push(C):i=[C])}}else if(u===ki.current){if(y=u.alternate,y===null)throw Error(r(387));y.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(i!==null?i.push(ja):i=[ja])}u=u.return}return i!==null&&zu(s,i,a,o),s.flags|=262144,i!==null}function ic(i){for(i=i.firstContext;i!==null;){if(!Di(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function fr(i){ur=i,Vs=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Kt(i){return Lp(ur,i)}function sc(i,s){return ur===null&&fr(i),Lp(i,s)}function Lp(i,s){var a=s._currentValue;if(s={context:s,memoizedValue:a,next:null},Vs===null){if(i===null)throw Error(r(308));Vs=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else Vs=Vs.next=s;return a}var g4=typeof AbortController<"u"?AbortController:function(){var i=[],s=this.signal={aborted:!1,addEventListener:function(a,o){i.push(o)}};this.abort=function(){s.aborted=!0,i.forEach(function(a){return a()})}},m4=e.unstable_scheduleCallback,v4=e.unstable_NormalPriority,xt={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Hu(){return{controller:new g4,data:new Map,refCount:0}}function gl(i){i.refCount--,i.refCount===0&&m4(v4,function(){i.controller.abort()})}function Bp(i,s){if((i.pendingLanes&4194048)!==0){var a=i.transitionTypes;for(a===null&&(a=i.transitionTypes=[]),i=0;i<s.length;i++){var o=s[i];a.indexOf(o)===-1&&a.push(o)}}}var ml=null;function _4(i){var s=i.transitionTypes;return i.transitionTypes=null,s}var vl=null,Iu=0,pr=0,na=null;function y4(i,s){if(vl===null){var a=vl=[];Iu=0,pr=t0(),na={status:"pending",value:void 0,then:function(o){a.push(o)}}}return Iu++,s.then(Op,Op),s}function Op(){if(--Iu===0&&(ml=null,vl!==null)){na!==null&&(na.status="fulfilled");var i=vl;vl=null,pr=0,na=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function S4(i,s){var a=[],o={status:"pending",value:null,reason:null,then:function(u){a.push(u)}};return i.then(function(){o.status="fulfilled",o.value=s;for(var u=0;u<a.length;u++)(0,a[u])(s)},function(u){for(o.status="rejected",o.reason=u,u=0;u<a.length;u++)(0,a[u])(void 0)}),o}var zp=pe.S;pe.S=function(i,s){if(Tm=Ei(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&y4(i,s),ml!==null)for(var a=wa;a!==null;)Bp(a,ml),a=a.next;if(a=i.types,a!==null){for(var o=wa;o!==null;)Bp(o,a),o=o.next;if(pr!==0){o=ml,o===null&&(o=ml=[]);for(var u=0;u<a.length;u++){var f=a[u];o.indexOf(f)===-1&&o.push(f)}}}zp!==null&&zp(i,s)};var gr=Bt(null);function Uu(){var i=gr.current;return i!==null?i:st.pooledCache}function nc(i,s){s===null?$e(gr,gr.current):$e(gr,s.pool)}function Hp(){var i=Uu();return i===null?null:{parent:xt._currentValue,pool:i}}var ra=Error(r(460)),Pu=Error(r(474)),rc=Error(r(542)),ac={then:function(){}};function Ip(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Up(i,s,a){switch(a=i[a],a===void 0?i.push(s):a!==s&&(s.then(gs,gs),s=a),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,qp(i),i===void 0&&!("reason"in s)?Error(r(600)):i;default:if(typeof s.status=="string")s.then(gs,gs);else{if(i=st,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=s,i.status="pending",i.then(function(o){if(s.status==="pending"){var u=s;u.status="fulfilled",u.value=o}},function(o){if(s.status==="pending"){var u=s;u.status="rejected",u.reason=o}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,qp(i),i}throw vr=s,ra}}function mr(i){try{var s=i._init;return s(i._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(vr=a,ra):a}}var vr=null;function Pp(){if(vr===null)throw Error(r(459));var i=vr;return vr=null,i}function qp(i){if(i===ra||i===rc)throw Error(r(483))}var aa=null,_l=0;function lc(i){var s=_l;return _l+=1,aa===null&&(aa=[]),Up(aa,i,s)}function Sn(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function oc(i,s){throw s.$$typeof===q?Error(r(525)):(i=Object.prototype.toString.call(s),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function Vp(i){function s(K,H){if(i){var Z=K.deletions;Z===null?(K.deletions=[H],K.flags|=16):Z.push(H)}}function a(K,H){if(!i)return null;for(;H!==null;)s(K,H),H=H.sibling;return null}function o(K){for(var H=new Map;K!==null;)K.key===null?H.set(K.index,K):H.set(K.key,K),K=K.sibling;return H}function u(K,H){return K=Ps(K,H),K.index=0,K.sibling=null,K}function f(K,H,Z){return K.index=Z,i?(Z=K.alternate,Z!==null?(Z=Z.index,Z<H?(K.flags|=2,H):Z):(K.flags|=134217730,H)):(K.flags|=1048576,H)}function y(K){return i&&K.alternate===null&&(K.flags|=134217730),K}function C(K,H,Z,ie){return H===null||H.tag!==6?(H=Ru(Z,K.mode,ie),H.return=K,H):(H=u(H,Z),H.return=K,H)}function T(K,H,Z,ie){var ve=Z.type;return ve===$?(K=ee(K,H,Z.props.children,ie,Z.key),Sn(K,Z),K):H!==null&&(H.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===re&&mr(ve)===H.type)?(H=u(H,Z.props),Sn(H,Z),H.return=K,H):(H=Xo(Z.type,Z.key,Z.props,null,K.mode,ie),Sn(H,Z),H.return=K,H)}function G(K,H,Z,ie){return H===null||H.tag!==4||H.stateNode.containerInfo!==Z.containerInfo||H.stateNode.implementation!==Z.implementation?(H=Au(Z,K.mode,ie),H.return=K,H):(H=u(H,Z.children||[]),H.return=K,H)}function ee(K,H,Z,ie,ve){return H===null||H.tag!==7?(H=cr(Z,K.mode,ie,ve),H.return=K,H):(H=u(H,Z),H.return=K,H)}function se(K,H,Z){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=Ru(""+H,K.mode,Z),H.return=K,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case U:return Z=Xo(H.type,H.key,H.props,null,K.mode,Z),Sn(Z,H),Z.return=K,Z;case Y:return H=Au(H,K.mode,Z),H.return=K,H;case re:return H=mr(H),se(K,H,Z)}if(be(H)||he(H))return H=cr(H,K.mode,Z,null),H.return=K,H;if(typeof H.then=="function")return se(K,lc(H),Z);if(H.$$typeof===O)return se(K,sc(K,H),Z);oc(K,H)}return null}function W(K,H,Z,ie){var ve=H!==null?H.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return ve!==null?null:C(K,H,""+Z,ie);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case U:return Z.key===ve?T(K,H,Z,ie):null;case Y:return Z.key===ve?G(K,H,Z,ie):null;case re:return Z=mr(Z),W(K,H,Z,ie)}if(be(Z)||he(Z))return ve!==null?null:ee(K,H,Z,ie,null);if(typeof Z.then=="function")return W(K,H,lc(Z),ie);if(Z.$$typeof===O)return W(K,H,sc(K,Z),ie);oc(K,Z)}return null}function X(K,H,Z,ie,ve){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return K=K.get(Z)||null,C(H,K,""+ie,ve);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case U:return K=K.get(ie.key===null?Z:ie.key)||null,T(H,K,ie,ve);case Y:return K=K.get(ie.key===null?Z:ie.key)||null,G(H,K,ie,ve);case re:return ie=mr(ie),X(K,H,Z,ie,ve)}if(be(ie)||he(ie))return K=K.get(Z)||null,ee(H,K,ie,ve,null);if(typeof ie.then=="function")return X(K,H,Z,lc(ie),ve);if(ie.$$typeof===O)return X(K,H,Z,sc(H,ie),ve);oc(H,ie)}return null}function fe(K,H,Z,ie){for(var ve=null,qe=null,Se=H,Me=H=0,Ct=null;Se!==null&&Me<Z.length;Me++){Se.index>Me?(Ct=Se,Se=null):Ct=Se.sibling;var Ve=W(K,Se,Z[Me],ie);if(Ve===null){Se===null&&(Se=Ct);break}i&&Se&&Ve.alternate===null&&s(K,Se),H=f(Ve,H,Me),qe===null?ve=Ve:qe.sibling=Ve,qe=Ve,Se=Ct}if(Me===Z.length)return a(K,Se),Oe&&qs(K,Me),ve;if(Se===null){for(;Me<Z.length;Me++)Se=se(K,Z[Me],ie),Se!==null&&(H=f(Se,H,Me),qe===null?ve=Se:qe.sibling=Se,qe=Se);return Oe&&qs(K,Me),ve}for(Se=o(Se);Me<Z.length;Me++)Ct=X(Se,K,Me,Z[Me],ie),Ct!==null&&(i&&(Ve=Ct.alternate,Ve!==null&&Se.delete(Ve.key===null?Me:Ve.key)),H=f(Ct,H,Me),qe===null?ve=Ct:qe.sibling=Ct,qe=Ct);return i&&Se.forEach(function(In){return s(K,In)}),Oe&&qs(K,Me),ve}function ye(K,H,Z,ie){if(Z==null)throw Error(r(151));for(var ve=null,qe=null,Se=H,Me=H=0,Ct=null,Ve=Z.next();Se!==null&&!Ve.done;Me++,Ve=Z.next()){Se.index>Me?(Ct=Se,Se=null):Ct=Se.sibling;var In=W(K,Se,Ve.value,ie);if(In===null){Se===null&&(Se=Ct);break}i&&Se&&In.alternate===null&&s(K,Se),H=f(In,H,Me),qe===null?ve=In:qe.sibling=In,qe=In,Se=Ct}if(Ve.done)return a(K,Se),Oe&&qs(K,Me),ve;if(Se===null){for(;!Ve.done;Me++,Ve=Z.next())Ve=se(K,Ve.value,ie),Ve!==null&&(H=f(Ve,H,Me),qe===null?ve=Ve:qe.sibling=Ve,qe=Ve);return Oe&&qs(K,Me),ve}for(Se=o(Se);!Ve.done;Me++,Ve=Z.next())Ve=X(Se,K,Me,Ve.value,ie),Ve!==null&&(i&&(Ct=Ve.alternate,Ct!==null&&Se.delete(Ct.key===null?Me:Ct.key)),H=f(Ve,H,Me),qe===null?ve=Ve:qe.sibling=Ve,qe=Ve);return i&&Se.forEach(function(eb){return s(K,eb)}),Oe&&qs(K,Me),ve}function Be(K,H,Z,ie){if(typeof Z=="object"&&Z!==null&&Z.type===$&&Z.key===null&&Z.props.ref===void 0&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case U:e:{for(var ve=Z.key;H!==null;){if(H.key===ve){if(ve=Z.type,ve===$){if(H.tag===7){a(K,H.sibling),ie=u(H,Z.props.children),Sn(ie,Z),ie.return=K,K=ie;break e}}else if(H.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===re&&mr(ve)===H.type){a(K,H.sibling),ie=u(H,Z.props),Sn(ie,Z),ie.return=K,K=ie;break e}a(K,H);break}else s(K,H);H=H.sibling}Z.type===$?(ie=cr(Z.props.children,K.mode,ie,Z.key),Sn(ie,Z),ie.return=K,K=ie):(ie=Xo(Z.type,Z.key,Z.props,null,K.mode,ie),Sn(ie,Z),ie.return=K,K=ie)}return y(K);case Y:e:{for(ve=Z.key;H!==null;){if(H.key===ve)if(H.tag===4&&H.stateNode.containerInfo===Z.containerInfo&&H.stateNode.implementation===Z.implementation){a(K,H.sibling),ie=u(H,Z.children||[]),ie.return=K,K=ie;break e}else{a(K,H);break}else s(K,H);H=H.sibling}ie=Au(Z,K.mode,ie),ie.return=K,K=ie}return y(K);case re:return Z=mr(Z),Be(K,H,Z,ie)}if(be(Z))return fe(K,H,Z,ie);if(he(Z)){if(ve=he(Z),typeof ve!="function")throw Error(r(150));return Z=ve.call(Z),ye(K,H,Z,ie)}if(typeof Z.then=="function")return Be(K,H,lc(Z),ie);if(Z.$$typeof===O)return Be(K,H,sc(K,Z),ie);oc(K,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,H!==null&&H.tag===6?(a(K,H.sibling),ie=u(H,Z),ie.return=K,K=ie):(a(K,H),ie=Ru(Z,K.mode,ie),ie.return=K,K=ie),y(K)):a(K,H)}return function(K,H,Z,ie){try{_l=0;var ve=Be(K,H,Z,ie);return aa=null,ve}catch(Se){if(Se===ra||Se===rc)throw Se;var qe=vi(29,Se,null,K.mode);return qe.lanes=ie,qe.return=K,qe}}}var _r=Vp(!0),$p=Vp(!1),xn=!1;function qu(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vu(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function wn(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function bn(i,s,a){var o=i.updateQueue;if(o===null)return null;if(o=o.shared,(Ye&2)!==0){var u=o.pending;return u===null?s.next=s:(s.next=u.next,u.next=s),o.pending=s,s=Zo(i),Mp(i,null,a),s}return Go(i,o,s,a),Zo(i)}function yl(i,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194048)!==0)){var o=s.lanes;o&=i.pendingLanes,a|=o,s.lanes=a,R1(i,a)}}function $u(i,s){var a=i.updateQueue,o=i.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var u=null,f=null;if(a=a.firstBaseUpdate,a!==null){do{var y={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};f===null?u=f=y:f=f.next=y,a=a.next}while(a!==null);f===null?u=f=s:f=f.next=s}else u=f=s;a={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:o.shared,callbacks:o.callbacks},i.updateQueue=a;return}i=a.lastBaseUpdate,i===null?a.firstBaseUpdate=s:i.next=s,a.lastBaseUpdate=s}var Wu=!1;function Sl(){if(Wu){var i=na;if(i!==null)throw i}}function xl(i,s,a,o){Wu=!1;var u=i.updateQueue;xn=!1;var f=u.firstBaseUpdate,y=u.lastBaseUpdate,C=u.shared.pending;if(C!==null){u.shared.pending=null;var T=C,G=T.next;T.next=null,y===null?f=G:y.next=G,y=T;var ee=i.alternate;ee!==null&&(ee=ee.updateQueue,C=ee.lastBaseUpdate,C!==y&&(C===null?ee.firstBaseUpdate=G:C.next=G,ee.lastBaseUpdate=T))}if(f!==null){var se=u.baseState;y=0,ee=G=T=null,C=f;do{var W=C.lane&-536870913,X=W!==C.lane;if(X?(Pe&W)===W:(o&W)===W){W!==0&&W===pr&&(Wu=!0),ee!==null&&(ee=ee.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var fe=i,ye=C;W=s;var Be=a;switch(ye.tag){case 1:if(fe=ye.payload,typeof fe=="function"){se=fe.call(Be,se,W);break e}se=fe;break e;case 3:fe.flags=fe.flags&-65537|128;case 0:if(fe=ye.payload,W=typeof fe=="function"?fe.call(Be,se,W):fe,W==null)break e;se=I({},se,W);break e;case 2:xn=!0}}W=C.callback,W!==null&&(i.flags|=64,X&&(i.flags|=8192),X=u.callbacks,X===null?u.callbacks=[W]:X.push(W))}else X={lane:W,tag:C.tag,payload:C.payload,callback:C.callback,next:null},ee===null?(G=ee=X,T=se):ee=ee.next=X,y|=W;if(C=C.next,C===null){if(C=u.shared.pending,C===null)break;X=C,C=X.next,X.next=null,u.lastBaseUpdate=X,u.shared.pending=null}}while(!0);ee===null&&(T=se),u.baseState=T,u.firstBaseUpdate=G,u.lastBaseUpdate=ee,f===null&&(u.shared.lanes=0),Dn|=y,i.lanes=y,i.memoizedState=se}}function Wp(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function Fp(i,s){var a=i.callbacks;if(a!==null)for(i.callbacks=null,i=0;i<a.length;i++)Wp(a[i],s)}var Cn=Bt(null),cc=Bt(0);function Kp(i,s){i=Gs,$e(cc,i),$e(Cn,s),Gs=i|s.baseLanes}function Fu(){$e(cc,Gs),$e(Cn,Cn.current)}function Ku(){Gs=cc.current,pt(Cn),pt(cc)}var Yt=Bt(null),ii=null;function kn(i){var s=i.alternate;$e(Gt,Gt.current&1),$e(Yt,i),ii===null&&(s===null||Cn.current!==null||s.memoizedState!==null)&&(ii=i)}function Yu(i){$e(Gt,Gt.current),$e(Yt,i),ii===null&&(ii=i)}function Yp(i){i.tag===22?($e(Gt,Gt.current),$e(Yt,i),ii===null&&(ii=i)):En()}function En(){$e(Gt,Gt.current),$e(Yt,Yt.current)}function Ri(i){pt(Yt),ii===i&&(ii=null),pt(Gt)}var Gt=Bt(0);function wl(i,s){$e(Yt,Yt.current),$e(Gt,s)}function Gu(i){pt(Gt),pt(Yt),ii===i&&(ii=null)}function hc(i){for(var s=i;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||v0(a)||_0(a)))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!=="independent"){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Ws=0,Le=null,tt=null,wt=null,uc=!1,la=!1,yr=!1,dc=0,bl=0,oa=null,x4=0;function gt(){throw Error(r(321))}function Zu(i,s){if(s===null)return!1;for(var a=0;a<s.length&&a<i.length;a++)if(!Di(i[a],s[a]))return!1;return!0}function Xu(i,s,a,o,u,f){return Ws=f,Le=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,pe.H=i===null||i.memoizedState===null?Rg:Ag,yr=!1,f=a(o,u),yr=!1,la&&(f=Zp(s,a,o,u)),Gp(i),f}function Gp(i){pe.H=yc;var s=tt!==null&&tt.next!==null;if(Ws=0,wt=tt=Le=null,uc=!1,bl=0,oa=null,s)throw Error(r(300));i===null||bt||(i=i.dependencies,i!==null&&ic(i)&&(bt=!0))}function Zp(i,s,a,o){Le=i;var u=0;do{if(la&&(oa=null),bl=0,la=!1,25<=u)throw Error(r(301));if(u+=1,wt=tt=null,i.updateQueue!=null){var f=i.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}pe.H=T4,f=s(a,o)}while(la);return f}function w4(){var i=pe.H,s=i.useState()[0];return s=typeof s.then=="function"?Cl(s):s,i=i.useState()[0],(tt!==null?tt.memoizedState:null)!==i&&(Le.flags|=1024),s}function Qu(){var i=dc!==0;return dc=0,i}function Ju(i,s,a){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~a}function ed(i){if(uc){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}uc=!1}Ws=0,wt=tt=Le=null,la=!1,bl=dc=0,oa=null}function ai(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wt===null?Le.memoizedState=wt=i:wt=wt.next=i,wt}function yt(){if(tt===null){var i=Le.alternate;i=i!==null?i.memoizedState:null}else i=tt.next;var s=wt===null?Le.memoizedState:wt.next;if(s!==null)wt=s,tt=i;else{if(i===null)throw Le.alternate===null?Error(r(467)):Error(r(310));tt=i,i={memoizedState:tt.memoizedState,baseState:tt.baseState,baseQueue:tt.baseQueue,queue:tt.queue,next:null},wt===null?Le.memoizedState=wt=i:wt=wt.next=i}return wt}function fc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Cl(i){var s=bl;return bl+=1,oa===null&&(oa=[]),i=Up(oa,i,s),s=Le,(wt===null?s.memoizedState:wt.next)===null&&(s=s.alternate,pe.H=s===null||s.memoizedState===null?Rg:Ag),i}function pc(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Cl(i);if(i.$$typeof===J)return;if(i.$$typeof===O)return Kt(i)}throw Error(r(438,String(i)))}function td(i){var s=null,a=Le.updateQueue;if(a!==null&&(s=a.memoCache),s==null){var o=Le.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(s={data:o.data.map(function(u){return u.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),a===null&&(a=fc(),Le.updateQueue=a),a.memoCache=s,a=s.data[s.index],a===void 0)for(a=s.data[s.index]=Array(i),o=0;o<i;o++)a[o]=je;return s.index++,a}function Fs(i,s){return typeof s=="function"?s(i):s}function gc(i){var s=yt();return id(s,tt,i)}function id(i,s,a){var o=i.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=a;var u=i.baseQueue,f=o.pending;if(f!==null){if(u!==null){var y=u.next;u.next=f.next,f.next=y}s.baseQueue=u=f,o.pending=null}if(f=i.baseState,u===null)i.memoizedState=f;else{s=u.next;var C=y=null,T=null,G=s,ee=!1;do{var se=G.lane&-536870913;if(se!==G.lane?(Pe&se)===se:(Ws&se)===se){var W=G.revertLane;if(W===0)T!==null&&(T=T.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),se===pr&&(ee=!0);else if((Ws&W)===W){G=G.next,W===pr&&(ee=!0);continue}else se={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},T===null?(C=T=se,y=f):T=T.next=se,Le.lanes|=W,Dn|=W;se=G.action,yr&&a(f,se),f=G.hasEagerState?G.eagerState:a(f,se)}else W={lane:se,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},T===null?(C=T=W,y=f):T=T.next=W,Le.lanes|=se,Dn|=se;G=G.next}while(G!==null&&G!==s);if(T===null?y=f:T.next=C,!Di(f,i.memoizedState)&&(bt=!0,ee&&(a=na,a!==null)))throw a;i.memoizedState=f,i.baseState=y,i.baseQueue=T,o.lastRenderedState=f}return u===null&&(o.lanes=0),[i.memoizedState,o.dispatch]}function sd(i){var s=yt(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=i;var o=a.dispatch,u=a.pending,f=s.memoizedState;if(u!==null){a.pending=null;var y=u=u.next;do f=i(f,y.action),y=y.next;while(y!==u);Di(f,s.memoizedState)||(bt=!0),s.memoizedState=f,s.baseQueue===null&&(s.baseState=f),a.lastRenderedState=f}return[f,o]}function Xp(i,s,a){var o=Le,u=yt(),f=Oe;if(f){if(a===void 0)throw Error(r(407));a=a()}else a=s();var y=!Di((tt||u).memoizedState,a);if(y&&(u.memoizedState=a,bt=!0),u=u.queue,ad(eg.bind(null,o,u,i),[i]),i=u.getSnapshot!==s||y||wt!==null&&(wt.memoizedState.tag&1)!==0,ca(i?9:8,{destroy:void 0},Jp.bind(null,o,u,a,s),null),i){if(o.flags|=2048,st===null)throw Error(r(349));f||(Ws&127)!==0||Qp(o,s,a)}return a}function Qp(i,s,a){i.flags|=16384,i={getSnapshot:s,value:a},s=Le.updateQueue,s===null?(s=fc(),Le.updateQueue=s,s.stores=[i]):(a=s.stores,a===null?s.stores=[i]:a.push(i))}function Jp(i,s,a,o){s.value=a,s.getSnapshot=o,tg(s)&&ig(i)}function eg(i,s,a){return a(function(){tg(s)&&ig(i)})}function tg(i){var s=i.getSnapshot;i=i.value;try{var a=s();return!Di(i,a)}catch{return!0}}function ig(i){var s=or(i,2);s!==null&&xi(s,i,2)}function nd(i){var s=ai();if(typeof i=="function"){var a=i;if(i=a(),yr){fn(!0);try{a()}finally{fn(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:i},s}function sg(i,s,a,o){return i.baseState=a,id(i,tt,typeof o=="function"?o:Fs)}function b4(i,s,a,o,u){if(_c(i))throw Error(r(485));if(i=s.action,i!==null){var f={payload:u,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){f.listeners.push(y)}};pe.T!==null?a(!0):f.isTransition=!1,o(f),a=s.pending,a===null?(f.next=s.pending=f,ng(s,f)):(f.next=a.next,s.pending=a.next=f)}}function ng(i,s){var a=s.action,o=s.payload,u=i.state;if(s.isTransition){var f=pe.T,y={};y.types=f!==null?f.types:null,pe.T=y;try{var C=a(u,o),T=pe.S;T!==null&&T(y,C),rg(i,s,C)}catch(G){rd(i,s,G)}finally{f!==null&&y.types!==null&&(f.types=y.types),pe.T=f}}else try{f=a(u,o),rg(i,s,f)}catch(G){rd(i,s,G)}}function rg(i,s,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){ag(i,s,o)},function(o){return rd(i,s,o)}):ag(i,s,a)}function ag(i,s,a){s.status="fulfilled",s.value=a,lg(s),i.state=a,s=i.pending,s!==null&&(a=s.next,a===s?i.pending=null:(a=a.next,s.next=a,ng(i,a)))}function rd(i,s,a){var o=i.pending;if(i.pending=null,o!==null){o=o.next;do s.status="rejected",s.reason=a,lg(s),s=s.next;while(s!==o)}i.action=null}function lg(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function og(i,s){return s}function cg(i,s){if(Oe){var a=st.formState;if(a!==null){e:{var o=Le;if(Oe){if(nt){t:{for(var u=nt,f=Fi;u.nodeType!==8;){if(!f){u=null;break t}if(u=Yi(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){nt=Yi(u.nextSibling),o=u.data==="F!";break e}}_n(o)}o=!1}o&&(s=a[0])}}return a=ai(),a.memoizedState=a.baseState=s,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:og,lastRenderedState:s},a.queue=o,a=jg.bind(null,Le,o),o.dispatch=a,o=nd(!1),f=ud.bind(null,Le,!1,o.queue),o=ai(),u={state:s,dispatch:null,action:i,pending:null},o.queue=u,a=b4.bind(null,Le,u,f,a),u.dispatch=a,o.memoizedState=i,[s,a,!1]}function hg(i){var s=yt();return ug(s,tt,i)}function ug(i,s,a){if(s=id(i,s,og)[0],i=gc(Fs)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var o=Cl(s)}catch(y){throw y===ra?rc:y}else o=s;s=yt();var u=s.queue,f=u.dispatch;return a!==s.memoizedState&&(Le.flags|=2048,ca(9,{destroy:void 0},C4.bind(null,u,a),null)),[o,f,i]}function C4(i,s){i.action=s}function dg(i){var s=yt(),a=tt;if(a!==null)return ug(s,a,i);yt(),s=s.memoizedState,a=yt();var o=a.queue.dispatch;return a.memoizedState=i,[s,o,!1]}function ca(i,s,a,o){return i={tag:i,create:a,deps:o,inst:s,next:null},s=Le.updateQueue,s===null&&(s=fc(),Le.updateQueue=s),a=s.lastEffect,a===null?s.lastEffect=i.next=i:(o=a.next,a.next=i,i.next=o,s.lastEffect=i),i}function fg(){return yt().memoizedState}function mc(i,s,a,o){var u=ai();Le.flags|=i,u.memoizedState=ca(1|s,{destroy:void 0},a,o===void 0?null:o)}function vc(i,s,a,o){var u=yt();o=o===void 0?null:o;var f=u.memoizedState.inst;tt!==null&&o!==null&&Zu(o,tt.memoizedState.deps)?u.memoizedState=ca(s,f,a,o):(Le.flags|=i,u.memoizedState=ca(1|s,f,a,o))}function pg(i,s){mc(8390656,8,i,s)}function ad(i,s){vc(2048,8,i,s)}function k4(i){Le.flags|=4;var s=Le.updateQueue;if(s===null)s=fc(),Le.updateQueue=s,s.events=[i];else{var a=s.events;a===null?s.events=[i]:a.push(i)}}function gg(i){var s=yt().memoizedState;return k4({ref:s,nextImpl:i}),function(){if((Ye&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}function mg(i,s){return vc(4,2,i,s)}function vg(i,s){return vc(4,4,i,s)}function _g(i,s){if(typeof s=="function"){i=i();var a=s(i);return function(){typeof a=="function"?a():s(null)}}if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function yg(i,s,a){a=a!=null?a.concat([i]):null,vc(4,4,_g.bind(null,s,i),a)}function ld(){}function Sg(i,s){var a=yt();s=s===void 0?null:s;var o=a.memoizedState;return s!==null&&Zu(s,o[1])?o[0]:(a.memoizedState=[i,s],i)}function xg(i,s){var a=yt();s=s===void 0?null:s;var o=a.memoizedState;if(s!==null&&Zu(s,o[1]))return o[0];if(o=i(),yr){fn(!0);try{i()}finally{fn(!1)}}return a.memoizedState=[o,s],o}function od(i,s,a){return a===void 0||(Ws&1073741824)!==0&&(Pe&261930)===0?i.memoizedState=s:(i.memoizedState=a,i=Rm(),Le.lanes|=i,Dn|=i,a)}function wg(i,s,a,o){return Di(a,s)?a:Cn.current!==null?(i=od(i,a,o),Di(i,s)||(bt=!0),i):(Ws&106)===0||(Ws&1073741824)!==0&&(Pe&261930)===0?(bt=!0,i.memoizedState=a):(i=Rm(),Le.lanes|=i,Dn|=i,s)}function bg(i,s,a,o,u){var f=_e.p;_e.p=f!==0&&8>f?f:8;var y=pe.T,C={};C.types=y!==null?y.types:null,pe.T=C,ud(i,!1,s,a);try{var T=u(),G=pe.S;if(G!==null&&G(C,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var ee=S4(T,o);kl(i,s,ee,Bi(i))}else kl(i,s,o,Bi(i))}catch(se){kl(i,s,{then:function(){},status:"rejected",reason:se},Bi())}finally{_e.p=f,y!==null&&C.types!==null&&(y.types=C.types),pe.T=y}}function E4(){}function cd(i,s,a,o){if(i.tag!==5)throw Error(r(476));var u=Cg(i).queue;bg(i,u,s,Re,a===null?E4:function(){return kg(i),a(o)})}function Cg(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:Re,baseState:Re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:Re},next:null};var a={};return s.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:a},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function kg(i){var s=Cg(i);s.next===null&&(s=i.alternate.memoizedState),kl(i,s.next.queue,{},Bi())}function hd(){return Kt(ja)}function Eg(){return yt().memoizedState}function Mg(){return yt().memoizedState}function M4(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var a=Bi();i=wn(a);var o=bn(s,i,a);o!==null&&(xi(o,s,a),yl(o,s,a)),s={cache:Hu()},i.payload=s;return}s=s.return}}function j4(i,s,a){var o=Bi();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},_c(i)?Tg(s,a):(a=Tu(i,s,a,o),a!==null&&(xi(a,i,o),Dg(a,s,o)))}function jg(i,s,a){var o=Bi();kl(i,s,a,o)}function kl(i,s,a,o){var u={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(_c(i))Tg(s,u);else{var f=i.alternate;if(i.lanes===0&&(f===null||f.lanes===0)&&(f=s.lastRenderedReducer,f!==null))try{var y=s.lastRenderedState,C=f(y,a);if(u.hasEagerState=!0,u.eagerState=C,Di(C,y))return Go(i,s,u,0),st===null&&Yo(),!1}catch{}if(a=Tu(i,s,u,o),a!==null)return xi(a,i,o),Dg(a,s,o),!0}return!1}function ud(i,s,a,o){if(o={lane:2,revertLane:t0(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},_c(i)){if(s)throw Error(r(479))}else s=Tu(i,a,o,2),s!==null&&xi(s,i,2)}function _c(i){var s=i.alternate;return i===Le||s!==null&&s===Le}function Tg(i,s){la=uc=!0;var a=i.pending;a===null?s.next=s:(s.next=a.next,a.next=s),i.pending=s}function Dg(i,s,a){if((a&4194048)!==0){var o=s.lanes;o&=i.pendingLanes,a|=o,s.lanes=a,R1(i,a)}}var yc={readContext:Kt,use:pc,useCallback:gt,useContext:gt,useEffect:gt,useImperativeHandle:gt,useLayoutEffect:gt,useInsertionEffect:gt,useMemo:gt,useReducer:gt,useRef:gt,useState:gt,useDebugValue:gt,useDeferredValue:gt,useTransition:gt,useSyncExternalStore:gt,useId:gt,useHostTransitionStatus:gt,useFormState:gt,useActionState:gt,useOptimistic:gt,useMemoCache:gt,useCacheRefresh:gt,useEffectEvent:gt},Rg={readContext:Kt,use:pc,useCallback:function(i,s){return ai().memoizedState=[i,s===void 0?null:s],i},useContext:Kt,useEffect:pg,useImperativeHandle:function(i,s,a){a=a!=null?a.concat([i]):null,mc(4194308,4,_g.bind(null,s,i),a)},useLayoutEffect:function(i,s){return mc(4194308,4,i,s)},useInsertionEffect:function(i,s){mc(4,2,i,s)},useMemo:function(i,s){var a=ai();s=s===void 0?null:s;var o=i();if(yr){fn(!0);try{i()}finally{fn(!1)}}return a.memoizedState=[o,s],o},useReducer:function(i,s,a){var o=ai();if(a!==void 0){var u=a(s);if(yr){fn(!0);try{a(s)}finally{fn(!1)}}}else u=s;return o.memoizedState=o.baseState=u,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:u},o.queue=i,i=i.dispatch=j4.bind(null,Le,i),[o.memoizedState,i]},useRef:function(i){var s=ai();return i={current:i},s.memoizedState=i},useState:function(i){i=nd(i);var s=i.queue,a=jg.bind(null,Le,s);return s.dispatch=a,[i.memoizedState,a]},useDebugValue:ld,useDeferredValue:function(i,s){var a=ai();return od(a,i,s)},useTransition:function(){var i=nd(!1);return i=bg.bind(null,Le,i.queue,!0,!1),ai().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,a){var o=Le,u=ai();if(Oe){if(a===void 0)throw Error(r(407));a=a()}else{if(a=s(),st===null)throw Error(r(349));(Pe&127)!==0||Qp(o,s,a)}u.memoizedState=a;var f={value:a,getSnapshot:s};return u.queue=f,pg(eg.bind(null,o,f,i),[i]),o.flags|=2048,ca(9,{destroy:void 0},Jp.bind(null,o,f,a,s),null),a},useId:function(){var i=ai(),s=st.identifierPrefix;if(Oe){var a=vs,o=ms;a=(o&~(1<<32-ji(o)-1)).toString(32)+a,s="_"+s+"R_"+a,a=dc++,0<a&&(s+="H"+a.toString(32)),s+="_"}else a=x4++,s="_"+s+"r_"+a.toString(32)+"_";return i.memoizedState=s},useHostTransitionStatus:hd,useFormState:cg,useActionState:cg,useOptimistic:function(i){var s=ai();s.memoizedState=s.baseState=i;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=a,s=ud.bind(null,Le,!0,a),a.dispatch=s,[i,s]},useMemoCache:td,useCacheRefresh:function(){return ai().memoizedState=M4.bind(null,Le)},useEffectEvent:function(i){var s=ai(),a={impl:i};return s.memoizedState=a,function(){if((Ye&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Ag={readContext:Kt,use:pc,useCallback:Sg,useContext:Kt,useEffect:ad,useImperativeHandle:yg,useInsertionEffect:mg,useLayoutEffect:vg,useMemo:xg,useReducer:gc,useRef:fg,useState:function(){return gc(Fs)},useDebugValue:ld,useDeferredValue:function(i,s){var a=yt();return wg(a,tt.memoizedState,i,s)},useTransition:function(){var i=gc(Fs)[0],s=yt().memoizedState;return[typeof i=="boolean"?i:Cl(i),s]},useSyncExternalStore:Xp,useId:Eg,useHostTransitionStatus:hd,useFormState:hg,useActionState:hg,useOptimistic:function(i,s){var a=yt();return sg(a,tt,i,s)},useMemoCache:td,useCacheRefresh:Mg,useEffectEvent:gg},T4={readContext:Kt,use:pc,useCallback:Sg,useContext:Kt,useEffect:ad,useImperativeHandle:yg,useInsertionEffect:mg,useLayoutEffect:vg,useMemo:xg,useReducer:sd,useRef:fg,useState:function(){return sd(Fs)},useDebugValue:ld,useDeferredValue:function(i,s){var a=yt();return tt===null?od(a,i,s):wg(a,tt.memoizedState,i,s)},useTransition:function(){var i=sd(Fs)[0],s=yt().memoizedState;return[typeof i=="boolean"?i:Cl(i),s]},useSyncExternalStore:Xp,useId:Eg,useHostTransitionStatus:hd,useFormState:dg,useActionState:dg,useOptimistic:function(i,s){var a=yt();return tt!==null?sg(a,tt,i,s):(a.baseState=i,[i,a.queue.dispatch])},useMemoCache:td,useCacheRefresh:Mg,useEffectEvent:gg};function dd(i,s,a,o){s=i.memoizedState,a=a(o,s),a=a==null?s:I({},s,a),i.memoizedState=a,i.lanes===0&&(i.updateQueue.baseState=a)}var fd={enqueueSetState:function(i,s,a){i=i._reactInternals;var o=Bi(),u=wn(o);u.payload=s,a!=null&&(u.callback=a),s=bn(i,u,o),s!==null&&(xi(s,i,o),yl(s,i,o))},enqueueReplaceState:function(i,s,a){i=i._reactInternals;var o=Bi(),u=wn(o);u.tag=1,u.payload=s,a!=null&&(u.callback=a),s=bn(i,u,o),s!==null&&(xi(s,i,o),yl(s,i,o))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var a=Bi(),o=wn(a);o.tag=2,s!=null&&(o.callback=s),s=bn(i,o,a),s!==null&&(xi(s,i,a),yl(s,i,a))}};function Ng(i,s,a,o,u,f,y){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(o,f,y):s.prototype&&s.prototype.isPureReactComponent?!ul(a,o)||!ul(u,f):!0}function Lg(i,s,a,o){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,o),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,o),s.state!==i&&fd.enqueueReplaceState(s,s.state,null)}function Sr(i,s){var a=s;if("ref"in s){a={};for(var o in s)o!=="ref"&&(a[o]=s[o])}if(i=i.defaultProps){a===s&&(a=I({},a));for(var u in i)a[u]===void 0&&(a[u]=i[u])}return a}function Bg(i){Ko(i)}function Og(i){console.error(i)}function zg(i){Ko(i)}function Sc(i,s){try{var a=i.onUncaughtError;a(s.value,{componentStack:s.stack})}catch(o){setTimeout(function(){throw o})}}function Hg(i,s,a){try{var o=i.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function pd(i,s,a){return a=wn(a),a.tag=3,a.payload={element:null},a.callback=function(){Sc(i,s)},a}function Ig(i){return i=wn(i),i.tag=3,i}function Ug(i,s,a,o){var u=a.type.getDerivedStateFromError;if(typeof u=="function"){var f=o.value;i.payload=function(){return u(f)},i.callback=function(){Hg(s,a,o)}}var y=a.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(i.callback=function(){Hg(s,a,o),typeof u!="function"&&(Rn===null?Rn=new Set([this]):Rn.add(this));var C=o.stack;this.componentDidCatch(o.value,{componentStack:C!==null?C:""})})}function D4(i,s,a,o,u){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(s=a.alternate,s!==null&&dr(s,a,u,!0),a=Yt.current,a!==null){switch(a.tag){case 31:case 13:case 19:return ii===null?Pc():a.alternate===null&&mt===0&&(mt=3),a.flags&=-257,a.flags|=65536,a.lanes=u,o===ac?a.flags|=16384:(s=a.updateQueue,s===null?a.updateQueue=new Set([o]):s.add(o),Qd(i,o,u)),!1;case 22:return a.flags|=65536,o===ac?a.flags|=16384:(s=a.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=s):(a=s.retryQueue,a===null?s.retryQueue=new Set([o]):a.add(o)),Qd(i,o,u)),!1}throw Error(r(435,a.tag))}return Qd(i,o,u),Pc(),!1}if(Oe)return s=Yt.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=u,o!==Lu&&(i=Error(r(422),{cause:o}),pl(Vi(i,a)))):(o!==Lu&&(s=Error(r(423),{cause:o}),pl(Vi(s,a))),i=i.current.alternate,i.flags|=65536,u&=-u,i.lanes|=u,o=Vi(o,a),u=pd(i.stateNode,o,u),$u(i,u),mt!==4&&(mt=2)),!1;var f=Error(r(520),{cause:o});if(f=Vi(f,a),Nl===null?Nl=[f]:Nl.push(f),mt!==4&&(mt=2),s===null)return!0;o=Vi(o,a),a=s;do{switch(a.tag){case 3:return a.flags|=65536,i=u&-u,a.lanes|=i,i=pd(a.stateNode,o,i),$u(a,i),!1;case 1:if(s=a.type,f=a.stateNode,(a.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(Rn===null||!Rn.has(f))))return a.flags|=65536,u&=-u,a.lanes|=u,u=Ig(u),Ug(u,i,a,o),$u(a,u),!1;break;case 22:if(a.memoizedState!==null)return a.flags|=65536,!1}a=a.return}while(a!==null);return!1}var gd=Error(r(461)),bt=!1;function jt(i,s,a,o){s.child=i===null?$p(s,null,a,o):_r(s,i.child,a,o)}function Pg(i,s,a,o,u){a=a.render;var f=s.ref;if("ref"in o){var y={};for(var C in o)C!=="ref"&&(y[C]=o[C])}else y=o;return fr(s),o=Xu(i,s,a,y,f,u),C=Qu(),i!==null&&!bt?(Ju(i,s,u),Ks(i,s,u)):(Oe&&C&&Jo(s),s.flags|=1,jt(i,s,o,u),s.child)}function qg(i,s,a,o,u){if(i===null){var f=a.type;return typeof f=="function"&&!Du(f)&&f.defaultProps===void 0&&a.compare===null?(s.tag=15,s.type=f,Vg(i,s,f,o,u)):(i=Xo(a.type,null,o,s,s.mode,u),i.ref=s.ref,i.return=s,s.child=i)}if(f=i.child,!bd(i,u)){var y=f.memoizedProps;if(a=a.compare,a=a!==null?a:ul,a(y,o)&&i.ref===s.ref)return Ks(i,s,u)}return s.flags|=1,i=Ps(f,o),i.ref=s.ref,i.return=s,s.child=i}function Vg(i,s,a,o,u){if(i!==null){var f=i.memoizedProps;if(ul(f,o)&&i.ref===s.ref)if(bt=!1,s.pendingProps=o=f,bd(i,u))(i.flags&131072)!==0&&(bt=!0);else return s.lanes=i.lanes,Ks(i,s,u)}return md(i,s,a,o,u)}function $g(i,s,a,o){var u=o.children,f=i!==null?i.memoizedState:null;if(i===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((s.flags&128)!==0){if(f=f!==null?f.baseLanes|a:a,i!==null){for(o=s.child=i.child,u=0;o!==null;)u=u|o.lanes|o.childLanes,o=o.sibling;o=u&~f}else o=0,s.child=null;return Wg(i,s,f,a,o)}if((a&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&nc(s,f!==null?f.cachePool:null),f!==null?Kp(s,f):Fu(),Yp(s);else return o=s.lanes=536870912,Wg(i,s,f!==null?f.baseLanes|a:a,a,o)}else f!==null?(nc(s,f.cachePool),Kp(s,f),En(),s.memoizedState=null):(i!==null&&nc(s,null),Fu(),En());return jt(i,s,u,a),s.child}function El(i,s){return i!==null&&i.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Wg(i,s,a,o,u){var f=Uu();return f=f===null?null:{parent:xt._currentValue,pool:f},s.memoizedState={baseLanes:a,cachePool:f},i!==null&&nc(s,null),Fu(),Yp(s),i!==null&&dr(i,s,o,!0),s.childLanes=u,null}function xc(i,s){return s=wc({mode:s.mode,children:s.children},i.mode),s.ref=i.ref,i.child=s,s.return=i,s}function Fg(i,s,a){return _r(s,i.child,null,a),i=xc(s,s.pendingProps),i.flags|=2,Ri(s),s.memoizedState=null,i}function R4(i,s,a){var o=s.pendingProps,u=(s.flags&128)!==0;if(s.flags&=-129,i===null){if(Oe){if(o.mode==="hidden")return i=xc(s,o),s.lanes=536870912,i.memoizedState={baseLanes:0,cachePool:null},El(null,i);if(Yu(s),(i=nt)?(i=_v(i,Fi),i=i!==null&&i.data==="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:mn!==null?{id:ms,overflow:vs}:null,retryLane:536870912,hydrationErrors:null},a=Tp(i),a.return=s,s.child=a,zt=s,nt=null)):i=null,i===null)throw _n(s);return s.lanes=536870912,null}return xc(s,o)}var f=i.memoizedState;if(f!==null){var y=f.dehydrated;if(Yu(s),u)if(s.flags&256)s.flags&=-257,s=Fg(i,s,a);else if(s.memoizedState!==null)s.child=i.child,s.flags|=128,s=null;else throw Error(r(558));else if(bt||dr(i,s,a,!1),u=(a&i.childLanes)!==0,bt||u){if(Cn.current===null){if(o=st,o!==null&&(y=A1(o,a),y!==0&&y!==f.retryLane))throw f.retryLane=y,or(i,y),xi(o,i,y),gd;Pc()}s=Fg(i,s,a)}else i=f.treeContext,nt=Yi(y.nextSibling),zt=s,Oe=!0,vn=null,Fi=!1,i!==null&&Ap(s,i),s=xc(s,o),s.flags|=134221824;return s}return i=Ps(i.child,{mode:o.mode,children:o.children}),i.ref=s.ref,s.child=i,i.return=s,i}function ha(i,s){var a=s.ref;if(a===null)i!==null&&i.ref!==null&&(s.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(i===null||i.ref!==a)&&(s.flags|=4194816)}}function md(i,s,a,o,u){return fr(s),a=Xu(i,s,a,o,void 0,u),o=Qu(),i!==null&&!bt?(Ju(i,s,u),Ks(i,s,u)):(Oe&&o&&Jo(s),s.flags|=1,jt(i,s,a,u),s.child)}function Kg(i,s,a,o,u,f){return fr(s),s.updateQueue=null,a=Zp(s,o,a,u),Gp(i),o=Qu(),i!==null&&!bt?(Ju(i,s,f),Ks(i,s,f)):(Oe&&o&&Jo(s),s.flags|=1,jt(i,s,a,f),s.child)}function Yg(i,s,a,o,u){if(fr(s),s.stateNode===null){var f=ea,y=a.contextType;typeof y=="object"&&y!==null&&(f=Kt(y)),f=new a(o,f),s.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=fd,s.stateNode=f,f._reactInternals=s,f=s.stateNode,f.props=o,f.state=s.memoizedState,f.refs={},qu(s),y=a.contextType,f.context=typeof y=="object"&&y!==null?Kt(y):ea,f.state=s.memoizedState,y=a.getDerivedStateFromProps,typeof y=="function"&&(dd(s,a,y,o),f.state=s.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(y=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),y!==f.state&&fd.enqueueReplaceState(f,f.state,null),xl(s,o,f,u),Sl(),f.state=s.memoizedState),typeof f.componentDidMount=="function"&&(s.flags|=4194308),o=!0}else if(i===null){f=s.stateNode;var C=s.memoizedProps,T=Sr(a,C);f.props=T;var G=f.context,ee=a.contextType;y=ea,typeof ee=="object"&&ee!==null&&(y=Kt(ee));var se=a.getDerivedStateFromProps;ee=typeof se=="function"||typeof f.getSnapshotBeforeUpdate=="function",C=s.pendingProps!==C,ee||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(C||G!==y)&&Lg(s,f,o,y),xn=!1;var W=s.memoizedState;f.state=W,xl(s,o,f,u),Sl(),G=s.memoizedState,C||W!==G||xn?(typeof se=="function"&&(dd(s,a,se,o),G=s.memoizedState),(T=xn||Ng(s,a,T,o,W,G,y))?(ee||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(s.flags|=4194308)):(typeof f.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=o,s.memoizedState=G),f.props=o,f.state=G,f.context=y,o=T):(typeof f.componentDidMount=="function"&&(s.flags|=4194308),o=!1)}else{f=s.stateNode,Vu(i,s),y=s.memoizedProps,ee=Sr(a,y),f.props=ee,se=s.pendingProps,W=f.context,G=a.contextType,T=ea,typeof G=="object"&&G!==null&&(T=Kt(G)),C=a.getDerivedStateFromProps,(G=typeof C=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y!==se||W!==T)&&Lg(s,f,o,T),xn=!1,W=s.memoizedState,f.state=W,xl(s,o,f,u),Sl();var X=s.memoizedState;y!==se||W!==X||xn||i!==null&&i.dependencies!==null&&ic(i.dependencies)?(typeof C=="function"&&(dd(s,a,C,o),X=s.memoizedState),(ee=xn||Ng(s,a,ee,o,W,X,T)||i!==null&&i.dependencies!==null&&ic(i.dependencies))?(G||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(o,X,T),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(o,X,T)),typeof f.componentDidUpdate=="function"&&(s.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof f.componentDidUpdate!="function"||y===i.memoizedProps&&W===i.memoizedState||(s.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===i.memoizedProps&&W===i.memoizedState||(s.flags|=1024),s.memoizedProps=o,s.memoizedState=X),f.props=o,f.state=X,f.context=T,o=ee):(typeof f.componentDidUpdate!="function"||y===i.memoizedProps&&W===i.memoizedState||(s.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===i.memoizedProps&&W===i.memoizedState||(s.flags|=1024),o=!1)}return f=o,ha(i,s),o=(s.flags&128)!==0,f||o?(f=s.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:f.render(),s.flags|=1,i!==null&&o?(s.child=_r(s,i.child,null,u),s.child=_r(s,null,a,u)):jt(i,s,a,u),s.memoizedState=f.state,i=s.child):i=Ks(i,s,u),i}function Gg(i,s,a,o){return hr(),s.flags|=256,jt(i,s,a,o),s.child}var vd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _d(i){return{baseLanes:i,cachePool:Hp()}}function yd(i,s,a){return i=i!==null?i.childLanes&~a:0,s&&(i|=Li),i}function Zg(i,s,a){var o=s.pendingProps,u=!1,f=(s.flags&128)!==0,y;if((y=f)||(y=i!==null&&i.memoizedState===null?!1:(Gt.current&2)!==0),y&&(u=!0,s.flags&=-129),y=(s.flags&32)!==0,s.flags&=-33,i===null){if(Oe){if(u?kn(s):En(),(i=nt)?(i=_v(i,Fi),i=i!==null&&i.data!=="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:mn!==null?{id:ms,overflow:vs}:null,retryLane:536870912,hydrationErrors:null},a=Tp(i),a.return=s,s.child=a,zt=s,nt=null)):i=null,i===null)throw _n(s);return _0(i)?s.lanes=32:s.lanes=536870912,null}return f=o.children,o=o.fallback,u?(En(),u=s.mode,f=wc({mode:"hidden",children:f},u),o=cr(o,u,a,null),f.return=s,o.return=s,f.sibling=o,s.child=f,o=s.child,o.memoizedState=_d(a),o.childLanes=yd(i,y,a),s.memoizedState=vd,El(null,o)):(kn(s),Sd(s,f))}var C=i.memoizedState;if(C!==null){var T=C.dehydrated;if(T!==null)return A4(i,s,f,y,o,T,C,a)}return u?(En(),u=o.fallback,f=s.mode,C=i.child,T=C.sibling,o=Ps(C,{mode:"hidden",children:o.children}),o.subtreeFlags=C.subtreeFlags&1206910976,T!==null?u=Ps(T,u):(u=cr(u,f,a,null),u.flags|=2),u.return=s,o.return=s,o.sibling=u,s.child=o,El(null,o),o=s.child,u=i.child.memoizedState,u===null?u=_d(a):(f=u.cachePool,f!==null?(C=xt._currentValue,f=f.parent!==C?{parent:C,pool:C}:f):f=Hp(),u={baseLanes:u.baseLanes|a,cachePool:f}),o.memoizedState=u,o.childLanes=yd(i,y,a),s.memoizedState=vd,El(i.child,o)):(kn(s),a=i.child,i=a.sibling,a=Ps(a,{mode:"visible",children:o.children}),a.return=s,a.sibling=null,i!==null&&(y=s.deletions,y===null?(s.deletions=[i],s.flags|=16):y.push(i)),s.child=a,s.memoizedState=null,a)}function Sd(i,s){return s=wc({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function wc(i,s){return i=vi(22,i,null,s),i.lanes=0,i}function bc(i,s,a){return _r(s,i.child,null,a),i=Sd(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function A4(i,s,a,o,u,f,y,C){if(a)return s.flags&256?(kn(s),s.flags&=-257,bc(i,s,C)):s.memoizedState!==null?(En(),s.child=i.child,s.flags|=128,null):(En(),f=u.fallback,y=s.mode,u=wc({mode:"visible",children:u.children},y),f=cr(f,y,C,null),f.flags|=2,u.return=s,f.return=s,u.sibling=f,s.child=u,_r(s,i.child,null,C),u=s.child,u.memoizedState=_d(C),u.childLanes=yd(i,o,C),s.memoizedState=vd,El(null,u));if(kn(s),_0(f)){if(o=f.nextSibling&&f.nextSibling.dataset,o)var T=o.dgst;return o=T,o!==""&&(u=Error(r(419)),u.stack="",u.digest=o,pl({value:u,source:null,stack:null})),bc(i,s,C)}if(bt||dr(i,s,C,!1),o=(C&i.childLanes)!==0,bt||o){if(Cn.current!==null)return bc(i,s,C);if(o=st,o!==null&&(u=A1(o,C),u!==0&&u!==y.retryLane))throw y.retryLane=u,or(i,u),xi(o,i,u),gd;return v0(f)||Pc(),bc(i,s,C)}return v0(f)?(s.flags|=192,s.child=i.child,null):(i=y.treeContext,nt=Yi(f.nextSibling),zt=s,Oe=!0,vn=null,Fi=!1,i!==null&&Ap(s,i),s=Sd(s,u.children),s.flags|=134221824,s)}function Xg(i,s,a){i.lanes|=s;var o=i.alternate;o!==null&&(o.lanes|=s),tc(i.return,s,a)}function Qg(i){for(var s=null;i!==null;){var a=i.alternate;a!==null&&hc(a)===null&&(s=i),i=i.sibling}return s}function Cc(i,s,a,o,u,f){var y=i.memoizedState;y===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:u,treeForkCount:f}:(y.isBackwards=s,y.rendering=null,y.renderingStartTime=0,y.last=o,y.tail=a,y.tailMode=u,y.treeForkCount=f)}function xd(i){var s=i.child;for(i.child=null;s!==null;){var a=s.sibling;s.sibling=i.child,i.child=s,s=a}}function wd(i,s,a){var o=s.pendingProps,u=o.revealOrder,f=o.tail;o=o.children;var y=Gt.current;if(s.flags&128)return wl(s,y),null;var C=(y&2)!==0;if(C?(y=y&1|2,s.flags|=128):y&=1,wl(s,y),u==="backwards"&&i!==null?(xd(i),jt(i,s,o,a),xd(i)):jt(i,s,o,a),o=Oe?fl:0,!C&&i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Xg(i,a,s);else if(i.tag===19)Xg(i,a,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(u){case"backwards":a=Qg(s.child),a===null?(u=s.child,s.child=null):(u=a.sibling,a.sibling=null,xd(s)),Cc(s,!0,u,null,f,o);break;case"unstable_legacy-backwards":for(a=null,u=s.child,s.child=null;u!==null;){if(i=u.alternate,i!==null&&hc(i)===null){s.child=u;break}i=u.sibling,u.sibling=a,a=u,u=i}Cc(s,!0,a,null,f,o);break;case"together":Cc(s,!1,null,null,void 0,o);break;case"independent":s.memoizedState=null;break;default:a=Qg(s.child),a===null?(u=s.child,s.child=null):(u=a.sibling,a.sibling=null),Cc(s,!1,u,a,f,o)}return s.child}function Jg(i,s,a){var o=s.pendingProps;return yn(s,s.type,o.value),jt(i,s,o.children,a),s.child}function Ks(i,s,a){if(i!==null&&(s.dependencies=i.dependencies),Dn|=s.lanes,(a&s.childLanes)===0)if(i!==null){if(dr(i,s,a,!1),(a&s.childLanes)===0)return null}else return null;if(i!==null&&s.child!==i.child)throw Error(r(153));if(s.child!==null){for(i=s.child,a=Ps(i,i.pendingProps),s.child=a,a.return=s;i.sibling!==null;)i=i.sibling,a=a.sibling=Ps(i,i.pendingProps),a.return=s;a.sibling=null}return s.child}function bd(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&ic(i)))}function N4(i,s,a){switch(s.tag){case 3:Ur(s,s.stateNode.containerInfo),yn(s,xt,i.memoizedState.cache),hr();break;case 27:case 5:Pr(s);break;case 4:Ur(s,s.stateNode.containerInfo);break;case 10:yn(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Yu(s),null;break;case 13:var o=s.memoizedState;if(o!==null){if(o.dehydrated!==null)return kn(s),s.flags|=128,null;o=dr(i,s,a,!1);var u=s.child.childLanes;return o||(a&u)!==0?Zg(i,s,a):(kn(s),i=Ks(i,s,a),i!==null?i.sibling:null)}kn(s);break;case 19:if(s.flags&128)return wd(i,s,a);if(u=(i.flags&128)!==0,o=(a&s.childLanes)!==0,o||(dr(i,s,a,!1),o=(a&s.childLanes)!==0),u){if(o)return wd(i,s,a);s.flags|=128}if(u=s.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),wl(s,Gt.current),o)break;return null;case 22:return s.lanes=0,$g(i,s,a,s.pendingProps);case 24:yn(s,xt,i.memoizedState.cache)}return Ks(i,s,a)}function em(i,s,a){if(i!==null)if(i.memoizedProps!==s.pendingProps)bt=!0;else{if(!bd(i,a)&&(s.flags&128)===0)return bt=!1,N4(i,s,a);bt=(i.flags&131072)!==0}else bt=!1,Oe&&(s.flags&1048576)!==0&&Rp(s,fl,s.index);switch(s.lanes=0,s.tag){case 16:e:{var o=s.pendingProps;if(i=mr(s.elementType),s.type=i,typeof i=="function")Du(i)?(o=Sr(i,o),s.tag=1,s=Yg(null,s,i,o,a)):(s.tag=0,s=md(null,s,i,o,a));else{if(i!=null){var u=i.$$typeof;if(u===P){s.tag=11,s=Pg(null,s,i,o,a);break e}else if(u===ce){s.tag=14,s=qg(null,s,i,o,a);break e}else if(u===O){s.tag=10,s.type=i,s=Jg(null,s,a);break e}}throw s=xe(i)||i,Error(r(306,s,""))}}return s;case 0:return md(i,s,s.type,s.pendingProps,a);case 1:return o=s.type,u=Sr(o,s.pendingProps),Yg(i,s,o,u,a);case 3:e:{if(Ur(s,s.stateNode.containerInfo),i===null)throw Error(r(387));o=s.pendingProps;var f=s.memoizedState;u=f.element,Vu(i,s),xl(s,o,null,a);var y=s.memoizedState;if(o=y.cache,yn(s,xt,o),o!==f.cache&&zu(s,[xt],a,!0),Sl(),o=y.element,f.isDehydrated)if(f={element:o,isDehydrated:!1,cache:y.cache},s.updateQueue.baseState=f,s.memoizedState=f,s.flags&256){s=Gg(i,s,o,a);break e}else if(o!==u){u=Vi(Error(r(424)),s),pl(u),s=Gg(i,s,o,a);break e}else for(i=s.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,nt=Yi(i.firstChild),zt=s,Oe=!0,vn=null,Fi=!0,a=$p(s,null,o,a),s.child=a;a;)a.flags=a.flags&-3|134221824,a=a.sibling;else{if(hr(),o===u){s=Ks(i,s,a);break e}jt(i,s,o,a)}s=s.child}return s;case 26:return ha(i,s),i===null?(a=kv(s.type,null,s.pendingProps,null))?s.memoizedState=a:Oe||(s.stateNode=nv(s.type,s.pendingProps,Ke.current,s)):s.memoizedState=kv(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return Pr(s),i===null&&Oe&&(o=s.stateNode=xv(s.type,s.pendingProps,Ke.current),zt=s,Fi=!0,u=nt,Ln(s.type)?(y0=u,nt=Yi(o.firstChild)):nt=u),jt(i,s,s.pendingProps.children,a),ha(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&Oe&&((u=o=nt)&&(o=M5(o,s.type,s.pendingProps,Fi),o!==null?(s.stateNode=o,zt=s,nt=Yi(o.firstChild),Fi=!1,u=!0):u=!1),u||_n(s)),Pr(s),u=s.type,f=s.pendingProps,y=i!==null?i.memoizedProps:null,o=f.children,h0(u,f)?o=null:y!==null&&h0(u,y)&&(s.flags|=32),s.memoizedState!==null&&(u=Xu(i,s,w4,null,null,a),ja._currentValue=u),ha(i,s),jt(i,s,o,a),s.child;case 6:return i===null&&Oe&&((i=a=nt)&&(a=j5(a,s.pendingProps,Fi),a!==null?(s.stateNode=a,zt=s,nt=null,i=!0):i=!1),i||_n(s)),null;case 13:return Zg(i,s,a);case 4:return Ur(s,s.stateNode.containerInfo),o=s.pendingProps,i===null?s.child=_r(s,null,o,a):jt(i,s,o,a),s.child;case 11:return Pg(i,s,s.type,s.pendingProps,a);case 7:return o=s.pendingProps,ha(i,s),jt(i,s,o,a),s.child;case 8:return jt(i,s,s.pendingProps.children,a),s.child;case 12:return jt(i,s,s.pendingProps.children,a),s.child;case 10:return Jg(i,s,a);case 9:return u=s.type._context,o=s.pendingProps.children,fr(s),u=Kt(u),o=o(u),s.flags|=1,jt(i,s,o,a),s.child;case 14:return qg(i,s,s.type,s.pendingProps,a);case 15:return Vg(i,s,s.type,s.pendingProps,a);case 19:return wd(i,s,a);case 31:return R4(i,s,a);case 22:return $g(i,s,a,s.pendingProps);case 24:return fr(s),o=Kt(xt),i===null?(u=Uu(),u===null&&(u=st,f=Hu(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=a),u=f),s.memoizedState={parent:o,cache:u},qu(s),yn(s,xt,u)):((i.lanes&a)!==0&&(Vu(i,s),xl(s,null,null,a),Sl()),u=i.memoizedState,f=s.memoizedState,u.parent!==o?(u={parent:o,cache:o},s.memoizedState=u,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=u),yn(s,xt,o)):(o=f.cache,yn(s,xt,o),o!==u.cache&&zu(s,[xt],a,!0))),jt(i,s,s.pendingProps.children,a),s.child;case 30:return s.stateNode===null&&(s.stateNode={autoName:null,paired:null,clones:null,ref:null}),o=s.pendingProps,o.name!=null&&o.name!=="auto"?s.flags|=i===null?18882560:18874368:Oe&&Jo(s),i!==null&&i.memoizedProps.name!==o.name?s.flags|=4194816:ha(i,s),jt(i,s,o.children,a),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function Ys(i){i.flags|=4}function Cd(i,s,a,o,u){var f;if((f=(i.mode&32)!==0)&&(f=a===null?Tv(s,o):Tv(s,o)&&(o.src!==a.src||o.srcSet!==a.srcSet)),f){if(i.flags|=16777216,(u&335544128)===u)if(i.stateNode.complete)i.flags|=8192;else if(Bm())i.flags|=8192;else throw vr=ac,Pu}else i.flags&=-16777217}function tm(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!Dv(s))if(Bm())i.flags|=8192;else throw vr=ac,Pu}function kc(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?T1():536870912,i.lanes|=s,ga|=s)}function Ml(i,s){if(!Oe)switch(i.tailMode){case"visible":break;case"collapsed":for(var a=i.tail,o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:o.sibling=null;break;default:for(s=i.tail,a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?i.tail=null:a.sibling=null}}function rt(i){var s=i.alternate!==null&&i.alternate.child===i.child,a=0,o=0;if(s)for(var u=i.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags&1206910976,o|=u.flags&1206910976,u.return=i,u=u.sibling;else for(u=i.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags,o|=u.flags,u.return=i,u=u.sibling;return i.subtreeFlags|=o,i.childLanes=a,s}function L4(i,s,a){var o=s.pendingProps;switch(Nu(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return rt(s),null;case 1:return rt(s),null;case 3:return a=s.stateNode,o=null,i!==null&&(o=i.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),$s(xt),Bs(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(i===null||i.child===null)&&(sa(s)?Ys(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Bu())),rt(s),null;case 26:var u=s.type,f=s.memoizedState;return i===null?(Ys(s),f!==null?(rt(s),tm(s,f)):(rt(s),Cd(s,u,null,o,a))):f?f!==i.memoizedState?(Ys(s),rt(s),tm(s,f)):(rt(s),s.flags&=-16777217):(i=i.memoizedProps,i!==o&&Ys(s),rt(s),Cd(s,u,i,o,a)),null;case 27:if(rs(s),a=Ke.current,u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==o&&Ys(s);else{if(!o){if(s.stateNode===null)throw Error(r(166));return rt(s),s.subtreeFlags&=-33554433,null}i=gi.current,sa(s)?Np(s):(i=xv(u,o,a),s.stateNode=i,Ys(s))}return rt(s),s.subtreeFlags&=-33554433,null;case 5:if(rs(s),u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==o&&Ys(s);else{if(!o){if(s.stateNode===null)throw Error(r(166));return rt(s),s.subtreeFlags&=-33554433,null}if(f=gi.current,sa(s))Np(s);else{var y=Hl(Ke.current);switch(f){case 1:f=y.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:f=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":f=y.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":f=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":f=y.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof o.is=="string"?y.createElement("select",{is:o.is}):y.createElement("select"),o.multiple?f.multiple=!0:o.size&&(f.size=o.size);break;default:f=typeof o.is=="string"?y.createElement(u,{is:o.is}):y.createElement(u)}}f[Ft]=s,f[mi]=o;e:for(y=s.child;y!==null;){if(y.tag===5||y.tag===6)f.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===s)break e;for(;y.sibling===null;){if(y.return===null||y.return===s)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}s.stateNode=f;e:switch(Xt(f,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Ys(s)}}return rt(s),s.subtreeFlags&=-33554433,Cd(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,a),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==o&&Ys(s);else{if(typeof o!="string"&&s.stateNode===null)throw Error(r(166));if(i=Ke.current,sa(s)){if(i=s.stateNode,a=s.memoizedProps,o=null,u=zt,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}i[Ft]=s,i=!!(i.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||ev(i.nodeValue,a)),i||_n(s,!0)}else i=Hl(i).createTextNode(o),i[Ft]=s,s.stateNode=i}return rt(s),null;case 31:if(a=s.memoizedState,i===null||i.memoizedState!==null){if(o=sa(s),a!==null){if(i===null){if(!o)throw Error(r(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[Ft]=s}else hr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;rt(s),i=!1}else a=Bu(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=a),i=!0;if(!i)return s.flags&256?(Ri(s),s):(Ri(s),null);if((s.flags&128)!==0)throw Error(r(558))}return rt(s),null;case 13:if(o=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(u=sa(s),o!==null&&o.dehydrated!==null){if(i===null){if(!u)throw Error(r(318));if(u=s.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));u[Ft]=s}else hr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;rt(s),u=!1}else u=Bu(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=u),u=!0;if(!u)return s.flags&256?(Ri(s),s):(Ri(s),null)}return Ri(s),(s.flags&128)!==0?(s.lanes=a,s):(a=o!==null,i=i!==null&&i.memoizedState!==null,a&&(o=s.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),f=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),f!==u&&(o.flags|=2048)),a!==i&&a&&(s.child.flags|=8192),kc(s,s.updateQueue),rt(s),null);case 4:return Bs(),i===null&&r0(s.stateNode.containerInfo),s.flags|=67108864,rt(s),null;case 10:return $s(s.type),rt(s),null;case 19:if(Gu(s),o=s.memoizedState,o===null)return rt(s),null;if(u=(s.flags&128)!==0,f=o.rendering,f===null)if(u)Ml(o,!1);else{if(mt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(f=hc(i),f!==null){for(s.flags|=128,Ml(o,!1),i=f.updateQueue,s.updateQueue=i,kc(s,i),s.subtreeFlags=0,i=a,a=s.child;a!==null;)jp(a,i),a=a.sibling;return wl(s,Gt.current&1|2),Oe&&qs(s,o.treeForkCount),s.child}i=i.sibling}o.tail!==null&&Ei()>zc&&(s.flags|=128,u=!0,Ml(o,!1),s.lanes=4194304)}else{if(!u)if(i=hc(f),i!==null){if(s.flags|=128,u=!0,i=i.updateQueue,s.updateQueue=i,kc(s,i),Ml(o,!0),o.tail===null&&o.tailMode!=="collapsed"&&o.tailMode!=="visible"&&!f.alternate&&!Oe)return rt(s),null}else 2*Ei()-o.renderingStartTime>zc&&a!==536870912&&(s.flags|=128,u=!0,Ml(o,!1),s.lanes=4194304);o.isBackwards?(f.sibling=s.child,s.child=f):(i=o.last,i!==null?i.sibling=f:s.child=f,o.last=f)}if(o.tail!==null){i=o.tail;e:{for(a=i;a!==null;){if(a.alternate!==null){a=!1;break e}a=a.sibling}a=!0}return o.rendering=i,o.tail=i.sibling,o.renderingStartTime=Ei(),i.sibling=null,f=Gt.current,f=u?f&1|2:f&1,o.tailMode==="visible"||o.tailMode==="collapsed"||!a||Oe?wl(s,f):(a=f,$e(Yt,s),$e(Gt,a),ii===null&&(ii=s)),Oe&&qs(s,o.treeForkCount),i}return rt(s),null;case 22:case 23:return Ri(s),Ku(),o=s.memoizedState!==null,i!==null?i.memoizedState!==null!==o&&(s.flags|=8192):o&&(s.flags|=8192),o?(a&536870912)!==0&&(s.flags&128)===0&&(rt(s),s.subtreeFlags&6&&(s.flags|=8192)):rt(s),a=s.updateQueue,a!==null&&kc(s,a.retryQueue),a=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),o=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),o!==a&&(s.flags|=2048),i!==null&&pt(gr),null;case 24:return a=null,i!==null&&(a=i.memoizedState.cache),s.memoizedState.cache!==a&&(s.flags|=2048),$s(xt),rt(s),null;case 25:return null;case 30:return s.flags|=33554432,rt(s),null}throw Error(r(156,s.tag))}function B4(i,s){switch(Nu(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return $s(xt),Bs(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return rs(s),null;case 31:if(s.memoizedState!==null){if(Ri(s),s.alternate===null)throw Error(r(340));hr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(Ri(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));hr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return Gu(s),i=s.flags,i&65536?(s.flags=i&-65537|128,i=s.memoizedState,i!==null&&(i.rendering=null,i.tail=null),s.flags|=4,s):null;case 4:return Bs(),null;case 10:return $s(s.type),null;case 22:case 23:return Ri(s),Ku(),i!==null&&pt(gr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return $s(xt),null;case 25:return null;default:return null}}function im(i,s){switch(Nu(s),s.tag){case 3:$s(xt),Bs();break;case 26:case 27:case 5:rs(s);break;case 4:Bs();break;case 31:s.memoizedState!==null&&Ri(s);break;case 13:Ri(s);break;case 19:Gu(s);break;case 10:$s(s.type);break;case 22:case 23:Ri(s),Ku(),i!==null&&pt(gr);break;case 24:$s(xt)}}function jl(i,s){try{var a=s.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var u=o.next;a=u;do{if((a.tag&i)===i){o=void 0;var f=a.create,y=a.inst;o=f(),y.destroy=o}a=a.next}while(a!==u)}}catch(C){Qe(s,s.return,C)}}function Mn(i,s,a){try{var o=s.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var f=u.next;o=f;do{if((o.tag&i)===i){var y=o.inst,C=y.destroy;if(C!==void 0){y.destroy=void 0,u=s;var T=a,G=C;try{G()}catch(ee){Qe(u,T,ee)}}}o=o.next}while(o!==f)}}catch(ee){Qe(s,s.return,ee)}}function sm(i){var s=i.updateQueue;if(s!==null){var a=i.stateNode;try{Fp(s,a)}catch(o){Qe(i,i.return,o)}}}function nm(i,s,a){a.props=Sr(i.type,i.memoizedProps),a.state=i.memoizedState;try{a.componentWillUnmount()}catch(o){Qe(i,s,o)}}function _s(i,s){try{var a=i.ref;if(a!==null){switch(i.tag){case 26:case 27:case 5:var o=i.stateNode;break;case 30:var u=i.stateNode,f=Is(i.memoizedProps,u);(u.ref===null||u.ref.name!==f)&&(u.ref=uv(f)),o=u.ref;break;case 7:if(i.stateNode===null){var y=new Oi(i);_(i.child,!1,k5,y,void 0,void 0),i.stateNode=y}o=i.stateNode;break;default:o=i.stateNode}typeof a=="function"?i.refCleanup=a(o):a.current=o}}catch(C){Qe(i,s,C)}}function Zt(i,s){var a=i.ref,o=i.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(u){Qe(i,s,u)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){Qe(i,s,u)}else a.current=null}function Ec(i,s){if((i.tag===5||i.tag===27||i.tag===6)&&i.alternate===null&&s!==null)for(var a=0;a<s.length;a++)vv(i.stateNode,s[a])}function rm(i){for(var s=i.return;s!==null&&(Ed(s)&&vv(i.stateNode,s.stateNode),!kd(s));)s=s.return}function Tl(i){for(var s=i.return;s!==null&&(Ed(s)&&E5(i.stateNode,s.stateNode),!kd(s));)s=s.return}function kd(i){return i.tag===5||i.tag===3||i.tag===27}function Ed(i){return i&&i.tag===7&&i.stateNode!==null}function Md(i){var s=i.type,a=i.memoizedProps,o=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(u){Qe(i,i.return,u)}}function jd(i,s,a){try{var o=i.stateNode;l5(o,i.type,a,s),o[mi]=s}catch(u){Qe(i,i.return,u)}}function am(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Ln(i.type)||i.tag===4}function Td(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||am(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Ln(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Dd(i,s,a,o){var u=i.tag;if(u===5||u===6)u=i.stateNode,s?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(u,s):(s=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,s.appendChild(u),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=gs)),Ec(i,o),We=!0;else if(u!==4&&(u===27&&(Ec(i,o),o=null,Ln(i.type)&&(a=i.stateNode,s=null)),i=i.child,i!==null))for(Dd(i,s,a,o),i=i.sibling;i!==null;)Dd(i,s,a,o),i=i.sibling}function Mc(i,s,a,o){var u=i.tag;if(u===5||u===6)u=i.stateNode,s?a.insertBefore(u,s):a.appendChild(u),Ec(i,o),We=!0;else if(u!==4&&(u===27&&(Ec(i,o),o=null,Ln(i.type)&&(a=i.stateNode)),i=i.child,i!==null))for(Mc(i,s,a,o),i=i.sibling;i!==null;)Mc(i,s,a,o),i=i.sibling}function lm(i){var s=i.stateNode,a=i.memoizedProps;try{for(var o=i.type,u=s.attributes;u.length;)s.removeAttributeNode(u[0]);Xt(s,o,a),s[Ft]=i,s[mi]=a}catch(f){Qe(i,i.return,f)}}var jc=!1,Ai=null;function om(i){(i.tag===30||(i.subtreeFlags&33554432)!==0)&&(jc=!0)}var ys=null;function cm(){var i=ys;return ys=null,i}var _i=0;function ua(i,s,a,o,u){return _i=0,hm(i.child,s,a,o,u)}function hm(i,s,a,o,u){for(var f=!1;i!==null;){if(i.tag===5){var y=i.stateNode;if(o!==null){var C=f0(y);o.push(C),C.view&&(f=!0)}else f||f0(y).view&&(f=!0);jc=!0,cv(y,_i===0?s:s+"_"+_i,a),_i++}else(i.tag!==22||i.memoizedState===null)&&(i.tag===30&&u||hm(i.child,s,a,o,u)&&(f=!0));i=i.sibling}return f}function Ss(i,s){for(;i!==null;)i.tag===5?hv(i.stateNode,i.memoizedProps):(i.tag!==22||i.memoizedState===null)&&(i.tag===30&&s||Ss(i.child,s)),i=i.sibling}function Tc(i){if((i.subtreeFlags&18874368)!==0)for(i=i.child;i!==null;){if((i.tag!==22||i.memoizedState===null)&&(Tc(i),i.tag===30&&(i.flags&18874368)!==0&&i.stateNode.paired)){var s=i.memoizedProps;if(s.name==null||s.name==="auto")throw Error(r(544));var a=s.name;s=Us(s.default,s.share),s!=="none"&&(ua(i,a,s,null,!1)||Ss(i.child,!1))}i=i.sibling}}function Rd(i,s){if(i.tag===30){var a=i.stateNode,o=i.memoizedProps,u=Is(o,a),f=Us(o.default,a.paired?o.share:o.enter);f!=="none"?ua(i,u,f,null,!1)?(Tc(i),a.paired||s||ya(i,o.onEnter)):Ss(i.child,!1):Tc(i)}else if((i.subtreeFlags&33554432)!==0)for(i=i.child;i!==null;)Rd(i,s),i=i.sibling;else Tc(i)}function Ad(i){if(Ai!==null&&Ai.size!==0){var s=Ai;if((i.subtreeFlags&18874368)!==0)for(i=i.child;i!==null;){if(i.tag!==22||i.memoizedState===null){if(i.tag===30&&(i.flags&18874368)!==0){var a=i.memoizedProps,o=a.name;if(o!=null&&o!=="auto"){var u=s.get(o);if(u!==void 0){var f=Us(a.default,a.share);if(f!=="none"&&(ua(i,o,f,null,!1)?(f=i.stateNode,u.paired=f,f.paired=u,ya(i,a.onShare)):Ss(i.child,!1)),s.delete(o),s.size===0)break}}}Ad(i)}i=i.sibling}}}function Nd(i){if(i.tag===30){var s=i.memoizedProps,a=Is(s,i.stateNode),o=Ai!==null?Ai.get(a):void 0,u=Us(s.default,o!==void 0?s.share:s.exit);u!=="none"&&(ua(i,a,u,null,!1)?o!==void 0?(u=i.stateNode,o.paired=u,u.paired=o,Ai.delete(a),ya(i,s.onShare)):ya(i,s.onExit):Ss(i.child,!1)),Ai!==null&&Ad(i)}else if((i.subtreeFlags&33554432)!==0)for(i=i.child;i!==null;)Nd(i),i=i.sibling;else Ai!==null&&Ad(i)}function um(i){for(i=i.child;i!==null;){if(i.tag===30){var s=i.memoizedProps,a=Is(s,i.stateNode);s=Us(s.default,s.update),i.flags&=-5,s!=="none"&&ua(i,a,s,i.memoizedState=[],!1)}else(i.subtreeFlags&33554432)!==0&&um(i);i=i.sibling}}function Ld(i){if((i.subtreeFlags&18874368)!==0)for(i=i.child;i!==null;){if(i.tag!==22||i.memoizedState===null){if(i.tag===30&&(i.flags&18874368)!==0){var s=i.stateNode;s.paired!==null&&(s.paired=null,Ss(i.child,!1))}Ld(i)}i=i.sibling}}function Dc(i){if(i.tag===30)i.stateNode.paired=null,Ss(i.child,!1),Ld(i);else if((i.subtreeFlags&33554432)!==0)for(i=i.child;i!==null;)Dc(i),i=i.sibling;else Ld(i)}function dm(i){for(i=i.child;i!==null;)i.tag===30?Ss(i.child,!1):(i.subtreeFlags&33554432)!==0&&dm(i),i=i.sibling}function Bd(i,s,a,o,u,f,y){for(var C=!1;s!==null;){if(s.tag===5){var T=s.stateNode;if(f!==null&&_i<f.length){var G=f[_i],ee=f0(T);(G.view||ee.view)&&(C=!0);var se;if(se=(i.flags&4)===0)if(ee.clip)se=!0;else{se=G.rect;var W=ee.rect;se=se.y!==W.y||se.x!==W.x||se.height!==W.height||se.width!==W.width}se&&(i.flags|=4),ee.abs?ee=!G.abs:(G=G.rect,ee=ee.rect,ee=G.height!==ee.height||G.width!==ee.width),ee&&(i.flags|=32)}else i.flags|=32;(i.flags&4)!==0&&cv(T,_i===0?a:a+"_"+_i,u),C&&(i.flags&4)!==0||(ys===null&&(ys=[]),ys.push(T,_i===0?o:o+"_"+_i,s.memoizedProps)),_i++}else(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&y?i.flags|=s.flags&32:Bd(i,s.child,a,o,u,f,y)&&(C=!0));s=s.sibling}return C}function fm(i,s){for(i=i.child;i!==null;){if(i.tag===30){var a=i.memoizedProps,o=i.stateNode,u=Is(a,o),f=Us(a.default,a.update),y;y=i.memoizedState,i.memoizedState=null,o=i;var C=i.child;_i=0,u=Bd(o,C,u,u,f,y,!1),(i.flags&4)!==0&&u&&ya(i,a.onUpdate)}else(i.subtreeFlags&33554432)!==0&&fm(i);i=i.sibling}}var Ht=!1,Ge=!1,xs=!1,Od=!1,pm=typeof WeakSet=="function"?WeakSet:Set,It=null,ws=!1,Dl=!1,Rc=!1,zd=!1;function O4(i,s,a){if(i=i.containerInfo,o0=Ta,i=_p(i),bu(i)){if("selectionStart"in i)var o={start:i.selectionStart,end:i.selectionEnd};else e:{o=(o=i.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var f=u.anchorOffset,y=u.focusNode;u=u.focusOffset;try{o.nodeType,y.nodeType}catch{o=null;break e}var C=0,T=-1,G=-1,ee=0,se=0,W=i,X=null;t:for(;;){for(var fe;W!==o||f!==0&&W.nodeType!==3||(T=C+f),W!==y||u!==0&&W.nodeType!==3||(G=C+u),W.nodeType===3&&(C+=W.nodeValue.length),(fe=W.firstChild)!==null;)X=W,W=fe;for(;;){if(W===i)break t;if(X===o&&++ee===f&&(T=C),X===y&&++se===u&&(G=C),(fe=W.nextSibling)!==null)break;W=X,X=W.parentNode}W=fe}o=T===-1||G===-1?null:{start:T,end:G}}else o=null}o=o||{start:0,end:0}}else o=null;for(c0={focusedElem:i,selectionRange:o},Ta=!1,a=(a&335544064)===a,It=s,s=a?9270:1024;It!==null;){if(i=It,a&&(o=i.deletions,o!==null))for(f=0;f<o.length;f++)a&&Nd(o[f]);if(i.alternate===null&&(i.flags&2)!==0)a&&om(i),Ac(a);else{if(i.tag===22){if(o=i.alternate,i.memoizedState!==null){o!==null&&o.memoizedState===null&&a&&Nd(o),Ac(a);continue}else if(o!==null&&o.memoizedState!==null){a&&om(i),Ac(a);continue}}o=i.child,(i.subtreeFlags&s)!==0&&o!==null?(o.return=i,It=o):(a&&um(i),Ac(a))}}Ai=null}function Ac(i){for(;It!==null;){var s=It,a=i,o=s.alternate,u=s.flags;switch(s.tag){case 0:case 11:case 15:break;case 1:if((u&1024)!==0&&o!==null){a=void 0,u=o.memoizedProps,o=o.memoizedState;var f=s.stateNode;try{var y=Sr(s.type,u);a=f.getSnapshotBeforeUpdate(y,o),f.__reactInternalSnapshotBeforeUpdate=a}catch(C){Qe(s,s.return,C)}}break;case 3:if((u&1024)!==0){if(o=s.stateNode.containerInfo,a=o.nodeType,a===9)m0(o);else if(a===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":m0(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:a&&o!==null&&(a=Is(o.memoizedProps,o.stateNode),u=s.memoizedProps,u=Us(u.default,u.update),u!=="none"&&ua(o,a,u,o.memoizedState=[],!0));break;default:if((u&1024)!==0)throw Error(r(163))}if(o=s.sibling,o!==null){o.return=s.return,It=o;break}It=s.return}}function gm(i,s,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:bs(i,a),o&4&&jl(5,a);break;case 1:if(bs(i,a),o&4)if(i=a.stateNode,s===null)try{i.componentDidMount()}catch(y){Qe(a,a.return,y)}else{var u=Sr(a.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(u,s,i.__reactInternalSnapshotBeforeUpdate)}catch(y){Qe(a,a.return,y)}}o&64&&sm(a),o&512&&_s(a,a.return);break;case 3:if(bs(i,a),o&64&&(i=a.updateQueue,i!==null)){if(s=null,a.child!==null)switch(a.child.tag){case 27:case 5:s=a.child.stateNode;break;case 1:s=a.child.stateNode}try{Fp(i,s)}catch(y){Qe(a,a.return,y)}}break;case 27:s===null&&o&4&&lm(a);case 26:case 5:bs(i,a),s===null&&o&4&&Md(a),o&512&&_s(a,a.return);break;case 12:bs(i,a);break;case 31:bs(i,a),o&4&&ym(i,a);break;case 13:bs(i,a),o&4&&Sm(i,a),o&64&&(i=a.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(a=Y4.bind(null,a),T5(i,a))));break;case 22:if(o=a.memoizedState!==null||Ht,!o){var f=s!==null&&s.memoizedState!==null||Ge;s=Ht,u=Ge,Ht=o,(Ge=f)&&!u?(o=2,(a.subtreeFlags&8772)!==0&&(o|=1),us(i,a,o)):bs(i,a),Ht=s,Ge=u}break;case 30:bs(i,a),o&512&&_s(a,a.return);break;case 7:o&512&&_s(a,a.return);default:bs(i,a)}}function Hd(i,s){for(i=i.child;i!==null;)mm(i,s),i=i.sibling}function mm(i,s){switch(i.tag){case 5:case 26:try{var a=i.stateNode;if(s){var o=a.style;typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"}else{var u=i.stateNode,f=i.memoizedProps.style,y=f!=null&&f.hasOwnProperty("display")?f.display:null;u.style.display=y==null||typeof y=="boolean"?"":(""+y).trim()}}catch(T){Qe(i,i.return,T)}Id(i,s);break;case 6:try{i.stateNode.nodeValue=s?"":i.memoizedProps,We=!0}catch(T){Qe(i,i.return,T)}break;case 18:try{var C=i.stateNode;s?ov(C,!0):ov(i.stateNode,!1)}catch(T){Qe(i,i.return,T)}break;case 22:case 23:i.memoizedState===null&&Hd(i,s);break;default:Hd(i,s)}}function Id(i,s){if(i.subtreeFlags&67108864)for(i=i.child;i!==null;){e:{var a=i,o=s;switch(a.tag){case 4:mm(a,o);break e;case 22:a.memoizedState===null&&Id(a,o);break e;default:Id(a,o)}}i=i.sibling}}function vm(i){var s=i.alternate;s!==null&&(i.alternate=null,vm(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&zo(s)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var ct=null,yi=!1;function cs(i,s,a){for(a=a.child;a!==null;)_m(i,s,a),a=a.sibling}function _m(i,s,a){if(Mi&&typeof Mi.onCommitFiberUnmount=="function")try{Mi.onCommitFiberUnmount(Ja,a)}catch{}switch(a.tag){case 26:Ge||Zt(a,s),cs(i,s,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&!Ge&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ge||Zt(a,s),Tl(a);var o=ct,u=yi;Ln(a.type)&&(ct=a.stateNode,yi=!1),cs(i,s,a),wv(a.stateNode,a.type,a.memoizedProps),ct=o,yi=u;break;case 5:Ge||Zt(a,s),Tl(a);case 6:if(a.tag===6&&Tl(a),o=ct,u=yi,ct=null,cs(i,s,a),ct=o,yi=u,ct!==null)if(yi)try{(ct.nodeType===9?ct.body:ct.nodeName==="HTML"?ct.ownerDocument.body:ct).removeChild(a.stateNode),We=!0}catch(f){Qe(a,s,f)}else try{ct.removeChild(a.stateNode),We=!0}catch(f){Qe(a,s,f)}break;case 18:ct!==null&&(yi?(i=ct,lv(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.stateNode),Da(i)):lv(ct,a.stateNode));break;case 4:o=ct,u=yi,ct=a.stateNode.containerInfo,yi=!0,cs(i,s,a),ct=o,yi=u;break;case 0:case 11:case 14:case 15:Mn(2,a,s),Ge||Mn(4,a,s),cs(i,s,a);break;case 1:Ge||(Zt(a,s),o=a.stateNode,typeof o.componentWillUnmount=="function"&&nm(a,s,o)),cs(i,s,a);break;case 21:cs(i,s,a);break;case 22:Ge=(o=Ge)||a.memoizedState!==null,cs(i,s,a),Ge=o;break;case 30:Zt(a,s),cs(i,s,a);break;case 7:Ge||Zt(a,s),cs(i,s,a);break;default:cs(i,s,a)}}function ym(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Da(i)}catch(a){Qe(s,s.return,a)}}}function Sm(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Da(i)}catch(a){Qe(s,s.return,a)}}function z4(i){switch(i.tag){case 31:case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new pm),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new pm),s;default:throw Error(r(435,i.tag))}}function Nc(i,s){var a=z4(i);s.forEach(function(o){if(!a.has(o)){a.add(o);var u=G4.bind(null,i,o);o.then(u,u)}})}function li(i,s,a){var o=s.deletions;if(o!==null)for(var u=0;u<o.length;u++){var f=o[u],y=i,C=s,T=C;e:for(;T!==null;){switch(T.tag){case 27:if(Ln(T.type)){ct=T.stateNode,yi=!1;break e}break;case 5:ct=T.stateNode,yi=!1;break e;case 3:case 4:ct=T.stateNode.containerInfo,yi=!0;break e}T=T.return}if(ct===null)throw Error(r(160));_m(y,C,f),ct=null,yi=!1,y=f.alternate,y!==null&&(y.return=null),f.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)xm(s,i,a),s=s.sibling}var hs=null;function xm(i,s,a){var o=i.alternate,u=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(u&4&&(o=i.updateQueue,o=o!==null?o.events:null,o!==null))for(var f=0;f<o.length;f++){var y=o[f];y.ref.impl=y.nextImpl}li(s,i,a),oi(i),u&4&&(Mn(3,i,i.return),jl(3,i),Mn(5,i,i.return));break;case 1:li(s,i,a),oi(i),u&512&&(Ge||o===null||Zt(o,o.return)),u&64&&Ht&&(i=i.updateQueue,i!==null&&(s=i.callbacks,s!==null&&(a=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=a===null?s:a.concat(s))));break;case 26:if(f=hs,li(s,i,a),oi(i),u&512&&(Ge||o===null||Zt(o,o.return)),u&4)if(u=o!==null?o.memoizedState:null,a=i.memoizedState,o===null)if(a===null)if(i.stateNode===null)if(Ht)i.stateNode=nv(i.type,i.memoizedProps,s.containerInfo,i);else{e:{s=i.type,a=i.memoizedProps,u=f.ownerDocument||f;t:switch(s){case"title":o=u.getElementsByTagName("title")[0],(!o||o[il]||o[Ft]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=u.createElement(s),u.head.insertBefore(o,u.querySelector("head > title"))),Xt(o,s,a),o[Ft]=i,Ot(o),s=o;break e;case"link":if(f=jv("link","href",u).get(s+(a.href||""))){for(y=0;y<f.length;y++)if(o=f[y],o.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&o.getAttribute("rel")===(a.rel==null?null:a.rel)&&o.getAttribute("title")===(a.title==null?null:a.title)&&o.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){f.splice(y,1);break t}}o=u.createElement(s),Xt(o,s,a),u.head.appendChild(o);break;case"meta":if(f=jv("meta","content",u).get(s+(a.content||""))){for(y=0;y<f.length;y++)if(o=f[y],o.getAttribute("content")===(a.content==null?null:""+a.content)&&o.getAttribute("name")===(a.name==null?null:a.name)&&o.getAttribute("property")===(a.property==null?null:a.property)&&o.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&o.getAttribute("charset")===(a.charSet==null?null:a.charSet)){f.splice(y,1);break t}}o=u.createElement(s),Xt(o,s,a),u.head.appendChild(o);break;default:throw Error(r(468,s))}o[Ft]=i,Ot(o),s=o}i.stateNode=s}else Ht||b0(f,i.type,i.stateNode);else i.stateNode=Mv(f,a,i.memoizedProps);else u!==a?(u===null?(s=o.stateNode,s===null||Ge||s.parentNode.removeChild(s)):u.count--,a===null?Ht||b0(f,i.type,i.stateNode):Mv(f,a,i.memoizedProps)):a===null&&i.stateNode!==null&&jd(i,i.memoizedProps,o.memoizedProps);break;case 27:li(s,i,a),oi(i),u&512&&(Ge||o===null||Zt(o,o.return)),o!==null&&u&4&&jd(i,i.memoizedProps,o.memoizedProps);break;case 5:if(f=xs,xs=!1,li(s,i,a),xs=f,oi(i),u&512&&(Ge||o===null||Zt(o,o.return)),i.flags&32){s=i.stateNode;try{Kr(s,""),We=!0}catch(ee){Qe(i,i.return,ee)}}u&4&&i.stateNode!=null&&(s=i.memoizedProps,jd(i,s,o!==null?o.memoizedProps:s)),u&1024&&(Od=!0);break;case 6:if(li(s,i,a),oi(i),u&4){if(i.stateNode===null)throw Error(r(162));s=i.memoizedProps,a=i.stateNode;try{a.nodeValue=s,We=!0}catch(ee){Qe(i,i.return,ee)}}break;case 3:if(We=!1,Yc=null,f=hs,hs=Il(s.containerInfo),li(s,i,a),hs=f,oi(i),u&4&&o!==null&&o.memoizedState.isDehydrated)try{Da(s.containerInfo)}catch(ee){Qe(i,i.return,ee)}Od&&(Od=!1,wm(i)),We=!1;break;case 4:u=xs,xs=Ht,o=q1(),f=hs,hs=Il(i.stateNode.containerInfo),li(s,i,a),oi(i),hs=f,We&&Dl&&(Rc=!0),We=o,xs=u;break;case 12:li(s,i,a),oi(i);break;case 31:li(s,i,a),oi(i),u&4&&(s=i.updateQueue,s!==null&&(i.updateQueue=null,Nc(i,s)));break;case 13:li(s,i,a),oi(i),i.child.flags&8192&&i.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Oc=Ei()),u&4&&(s=i.updateQueue,s!==null&&(i.updateQueue=null,Nc(i,s)));break;case 22:f=i.memoizedState!==null,y=o!==null&&o.memoizedState!==null;var C=Ht,T=Ge,G=xs;Ht=C||f,xs=G||f,Ge=T||y,li(s,i,a),Ge=T,xs=G,Ht=C,oi(i),u&8192&&(s=i.stateNode,s._visibility=f?s._visibility&-2:s._visibility|1,!f||o===null||y||Ht||Ge||(s=y||Ge,a=Ht,o=Ge,Ht=f||Ht,Ge=s,jn(i,2),Ht=a,Ge=o),!f&&xs||Hd(i,f)),u&4&&(s=i.updateQueue,s!==null&&(a=s.retryQueue,a!==null&&(s.retryQueue=null,Nc(i,a))));break;case 19:li(s,i,a),oi(i),u&4&&(s=i.updateQueue,s!==null&&(i.updateQueue=null,Nc(i,s)));break;case 30:u&512&&(Ge||o===null||Zt(o,o.return)),u=q1(),f=Dl,y=(a&335544064)===a,C=i.memoizedProps,Dl=y&&Us(C.default,C.update)!=="none",li(s,i,a),oi(i),y&&o!==null&&We&&(i.flags|=4),Dl=f,We=u;break;case 21:break;case 7:u&512&&(Ge||o===null||Zt(o,o.return)),o&&o.stateNode!==null&&(o.stateNode._fragmentFiber=i);default:li(s,i,a),oi(i)}}function oi(i){var s=i.flags;if(s&2){try{for(var a,o=i.return;o!==null;){if(am(o)){a=o;break}o=o.return}o=null;for(var u=i.return;u!==null;){if(Ed(u)){var f=u.stateNode;o===null?o=[f]:o.push(f)}if(kd(u))break;u=u.return}var y=o;if(a==null)throw Error(r(160));switch(a.tag){case 27:var C=a.stateNode,T=Td(i);Mc(i,T,C,y);break;case 5:var G=a.stateNode;a.flags&32&&(Kr(G,""),a.flags&=-33);var ee=Td(i);Mc(i,ee,G,y);break;case 3:case 4:var se=a.stateNode.containerInfo,W=Td(i);Dd(i,W,se,y);break;default:throw Error(r(161))}}catch(X){Qe(i,i.return,X)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function wm(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;wm(s),s.tag===5&&s.flags&1024&&(s=s.stateNode,Ta=!0,s.reset(),Ta=!1),i=i.sibling}}function da(i,s){if(s.subtreeFlags&9270)for(s=s.child;s!==null;)bm(s,i),s=s.sibling;else fm(s)}function bm(i,s){var a=i.alternate;if(a===null)Rd(i,!1);else switch(i.tag){case 3:if(zd=ws=!1,cm(),da(s,i),!ws&&!Rc){if(i=ys,i!==null)for(var o=0;o<i.length;o+=3){a=i[o];var u=i[o+1];hv(a,i[o+2]),a=a.ownerDocument.documentElement,a!==null&&a.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+u+")"})}i=s.containerInfo,i=i.nodeType===9?i.documentElement:i.ownerDocument.documentElement,i!==null&&i.style.viewTransitionName===""&&(i.style.viewTransitionName="none",i.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),i.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),zd=!0}ys=null;break;case 5:da(s,i);break;case 4:o=ws,ws=!1,da(s,i),ws&&(Rc=!0),ws=o;break;case 22:i.memoizedState===null&&(a.memoizedState!==null?Rd(i,!1):da(s,i));break;case 30:o=ws,u=cm(),ws=!1,da(s,i),ws&&(i.flags|=4);var f=i.memoizedProps,y=i.stateNode;s=Is(f,y),y=Is(a.memoizedProps,y);var C=Us(f.default,f.update);C==="none"?s=!1:(f=a.memoizedState,a.memoizedState=null,a=i.child,_i=0,s=Bd(i,a,s,y,C,f,!0),_i!==(f===null?0:f.length)&&(i.flags|=32)),(i.flags&4)!==0&&s?(ya(i,i.memoizedProps.onUpdate),ys=u):u!==null&&(u.push.apply(u,ys),ys=u),ws=(i.flags&32)!==0?!0:o;break;default:da(s,i)}}function bs(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)gm(i,s.alternate,s),s=s.sibling}function jn(i,s){for(i=i.child;i!==null;){var a=i,o=s;switch(a.tag){case 0:case 11:case 14:case 15:Mn(4,a,a.return),jn(a,o);break;case 1:Zt(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&nm(a,a.return,u),jn(a,o);break;case 27:(o&2)!==0&&wv(a.stateNode,a.type,a.memoizedProps);case 5:Zt(a,a.return),a.tag!==5&&a.tag!==27||Tl(a),jn(a,o);break;case 6:Tl(a);break;case 26:Zt(a,a.return),u=a.stateNode,a.memoizedState!==null||u===null||Ge||u.parentNode.removeChild(u),jn(a,o);break;case 22:a.memoizedState===null&&jn(a,o);break;case 30:Zt(a,a.return),jn(a,o);break;case 7:Zt(a,a.return);default:jn(a,o)}i=i.sibling}}function us(i,s,a){for(a=(s.subtreeFlags&8772)!==0?a:a&-2,s=s.child;s!==null;){var o=s.alternate,u=i,f=s,y=f.flags,C=(a&1)!==0;switch(f.tag){case 0:case 11:case 15:us(u,f,a),jl(4,f);break;case 1:if(us(u,f,a),o=f,u=o.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(ee){Qe(o,o.return,ee)}if(o=f,u=o.updateQueue,u!==null){var T=o.stateNode;try{var G=u.shared.hiddenCallbacks;if(G!==null)for(u.shared.hiddenCallbacks=null,u=0;u<G.length;u++)Wp(G[u],T)}catch(ee){Qe(o,o.return,ee)}}C&&y&64&&sm(f),_s(f,f.return);break;case 27:(a&2)!==0&&lm(f);case 5:f.tag!==5&&f.tag!==27||rm(f),us(u,f,a),C&&o===null&&y&4&&Md(f),_s(f,f.return);break;case 6:rm(f);break;case 26:T=f.stateNode,f.memoizedState!==null||T===null||Ht||b0(Il(T.ownerDocument),f.type,T),us(u,f,a),C&&o===null&&y&4&&Md(f),_s(f,f.return);break;case 12:us(u,f,a);break;case 31:us(u,f,a),C&&y&4&&ym(u,f);break;case 13:us(u,f,a),C&&y&4&&Sm(u,f);break;case 22:f.memoizedState===null&&us(u,f,a),_s(f,f.return);break;case 30:us(u,f,a),_s(f,f.return);break;case 7:_s(f,f.return);default:us(u,f,a)}s=s.sibling}}function Ud(i,s){var a=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==a&&(i!=null&&i.refCount++,a!=null&&gl(a))}function Pd(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&gl(i))}function Ki(i,s,a,o){var u=(a&335544064)===a;if(s.subtreeFlags&(u?10262:10256))for(s=s.child;s!==null;)Cm(i,s,a,o),s=s.sibling;else u&&dm(s)}function Cm(i,s,a,o){var u=(a&335544064)===a;u&&s.alternate===null&&s.return!==null&&s.return.alternate!==null&&Dc(s);var f=s.flags;switch(s.tag){case 0:case 11:case 15:Ki(i,s,a,o),f&2048&&jl(9,s);break;case 1:Ki(i,s,a,o);break;case 3:Ki(i,s,a,o),u&&zd&&(i=i.containerInfo,i=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,i.style.viewTransitionName==="root"&&(i.style.viewTransitionName=""),i=i.ownerDocument.documentElement,i!==null&&i.style.viewTransitionName==="none"&&(i.style.viewTransitionName="")),f&2048&&(f=null,s.alternate!==null&&(f=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==f&&(s.refCount++,f!=null&&gl(f)));break;case 12:if(f&2048){Ki(i,s,a,o),f=s.stateNode;try{var y=s.memoizedProps,C=y.id,T=y.onPostCommit;typeof T=="function"&&T(C,s.alternate===null?"mount":"update",f.passiveEffectDuration,-0)}catch(G){Qe(s,s.return,G)}}else Ki(i,s,a,o);break;case 31:Ki(i,s,a,o);break;case 13:Ki(i,s,a,o);break;case 23:break;case 22:y=s.stateNode,C=s.alternate,s.memoizedState!==null?(u&&C!==null&&C.memoizedState===null&&Dc(C),y._visibility&2?Ki(i,s,a,o):Rl(i,s)):(u&&C!==null&&C.memoizedState!==null&&Dc(s),y._visibility&2?Ki(i,s,a,o):(y._visibility|=2,fa(i,s,a,o,(s.subtreeFlags&10256)!==0||!1))),f&2048&&Ud(C,s);break;case 24:Ki(i,s,a,o),f&2048&&Pd(s.alternate,s);break;case 30:u&&(f=s.alternate,f!==null&&(Ss(f.child,!0),Ss(s.child,!0))),Ki(i,s,a,o);break;default:Ki(i,s,a,o)}}function fa(i,s,a,o,u){for(u=u&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var f=i,y=s,C=a,T=o,G=y.flags;switch(y.tag){case 0:case 11:case 15:fa(f,y,C,T,u),jl(8,y);break;case 23:break;case 22:var ee=y.stateNode;y.memoizedState!==null?ee._visibility&2?fa(f,y,C,T,u):Rl(f,y):(ee._visibility|=2,fa(f,y,C,T,u)),u&&G&2048&&Ud(y.alternate,y);break;case 24:fa(f,y,C,T,u),u&&G&2048&&Pd(y.alternate,y);break;default:fa(f,y,C,T,u)}s=s.sibling}}function Rl(i,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var a=i,o=s,u=o.flags;switch(o.tag){case 22:Rl(a,o),u&2048&&Ud(o.alternate,o);break;case 24:Rl(a,o),u&2048&&Pd(o.alternate,o);break;default:Rl(a,o)}s=s.sibling}}var xr=8192;function wr(i,s,a){if(i.subtreeFlags&xr)for(i=i.child;i!==null;)km(i,s,a),i=i.sibling}function km(i,s,a){switch(i.tag){case 26:wr(i,s,a),i.flags&xr&&(i.memoizedState!==null?V5(a,hs,i.memoizedState,i.memoizedProps):(i=i.stateNode,(s&335544128)===s&&Av(a,i)));break;case 5:wr(i,s,a),i.flags&xr&&(i=i.stateNode,(s&335544128)===s&&Av(a,i));break;case 3:case 4:var o=hs;hs=Il(i.stateNode.containerInfo),wr(i,s,a),hs=o;break;case 22:i.memoizedState===null&&(o=i.alternate,o!==null&&o.memoizedState!==null?(o=xr,xr=16777216,wr(i,s,a),xr=o):wr(i,s,a));break;case 30:if((i.flags&xr)!==0&&(o=i.memoizedProps.name,o!=null&&o!=="auto")){var u=i.stateNode;u.paired=null,Ai===null&&(Ai=new Map),Ai.set(o,u)}wr(i,s,a);break;default:wr(i,s,a)}}function Em(i){var s=i.alternate;if(s!==null&&(i=s.child,i!==null)){s.child=null;do s=i.sibling,i.sibling=null,i=s;while(i!==null)}}function Al(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var o=s[a];It=o,jm(o,i)}Em(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Mm(i),i=i.sibling}function Mm(i){switch(i.tag){case 0:case 11:case 15:Al(i),i.flags&2048&&Mn(9,i,i.return);break;case 3:Al(i);break;case 12:Al(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,Lc(i)):Al(i);break;default:Al(i)}}function Lc(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var o=s[a];It=o,jm(o,i)}Em(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:Mn(8,s,s.return),Lc(s);break;case 22:a=s.stateNode,a._visibility&2&&(a._visibility&=-3,Lc(s));break;default:Lc(s)}i=i.sibling}}function jm(i,s){for(;It!==null;){var a=It;switch(a.tag){case 0:case 11:case 15:Mn(8,a,s);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:gl(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,It=o;else e:for(a=i;It!==null;){o=It;var u=o.sibling,f=o.return;if(vm(o),o===a){It=null;break e}if(u!==null){u.return=f,It=u;break e}It=f}}}var H4={getCacheForType:function(i){var s=Kt(xt),a=s.data.get(i);return a===void 0&&(a=i(),s.data.set(i,a)),a},cacheSignal:function(){return Kt(xt).controller.signal}},I4=typeof WeakMap=="function"?WeakMap:Map,Ye=0,st=null,Ie=null,Pe=0,Xe=0,Ni=null,Tn=!1,pa=!1,qd=!1,Gs=0,mt=0,Dn=0,br=0,Bc=0,Li=0,ga=0,Nl=null,Si=null,Vd=!1,Oc=0,Tm=0,zc=1/0,Hc=null,Rn=null,ut=0,ds=null,Cr=null,Cs=0,$d=0,Wd=null,Dm=null,ma=null,va=null,_a=null,Ll=0,Ic=null;function Bi(){return(Ye&2)!==0&&Pe!==0?Pe&-Pe:pe.T!==null?t0():N1()}function Rm(){if(Li===0)if((Pe&536870912)===0||Oe){var i=No;No<<=1,(No&3932160)===0&&(No=262144),Li=i}else Li=536870912;return i=Yt.current,i!==null&&(i.flags|=32),Li}function ya(i,s){if(s!=null){var a=i.stateNode,o=a.ref;o===null&&(o=a.ref=uv(Is(i.memoizedProps,a))),va===null&&(va=[]),va.push(s.bind(null,o))}}function xi(i,s,a){(i===st&&(Xe===2||Xe===9)||i.cancelPendingCommit!==null)&&(Sa(i,0),An(i,Pe,Li,!1)),tl(i,a),((Ye&2)===0||i!==st)&&(i===st&&((Ye&2)===0&&(br|=a),mt===4&&An(i,Pe,Li,!1)),ks(i))}function Am(i,s,a){if((Ye&6)!==0)throw Error(r(327));var o=!a&&(s&127)===0&&(s&i.expiredLanes)===0||el(i,s),u=o?q4(i,s):Kd(i,s,!0),f=o;do{if(u===0){pa&&!o&&An(i,s,0,!1);break}else{if(a=i.current.alternate,f&&!U4(a)){u=Kd(i,s,!1),f=!1;continue}if(u===2){if(f=s,i.errorRecoveryDisabledLanes&f)var y=0;else y=i.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){s=y;e:{var C=i;u=Nl;var T=C.current.memoizedState.isDehydrated;if(T&&(Sa(C,y).flags|=256),y=Kd(C,y,!1),y!==2&&y!==6){if(qd&&!T){C.errorRecoveryDisabledLanes|=f,br|=f,u=4;break e}f=Si,Si=u,f!==null&&(Si===null?Si=f:Si.push.apply(Si,f))}u=y}if(f=!1,u!==2)continue}}if(u===1){Sa(i,0),An(i,s,0,!0);break}e:{switch(o=i,f=u,f){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s&&(s&62914560)!==s)break;case 6:An(o,s,Li,!Tn);break e;case 2:Si=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(u=Oc+300-Ei(),10<u)){if(An(o,s,Li,!Tn),Bo(o,0,!0)!==0)break e;Cs=s,o.timeoutHandle=d0(Nm.bind(null,o,a,Si,Hc,Vd,s,Li,br,ga,Tn,f,"Throttled",-0,0),u);break e}Nm(o,a,Si,Hc,Vd,s,Li,br,ga,Tn,f,null,-0,0)}}break}while(!0);ks(i)}function Nm(i,s,a,o,u,f,y,C,T,G,ee,se,W,X){i.timeoutHandle=-1;var fe=s.subtreeFlags,ye=(f&335544064)===f;if(se=null,(ye||fe&8192||(fe&16785408)===16785408)&&(se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:gs},Ai=null,km(s,f,se),ye&&(fe=se,ye=i.containerInfo,ye=(ye.nodeType===9?ye:ye.ownerDocument).__reactViewTransition,ye!=null&&(fe.count++,fe.waitingForViewTransition=!0,fe=ql.bind(fe),ye.finished.then(fe,fe))),fe=(f&62914560)===f?Oc-Ei():(f&4194048)===f?Tm-Ei():0,fe=$5(se,fe),fe!==null)){Cs=f,i.cancelPendingCommit=fe(Pm.bind(null,i,s,f,a,o,u,y,C,T,G,ee,se,null,W,X)),An(i,f,y,!G);return}Pm(i,s,f,a,o,u,y,C,T,G,ee,se)}function U4(i){for(var s=i;;){var a=s.tag;if((a===0||a===11||a===15)&&s.flags&16384&&(a=s.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var o=0;o<a.length;o++){var u=a[o],f=u.getSnapshot;u=u.value;try{if(!Di(f(),u))return!1}catch{return!1}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function An(i,s,a,o){s=j1(i,s),s&=~Bc,s&=~br,i.suspendedLanes|=s,i.pingedLanes&=~s,o&&(i.warmLanes|=s),o=i.expirationTimes;for(var u=s;0<u;){var f=31-ji(u),y=1<<f;o[f]=-1,u&=~y}a!==0&&D1(i,a,s)}function Uc(){return(Ye&6)===0?(Bl(0),!1):!0}function Fd(){if(Ie!==null){if(Xe===0)var i=Ie.return;else i=Ie,Vs=ur=null,ed(i),aa=null,_l=0,i=Ie;for(;i!==null;)im(i.alternate,i),i=i.return;Ie=null}}function Sa(i,s){var a=i.timeoutHandle;return a!==-1&&(i.timeoutHandle=-1,h5(a)),a=i.cancelPendingCommit,a!==null&&(i.cancelPendingCommit=null,a()),Cs=0,Fd(),st=i,Ie=a=Ps(i.current,null),Pe=s,Xe=0,Ni=null,Tn=!1,pa=el(i,s),qd=!1,ga=Li=Bc=br=Dn=mt=0,Si=Nl=null,Vd=!1,Gs=j1(i,s),Yo(),a}function Lm(i,s){Le=null,pe.H=yc,s===ra||s===rc?(s=Pp(),Xe=3):s===Pu?(s=Pp(),Xe=4):Xe=s===gd?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Ni=s,Ie===null&&(mt=1,Sc(i,Vi(s,i.current)))}function Bm(){var i=Yt.current;return i===null?!0:(Pe&4194048)===Pe?ii===null:(Pe&62914560)===Pe||(Pe&536870912)!==0?i===ii:!1}function Om(){var i=pe.H;return pe.H=yc,i===null?yc:i}function zm(){var i=pe.A;return pe.A=H4,i}function Pc(){mt=4,Tn||(Pe&4194048)!==Pe&&Yt.current!==null||(pa=!0),(Dn&134217727)===0&&(br&134217727)===0||st===null||An(st,Pe,Li,!1)}function Kd(i,s,a){var o=Ye;Ye|=2;var u=Om(),f=zm();(st!==i||Pe!==s)&&(Hc=null,Sa(i,s)),s=!1;var y=mt;e:do try{if(Xe!==0&&Ie!==null){var C=Ie,T=Ni;switch(Xe){case 8:Fd(),y=6;break e;case 3:case 2:case 9:case 6:Yt.current===null&&(s=!0);var G=Xe;if(Xe=0,Ni=null,xa(i,C,T,G),a&&pa){y=0;break e}break;default:G=Xe,Xe=0,Ni=null,xa(i,C,T,G)}}P4(),y=mt;break}catch(ee){Lm(i,ee)}while(!0);return s&&i.shellSuspendCounter++,Vs=ur=null,Ye=o,pe.H=u,pe.A=f,Ie===null&&(st=null,Pe=0,Yo()),y}function P4(){for(;Ie!==null;)Hm(Ie)}function q4(i,s){var a=Ye;Ye|=2;var o=Om(),u=zm();st!==i||Pe!==s?(Hc=null,zc=Ei()+500,Sa(i,s)):pa=el(i,s);e:do try{if(Xe!==0&&Ie!==null){s=Ie;var f=Ni;t:switch(Xe){case 1:Xe=0,Ni=null,xa(i,s,f,1);break;case 2:case 9:if(Ip(f)){Xe=0,Ni=null,Im(s);break}s=function(){Xe!==2&&Xe!==9||st!==i||(Xe=7),ks(i)},f.then(s,s);break e;case 3:Xe=7;break e;case 4:Xe=5;break e;case 7:Ip(f)?(Xe=0,Ni=null,Im(s)):(Xe=0,Ni=null,xa(i,s,f,7));break;case 5:var y=null;switch(Ie.tag){case 26:y=Ie.memoizedState;case 5:case 27:var C=Ie;if(y?Dv(y):C.stateNode.complete){Xe=0,Ni=null;var T=C.sibling;if(T!==null)Ie=T;else{var G=C.return;G!==null?(Ie=G,qc(G)):Ie=null}break t}}Xe=0,Ni=null,xa(i,s,f,5);break;case 6:Xe=0,Ni=null,xa(i,s,f,6);break;case 8:Fd(),mt=6;break e;default:throw Error(r(462))}}V4();break}catch(ee){Lm(i,ee)}while(!0);return Vs=ur=null,pe.H=o,pe.A=u,Ye=a,Ie!==null?0:(st=null,Pe=0,Yo(),mt)}function V4(){for(;Ie!==null&&!aw();)Hm(Ie)}function Hm(i){var s=em(i.alternate,i,Gs);i.memoizedProps=i.pendingProps,s===null?qc(i):Ie=s}function Im(i){var s=i,a=s.alternate;switch(s.tag){case 15:case 0:s=Kg(a,s,s.pendingProps,s.type,void 0,Pe);break;case 11:s=Kg(a,s,s.pendingProps,s.type.render,s.ref,Pe);break;case 5:ed(s);var o=s;o===zt&&(Oe?(ec(o),o.tag===5&&o.stateNode!=null&&(nt=o.stateNode)):(ec(o),Oe=!0));default:im(a,s),s=Ie=jp(s,Gs),s=em(a,s,Gs)}i.memoizedProps=i.pendingProps,s===null?qc(i):Ie=s}function xa(i,s,a,o){Vs=ur=null,ed(s),aa=null,_l=0;var u=s.return;try{if(D4(i,u,s,a,Pe)){mt=1,Sc(i,Vi(a,i.current)),Ie=null;return}}catch(f){if(u!==null)throw Ie=u,f;mt=1,Sc(i,Vi(a,i.current)),Ie=null;return}s.flags&32768?(Oe||o===1?i=!0:pa||(Pe&536870912)!==0?i=!1:(Tn=i=!0,(o===2||o===9||o===3||o===6)&&(o=Yt.current,o!==null&&o.tag===13&&(o.flags|=16384))),Um(s,i)):qc(s)}function qc(i){var s=i;do{if((s.flags&32768)!==0){Um(s,Tn);return}i=s.return;var a=L4(s.alternate,s,Gs);if(a!==null){Ie=a;return}if(s=s.sibling,s!==null){Ie=s;return}Ie=s=i}while(s!==null);mt===0&&(mt=5)}function Um(i,s){do{var a=B4(i.alternate,i);if(a!==null){a.flags&=32767,Ie=a;return}if(a=i.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!s&&(i=i.sibling,i!==null)){Ie=i;return}Ie=i=a}while(i!==null);mt=6,Ie=null}function Pm(i,s,a,o,u,f,y,C,T,G,ee,se){i.cancelPendingCommit=null;do Vc();while(ut!==0);if((Ye&6)!==0)throw Error(r(327));if(s!==null){if(s===i.current)throw Error(r(177));i===st&&(Ie=st=null,Pe=0),Cr=s,ds=i,Cs=a,Wd=u,Dm=o,$4(i,s,a,y,C,T,se)}}function $4(i,s,a,o,u,f,y){var C=s.lanes|s.childLanes;if($d=C,C|=ju,mw(i,a,C,o,u,f),va=null,(a&335544064)===a?(_a=_4(i),o=10262):(_a=null,o=10256),(s.subtreeFlags&o)!==0||(s.flags&o)!==0?(i.callbackNode=null,i.callbackPriority=0,Z4(Ro,function(){return Xd(),null})):(i.callbackNode=null,i.callbackPriority=0),jc=!1,o=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||o){o=pe.T,pe.T=null,u=_e.p,_e.p=2,f=Ye,Ye|=4;try{O4(i,s,a)}finally{Ye=f,_e.p=u,pe.T=o}}ut=1,jc?ma=m5(y,i.containerInfo,_a,Yd,Gd,F4,Zd,Xd,W4):(Yd(),Gd(),Zd())}function W4(i){if(ut!==0){var s=ds.onRecoverableError;s(i,{componentStack:null})}}function F4(){ut===3&&(ut=0,bm(Cr,ds),ut=4)}function Yd(){if(ut===1){ut=0;var i=ds,s=Cr,a=Cs,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=pe.T,pe.T=null;var u=_e.p;_e.p=2;var f=Ye;Ye|=4;try{Dl=Rc=!1,xm(s,i,a),a=c0;var y=_p(i.containerInfo),C=a.focusedElem,T=a.selectionRange;if(y!==C&&C&&C.ownerDocument&&vp(C.ownerDocument.documentElement,C)){if(T!==null&&bu(C)){var G=T.start,ee=T.end;if(ee===void 0&&(ee=G),"selectionStart"in C)C.selectionStart=G,C.selectionEnd=Math.min(ee,C.value.length);else{var se=C.ownerDocument||document,W=se&&se.defaultView||window;if(W.getSelection){var X=W.getSelection(),fe=C.textContent.length,ye=Math.min(T.start,fe),Be=T.end===void 0?ye:Math.min(T.end,fe);!X.extend&&ye>Be&&(y=Be,Be=ye,ye=y);var K=mp(C,ye),H=mp(C,Be);if(K&&H&&(X.rangeCount!==1||X.anchorNode!==K.node||X.anchorOffset!==K.offset||X.focusNode!==H.node||X.focusOffset!==H.offset)){var Z=se.createRange();Z.setStart(K.node,K.offset),X.removeAllRanges(),ye>Be?(X.addRange(Z),X.extend(H.node,H.offset)):(Z.setEnd(H.node,H.offset),X.addRange(Z))}}}}for(se=[],X=C;X=X.parentNode;)X.nodeType===1&&se.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<se.length;C++){var ie=se[C];ie.element.scrollLeft=ie.left,ie.element.scrollTop=ie.top}}Ta=!!o0,c0=o0=null}finally{Ye=f,_e.p=u,pe.T=o}}i.current=s,ut=2}}function Gd(){if(ut===2){ut=0;var i=ds,s=Cr,a=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||a){a=pe.T,pe.T=null;var o=_e.p;_e.p=2;var u=Ye;Ye|=4;try{gm(i,s.alternate,s)}finally{Ye=u,_e.p=o,pe.T=a}}ut=3}}function Zd(){if(ut===4||ut===3){ut=0;var i=ma;ma=null,lw();var s=ds,a=Cr,o=Cs,u=Dm,f=(o&335544064)===o?10262:10256;if((a.subtreeFlags&f)!==0||(a.flags&f)!==0?ut=5:(ut=0,Cr=ds=null,qm(s,s.pendingLanes)),f=s.pendingLanes,f===0&&(Rn=null),ru(o),a=a.stateNode,Mi&&typeof Mi.onCommitFiberRoot=="function")try{Mi.onCommitFiberRoot(Ja,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=pe.T,f=_e.p,_e.p=2,pe.T=null;try{for(var y=s.onRecoverableError,C=0;C<u.length;C++){var T=u[C];y(T.value,{componentStack:T.stack})}}finally{pe.T=a,_e.p=f}}if(u=va,y=_a,_a=null,u!==null&&(va=null,y===null&&(y=[]),i!==null))for(T=0;T<u.length;T++)a=(0,u[T])(y),a!==void 0&&i.finished.finally(a);(Cs&3)!==0&&Vc(),ks(s),f=s.pendingLanes,(o&261930)!==0&&(f&42)!==0?s===Ic?Ll++:(Ll=0,Ic=s):(Ll=0,Ic=null),Bl(0)}}function qm(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,gl(s)))}function Vc(){return ma!==null&&(ma.skipTransition(),ma=null),Yd(),Gd(),Zd(),Xd()}function Xd(){if(ut!==5)return!1;var i=ds,s=$d;$d=0;var a=ru(Cs),o=pe.T,u=_e.p;try{_e.p=32>a?32:a,pe.T=null,a=Wd,Wd=null;var f=ds,y=Cs;if(ut=0,Cr=ds=null,Cs=0,(Ye&6)!==0)throw Error(r(331));var C=Ye;if(Ye|=4,Mm(f.current),Cm(f,f.current,y,a),Ye=C,Bl(0,!1),Mi&&typeof Mi.onPostCommitFiberRoot=="function")try{Mi.onPostCommitFiberRoot(Ja,f)}catch{}return!0}finally{_e.p=u,pe.T=o,qm(i,s)}}function Vm(i,s,a){s=Vi(a,s),s=pd(i.stateNode,s,2),i=bn(i,s,2),i!==null&&(tl(i,2),ks(i))}function Qe(i,s,a){if(i.tag===3)Vm(i,i,a);else for(;s!==null;){if(s.tag===3){Vm(s,i,a);break}else if(s.tag===1){var o=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Rn===null||!Rn.has(o))){i=Vi(a,i),a=Ig(2),o=bn(s,a,2),o!==null&&(Ug(a,o,s,i),tl(o,2),ks(o));break}}s=s.return}}function Qd(i,s,a){var o=i.pingCache;if(o===null){o=i.pingCache=new I4;var u=new Set;o.set(s,u)}else u=o.get(s),u===void 0&&(u=new Set,o.set(s,u));u.has(a)||(qd=!0,u.add(a),i=K4.bind(null,i,s,a),s.then(i,i))}function K4(i,s,a){var o=i.pingCache;o!==null&&o.delete(s),i.pingedLanes|=i.suspendedLanes&a,i.warmLanes&=~a,st===i&&(Pe&a)===a&&((mt===4||mt===3&&(Pe&62914560)===Pe&&300>Ei()-Oc)&&(Ye&2)===0?Sa(i,0):Bc|=a,ga===Pe&&(ga=0)),ks(i)}function $m(i,s){s===0&&(s=T1()),i=or(i,s),i!==null&&(tl(i,s),ks(i))}function Y4(i){var s=i.memoizedState,a=0;s!==null&&(a=s.retryLane),$m(i,a)}function G4(i,s){var a=0;switch(i.tag){case 31:case 13:var o=i.stateNode,u=i.memoizedState;u!==null&&(a=u.retryLane);break;case 19:o=i.stateNode;break;case 22:o=i.stateNode._retryCache;break;default:throw Error(r(314))}o!==null&&o.delete(s),$m(i,a)}function Z4(i,s){return tu(i,s)}var wa=null,ba=null,Jd=!1,$c=!1,e0=!1,Nn=0;function ks(i){i!==ba&&i.next===null&&(ba===null?wa=ba=i:ba=ba.next=i),$c=!0,Jd||(Jd=!0,Q4())}function Bl(i,s){if(!e0&&$c){e0=!0;do for(var a=!1,o=wa;o!==null;){if(i!==0){var u=o.pendingLanes;if(u===0)var f=0;else{var y=o.suspendedLanes,C=o.pingedLanes;f=(1<<31-ji(42|i)+1)-1,f&=u&~(y&~C),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(a=!0,Ym(o,f))}else f=Pe,f=Bo(o,o===st?f:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(f&3)===0||el(o,f)||(a=!0,Ym(o,f));o=o.next}while(a);e0=!1}}function X4(){Wm()}function Wm(){$c=Jd=!1;var i=0;Nn!==0&&c5()&&(i=Nn);for(var s=Ei(),a=null,o=wa;o!==null;){var u=o.next,f=Fm(o,s);f===0?(o.next=null,a===null?wa=u:a.next=u,u===null&&(ba=a)):(a=o,(i!==0||(f&3)!==0)&&($c=!0)),o=u}ut!==0&&ut!==5||Bl(i),Nn!==0&&(Nn=0)}function Fm(i,s){for(var a=i.suspendedLanes,o=i.pingedLanes,u=i.expirationTimes,f=i.pendingLanes&-62914561;0<f;){var y=31-ji(f),C=1<<y,T=u[y];T===-1?((C&a)===0||(C&o)!==0)&&(u[y]=gw(C,s)):T<=s&&(i.expiredLanes|=C),f&=~C}if(s=st,a=Pe,a=Bo(i,i===s?a:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),o=i.callbackNode,a===0||i===s&&(Xe===2||Xe===9)||i.cancelPendingCommit!==null)return o!==null&&o!==null&&iu(o),i.callbackNode=null,i.callbackPriority=0;if((a&3)===0||el(i,a)){if(s=a&-a,s===i.callbackPriority)return s;switch(o!==null&&iu(o),ru(a)){case 2:case 8:a=E1;break;case 32:a=Ro;break;case 268435456:a=M1;break;default:a=Ro}return o=Km.bind(null,i),a=tu(a,o),i.callbackPriority=s,i.callbackNode=a,s}return o!==null&&o!==null&&iu(o),i.callbackPriority=2,i.callbackNode=null,2}function Km(i,s){if(ut!==0&&ut!==5)return i.callbackNode=null,i.callbackPriority=0,null;var a=i.callbackNode;if(Vc()&&i.callbackNode!==a)return null;var o=Pe;return o=Bo(i,i===st?o:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),o===0?null:(Am(i,o,s),Fm(i,Ei()),i.callbackNode!=null&&i.callbackNode===a?Km.bind(null,i):null)}function Ym(i,s){if(Vc())return null;Am(i,s,!0)}function Q4(){u5(function(){(Ye&6)!==0?tu(k1,X4):Wm()})}function t0(){if(Nn===0){var i=pr;i===0&&(i=Ao,Ao<<=1,(Ao&261888)===0&&(Ao=256)),Nn=i}return Nn}function Gm(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Uo(i)}function J4(i,s,a,o,u){if(s==="submit"&&a&&a.stateNode===u){var f=Gm((u[mi]||null).action),y=o.submitter;y&&(s=(s=y[mi]||null)?Gm(s.formAction):y.getAttribute("formAction"),s!==null&&(f=s,y=null));var C=new $o("action","action",null,o,u);i.push({event:C,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Nn!==0){var T=new FormData(u,y);cd(a,{pending:!0,data:T,method:u.method,action:f},null,T)}}else typeof f=="function"&&(C.preventDefault(),T=new FormData(u,y),cd(a,{pending:!0,data:T,method:u.method,action:f},f,T))},currentTarget:u}]})}}for(var i0=0;i0<Mu.length;i0++){var s0=Mu[i0],e5=s0.toLowerCase(),t5=s0[0].toUpperCase()+s0.slice(1);os(e5,"on"+t5)}os(xp,"onAnimationEnd"),os(wp,"onAnimationIteration"),os(bp,"onAnimationStart"),os("dblclick","onDoubleClick"),os("focusin","onFocus"),os("focusout","onBlur"),os(h4,"onTransitionRun"),os(u4,"onTransitionStart"),os(d4,"onTransitionCancel"),os(Cp,"onTransitionEnd"),Wr("onMouseEnter",["mouseout","mouseover"]),Wr("onMouseLeave",["mouseout","mouseover"]),Wr("onPointerEnter",["pointerout","pointerover"]),Wr("onPointerLeave",["pointerout","pointerover"]),rr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),rr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),rr("onBeforeInput",["compositionend","keypress","textInput","paste"]),rr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),rr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),rr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ol="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(" "),i5=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ol));function Zm(i,s){s=(s&4)!==0;for(var a=0;a<i.length;a++){var o=i[a],u=o.event;o=o.listeners;e:{var f=void 0;if(s)for(var y=o.length-1;0<=y;y--){var C=o[y],T=C.instance,G=C.currentTarget;if(C=C.listener,T!==f&&u.isPropagationStopped())break e;f=C,u.currentTarget=G;try{f(u)}catch(ee){Ko(ee)}u.currentTarget=null,f=T}else for(y=0;y<o.length;y++){if(C=o[y],T=C.instance,G=C.currentTarget,C=C.listener,T!==f&&u.isPropagationStopped())break e;f=C,u.currentTarget=G;try{f(u)}catch(ee){Ko(ee)}u.currentTarget=null,f=T}}}}function Ue(i,s){var a=s[B1];a===void 0&&(a=s[B1]=new Set);var o=i+"__bubble";a.has(o)||(Xm(s,i,2,!1),a.add(o))}function n0(i,s,a){var o=0;s&&(o|=4),Xm(a,i,o,s)}var Wc="_reactListening"+Math.random().toString(36).slice(2);function r0(i){if(!i[Wc]){i[Wc]=!0,H1.forEach(function(a){a!=="selectionchange"&&(i5.has(a)||n0(a,!1,i),n0(a,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[Wc]||(s[Wc]=!0,n0("selectionchange",!1,s))}}function Xm(i,s,a,o){switch(Uv(s)){case 2:var u=Y5;break;case 8:u=G5;break;default:u=k0}a=u.bind(null,s,a,i),u=void 0,!fu||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(u=!0),o?u!==void 0?i.addEventListener(s,a,{capture:!0,passive:u}):i.addEventListener(s,a,!0):u!==void 0?i.addEventListener(s,a,{passive:u}):i.addEventListener(s,a,!1)}function a0(i,s,a,o,u){var f=o;if((s&1)===0&&(s&2)===0&&o!==null)e:for(;;){if(o===null)return;var y=o.tag;if(y===3||y===4){var C=o.stateNode.containerInfo;if(C===u)break;if(y===4)for(y=o.return;y!==null;){var T=y.tag;if((T===3||T===4)&&y.stateNode.containerInfo===u)return;y=y.return}for(;C!==null;){if(y=nr(C),y===null)return;if(T=y.tag,T===5||T===6||T===26||T===27){o=f=y;continue e}C=C.parentNode}}o=o.return}X1(function(){var G=f,ee=uu(a),se=[];e:{var W=kp.get(i);if(W!==void 0){var X=$o,fe=i;switch(i){case"keypress":if(qo(a)===0)break e;case"keydown":case"keyup":X=Uw;break;case"focusin":fe="focus",X=vu;break;case"focusout":fe="blur",X=vu;break;case"beforeblur":case"afterblur":X=vu;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=ep;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=jw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=Ww;break;case xp:case wp:case bp:X=Rw;break;case Cp:X=Kw;break;case"scroll":case"scrollend":X=Ew;break;case"wheel":X=Gw;break;case"copy":case"cut":case"paste":X=Nw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=ip;break;case"submit":X=Vw;break;case"toggle":case"beforetoggle":X=Xw}var ye=(s&4)!==0,Be=!ye&&(i==="scroll"||i==="scrollend"),K=ye?W!==null?W+"Capture":null:W;ye=[];for(var H=G,Z;H!==null;){var ie=H;if(Z=ie.stateNode,ie=ie.tag,ie!==5&&ie!==26&&ie!==27||Z===null||K===null||(ie=nl(H,K),ie!=null&&ye.push(zl(H,ie,Z))),Be)break;H=H.return}0<ye.length&&(W=new X(W,fe,null,a,ee),se.push({event:W,listeners:ye}))}}if((s&7)===0){e:{if(X=i==="mouseover"||i==="pointerover",W=i==="mouseout"||i==="pointerout",X&&a!==hu&&(fe=a.relatedTarget||a.fromElement)&&(nr(fe)||fe[qr]))break e;(W||X)&&(fe=ee.window===ee?ee:(X=ee.ownerDocument)?X.defaultView||X.parentWindow:window,W?(X=a.relatedTarget||a.toElement,W=G,X=X?nr(X):null,X!==null&&(Be=h(X),ye=X.tag,X!==Be||ye!==5&&ye!==27&&ye!==6)&&(X=null)):(W=null,X=G),W!==X&&(ye=ep,ie="onMouseLeave",K="onMouseEnter",H="mouse",(i==="pointerout"||i==="pointerover")&&(ye=ip,ie="onPointerLeave",K="onPointerEnter",H="pointer"),Be=W==null?fe:sl(W),Z=X==null?fe:sl(X),fe=new ye(ie,H+"leave",W,a,ee),fe.target=Be,fe.relatedTarget=Z,ie=null,nr(ee)===G&&(ye=new ye(K,H+"enter",X,a,ee),ye.target=Z,ye.relatedTarget=Be,ie=ye),Be=ie,ye=W&&X?R(W,X,s5):null,W!==null&&Qm(se,fe,W,ye,!1),X!==null&&Be!==null&&Qm(se,Be,X,ye,!0)))}e:{if(W=G?sl(G):window,X=W.nodeName&&W.nodeName.toLowerCase(),X==="select"||X==="input"&&W.type==="file")var ve=hp;else if(op(W))if(up)ve=l4;else{ve=r4;var qe=n4}else X=W.nodeName,!X||X.toLowerCase()!=="input"||W.type!=="checkbox"&&W.type!=="radio"?G&&cu(G.elementType)&&(ve=hp):ve=a4;if(ve&&(ve=ve(i,G))){cp(se,ve,a,ee);break e}qe&&qe(i,W,G)}switch(qe=G?sl(G):window,i){case"focusin":(op(qe)||qe.contentEditable==="true")&&(Xr=qe,Cu=G,dl=null);break;case"focusout":dl=Cu=Xr=null;break;case"mousedown":ku=!0;break;case"contextmenu":case"mouseup":case"dragend":ku=!1,yp(se,a,ee);break;case"selectionchange":if(c4)break;case"keydown":case"keyup":yp(se,a,ee)}var Se;if(yu)e:{switch(i){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else Zr?ap(i,a)&&(Me="onCompositionEnd"):i==="keydown"&&a.keyCode===229&&(Me="onCompositionStart");Me&&(sp&&a.locale!=="ko"&&(Zr||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&Zr&&(Se=Q1()):(pn=ee,pu="value"in pn?pn.value:pn.textContent,Zr=!0)),qe=Fc(G,Me),0<qe.length&&(Me=new tp(Me,i,null,a,ee),se.push({event:Me,listeners:qe}),Se?Me.data=Se:(Se=lp(a),Se!==null&&(Me.data=Se)))),(Se=Jw?e4(i,a):t4(i,a))&&(Me=Fc(G,"onBeforeInput"),0<Me.length&&(qe=new tp("onBeforeInput","beforeinput",null,a,ee),se.push({event:qe,listeners:Me}),qe.data=Se)),J4(se,i,G,a,ee)}Zm(se,s)})}function zl(i,s,a){return{instance:i,listener:s,currentTarget:a}}function Fc(i,s){for(var a=s+"Capture",o=[];i!==null;){var u=i,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=nl(i,a),u!=null&&o.unshift(zl(i,u,f)),u=nl(i,s),u!=null&&o.push(zl(i,u,f))),i.tag===3)return o;i=i.return}return[]}function s5(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function Qm(i,s,a,o,u){for(var f=s._reactName,y=[];a!==null&&a!==o;){var C=a,T=C.alternate,G=C.stateNode;if(C=C.tag,T!==null&&T===o)break;C!==5&&C!==26&&C!==27||G===null||(T=G,u?(G=nl(a,f),G!=null&&y.unshift(zl(a,G,T))):u||(G=nl(a,f),G!=null&&y.push(zl(a,G,T)))),a=a.return}y.length!==0&&i.push({event:s,listeners:y})}var n5=/\r\n?/g,r5=/\u0000|\uFFFD/g;function Jm(i){return(typeof i=="string"?i:""+i).replace(n5,`+`).replace(r5,"")}function ev(i,s){return s=Jm(s),Jm(i)===s}function Je(i,s,a,o,u,f){switch(a){case"children":if(typeof o=="string")s==="body"||s==="textarea"&&o===""||Kr(i,o);else if(typeof o=="number"||typeof o=="bigint")s!=="body"&&Kr(i,""+o);else return;break;case"className":Io(i,"class",o);break;case"tabIndex":Io(i,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Io(i,a,o);break;case"style":G1(i,o,f);return;case"data":if(s!=="object"){Io(i,"data",o);break}case"src":case"href":if(o===""&&(s!=="a"||a!=="href")){i.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){i.removeAttribute(a);break}o=Uo(o),i.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){i.setAttribute(a,"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}else typeof f=="function"&&(a==="formAction"?(s!=="input"&&Je(i,s,"name",u.name,u,null),Je(i,s,"formEncType",u.formEncType,u,null),Je(i,s,"formMethod",u.formMethod,u,null),Je(i,s,"formTarget",u.formTarget,u,null)):(Je(i,s,"encType",u.encType,u,null),Je(i,s,"method",u.method,u,null),Je(i,s,"target",u.target,u,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){i.removeAttribute(a);break}o=Uo(o),i.setAttribute(a,o);break;case"onClick":o!=null&&(i.onclick=gs);return;case"onScroll":o!=null&&Ue("scroll",i);return;case"onScrollEnd":o!=null&&Ue("scrollend",i);return;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(r(60));f?.__html!==a&&(i.innerHTML=a)}}break;case"multiple":i.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":i.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){i.removeAttribute("xlink:href");break}a=Uo(o),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?i.setAttribute(a,o):i.removeAttribute(a);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":o&&typeof o!="function"&&typeof o!="symbol"?i.setAttribute(a,""):i.removeAttribute(a);break;case"capture":case"download":o===!0?i.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?i.setAttribute(a,o):i.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?i.setAttribute(a,o):i.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?i.removeAttribute(a):i.setAttribute(a,o);break;case"popover":Ue("beforetoggle",i),Ue("toggle",i),Ho(i,"popover",o);break;case"xlinkActuate":zs(i,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":zs(i,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":zs(i,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":zs(i,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":zs(i,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":zs(i,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":zs(i,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":zs(i,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":zs(i,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Ho(i,"is",o);break;case"innerText":case"textContent":return;default:if(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")a=Cw.get(a)||a,Ho(i,a,o);else return}We=!0}function l0(i,s,a,o,u,f){switch(a){case"style":G1(i,o,f);return;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(r(60));f?.__html!==a&&(i.innerHTML=a)}}break;case"children":if(typeof o=="string")Kr(i,o);else if(typeof o=="number"||typeof o=="bigint")Kr(i,""+o);else return;break;case"onScroll":o!=null&&Ue("scroll",i);return;case"onScrollEnd":o!=null&&Ue("scrollend",i);return;case"onClick":o!=null&&(i.onclick=gs);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!I1.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(u=a.endsWith("Capture"),f=a.slice(2,u?a.length-7:void 0),s=i[mi]||null,s=s!=null?s[a]:null,typeof s=="function"&&i.removeEventListener(f,s,u),typeof o=="function")){typeof s!="function"&&s!==null&&(a in i?i[a]=null:i.hasAttribute(a)&&i.removeAttribute(a)),i.addEventListener(f,o,u);break e}We=!0,a in i?i[a]=o:o===!0?i.setAttribute(a,""):Ho(i,a,o)}return}We=!0}function Xt(i,s,a){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ue("error",i),Ue("load",i);var o=!1,u=!1,f;for(f in a)if(a.hasOwnProperty(f)){var y=a[f];if(y!=null)switch(f){case"src":o=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:Je(i,s,f,y,a,null)}}u&&Je(i,s,"srcSet",a.srcSet,a,null),o&&Je(i,s,"src",a.src,a,null);return;case"input":Ue("invalid",i);var C=f=y=u=null,T=null,G=null;for(o in a)if(a.hasOwnProperty(o)){var ee=a[o];if(ee!=null)switch(o){case"name":u=ee;break;case"type":y=ee;break;case"checked":T=ee;break;case"defaultChecked":G=ee;break;case"value":f=ee;break;case"defaultValue":C=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(r(137,s));break;default:Je(i,s,o,ee,a,null)}}W1(i,f,C,T,G,y,u,!1);return;case"select":Ue("invalid",i),o=y=f=null;for(u in a)if(a.hasOwnProperty(u)&&(C=a[u],C!=null))switch(u){case"value":f=C;break;case"defaultValue":y=C;break;case"multiple":o=C;default:Je(i,s,u,C,a,null)}s=f,a=y,i.multiple=!!o,s!=null?Fr(i,!!o,s,!1):a!=null&&Fr(i,!!o,a,!0);return;case"textarea":Ue("invalid",i),f=u=o=null;for(y in a)if(a.hasOwnProperty(y)&&(C=a[y],C!=null))switch(y){case"value":o=C;break;case"defaultValue":u=C;break;case"children":f=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(r(91));break;default:Je(i,s,y,C,a,null)}K1(i,o,u,f);return;case"option":for(T in a)a.hasOwnProperty(T)&&(o=a[T],o!=null)&&(T==="selected"?i.selected=o&&typeof o!="function"&&typeof o!="symbol":Je(i,s,T,o,a,null));return;case"dialog":Ue("beforetoggle",i),Ue("toggle",i),Ue("cancel",i),Ue("close",i);break;case"iframe":case"object":Ue("load",i);break;case"video":case"audio":for(o=0;o<Ol.length;o++)Ue(Ol[o],i);break;case"image":Ue("error",i),Ue("load",i);break;case"details":Ue("toggle",i);break;case"embed":case"source":case"link":Ue("error",i),Ue("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(G in a)if(a.hasOwnProperty(G)&&(o=a[G],o!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:Je(i,s,G,o,a,null)}return;default:if(cu(s)){for(ee in a)a.hasOwnProperty(ee)&&(o=a[ee],o!==void 0&&l0(i,s,ee,o,a,void 0));return}}for(C in a)a.hasOwnProperty(C)&&(o=a[C],o!=null&&Je(i,s,C,o,a,null))}var a5={};function l5(i,s,a,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,f=null,y=null,C=null,T=null,G=null,ee=null;for(X in a){var se=a[X];if(a.hasOwnProperty(X)&&se!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":T=se;default:o.hasOwnProperty(X)||Je(i,s,X,null,o,se)}}for(var W in o){var X=o[W];if(se=a[W],o.hasOwnProperty(W)&&(X!=null||se!=null))switch(W){case"type":X!==se&&(We=!0),f=X;break;case"name":X!==se&&(We=!0),u=X;break;case"checked":X!==se&&(We=!0),G=X;break;case"defaultChecked":X!==se&&(We=!0),ee=X;break;case"value":X!==se&&(We=!0),y=X;break;case"defaultValue":X!==se&&(We=!0),C=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,s));break;default:X!==se&&Je(i,s,W,X,o,se)}}lu(i,y,C,T,G,ee,f,u);return;case"select":X=y=C=W=null;for(f in a)if(T=a[f],a.hasOwnProperty(f)&&T!=null)switch(f){case"value":break;case"multiple":X=T;default:o.hasOwnProperty(f)||Je(i,s,f,null,o,T)}for(u in o)if(f=o[u],T=a[u],o.hasOwnProperty(u)&&(f!=null||T!=null))switch(u){case"value":f!==T&&(We=!0),W=f;break;case"defaultValue":f!==T&&(We=!0),C=f;break;case"multiple":f!==T&&(We=!0),y=f;default:f!==T&&Je(i,s,u,f,o,T)}s=C,a=y,o=X,W!=null?Fr(i,!!a,W,!1):!!o!=!!a&&(s!=null?Fr(i,!!a,s,!0):Fr(i,!!a,a?[]:"",!1));return;case"textarea":X=W=null;for(C in a)if(u=a[C],a.hasOwnProperty(C)&&u!=null&&!o.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:Je(i,s,C,null,o,u)}for(y in o)if(u=o[y],f=a[y],o.hasOwnProperty(y)&&(u!=null||f!=null))switch(y){case"value":u!==f&&(We=!0),W=u;break;case"defaultValue":u!==f&&(We=!0),X=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(r(91));break;default:u!==f&&Je(i,s,y,u,o,f)}F1(i,W,X);return;case"option":for(var fe in a)W=a[fe],a.hasOwnProperty(fe)&&W!=null&&!o.hasOwnProperty(fe)&&(fe==="selected"?i.selected=!1:Je(i,s,fe,null,o,W));for(T in o)W=o[T],X=a[T],o.hasOwnProperty(T)&&W!==X&&(W!=null||X!=null)&&(T==="selected"?(W!==X&&(We=!0),i.selected=W&&typeof W!="function"&&typeof W!="symbol"):Je(i,s,T,W,o,X));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 ye in a)W=a[ye],a.hasOwnProperty(ye)&&W!=null&&!o.hasOwnProperty(ye)&&Je(i,s,ye,null,o,W);for(G in o)if(W=o[G],X=a[G],o.hasOwnProperty(G)&&W!==X&&(W!=null||X!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(r(137,s));break;default:Je(i,s,G,W,o,X)}return;default:if(cu(s)){for(var Be in a)W=a[Be],a.hasOwnProperty(Be)&&W!==void 0&&!o.hasOwnProperty(Be)&&l0(i,s,Be,void 0,o,W);for(ee in o)W=o[ee],X=a[ee],!o.hasOwnProperty(ee)||W===X||W===void 0&&X===void 0||l0(i,s,ee,W,o,X);return}}for(var K in a)W=a[K],a.hasOwnProperty(K)&&W!=null&&!o.hasOwnProperty(K)&&Je(i,s,K,null,o,W);for(se in o)W=o[se],X=a[se],!o.hasOwnProperty(se)||W===X||W==null&&X==null||Je(i,s,se,W,o,X)}function tv(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function o5(){if(typeof performance.getEntriesByType=="function"){for(var i=0,s=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var u=a[o],f=u.transferSize,y=u.initiatorType,C=u.duration;if(f&&C&&tv(y)){for(y=0,C=u.responseEnd,o+=1;o<a.length;o++){var T=a[o],G=T.startTime;if(G>C)break;var ee=T.transferSize,se=T.initiatorType;ee&&tv(se)&&(T=T.responseEnd,y+=ee*(T<C?1:(C-G)/(T-G)))}if(--o,s+=8*(f+y)/(u.duration/1e3),i++,10<i)break}}if(0<i)return s/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var o0=null,c0=null;function Hl(i){return i.nodeType===9?i:i.ownerDocument}function iv(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function sv(i,s){if(i===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&s==="foreignObject"?0:i}function nv(i,s,a,o){return a=Hl(a).createElement(i),a[Ft]=o,a[mi]=s,Xt(a,i,s),Ot(a),a}function h0(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var u0=null;function c5(){var i=window.event;return i&&i.type==="popstate"?i===u0?!1:(u0=i,!0):(u0=null,!1)}var d0=typeof setTimeout=="function"?setTimeout:void 0,h5=typeof clearTimeout=="function"?clearTimeout:void 0,rv=typeof Promise=="function"?Promise:void 0,av=typeof requestAnimationFrame=="function"?requestAnimationFrame:d0,u5=typeof queueMicrotask=="function"?queueMicrotask:typeof rv<"u"?function(i){return rv.resolve(null).then(i).catch(d5)}:d0;function d5(i){setTimeout(function(){throw i})}function Ln(i){return i==="head"}function lv(i,s){var a=s,o=0;do{var u=a.nextSibling;if(i.removeChild(a),u&&u.nodeType===8)if(a=u.data,a==="/$"||a==="/&"){if(o===0){i.removeChild(u),Da(s);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")S0(i.ownerDocument.documentElement);else if(a==="head"){a=i.ownerDocument.head,S0(a);for(var f=a.firstChild;f;){var y=f.nextSibling,C=f.nodeName;f[il]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&f.rel.toLowerCase()==="stylesheet"||a.removeChild(f),f=y}}else a==="body"&&S0(i.ownerDocument.body);a=u}while(a);Da(s)}function ov(i,s){var a=i;i=0;do{var o=a.nextSibling;if(a.nodeType===1?s?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(s?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(i===0)break;i--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||i++;a=o}while(a)}function cv(i,s,a){if(s=CSS.escape(s)!==s?"r-"+btoa(s).replace(/=/g,""):s,i.style.viewTransitionName=s,a!=null&&(i.style.viewTransitionClass=a),a=getComputedStyle(i),a.display==="inline"){if(s=i.getClientRects(),s.length===1)var o=1;else for(var u=o=0;u<s.length;u++){var f=s[u];0<f.width&&0<f.height&&o++}o===1&&(i=i.style,i.display=s.length===1?"inline-block":"block",i.marginTop="-"+a.paddingTop,i.marginBottom="-"+a.paddingBottom)}}function hv(i,s){i=i.style,s=s.style;var a=s!=null?s.hasOwnProperty("viewTransitionName")?s.viewTransitionName:s.hasOwnProperty("view-transition-name")?s["view-transition-name"]:null:null;i.viewTransitionName=a==null||typeof a=="boolean"?"":(""+a).trim(),a=s!=null?s.hasOwnProperty("viewTransitionClass")?s.viewTransitionClass:s.hasOwnProperty("view-transition-class")?s["view-transition-class"]:null:null,i.viewTransitionClass=a==null||typeof a=="boolean"?"":(""+a).trim(),i.display==="inline-block"&&(s==null?i.display=i.margin="":(a=s.display,i.display=a==null||typeof a=="boolean"?"":a,a=s.margin,a!=null?i.margin=a:(a=s.hasOwnProperty("marginTop")?s.marginTop:s["margin-top"],i.marginTop=a==null||typeof a=="boolean"?"":a,s=s.hasOwnProperty("marginBottom")?s.marginBottom:s["margin-bottom"],i.marginBottom=s==null||typeof s=="boolean"?"":s)))}function f5(i,s,a){return a=a.ownerDocument.defaultView,{rect:i,abs:s.position==="absolute"||s.position==="fixed",clip:s.clipPath!=="none"||s.overflow!=="visible"||s.filter!=="none"||s.mask!=="none"||s.mask!=="none"||s.borderRadius!=="0px",view:0<=i.bottom&&0<=i.right&&i.top<=a.innerHeight&&i.left<=a.innerWidth}}function f0(i){var s=i.getBoundingClientRect(),a=getComputedStyle(i);return f5(s,a,i)}function p5(i){return i.documentElement.clientHeight}function g5(i){this.addEventListener("load",i),this.addEventListener("error",i)}function m5(i,s,a,o,u,f,y,C,T){var G=s.nodeType===9?s:s.ownerDocument;try{var ee=G.startViewTransition({update:function(){var W=G.defaultView,X=W.navigation&&W.navigation.transition,fe=G.fonts.status;o();var ye=[];if(fe==="loaded"&&(p5(G),G.fonts.status==="loading"&&ye.push(G.fonts.ready)),fe=ye.length,i!==null)for(var Be=i.suspenseyImages,K=0,H=0;H<Be.length;H++){var Z=Be[H];if(!Z.complete){var ie=Z.getBoundingClientRect();if(0<ie.bottom&&0<ie.right&&ie.top<W.innerHeight&&ie.left<W.innerWidth){if(K+=Rv(Z),K>Gc){ye.length=fe;break}Z=new Promise(g5.bind(Z)),ye.push(Z)}}}if(0<ye.length)return W=Promise.race([Promise.all(ye),new Promise(function(ve){return setTimeout(ve,500)})]).then(u,u),(X?Promise.allSettled([X.finished,W]):W).then(f,f);if(u(),X)return X.finished.then(f,f);f()},types:a});G.__reactViewTransition=ee;var se=[];return ee.ready.then(function(){for(var W=G.documentElement.getAnimations({subtree:!0}),X=0;X<W.length;X++){var fe=W[X],ye=fe.effect,Be=ye.pseudoElement;if(Be!=null&&Be.startsWith("::view-transition")){se.push(fe),fe=ye.getKeyframes();for(var K=Be=void 0,H=!0,Z=0;Z<fe.length;Z++){var ie=fe[Z],ve=ie.width;if(Be===void 0)Be=ve;else if(Be!==ve){H=!1;break}if(ve=ie.height,K===void 0)K=ve;else if(K!==ve){H=!1;break}delete ie.width,delete ie.height,ie.transform==="none"&&delete ie.transform}H&&Be!==void 0&&K!==void 0&&(ye.setKeyframes(fe),H=getComputedStyle(ye.target,ye.pseudoElement),H.width!==Be||H.height!==K)&&(H=fe[0],H.width=Be,H.height=K,H=fe[fe.length-1],H.width=Be,H.height=K,ye.setKeyframes(fe))}}y()},function(W){G.__reactViewTransition===ee&&(G.__reactViewTransition=null);try{typeof W=="object"&&W!==null&&W.name==="InvalidStateError"&&(W.message==="View transition was skipped because document visibility state is hidden."||W.message==="Skipping view transition because document visibility state has become hidden."||W.message==="Skipping view transition because viewport size changed."||W.message==="Transition was aborted because of invalid state")&&(W=null),W!==null&&T(W)}finally{o(),u(),y()}}),ee.finished.finally(function(){for(var W=0;W<se.length;W++)se[W].cancel();G.__reactViewTransition===ee&&(G.__reactViewTransition=null),C()}),ee}catch{return o(),u(),y(),null}}function kr(i,s){this._scope=document.documentElement,this._selector="::view-transition-"+i+"("+s+")"}kr.prototype.animate=function(i,s){return s=typeof s=="number"?{duration:s}:I({},s),s.pseudoElement=this._selector,this._scope.animate(i,s)},kr.prototype.getAnimations=function(){for(var i=this._scope,s=this._selector,a=i.getAnimations({subtree:!0}),o=[],u=0;u<a.length;u++){var f=a[u].effect;f!==null&&f.target===i&&f.pseudoElement===s&&o.push(a[u])}return o},kr.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function uv(i){return{name:i,group:new kr("group",i),imagePair:new kr("image-pair",i),old:new kr("old",i),new:new kr("new",i)}}function Oi(i){this._fragmentFiber=i,this._observers=this._eventListeners=null}Oi.prototype.addEventListener=function(i,s,a){var o=null,u=null;if(!(a!=null&&typeof a!="boolean"&&(o=a.signal||null,o!==null&&o.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var f=this._eventListeners;if(fv(f,i,s,a)===-1){var y=this,C=s;a!=null&&typeof a!="boolean"&&a.once===!0&&(C=function(T){y.removeEventListener(i,s,a),typeof s=="function"?s.call(this,T):s.handleEvent(T)}),o!==null&&(u=y.removeEventListener.bind(y,i,s,a),o.addEventListener("abort",u,{once:!0}),u=o.removeEventListener.bind(o,"abort",u)),o=Ca(a),f.push({type:i,listener:s,optionsOrUseCapture:a,attachedListener:C,cleanup:u}),_(this._fragmentFiber.child,!1,v5,i,C,o)}this._eventListeners=f}};function v5(i,s,a,o){return E(i).addEventListener(s,a,o),!1}Oi.prototype.removeEventListener=function(i,s,a){var o=this._eventListeners;if(o!==null&&(s=fv(o,i,s,a),s!==-1)){var u=o[s];a=u.attachedListener;var f=u.cleanup;u=Ca(u.optionsOrUseCapture),_(this._fragmentFiber.child,!1,_5,i,a,u),o.splice(s,1),f!==null&&f()}};function _5(i,s,a,o){return E(i).removeEventListener(s,a,o),!1}function Ca(i){return i!=null&&typeof i!="boolean"&&(i.once===!0||i.signal instanceof AbortSignal)?{capture:i.capture,passive:i.passive}:i}function dv(i){return i==null?"c=0":typeof i=="boolean"?"c="+(i?"1":"0"):"c="+(i.capture?"1":"0")}function fv(i,s,a,o){if(i.length===0)return-1;o=dv(o);for(var u=0;u<i.length;u++){var f=i[u];if(f.type===s&&f.listener===a&&dv(f.optionsOrUseCapture)===o)return u}return-1}Oi.prototype.dispatchEvent=function(i){var s=S(this._fragmentFiber);if(s===null)return!0;s=E(s);var a=this._eventListeners;if(a!==null&&0<a.length||!i.bubbles){var o=s.nodeType===9?s.createComment(""):document.createTextNode("");if(a)for(var u=0;u<a.length;u++){var f=a[u];o.addEventListener(f.type,f.attachedListener,Ca(f.optionsOrUseCapture))}if(s.appendChild(o),i=o.dispatchEvent(i),a)for(u=0;u<a.length;u++)f=a[u],o.removeEventListener(f.type,f.attachedListener,Ca(f.optionsOrUseCapture));return s.removeChild(o),i}return s.dispatchEvent(i)},Oi.prototype.focus=function(i){_(this._fragmentFiber.child,!0,pv,i,void 0,void 0)};function pv(i,s){return i.tag===6?!1:(i=E(i),D5(i,s))}Oi.prototype.focusLast=function(i){var s=[];_(this._fragmentFiber.child,!0,p0,s,void 0,void 0);for(var a=s.length-1;0<=a&&!pv(s[a],i);a--);};function p0(i,s){return s.push(i),!1}Oi.prototype.blur=function(){var i=S(this._fragmentFiber);i!==null&&(i=E(i),i=Hl(i).activeElement,i!==null&&_(this._fragmentFiber.child,!1,y5,i,void 0,void 0))};function y5(i,s){return i.tag===6?!1:(i=E(i),i===s||i.contains(s)?(s.blur(),!0):!1)}Oi.prototype.observeUsing=function(i){this._observers===null&&(this._observers=new Set),this._observers.add(i),_(this._fragmentFiber.child,!1,S5,i,void 0,void 0)};function S5(i,s){return i.tag===6||(i=E(i),s.observe(i)),!1}Oi.prototype.unobserveUsing=function(i){var s=this._observers;if(s!==null&&s.has(i)){s.delete(i),_(this._fragmentFiber.child,!1,x5,i,void 0,void 0);for(var a=s=0;a<fs.length;a++){var o=fs[a];o.fragmentInstance===this&&o.observer===i?i.unobserve(o.instance):fs[s++]=o}fs.length=s}};function x5(i,s){return i.tag===6||(i=E(i),s.unobserve(i)),!1}var fs=[],g0=!1;function w5(i,s,a){fs.push({fragmentInstance:i,observer:s,instance:a}),g0||(g0=!0,R5(function(){g0=!1;var o=fs;fs=[];for(var u=0;u<o.length;u++){var f=o[u];f.observer.unobserve(f.instance)}}))}Oi.prototype.getClientRects=function(){var i=[];return _(this._fragmentFiber.child,!1,b5,i,void 0,void 0),i};function b5(i,s){if(i.tag===6){i=i.stateNode;var a=i.ownerDocument.createRange();a.selectNodeContents(i),s.push.apply(s,a.getClientRects())}else i=E(i),s.push.apply(s,i.getClientRects());return!1}Oi.prototype.getRootNode=function(i){var s=S(this._fragmentFiber);return s===null?this:E(s).getRootNode(i)},Oi.prototype.compareDocumentPosition=function(i){var s=S(this._fragmentFiber);if(s===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var a=[];_(this._fragmentFiber.child,!1,p0,a,void 0,void 0);var o=E(s);if(a.length===0){if(a=o,w(this._fragmentFiber)){e:{for(s=this._fragmentFiber.return;s!==null;){if(s.tag===4){s=s.stateNode.containerInfo;break e}if(s.tag===3||s.tag===5||s.tag===27)break;s=s.return}s=null}s!=null&&(a=s)}s=this._fragmentFiber;var u=o=a.compareDocumentPosition(i);return a===i?u=Node.DOCUMENT_POSITION_CONTAINS:o&Node.DOCUMENT_POSITION_CONTAINED_BY&&(a=b(s)[1],a===null?u=Node.DOCUMENT_POSITION_PRECEDING:(i=E(a).compareDocumentPosition(i),u=i===0||i&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),u|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}s=E(a[0]),u=E(a[a.length-1]);var f=w(this._fragmentFiber)?s.parentElement:o;if(f==null)return Node.DOCUMENT_POSITION_DISCONNECTED;o=f.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_CONTAINED_BY,f=f.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_CONTAINED_BY;var y=s.compareDocumentPosition(i),C=u.compareDocumentPosition(i),T=y&Node.DOCUMENT_POSITION_CONTAINED_BY||C&Node.DOCUMENT_POSITION_CONTAINED_BY;return C=o&&f&&y&Node.DOCUMENT_POSITION_FOLLOWING&&C&Node.DOCUMENT_POSITION_PRECEDING,s=o&&s===i||f&&u===i||T||C?Node.DOCUMENT_POSITION_CONTAINED_BY:!o&&s===i||!f&&u===i?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:y,s&Node.DOCUMENT_POSITION_DISCONNECTED||s&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||C5(s,this._fragmentFiber,a[0],a[a.length-1],i)?s:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function C5(i,s,a,o,u){var f=nr(u);if(i&Node.DOCUMENT_POSITION_CONTAINED_BY){if(a=!!f)e:{for(;f!==null;){if(f.tag===7&&(f===s||f.alternate===s)){a=!0;break e}f=f.return}a=!1}return a}if(i&Node.DOCUMENT_POSITION_CONTAINS){if(f===null)return f=u.ownerDocument,u===f||u===f.documentElement||u===f.body;e:{for(f=s,s=S(s);f!==null;){if(!(f.tag!==5&&f.tag!==3&&f.tag!==27||f!==s&&f.alternate!==s)){f=!0;break e}f=f.return}f=!1}return f}return i&Node.DOCUMENT_POSITION_PRECEDING?((s=!!f)&&!(s=f===a)&&(s=R(a,f,F),s===null?s=!1:(_(s,!0,A,f,a),f=j,j=null,s=f!==null)),s):i&Node.DOCUMENT_POSITION_FOLLOWING?((s=!!f)&&!(s=f===o)&&(s=R(o,f,F),s===null?s=!1:(_(s,!0,z,f,o),f=j,V=j=null,s=f!==null)),s):!1}function gv(i,s){var a=i.ownerDocument.createRange();a.selectNodeContents(i),i=a.getBoundingClientRect(),window.scrollTo(window.scrollX+i.left,s?window.scrollY+i.top:window.scrollY+i.bottom-window.innerHeight)}Oi.prototype.scrollIntoView=function(i){if(typeof i=="object")throw Error(r(566));var s=[];_(this._fragmentFiber.child,!1,p0,s,void 0,void 0);var a=i!==!1;if(s.length===0){var o=b(this._fragmentFiber);if(o=a?o[1]||o[0]||S(this._fragmentFiber):o[0]||o[1],o===null)return;if(o.tag===6){i=E(o),gv(i,a);return}if(o=E(o),o.nodeType!==9){if(o.nodeType===11){a="host"in o?o.host:null,a!==null&&a.scrollIntoView(i);return}o.scrollIntoView(i)}}for(o=a?s.length-1:0;o!==(a?-1:s.length);){var u=s[o];u.tag===6?(u=E(u),gv(u,a)):E(u).scrollIntoView(i),o+=a?-1:1}};function k5(i,s){return i=E(i),mv(i,s),!1}function mv(i,s){i.reactFragments==null&&(i.reactFragments=new Set),i.reactFragments.add(s)}function vv(i,s){var a=s._eventListeners;if(a!==null)for(var o=0;o<a.length;o++){var u=a[o];i.addEventListener(u.type,u.attachedListener,Ca(u.optionsOrUseCapture))}i.nodeType!==3&&(a=s._observers,a!==null&&a.forEach(function(f){for(var y=0,C=0;C<fs.length;C++){var T=fs[C];(T.fragmentInstance!==s||T.observer!==f||T.instance!==i)&&(fs[y++]=T)}fs.length=y,f.observe(i)}),mv(i,s))}function E5(i,s){var a=s._eventListeners;if(a!==null)for(var o=0;o<a.length;o++){var u=a[o];i.removeEventListener(u.type,u.attachedListener,Ca(u.optionsOrUseCapture))}i.nodeType!==3&&(a=s._observers,a!==null&&a.forEach(function(f){typeof f.rootMargin=="string"?w5(s,f,i):f.unobserve(i)}),i.reactFragments!=null&&i.reactFragments.delete(s))}function m0(i){var s=i.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var a=s;switch(s=s.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":m0(a),zo(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}i.removeChild(a)}}function M5(i,s,a,o){for(;i.nodeType===1;){var u=a;if(i.nodeName.toLowerCase()!==s.toLowerCase()){if(!o&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(o){if(!i[il])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(f=i.getAttribute("rel"),f==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(f!==u.rel||i.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||i.getAttribute("title")!==(u.title==null?null:u.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(f=i.getAttribute("src"),(f!==(u.src==null?null:u.src)||i.getAttribute("type")!==(u.type==null?null:u.type)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&f&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var f=u.name==null?null:""+u.name;if(u.type==="hidden"&&i.getAttribute("name")===f)return i}else return i;if(i=Yi(i.nextSibling),i===null)break}return null}function j5(i,s,a){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=Yi(i.nextSibling),i===null))return null;return i}function _v(i,s){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!s||(i=Yi(i.nextSibling),i===null))return null;return i}function v0(i){return i.data==="$?"||i.data==="$~"}function _0(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function T5(i,s){var a=i.ownerDocument;if(i.data==="$~")i._reactRetry=s;else if(i.data!=="$?"||a.readyState!=="loading")s();else{var o=function(){s(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),i._reactRetry=o}}function Yi(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return i}var y0=null;function yv(i){i=i.nextSibling;for(var s=0;i;){if(i.nodeType===8){var a=i.data;if(a==="/$"||a==="/&"){if(s===0)return Yi(i.nextSibling);s--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||s++}i=i.nextSibling}return null}function Sv(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var a=i.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(s===0)return i;s--}else a!=="/$"&&a!=="/&"||s++}i=i.previousSibling}return null}function D5(i,s){function a(){o=!0}if(i.ownerDocument.activeElement===i)return!0;var o=!1;try{i.ownerDocument.addEventListener("focus",a,!0),(i.focus||HTMLElement.prototype.focus).call(i,s)}finally{i.ownerDocument.removeEventListener("focus",a,!0)}return o}function R5(i){av(function(){av(function(s){return i(s)})})}function xv(i,s,a){switch(s=Hl(a),i){case"html":if(i=s.documentElement,!i)throw Error(r(452));return i;case"head":if(i=s.head,!i)throw Error(r(453));return i;case"body":if(i=s.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function wv(i,s,a){for(var o in a){var u=a[o];a.hasOwnProperty(o)&&u!=null&&Je(i,s,o,null,a5,u)}a.dangerouslySetInnerHTML!=null&&(i.textContent=""),i.onclick===gs&&(i.onclick=null),zo(i)}function S0(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);zo(i)}var Gi=new Map,bv=new Set;function Il(i){if(typeof i.getRootNode=="function"){var s=i.getRootNode();if(s.nodeType===9||s.nodeType===11)return s}return i.nodeType===9?i:i.ownerDocument}var Zs=_e.d;_e.d={f:A5,r:N5,D:L5,C:B5,L:O5,m:z5,X:I5,S:H5,M:U5};function A5(){var i=Zs.f(),s=Uc();return i||s}function N5(i){var s=Vr(i);s!==null&&s.tag===5&&s.type==="form"?kg(s):Zs.r(i)}var ka=typeof document>"u"?null:document;function Cv(i,s,a){var o=ka;if(o&&typeof s=="string"&&s){var u=Pi(s);u='link[rel="'+i+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),bv.has(u)||(bv.add(u),i={rel:i,crossOrigin:a,href:s},o.querySelector(u)===null&&(s=o.createElement("link"),Xt(s,"link",i),Ot(s),o.head.appendChild(s)))}}function L5(i){Zs.D(i),Cv("dns-prefetch",i,null)}function B5(i,s){Zs.C(i,s),Cv("preconnect",i,s)}function O5(i,s,a){Zs.L(i,s,a);var o=ka;if(o&&i&&s){var u='link[rel="preload"][as="'+Pi(s)+'"]';s==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+Pi(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+Pi(a.imageSizes)+'"]')):u+='[href="'+Pi(i)+'"]';var f=u;switch(s){case"style":f=Ea(i);break;case"script":f=Ma(i)}if(!(Gi.has(f)||(i=I({rel:"preload",href:s==="image"&&a&&a.imageSrcSet?void 0:i,as:s},a),Gi.set(f,i),o.querySelector(u)!==null||s==="style"&&o.querySelector(Ul(f))||s==="script"&&o.querySelector(Pl(f))))){var y=o.createElement("link");Xt(y,"link",i),s==="style"&&(y[Oo]=!0,y.onload=y.onerror=function(){z1(y)}),Ot(y),o.head.appendChild(y)}}}function z5(i,s){Zs.m(i,s);var a=ka;if(a&&i){var o=s&&typeof s.as=="string"?s.as:"script",u='link[rel="modulepreload"][as="'+Pi(o)+'"][href="'+Pi(i)+'"]',f=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Ma(i)}if(!Gi.has(f)&&(i=I({rel:"modulepreload",href:i},s),Gi.set(f,i),a.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Pl(f)))return}o=a.createElement("link"),Xt(o,"link",i),Ot(o),a.head.appendChild(o)}}}function H5(i,s,a){Zs.S(i,s,a);var o=ka;if(o&&i){var u=$r(o).hoistableStyles,f=Ea(i);s=s||"default";var y=u.get(f);if(!y){var C={loading:0,preload:null};if(y=o.querySelector(Ul(f)))C.loading=5;else{i=I({rel:"stylesheet",href:i,"data-precedence":s},a),(a=Gi.get(f))&&x0(i,a);var T=y=o.createElement("link");Ot(T),Xt(T,"link",i),T._p=new Promise(function(G,ee){T.onload=G,T.onerror=ee}),T.addEventListener("load",function(){C.loading|=1}),T.addEventListener("error",function(){C.loading|=2}),C.loading|=4,Kc(y,s,o)}y={type:"stylesheet",instance:y,count:1,state:C},u.set(f,y)}}}function I5(i,s){Zs.X(i,s);var a=ka;if(a&&i){var o=$r(a).hoistableScripts,u=Ma(i),f=o.get(u);f||(f=a.querySelector(Pl(u)),f||(i=I({src:i,async:!0},s),(s=Gi.get(u))&&w0(i,s),f=a.createElement("script"),Ot(f),Xt(f,"link",i),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(u,f))}}function U5(i,s){Zs.M(i,s);var a=ka;if(a&&i){var o=$r(a).hoistableScripts,u=Ma(i),f=o.get(u);f||(f=a.querySelector(Pl(u)),f||(i=I({src:i,async:!0,type:"module"},s),(s=Gi.get(u))&&w0(i,s),f=a.createElement("script"),Ot(f),Xt(f,"link",i),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(u,f))}}function kv(i,s,a,o){var u=(u=Ke.current)?Il(u):null;if(!u)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(a=Ea(a.href),s=$r(u).hoistableStyles,o=s.get(a),o||(o={type:"style",instance:null,count:0,state:null},s.set(a,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){i=Ea(a.href);var f=$r(u).hoistableStyles,y=f.get(i);if(y||(u=u.ownerDocument||u,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(i,y),(f=u.querySelector(Ul(i)))?f._p||(y.instance=f,y.state.loading=5):(f=Gi.get(i),f||(f={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Gi.set(i,f)),P5(u,i,f,y.state))),s&&o===null)throw Error(r(528,""));return y}if(s&&o!==null)throw Error(r(529,""));return null;case"script":return s=a.async,a=a.src,typeof a=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(a=Ma(a),s=$r(u).hoistableScripts,o=s.get(a),o||(o={type:"script",instance:null,count:0,state:null},s.set(a,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function Ea(i){return'href="'+Pi(i)+'"'}function Ul(i){return'link[rel="stylesheet"]['+i+"]"}function Ev(i){return I({},i,{"data-precedence":i.precedence,precedence:null})}function P5(i,s,a,o){if(s=i.querySelector('link[rel="preload"][as="style"]['+s+"]")){if(s[Oo]!==!0){o.loading=1;return}}else s=i.createElement("link"),s[Oo]=!0,s.onload=s.onerror=z1.bind(null,s),Xt(s,"link",a),Ot(s),i.head.appendChild(s);o.preload=s,s.addEventListener("load",function(){return o.loading|=1}),s.addEventListener("error",function(){return o.loading|=2})}function Ma(i){return'[src="'+Pi(i)+'"]'}function Pl(i){return"script[async]"+i}function Mv(i,s,a){if(s.count++,s.instance===null)switch(s.type){case"style":var o=i.querySelector('style[data-href~="'+Pi(a.href)+'"]');if(o)return s.instance=o,Ot(o),o;var u=I({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(i.ownerDocument||i).createElement("style"),Ot(o),Xt(o,"style",u),Kc(o,a.precedence,i),s.instance=o;case"stylesheet":u=Ea(a.href);var f=i.querySelector(Ul(u));if(f)return s.state.loading|=4,s.instance=f,Ot(f),f;o=Ev(a),(u=Gi.get(u))&&x0(o,u),f=(i.ownerDocument||i).createElement("link"),Ot(f);var y=f;return y._p=new Promise(function(C,T){y.onload=C,y.onerror=T}),Xt(f,"link",o),s.state.loading|=4,Kc(f,a.precedence,i),s.instance=f;case"script":return f=Ma(a.src),(u=i.querySelector(Pl(f)))?(s.instance=u,Ot(u),u):(o=a,(u=Gi.get(f))&&(o=I({},a),w0(o,u)),i=i.ownerDocument||i,u=i.createElement("script"),Ot(u),Xt(u,"link",o),i.head.appendChild(u),s.instance=u);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(o=s.instance,s.state.loading|=4,Kc(o,a.precedence,i));return s.instance}function Kc(i,s,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,f=u,y=0;y<o.length;y++){var C=o[y];if(C.dataset.precedence===s)f=C;else if(f!==u)break}f?f.parentNode.insertBefore(i,f.nextSibling):(s=a.nodeType===9?a.head:a,s.insertBefore(i,s.firstChild))}function x0(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function w0(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var Yc=null;function jv(i,s,a){if(Yc===null){var o=new Map,u=Yc=new Map;u.set(a,o)}else u=Yc,o=u.get(a),o||(o=new Map,u.set(a,o));if(o.has(i))return o;for(o.set(i,null),a=a.getElementsByTagName(i),u=0;u<a.length;u++){var f=a[u];if(!(f[il]||f[Ft]||i==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var y=f.getAttribute(s)||"";y=i+y;var C=o.get(y);C?C.push(f):o.set(y,[f])}}return o}function b0(i,s,a){i=i.ownerDocument||i,i.head.insertBefore(a,s==="title"?i.querySelector("head > title"):null)}function q5(i,s,a){if(a===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(i=s.disabled,typeof s.precedence=="string"&&i==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function Tv(i,s){return i==="img"&&s.src!=null&&s.src!==""&&s.onLoad==null&&s.loading!=="lazy"}function Dv(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function Rv(i){return(i.width||100)*(i.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Av(i,s){typeof s.decode=="function"&&(i.imgCount++,s.complete||(i.imgBytes+=Rv(s),i.suspenseyImages.push(s)),i=W5.bind(i),s.decode().then(i,i))}function V5(i,s,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=Ea(o.href),f=s.querySelector(Ul(u));if(f){s=f._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=ql.bind(i),s.then(i,i)),a.state.loading|=4,a.instance=f,Ot(f);return}f=s.ownerDocument||s,o=Ev(o),(u=Gi.get(u))&&x0(o,u),f=f.createElement("link"),Ot(f);var y=f;y._p=new Promise(function(C,T){y.onload=C,y.onerror=T}),Xt(f,"link",o),a.instance=f}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(a,s),(s=a.state.preload)&&(a.state.loading&3)===0&&(i.count++,a=ql.bind(i),s.addEventListener("load",a),s.addEventListener("error",a))}}var Gc=0;function $5(i,s){return i.stylesheets&&i.count===0&&Xc(i,i.stylesheets),0<i.count||0<i.imgCount?function(a){var o=setTimeout(function(){if(i.stylesheets&&Xc(i,i.stylesheets),i.unsuspend){var f=i.unsuspend;i.unsuspend=null,f()}},6e4+s);0<i.imgBytes&&Gc===0&&(Gc=62500*o5());var u=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Xc(i,i.stylesheets),i.unsuspend)){var f=i.unsuspend;i.unsuspend=null,f()}},(i.imgBytes>Gc?50:800)+s);return i.unsuspend=a,function(){i.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function Nv(i){if(i.count===0&&(i.imgCount===0||!i.waitingForImages)){if(i.stylesheets)Xc(i,i.stylesheets);else if(i.unsuspend){var s=i.unsuspend;i.unsuspend=null,s()}}}function ql(){this.count--,Nv(this)}function W5(){this.imgCount--,Nv(this)}var Zc=null;function Xc(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Zc=new Map,s.forEach(F5,i),Zc=null,ql.call(i))}function F5(i,s){if(!(s.state.loading&4)){var a=Zc.get(i);if(a)var o=a.get(null);else{a=new Map,Zc.set(i,a);for(var u=i.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var y=u[f];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(a.set(y.dataset.precedence,y),o=y)}o&&a.set(null,o)}u=s.instance,y=u.getAttribute("data-precedence"),f=a.get(y)||o,f===o&&a.set(null,u),a.set(y,u),this.count++,o=ql.bind(this),u.addEventListener("load",o),u.addEventListener("error",o),f?f.parentNode.insertBefore(u,f.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(u,i.firstChild)),s.state.loading|=4}}var ja={$$typeof:O,Provider:null,Consumer:null,_currentValue:Re,_currentValue2:Re,_threadCount:0};function K5(i,s,a,o,u,f,y,C,T){this.tag=1,this.containerInfo=i,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=su(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=su(0),this.hiddenUpdates=su(null),this.identifierPrefix=o,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.transitionTypes=null,this.incompleteTransitions=new Map}function Lv(i,s,a,o,u,f,y,C,T,G,ee,se){return i=new K5(i,s,a,y,T,G,ee,se,C),s=1,f===!0&&(s|=24),f=vi(3,null,null,s),i.current=f,f.stateNode=i,s=Hu(),s.refCount++,i.pooledCache=s,s.refCount++,f.memoizedState={element:o,isDehydrated:a,cache:s},qu(f),i}function Bv(i){return i?(i=ea,i):ea}function Ov(i,s,a,o,u,f){u=Bv(u),o.context===null?o.context=u:o.pendingContext=u,o=wn(s),o.payload={element:a},f=f===void 0?null:f,f!==null&&(o.callback=f),a=bn(i,o,s),a!==null&&(xi(a,i,s),yl(a,i,s))}function zv(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var a=i.retryLane;i.retryLane=a!==0&&a<s?a:s}}function C0(i,s){zv(i,s),(i=i.alternate)&&zv(i,s)}function Hv(i){if(i.tag===13||i.tag===31){var s=or(i,67108864);s!==null&&xi(s,i,67108864),C0(i,67108864)}}function Iv(i){if(i.tag===13||i.tag===31){var s=Bi();s=nu(s);var a=or(i,s);a!==null&&xi(a,i,s),C0(i,s)}}var Ta=!0;function Y5(i,s,a,o){var u=pe.T;pe.T=null;var f=_e.p;try{_e.p=2,k0(i,s,a,o)}finally{_e.p=f,pe.T=u}}function G5(i,s,a,o){var u=pe.T;pe.T=null;var f=_e.p;try{_e.p=8,k0(i,s,a,o)}finally{_e.p=f,pe.T=u}}function k0(i,s,a,o){if(Ta){var u=E0(o);if(u===null)a0(i,s,o,Qc,a),Pv(i,o);else if(X5(u,i,s,a,o))o.stopPropagation();else if(Pv(i,o),s&4&&-1<Z5.indexOf(i)){for(;u!==null;){var f=Vr(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var y=sr(f.pendingLanes);if(y!==0){var C=f;for(C.pendingLanes|=2,C.entangledLanes|=2;y;){var T=1<<31-ji(y);C.entanglements[1]|=T,y&=~T}ks(f),(Ye&6)===0&&(zc=Ei()+500,Bl(0))}}break;case 31:case 13:C=or(f,2),C!==null&&xi(C,f,2),Uc(),C0(f,2)}if(f=E0(o),f===null&&a0(i,s,o,Qc,a),f===u)break;u=f}u!==null&&o.stopPropagation()}else a0(i,s,o,null,a)}}function E0(i){return i=uu(i),M0(i)}var Qc=null;function M0(i){if(Qc=null,i=nr(i),i!==null){var s=h(i);if(s===null)i=null;else{var a=s.tag;if(a===13){if(i=d(s),i!==null)return i;i=null}else if(a===31){if(i=p(s),i!==null)return i;i=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null)}}return Qc=i,null}function Uv(i){switch(i){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(ow()){case k1:return 2;case E1:return 8;case Ro:case cw:return 32;case M1:return 268435456;default:return 32}default:return 32}}var j0=!1,Bn=null,On=null,zn=null,Vl=new Map,$l=new Map,Hn=[],Z5="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 Pv(i,s){switch(i){case"focusin":case"focusout":Bn=null;break;case"dragenter":case"dragleave":On=null;break;case"mouseover":case"mouseout":zn=null;break;case"pointerover":case"pointerout":Vl.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":$l.delete(s.pointerId)}}function Wl(i,s,a,o,u,f){return i===null||i.nativeEvent!==f?(i={blockedOn:s,domEventName:a,eventSystemFlags:o,nativeEvent:f,targetContainers:[u]},s!==null&&(s=Vr(s),s!==null&&Hv(s)),i):(i.eventSystemFlags|=o,s=i.targetContainers,u!==null&&s.indexOf(u)===-1&&s.push(u),i)}function X5(i,s,a,o,u){switch(s){case"focusin":return Bn=Wl(Bn,i,s,a,o,u),!0;case"dragenter":return On=Wl(On,i,s,a,o,u),!0;case"mouseover":return zn=Wl(zn,i,s,a,o,u),!0;case"pointerover":var f=u.pointerId;return Vl.set(f,Wl(Vl.get(f)||null,i,s,a,o,u)),!0;case"gotpointercapture":return f=u.pointerId,$l.set(f,Wl($l.get(f)||null,i,s,a,o,u)),!0}return!1}function qv(i){var s=nr(i.target);if(s!==null){var a=h(s);if(a!==null){if(s=a.tag,s===13){if(s=d(a),s!==null){i.blockedOn=s,L1(i.priority,function(){Iv(a)});return}}else if(s===31){if(s=p(a),s!==null){i.blockedOn=s,L1(i.priority,function(){Iv(a)});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){i.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Jc(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var a=E0(i.nativeEvent);if(a===null){a=i.nativeEvent;var o=new a.constructor(a.type,a);hu=o,a.target.dispatchEvent(o),hu=null}else return s=Vr(a),s!==null&&Hv(s),i.blockedOn=a,!1;s.shift()}return!0}function Vv(i,s,a){Jc(i)&&a.delete(s)}function Q5(){j0=!1,Bn!==null&&Jc(Bn)&&(Bn=null),On!==null&&Jc(On)&&(On=null),zn!==null&&Jc(zn)&&(zn=null),Vl.forEach(Vv),$l.forEach(Vv)}function eh(i,s){i.blockedOn===s&&(i.blockedOn=null,j0||(j0=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Q5)))}var th=null;function $v(i){th!==i&&(th=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){th===i&&(th=null);for(var s=0;s<i.length;s+=3){var a=i[s],o=i[s+1],u=i[s+2];if(typeof o!="function"){if(M0(o||a)===null)continue;break}var f=Vr(a);f!==null&&(i.splice(s,3),s-=3,cd(f,{pending:!0,data:u,method:a.method,action:o},o,u))}}))}function Da(i){function s(T){return eh(T,i)}Bn!==null&&eh(Bn,i),On!==null&&eh(On,i),zn!==null&&eh(zn,i),Vl.forEach(s),$l.forEach(s);for(var a=0;a<Hn.length;a++){var o=Hn[a];o.blockedOn===i&&(o.blockedOn=null)}for(;0<Hn.length&&(a=Hn[0],a.blockedOn===null);)qv(a),a.blockedOn===null&&Hn.shift();if(a=(i.ownerDocument||i).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var u=a[o],f=a[o+1],y=u[mi]||null;if(typeof f=="function")y||$v(a);else if(y){var C=null;if(f&&f.hasAttribute("formAction")){if(u=f,y=f[mi]||null)C=y.formAction;else if(M0(u)!==null)continue}else C=y.action;typeof C=="function"?a[o+1]=C:(a.splice(o,3),o-=3),$v(a)}}}function Wv(){function i(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(y){return u=y})},focusReset:"manual",scroll:"manual"})}function s(){u!==null&&(u(),u=null),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,u=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),u!==null&&(u(),u=null)}}}function T0(i){this._internalRoot=i}ih.prototype.render=T0.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(r(409));var a=s.current,o=Bi();Ov(a,o,i,s,null,null)},ih.prototype.unmount=T0.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;Ov(i.current,2,null,i,null,null),Uc(),s[qr]=null}};function ih(i){this._internalRoot=i}ih.prototype.unstable_scheduleHydration=function(i){if(i){var s=N1();i={blockedOn:null,target:i,priority:s};for(var a=0;a<Hn.length&&s!==0&&s<Hn[a].priority;a++);Hn.splice(a,0,i),a===0&&qv(i)}};var Fv=t.version;if(Fv!=="19.3.0")throw Error(r(527,Fv,"19.3.0"));_e.findDOMNode=function(i){var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=m(s),i=i!==null?v(i):null,i=i===null?null:i.stateNode,i};var J5={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:pe,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var sh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sh.isDisabled&&sh.supportsFiber)try{Ja=sh.inject(J5),Mi=sh}catch{}}return Kl.createRoot=function(i,s){if(!l(i))throw Error(r(299));var a=!1,o="",u=Bg,f=Og,y=zg;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(o=s.identifierPrefix),s.onUncaughtError!==void 0&&(u=s.onUncaughtError),s.onCaughtError!==void 0&&(f=s.onCaughtError),s.onRecoverableError!==void 0&&(y=s.onRecoverableError)),s=Lv(i,1,!1,null,null,a,o,null,u,f,y,Wv),i[qr]=s.current,r0(i),new T0(s)},Kl.hydrateRoot=function(i,s,a){if(!l(i))throw Error(r(299));var o=!1,u="",f=Bg,y=Og,C=zg,T=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(f=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(C=a.onRecoverableError),a.formState!==void 0&&(T=a.formState)),s=Lv(i,1,!0,s,a??null,o,u,T,f,y,C,Wv),s.context=Bv(null),a=s.current,o=Bi(),o=nu(o),u=wn(o),u.callback=null,bn(a,u,o),a=o,s.current.lanes=a,tl(s,a),ks(s),i[qr]=s.current,r0(i),new ih(s)},Kl.version="19.3.0",Kl}var l_;function bb(){if(l_)return N0.exports;l_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),N0.exports=wb(),N0.exports}var Cb=bb(),x=W2();const Hf=window.matchMedia("(prefers-color-scheme: dark)"),If=window.matchMedia("(prefers-reduced-motion: reduce)"),P3=e=>t=>(e.addEventListener("change",t),()=>e.removeEventListener("change",t));function F2(){return x.useSyncExternalStore(P3(Hf),()=>Hf.matches)}function Ka(){return x.useSyncExternalStore(P3(If),()=>If.matches)}const Co=()=>Hf.matches,o_=()=>If.matches,kb=e=>({text:e?[242,242,242]:[20,20,20],secondary:e?"#9a9a9a":"#6b6b6b",background:e?"#0a0a0a":"#ffffff"}),Ah=[{id:"black",label:"Black",hex:"#2B2B2B"},{id:"brown",label:"Brown",hex:"#936439"},{id:"red",label:"Red",hex:"#FF263C"},{id:"orange",label:"Orange",hex:"#FF6700"},{id:"yellow",label:"Yellow",hex:"#FF9800"},{id:"green",label:"Green",hex:"#00C972"},{id:"cyan",label:"Cyan",hex:"#00BCA6"},{id:"blue",label:"Blue",hex:"#1084FE"},{id:"violet",label:"Violet",hex:"#9159FE"},{id:"magenta",label:"Magenta",hex:"#FF309B"},{id:"gray",label:"Gray",hex:"#777777"}],q3=["blob","pebble","squircle","tablet","wedge","hex","cloud","teardrop"];function ko(e){return(Ah.find(t=>t.id===e)??Ah[7]).hex}function Eb(e,t){const n=parseInt(e.slice(1),16);return`rgba(${n>>16&255}, ${n>>8&255}, ${n&255}, ${t})`}const Mb=[["path",{d:"M12 6.528V3a1 1 0 0 1 1-1h0"}],["path",{d:"M18.237 21A15 15 0 0 0 22 11a6 6 0 0 0-10-4.472A6 6 0 0 0 2 11a15.1 15.1 0 0 0 3.763 10 3 3 0 0 0 3.648.648 5.5 5.5 0 0 1 5.178 0A3 3 0 0 0 18.237 21"}]];const jb=[["path",{d:"M12 5v14"}],["path",{d:"m19 12-7 7-7-7"}]];const Tb=[["path",{d:"m12 19-7-7 7-7"}],["path",{d:"M19 12H5"}]];const Db=[["path",{d:"M17 12H3"}],["path",{d:"m11 18 6-6-6-6"}],["path",{d:"M21 5v14"}]];const Rb=[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]];const Ab=[["path",{d:"m5 12 7-7 7 7"}],["path",{d:"M12 19V5"}]];const Nb=[["path",{d:"M2 10v3"}],["path",{d:"M6 6v11"}],["path",{d:"M10 3v18"}],["path",{d:"M14 8v7"}],["path",{d:"M18 5v13"}],["path",{d:"M22 10v3"}]];const Lb=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"}],["path",{d:"m16 9-5.5 5.5L8 12"}]];const Bb=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0"}],["path",{d:"M11.68 2.009A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673c-.824-.85-1.678-1.731-2.21-3.348"}],["circle",{cx:"18",cy:"5",r:"3"}]];const Ob=[["path",{d:"M12 5v16"}],["path",{d:"M16 13h2"}],["path",{d:"M16 9h2"}],["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"}],["path",{d:"M6 13h2"}],["path",{d:"M6 9h2"}]];const zb=[["path",{d:"M12 5v16"}],["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"}]];const Hb=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20"}]];const Ib=[["path",{d:"M8 2v3"}],["path",{d:"M16 2v3"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}],["path",{d:"M3 9h18"}]];const Ub=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}],["path",{d:"M18 17V9"}],["path",{d:"M13 17V5"}],["path",{d:"M8 17v-3"}]];const Pb=[["path",{d:"M20 6 9 17l-5-5"}]];const qb=[["path",{d:"m6 9 6 6 6-6"}]];const Vb=[["path",{d:"m15 18-6-6 6-6"}]];const $b=[["path",{d:"m18 15-6-6-6 6"}]];const Wb=[["path",{d:"m9 18 6-6-6-6"}]];const Fb=[["path",{d:"m11 17-5-5 5-5"}],["path",{d:"m18 17-5-5 5-5"}]];const Kb=[["path",{d:"m6 17 5-5-5-5"}],["path",{d:"m13 17 5-5-5-5"}]];const Yb=[["path",{d:"m7 15 5 5 5-5"}],["path",{d:"m7 9 5-5 5 5"}]];const c_=[["circle",{cx:"12",cy:"12",r:"10"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16"}]];const Gb=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 8v8"}],["path",{d:"m8 12 4 4 4-4"}]];const h_=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m16 9-5.5 5.5L8 12"}]];const Zb=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7"}]];const Xb=[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"12",cy:"12",r:"10"}]];const Qb=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M17 12h.01"}],["path",{d:"M12 12h.01"}],["path",{d:"M7 12h.01"}]];const Jb=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M8 12h8"}]];const e6=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z"}],["circle",{cx:"12",cy:"12",r:"10"}]];const t6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M8 12h8"}],["path",{d:"M12 8v8"}]];const i6=[["circle",{cx:"12",cy:"12",r:"10"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1"}]];const s6=[["circle",{cx:"12",cy:"12",r:"10"}],["circle",{cx:"12",cy:"10",r:"3"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662"}]];const u_=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m15 9-6 6"}],["path",{d:"m9 9 6 6"}]];const V3=[["circle",{cx:"12",cy:"12",r:"10"}]];const n6=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4"}],["path",{d:"M21 14H11"}],["path",{d:"m15 10-4 4 4 4"}]];const r6=[["path",{d:"M11 14h10"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344"}],["path",{d:"m17 18 4-4-4-4"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1"}]];const d_=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}]];const a6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]];const l6=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"}]];const o6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z"}]];const f_=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]];const c6=[["path",{d:"M12 20v2"}],["path",{d:"M12 2v2"}],["path",{d:"M17 20v2"}],["path",{d:"M17 2v2"}],["path",{d:"M2 12h2"}],["path",{d:"M2 17h2"}],["path",{d:"M2 7h2"}],["path",{d:"M20 12h2"}],["path",{d:"M20 17h2"}],["path",{d:"M20 7h2"}],["path",{d:"M7 20v2"}],["path",{d:"M7 2v2"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1"}]];const h6=[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"19",cy:"12",r:"1"}],["circle",{cx:"5",cy:"12",r:"1"}]];const u6=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]];const d6=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}],["circle",{cx:"12",cy:"12",r:"3"}]];const f6=[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M8 12v-1"}],["path",{d:"M8 18v-2"}],["path",{d:"M8 7V6"}],["circle",{cx:"8",cy:"20",r:"2"}]];const p6=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M9 15h6"}],["path",{d:"M12 18v-6"}]];const H0=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 9H8"}],["path",{d:"M16 13H8"}],["path",{d:"M16 17H8"}]];const g6=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}]];const m6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M7 3v18"}],["path",{d:"M3 7.5h4"}],["path",{d:"M3 12h18"}],["path",{d:"M3 16.5h4"}],["path",{d:"M17 3v18"}],["path",{d:"M17 7.5h4"}],["path",{d:"M17 16.5h4"}]];const v6=[["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"}]];const _6=[["path",{d:"m12 14 4-4"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0"}]];const y6=[["path",{d:"M15 6a9 9 0 0 0-9 9V3"}],["circle",{cx:"18",cy:"6",r:"3"}],["circle",{cx:"6",cy:"18",r:"3"}]];const S6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}],["path",{d:"M2 12h20"}]];const x6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M3 15h18"}],["path",{d:"M9 3v18"}],["path",{d:"M15 3v18"}]];const w6=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9"}],["path",{d:"m18 15 4-4"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5"}]];const b6=[["path",{d:"M18 12.5V10a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4"}],["path",{d:"M14 11V9a2 2 0 1 0-4 0v2"}],["path",{d:"M10 10.5V5a2 2 0 1 0-4 0v9"}],["path",{d:"m7 15-1.76-1.76a2 2 0 0 0-2.83 2.82l3.6 3.6C7.5 21.14 9.2 22 12 22h2a8 8 0 0 0 8-8V7a2 2 0 1 0-4 0v5"}]];const C6=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"}]];const k6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}],["circle",{cx:"9",cy:"9",r:"2"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}]];const E6=[["path",{d:"m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16"}],["path",{d:"M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2"}],["circle",{cx:"13",cy:"7",r:"1",fill:"currentColor"}],["rect",{x:"8",y:"2",width:"14",height:"14",rx:"2"}]];const M6=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}],["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"}]];const j6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 16v-4"}],["path",{d:"M12 8h.01"}]];const T6=[["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"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor"}]];const D6=[["path",{d:"m2 21 9.6-9.6"}],["path",{d:"m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19"}],["circle",{cx:"15.5",cy:"7.5",r:"5.5"}]];const R6=[["path",{d:"M10 8h.01"}],["path",{d:"M12 12h.01"}],["path",{d:"M14 8h.01"}],["path",{d:"M16 12h.01"}],["path",{d:"M18 8h.01"}],["path",{d:"M6 8h.01"}],["path",{d:"M7 16h10"}],["path",{d:"M8 12h.01"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}]];const A6=[["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"}],["path",{d:"M20.054 15.987H3.946"}]];const N6=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1"}]];const L6=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}]];const B6=[["path",{d:"M13 5h8"}],["path",{d:"M13 12h8"}],["path",{d:"M13 19h8"}],["path",{d:"m3 17 2 2 4-4"}],["path",{d:"m3 7 2 2 4-4"}]];const O6=[["path",{d:"M3 5h.01"}],["path",{d:"M3 12h.01"}],["path",{d:"M3 19h.01"}],["path",{d:"M8 5h13"}],["path",{d:"M8 12h13"}],["path",{d:"M8 19h13"}]];const z6=[["path",{d:"m16 17 5-5-5-5"}],["path",{d:"M21 12H9"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}]];const H6=[["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"}],["path",{d:"M7 11h10"}],["path",{d:"M7 15h6"}],["path",{d:"M7 7h8"}]];const I6=[["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"}]];const U6=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1"}]];const p_=[["path",{d:"M12 19v3"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2"}],["path",{d:"m2 2 20 20"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12"}]];const g_=[["path",{d:"M12 19v3"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3"}]];const P6=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const q6=[["path",{d:"M12 17v4"}],["path",{d:"M22 12.307V15a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8.693"}],["path",{d:"M8 21h8"}],["circle",{cx:"19",cy:"6",r:"3"}]];const V6=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8"}],["path",{d:"M10 19v-3.96 3.15"}],["path",{d:"M7 19h5"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2"}]];const m_=[["path",{d:"m14.5 12.5-5-5"}],["path",{d:"m9.5 12.5 5-5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}],["path",{d:"M12 17v4"}],["path",{d:"M8 21h8"}]];const v_=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21"}]];const $6=[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"}]];const W6=[["path",{d:"M14 4.1 12 6"}],["path",{d:"m5.1 8-2.9-.8"}],["path",{d:"m6 12-1.9 2"}],["path",{d:"M7.2 2.2 8 5.1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z"}]];const F6=[["path",{d:"M9 18V5l12-2v13"}],["circle",{cx:"6",cy:"18",r:"3"}],["circle",{cx:"18",cy:"16",r:"3"}]];const K6=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"}],["path",{d:"M12 12V8"}]];const Y6=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"}],["path",{d:"M12 22V12"}],["polyline",{points:"3.29 7 12 12 20.71 7"}],["path",{d:"m7.5 4.27 9 5.15"}]];const G6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M9 3v18"}]];const Z6=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}],["path",{d:"m15 5 4 4"}]];const X6=[["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"}],["path",{d:"M22 2 2 22"}],["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"}]];const Q6=[["path",{d:"M12 17v5"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89"}],["path",{d:"m2 2 20 20"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11"}]];const __=[["path",{d:"M12 17v5"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"}]];const J6=[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]];const eC=[["path",{d:"M22 14a8 8 0 0 1-8 8"}],["path",{d:"M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2"}],["path",{d:"M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1"}],["path",{d:"M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"}]];const tC=[["path",{d:"M12 2v10"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04"}]];const iC=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3"}],["path",{d:"M21 21v.01"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7"}],["path",{d:"M3 12h.01"}],["path",{d:"M12 3h.01"}],["path",{d:"M12 16v.01"}],["path",{d:"M16 12h1"}],["path",{d:"M21 12v.01"}],["path",{d:"M12 21v-1"}]];const sC=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]];const nC=[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4"}],["path",{d:"m9 17-5-5 5-5"}]];const rC=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}],["path",{d:"M12 7v5l4 2"}]];const aC=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}]];const y_=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}]];const lC=[["path",{d:"M15 12h-5"}],["path",{d:"M15 8h-5"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4"}],["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"}]];const oC=[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]];const ah=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18"}]];const cC=[["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"}],["circle",{cx:"12",cy:"12",r:"3"}]];const hC=[["path",{d:"M12 2v13"}],["path",{d:"m16 6-4-4-4 4"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}]];const uC=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}],["path",{d:"m9 12 2 2 4-4"}]];const dC=[["path",{d:"M10 5H3"}],["path",{d:"M12 19H3"}],["path",{d:"M14 3v4"}],["path",{d:"M16 17v4"}],["path",{d:"M21 12h-9"}],["path",{d:"M21 19h-5"}],["path",{d:"M21 5h-7"}],["path",{d:"M8 10v4"}],["path",{d:"M8 12H3"}]];const fC=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2"}],["path",{d:"M12 18h.01"}]];const pC=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"}],["path",{d:"M20 2v4"}],["path",{d:"M22 4h-4"}],["circle",{cx:"4",cy:"20",r:"2"}]];const gC=[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6"}],["path",{d:"m21 3-9 9"}],["path",{d:"M15 3h6v6"}]];const mC=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}],["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"}]];const vC=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}]];const _C=[["path",{d:"M12 19h8"}],["path",{d:"m4 17 6-6-6-6"}]];const yC=[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]];const I0=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}],["path",{d:"M12 9v4"}],["path",{d:"M12 17h.01"}]];const SC=[["path",{d:"m16 11 2 2 4-4"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}],["circle",{cx:"9",cy:"7",r:"4"}]];const xC=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}],["circle",{cx:"9",cy:"7",r:"4"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11"}]];const S_=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}],["circle",{cx:"12",cy:"7",r:"4"}]];const wC=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}],["circle",{cx:"9",cy:"7",r:"4"}]];const x_=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"}],["path",{d:"M16 9a5 5 0 0 1 0 6"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728"}]];const bC=[["path",{d:"M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z"}],["path",{d:"m16.5 14.5 5-5"}],["path",{d:"m16.5 9.5 5 5"}]];const CC=[["path",{d:"m10.586 5.414-5.172 5.172"}],["path",{d:"m18.586 13.414-5.172 5.172"}],["path",{d:"M6 12h12"}],["circle",{cx:"12",cy:"20",r:"2"}],["circle",{cx:"12",cy:"4",r:"2"}],["circle",{cx:"20",cy:"12",r:"2"}],["circle",{cx:"4",cy:"12",r:"2"}]];const kC=[["path",{d:"M12 20h.01"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764"}],["path",{d:"m2 2 20 20"}]];const EC=[["path",{d:"M12 20h.01"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0"}]];const MC=[["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"}]];const jC=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const TC=[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z"}]],DC={"arrow.clockwise":y_,"arrow.counterclockwise":aC,"arrow.down":jb,"arrow.down.circle":Gb,"arrow.down.right.and.arrow.up.left":P6,"arrow.left":Tb,"arrow.right":Rb,"arrow.right.doc.on.clipboard":n6,"arrow.up.doc.on.clipboard":r6,"arrow.right.to.line":Db,"arrow.triangle.2.circlepath":sC,"arrow.triangle.branch":y6,"arrow.up":Ab,"arrow.up.right.square":gC,"arrowshape.turn.up.left":nC,"apple.logo":Mb,"bell.badge":Bb,bolt:TC,book:zb,"book.closed":Hb,"book.pages":Ob,"bubble.left":I6,"bubble.left.and.bubble.right":U6,calendar:Ib,"chart.bar":Ub,checklist:B6,checkmark:Pb,"checkmark.circle":h_,"checkmark.circle.fill":h_,"checkmark.seal":Lb,"chevron.down":qb,"chevron.left":Vb,"chevron.left.2":Fb,"chevron.right":Wb,"chevron.right.2":Kb,"chevron.up":$b,"chevron.up.chevron.down":Yb,circle:V3,"circle.dotted":Zb,clock:a6,"clock.arrow.circlepath":rC,cloud:l6,cpu:c6,"cursorarrow.motionlines":W6,desktopcomputer:v_,"desktopcomputer.trianglebadge.exclamationmark":m_,display:v_,"display.2":V6,"display.trianglebadge.exclamationmark":m_,doc:g6,"doc.badge.plus":p6,"doc.on.clipboard":d_,"doc.on.clipboard.fill":d_,"doc.on.doc":f_,"doc.plaintext":H0,"doc.richtext":H0,"doc.text":H0,"doc.zipper":f6,ellipsis:h6,"ellipsis.circle":Qb,exclamationmark:I0,"exclamationmark.circle":c_,"exclamationmark.circle.fill":c_,"exclamationmark.triangle":I0,"exclamationmark.triangle.fill":I0,eye:d6,"eye.slash":u6,film:m6,folder:v6,"gauge.with.dots.needle.33percent":_6,gearshape:cC,globe:S6,hammer:w6,"hand.point.up.left":eC,"hand.raised":C6,"hand.raised.slash":b6,"info.circle":j6,iphone:fC,key:D6,"key.fill":T6,"keyboard.chevron.compact.down":R6,laptopcomputer:A6,link:L6,"list.bullet":O6,"list.bullet.rectangle":lC,"lock.display":q6,"lock.shield":uC,macmini:ah,"macpro.gen3":ah,macstudio:ah,magnifyingglass:oC,mic:g_,"mic.fill":g_,"mic.slash":p_,"mic.slash.fill":p_,"minus.circle":Jb,"music.note":F6,network:K6,pencil:Z6,person:S_,"person.2":wC,"person.crop.circle":s6,"person.crop.circle.badge.checkmark":SC,"person.crop.circle.badge.plus":xC,"person.fill":S_,"phone.down.fill":X6,photo:k6,"photo.on.rectangle":E6,pin:__,"pin.fill":__,"pin.slash":Q6,"play.circle":e6,plus:J6,"plus.circle":t6,"point.3.connected.trianglepath.dotted":CC,power:tC,qrcode:iC,"record.circle":Xb,"rectangle.and.hand.point.up.left":$6,"rectangle.portrait.and.arrow.right":z6,"rotate.right":y_,safari:o6,"server.rack":ah,shippingbox:Y6,"sidebar.left":G6,"slider.horizontal.3":dC,sparkles:pC,"speaker.slash.fill":bC,"speaker.wave.2":x_,"speaker.wave.2.fill":x_,"square.and.arrow.up":hC,"square.and.pencil":mC,"square.grid.2x2":N6,"square.grid.3x3":x6,"square.on.square":f_,"stop.circle":i6,"stop.fill":vC,terminal:_C,"text.bubble":H6,tray:M6,trash:yC,waveform:Nb,wifi:EC,"wifi.slash":kC,"wrench.and.screwdriver":MC,xmark:jC,"xmark.circle":u_,"xmark.circle.fill":u_},w_=new Map;function RC(e){const t=w_.get(e);if(t!==void 0)return t;const r=(DC[e]??V3).map(([l,h])=>`<${l} ${Object.entries(h).filter(([,d])=>d!==void 0).map(([d,p])=>`${d}="${p}"`).join(" ")}/>`).join("");return w_.set(e,r),r}let xh=null;const Nh=new Set;window.codync?.platform==="darwin"?fetch("/demo/desktop/symbols/manifest.json").then(e=>e.ok?e.json():{}).then(e=>{xh=e;for(const t of Nh)t()}).catch(()=>{xh={};for(const e of Nh)e()}):xh={};function AC(){return x.useSyncExternalStore(e=>(Nh.add(e),()=>{Nh.delete(e)}),()=>xh)}function ae({name:e,size:t,weight:n="regular",color:r,style:l,className:h,scaled:d=!0,title:p}){const m=AC()?.[e],v=d?`${t}px * var(--scale)`:`${t}px`;if(m){const S=`url("/demo/desktop/symbols/${e}.${n}.png")`;return c.jsx("span",{className:h,title:p,"aria-hidden":p?void 0:!0,style:{display:"inline-block",flex:"none",width:`calc(${m.w} * ${v})`,height:`calc(${m.h} * ${v})`,backgroundColor:r??"currentColor",WebkitMaskImage:S,maskImage:S,WebkitMaskSize:"100% 100%",maskSize:"100% 100%",WebkitMaskRepeat:"no-repeat",...l}})}const _={light:1.5,regular:1.75,medium:2,semibold:2.25,bold:2.5,black:2.75}[n];return c.jsx("svg",{className:h,"aria-hidden":p?void 0:!0,viewBox:"0 0 24 24",fill:"none",stroke:r??"currentColor",strokeWidth:_,strokeLinecap:"round",strokeLinejoin:"round",style:{width:`calc(1.2 * ${v})`,height:`calc(1.2 * ${v})`,flex:"none",...l},dangerouslySetInnerHTML:{__html:(p?`<title>${p}</title>`:"")+RC(e)}})}function NC(e,t,n){const r=new Path2D;let l=0;switch(e){case"pebble":r.ellipse(t/2,n/2,t/2,n*.4,0,0,Math.PI*2);break;case"squircle":r.roundRect(t*.04,n*.04,t*.92,n*.92,t*.3);break;case"tablet":r.roundRect(t*.14,0,t*.72,n,t*.22);break;case"wedge":r.moveTo(t*.5,n*.04),r.quadraticCurveTo(t*.9,n*.4,t*.98,n*.86),r.quadraticCurveTo(t*.5,n*1.04,t*.02,n*.86),r.quadraticCurveTo(t*.1,n*.4,t*.5,n*.04);break;case"hex":for(let h=0;h<6;h++){const d=h*Math.PI/3-Math.PI/2,p=t/2+Math.cos(d)*t*.49,g=n/2+Math.sin(d)*n*.49;h===0?r.moveTo(p,g):r.lineTo(p,g)}r.closePath(),l=t*.08;break;case"cloud":r.ellipse(t*.275,n*.575,t*.275,n*.275,0,0,Math.PI*2),r.moveTo(t,n*.575),r.ellipse(t*.725,n*.575,t*.275,n*.275,0,0,Math.PI*2),r.moveTo(t*.82,n*.4),r.ellipse(t*.5,n*.4,t*.32,n*.32,0,0,Math.PI*2),r.roundRect(t*.1,n*.5,t*.8,n*.35,t*.15);break;case"teardrop":r.moveTo(t*.5,0),r.bezierCurveTo(t*.62,n*.2,t*.94,n*.38,t*.94,n*.62),r.arc(t*.5,n*.62,t*.44,0,Math.PI,!1),r.bezierCurveTo(t*.06,n*.38,t*.38,n*.2,t*.5,0);break;default:{for(let d=0;d<=64;d++){const p=d/64*2*Math.PI,g=.46+.035*Math.sin(p*3+.6),m=t/2+Math.cos(p)*t*g,v=n/2+Math.sin(p)*n*g;d===0?r.moveTo(m,v):r.lineTo(m,v)}r.closePath()}}return{path:r,stroke:l}}const lh=document.createElement("canvas").getContext("2d"),b_=new Map;function LC(e,t,n){const r=`${e}|${t}|${n}`,l=b_.get(r);if(l)return l;const{path:h,stroke:d}=NC(e,t,t),p=t/n,g=[];lh.lineWidth=d,lh.lineJoin="round";for(let m=0;m<n;m++)for(let v=0;v<n;v++){const _=(v+.5)*p,S=(m+.5)*p;(lh.isPointInPath(h,_,S,"nonzero")||d>0&&lh.isPointInStroke(h,_,S))&&g.push({row:m,col:v,x:_,y:S})}return b_.set(r,g),g}const nn=x.memo(function({shape:t,color:n,tint:r,size:l=40,mood:h="idle",style:d}){const p=x.useRef(null),g=F2(),m=Ka(),v=r??ko(n);return x.useEffect(()=>{const _=p.current;if(!_)return;const S=window.devicePixelRatio||1;_.width=Math.round(l*S),_.height=Math.round(l*S);const w=_.getContext("2d"),b=h==="idle"||m;let k=0;const E=j=>{w.setTransform(S,0,0,S,0,0),w.clearRect(0,0,l,l),K2(w,{shape:t,fill:v,size:l,mood:h,dark:g,t:b?0:j/1e3%3600,still:b}),b||(k=requestAnimationFrame(E))};return E(performance.now()),()=>cancelAnimationFrame(k)},[t,v,l,h,g,m]),c.jsx("canvas",{ref:p,"aria-hidden":!0,style:{width:l,height:l,display:"block",flex:"none",...d}})});function K2(e,{shape:t,fill:n,size:r,mood:l,dark:h,t:d,still:p}){const g=r<18?7:r<28?9:13,m=g===7?[2,4]:g===9?[3,6]:[4,8],v=g===13?[4,5,6]:g===9?[3,4]:[2,3],_=r/g,S=LC(t,r,g),[w,b,k]=kb(h).text,E=parseInt(n.slice(1),16),[j,V,A]=[E>>16&255,E>>8&255,E&255],z=l==="working"?Math.round(Math.sin(d*2*Math.PI/3.2)*1.4):0,R=!p&&d/4.7%1<.035?v.slice(-1):v,I=m.map(L=>L+z),q=r/2,U=l==="working"?d*1.4:-.7,Y=Math.sin(U)*.8,$=.55,M=Math.cos(U)*.5+.6,N=Math.hypot(Y,$,M);for(const L of S){if(I.includes(L.col)&&R.includes(L.row))continue;const O=(L.x-q)/q,P=(q-L.y)/q,te=Math.sqrt(Math.max(.2,1-O*O-P*P)),Q=Math.hypot(O,P,te);let ce=.3+.7*Math.max(0,(O*Y+P*$+te*M)/(Q*N));if(l==="needsInput"){const Ce=.5+.5*Math.sin(Math.hypot(O,P)*9-d*5);ce*=.6+.4*Ce}const re=_*.42*(.55+.45*ce),de=g<13?.4+.4*ce:.2+.4*Math.min(1,ce/.7);e.beginPath(),e.arc(L.x,L.y,re,0,Math.PI*2),e.fillStyle=`rgba(${w},${b},${k},${de})`,e.fill(),ce>.6&&(e.fillStyle=`rgba(${j},${V},${A},${(ce-.6)/.4})`,e.fill())}}function $3(e,t=!0){return t?ln(e)?"needsInput":Jn(e)?"working":"idle":"idle"}function Ui({bot:e,size:t=40,animated:n=!0}){return c.jsx(nn,{shape:e.avatarShape,color:e.avatarColor,size:t,mood:$3(e,n)})}function Eo({members:e,size:t=40,animated:n=!0}){const r=(h,d,p)=>c.jsx("div",{style:{position:"absolute",...p},children:c.jsx(Ui,{bot:h,size:d,animated:n})},h.id);let l;switch(e.length){case 0:l=c.jsx("div",{style:{display:"grid",placeItems:"center",width:"100%",height:"100%",color:"var(--secondary)"},children:c.jsx(ae,{name:"person.2",size:t*.4})});break;case 1:l=c.jsx(Ui,{bot:e[0],size:t,animated:n});break;case 2:l=[r(e[1],t*.66,{top:0,right:0}),r(e[0],t*.66,{bottom:0,left:0})];break;case 3:l=[r(e[0],t*.55,{top:0,left:(t-t*.55)/2}),r(e[1],t*.55,{bottom:0,left:0}),r(e[2],t*.55,{bottom:0,right:0})];break;default:l=[r(e[0],t*.5,{top:0,left:0}),r(e[1],t*.5,{top:0,right:0}),r(e[2],t*.5,{bottom:0,left:0}),e.length===4?r(e[3],t*.5,{bottom:0,right:0}):c.jsxs("div",{style:{position:"absolute",right:0,bottom:0,width:t*.5,height:t*.5,display:"grid",placeItems:"center",fontSize:t*.24,fontWeight:700,color:"var(--secondary)",fontFamily:"ui-rounded, var(--font)"},children:["+",e.length-3]},"more")]}return c.jsx("div",{"aria-hidden":!0,style:{position:"relative",width:t,height:t,flex:"none"},children:l})}function BC({bot:e,members:t=[],size:n=44}){return c.jsxs("div",{style:{position:"relative",width:n,height:n,flex:"none"},children:[At(e)?c.jsx(Eo,{members:t,size:n}):c.jsx(Ui,{bot:e,size:n}),ln(e)?c.jsx("div",{style:{position:"absolute",right:0,bottom:0,width:n*.36,height:n*.36,borderRadius:"50%",background:"var(--warning)",boxShadow:"0 0 0 2px var(--background)",display:"grid",placeItems:"center",color:"#fff"},children:c.jsx(ae,{name:"exclamationmark",size:n*.2,weight:"black",scaled:!1})}):e.unread>0?c.jsx("div",{style:{position:"absolute",right:0,bottom:0,width:n*.28,height:n*.28,borderRadius:"50%",background:"var(--accent-fill)",boxShadow:"0 0 0 2px var(--background)"}}):null]})}const OC={largeTitle:26,title:22,title2:17,title3:15,headline:13,body:13,callout:12,subheadline:11,footnote:10,caption:10,caption2:10,compactBody:12,compactSecondary:11},Fh=e=>`calc(${e}px * var(--scale))`,zC={light:300,regular:400,medium:500,semibold:600,bold:700,black:900};function B(e,t,n){const r=typeof e=="number"?e:OC[e],l=t??(e==="headline"?"bold":"regular");return{fontSize:Fh(r),fontWeight:zC[l],...n==="monospaced"?{fontFamily:"var(--mono)"}:n==="rounded"?{fontFamily:"ui-rounded, var(--font)"}:{}}}var Kh=U3();function er(e,t=300,n=!0){const[r,l]=x.useState(e),[h,d]=x.useState(e&&!n);return x.useLayoutEffect(()=>{if(o_()){l(e),d(e);return}if(e){l(!0);let g=0;const m=requestAnimationFrame(()=>{g=requestAnimationFrame(()=>d(!0))});return()=>{cancelAnimationFrame(m),cancelAnimationFrame(g)}}d(!1);const p=setTimeout(()=>l(!1),o_()?0:t);return()=>clearTimeout(p)},[e,t]),{mounted:r,shown:h}}const W3=x.createContext(()=>{}),ss=()=>x.useContext(W3),Yl=[];let HC=0;function Y2(e,t){const n=x.useRef(t);n.current=t,x.useEffect(()=>{if(!e)return;const r=++HC;Yl.push(r);const l=h=>{h.key==="Escape"&&Yl[Yl.length-1]===r&&(h.preventDefault(),h.stopPropagation(),n.current())};return window.addEventListener("keydown",l,!0),()=>{window.removeEventListener("keydown",l,!0),Yl.splice(Yl.indexOf(r),1)}},[e])}function $t({open:e,onClose:t,width:n,height:r,children:l}){const{mounted:h,shown:d}=er(e),p=x.useRef(l);return e&&(p.current=l),Y2(e,t),h?Kh.createPortal(c.jsx(W3.Provider,{value:t,children:c.jsxs("div",{className:`modal-card ${d?"shown":""}`,role:"dialog","aria-modal":!0,children:[c.jsx("div",{className:"modal-dim"}),c.jsx("div",{className:"modal-content",style:{width:n,height:r,maxWidth:"calc(100vw - 48px)",maxHeight:"calc(100vh - 48px)"},children:e?l:p.current})]})}),document.body):null}function ts({open:e,title:t,message:n,actions:r,cancel:l="Cancel",onClose:h}){const{mounted:d,shown:p}=er(e,120),g=x.useRef({title:t,message:n,actions:r});if(e&&(g.current={title:t,message:n,actions:r}),Y2(e&&l!==null,h),!d)return null;const m=g.current;return Kh.createPortal(c.jsxs("div",{className:`dialog ${p?"shown":""}`,role:"alertdialog","aria-modal":!0,children:[c.jsx("div",{className:"dialog-dim",onClick:()=>l!==null&&h()}),c.jsxs("div",{className:"dialog-card",children:[c.jsxs("div",{className:"dialog-text",children:[c.jsx("div",{style:B("headline"),children:m.title}),m.message?c.jsx("div",{style:{...B("compactSecondary"),color:"var(--secondary)"},children:m.message}):null]}),c.jsxs("div",{className:"dialog-buttons",children:[m.actions.map(v=>c.jsx("button",{className:`dialog-button ${v.destructive?"destructive":"prominent"}`,onClick:()=>{h(),v.action()},children:v.title},v.title)),l!==null?c.jsx("button",{className:"dialog-button",onClick:h,children:l}):null]})]})]}),document.body)}function IC({pick:e,dismiss:t,size:n=26}){return c.jsx("div",{style:{display:"flex"},children:e.emoji.map(r=>{const l=e.chosen.includes(r);return c.jsx("button",{className:`reaction-button ${l?"chosen":""}`,style:{width:n,height:n,borderRadius:n*.28},title:l?`Remove ${r}`:`React ${r}`,"aria-label":l?`Remove reaction ${r}`:`React ${r}`,onClick:()=>{t?.(),e.toggle(r)},children:c.jsx("span",{style:B(14),children:r})},r)})})}function UC({items:e,reactions:t,dismiss:n,maxHeight:r}){const[l,h]=x.useState(-1);return x.useEffect(()=>{const d=p=>{p.key==="ArrowDown"||p.key==="ArrowUp"?(p.preventDefault(),h(g=>(g+(p.key==="ArrowDown"?1:-1)+e.length)%e.length)):p.key==="Enter"&&l>=0&&(p.preventDefault(),n(),e[l]?.action())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,l,n]),c.jsxs("div",{className:"menu-panel",style:{maxHeight:r},children:[t?c.jsx("div",{style:{paddingBottom:e.length?4:0},children:c.jsx(IC,{pick:t,dismiss:n})}):null,e.map((d,p)=>c.jsxs("div",{children:[d.divider?c.jsx("div",{className:"menu-divider"}):null,c.jsxs("button",{className:`menu-row ${d.destructive?"destructive":""} ${l===p?"highlight":""}`,title:d.title,onMouseEnter:()=>h(p),onClick:()=>{n(),d.action()},children:[d.icon?c.jsx("span",{className:"menu-icon",children:c.jsx(ae,{name:d.icon,size:12})}):null,c.jsx("span",{className:"menu-title",children:d.title}),d.selected!==void 0?c.jsx("span",{style:{opacity:d.selected?1:0,display:"flex"},children:c.jsx(ae,{name:"checkmark",size:10,weight:"semibold"})}):null]})]},`${d.title}-${p}`))]})}function Pa({open:e,onClose:t,anchor:n,point:r,items:l,reactions:h}){const{mounted:d,shown:p}=er(e,120),[g,m]=x.useState(null),v=x.useRef([]);if(e&&(v.current=l()),x.useLayoutEffect(()=>{e&&(r?m(new DOMRect(r.x,r.y,0,0)):n?.current&&m(n.current.getBoundingClientRect()))},[e,r,n]),Y2(e,t),!d||!g)return null;const _=window.innerWidth,S=window.innerHeight,w=Math.max(0,S-g.bottom-14),b=Math.max(0,g.top-14),k=w>=b,E=g.left+g.width/2<_*.6,j=Math.min(320,_-16),V=Math.max(8,_-j-8),A={position:"absolute",[k?"top":"bottom"]:k?g.bottom+6:S-g.top+6,...E?{left:Math.min(Math.max(8,g.left),V)}:{right:Math.min(Math.max(8,_-g.right),V)},maxWidth:j,transformOrigin:`${k?"top":"bottom"} ${E?"left":"right"}`};return Kh.createPortal(c.jsx("div",{className:`anchored ${p?"shown":""}`,onMouseDown:z=>z.target===z.currentTarget&&t(),onContextMenu:z=>{z.preventDefault(),t()},children:c.jsx("div",{className:"anchored-panel",style:A,children:c.jsx(UC,{items:v.current,reactions:h,dismiss:t,maxHeight:Math.min(420,k?w:b)})})}),document.body)}function PC(){const[e,t]=x.useState(null);return{point:e,open:e!==null,onContextMenu:n=>{n.preventDefault(),n.stopPropagation(),t({x:n.clientX,y:n.clientY})},close:()=>t(null)}}function Lt({title:e,trailing:t}){const n=ss();return c.jsxs("div",{className:"modal-header",children:[c.jsx("div",{style:{...B("compactBody","semibold"),flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),t,c.jsx(F3,{title:"Close",icon:"xmark",onClick:n})]})}function F3({title:e,icon:t,onClick:n,selected:r=!1,size:l=28,disabled:h,className:d,buttonRef:p}){return c.jsx("button",{ref:p,className:`icon-button ${r?"selected":""} ${d??""}`,style:{width:l,height:l,borderRadius:l*.28},title:e,"aria-label":e,disabled:h,onClick:n,children:c.jsx(ae,{name:t,size:l/2,weight:"medium"})})}const ke=F3;function Fe({kind:e="primary",children:t,onClick:n,disabled:r,style:l,className:h,title:d}){return c.jsx("button",{className:`styled-button ${e} ${h??""}`,onClick:n,disabled:r,style:l,title:d,children:t})}function et({size:e=14}){const t=Math.max(1.5,e/9),n=(e-t)/2,r=2*Math.PI*n;return c.jsx("svg",{className:"spinner",width:e,height:e,viewBox:`0 0 ${e} ${e}`,"aria-label":"Loading",role:"img",children:c.jsx("circle",{cx:e/2,cy:e/2,r:n,fill:"none",stroke:"var(--secondary)",strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${r*.7} ${r}`})})}function rn({on:e,onChange:t,children:n,disabled:r,style:l}){return c.jsxs("button",{className:"switch",role:"switch","aria-checked":e,disabled:r,onClick:()=>t(!e),style:l,children:[n!==void 0?c.jsx("span",{className:"switch-label",children:n}):null,c.jsx("span",{className:`switch-track ${e?"on":""}`,children:c.jsx("span",{className:"switch-knob"})})]})}function Yh({items:e,children:t,className:n,style:r,title:l}){const[h,d]=x.useState(!1),p=x.useRef(null);return c.jsxs(c.Fragment,{children:[c.jsx("button",{ref:p,className:n,style:r,title:l,onClick:()=>d(g=>!g),children:t}),c.jsx(Pa,{open:h,onClose:()=>d(!1),anchor:p,items:e})]})}function Ci({selection:e,options:t,onChange:n,fill:r,fits:l=!1}){const h=t.find(d=>d.id===e)?.label??"Choose";return c.jsxs(Yh,{title:h,className:`choice-picker ${r?"":"outlined"}`,style:{background:r,width:l?"100%":void 0},items:()=>t.map(d=>({title:d.label,selected:d.id===e,action:()=>n(d.id)})),children:[c.jsx("span",{className:"choice-label",children:h}),c.jsx(ae,{name:"chevron.down",size:10,weight:"semibold",color:"var(--secondary)"})]})}function qC({selection:e,options:t,onChange:n}){const r=Math.max(0,t.findIndex(l=>l.id===e));return c.jsxs("div",{className:"segmented",children:[c.jsx("div",{className:"segmented-thumb",style:{width:`calc((100% - 6px - ${(t.length-1)*2}px) / ${t.length})`,transform:`translateX(calc(${r} * (100% + 2px)))`}}),t.map(l=>c.jsx("button",{className:`segmented-option ${l.id===e?"on":""}`,onClick:()=>n(l.id),"aria-pressed":l.id===e,children:l.label},l.id))]})}function VC({selection:e,options:t,onChange:n}){return c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:t.map(r=>c.jsxs("button",{className:"choice-row",onClick:()=>n(r.id),children:[c.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:2},children:[c.jsx("span",{style:{color:"var(--text)"},children:r.label}),r.detail?c.jsx("span",{style:{...B("compactSecondary"),color:"var(--secondary)"},children:r.detail}):null]}),c.jsx("span",{style:{opacity:r.id===e?1:0,display:"flex"},children:c.jsx(ae,{name:"checkmark",size:10,weight:"semibold"})})]},r.id))})}function hi({children:e,style:t}){return c.jsx("div",{className:"card-form",style:t,children:c.jsx("div",{className:"card-form-content",children:e})})}function Ee({title:e,footer:t,accessory:n,children:r}){const l=x.Children.toArray(r);return c.jsxs("section",{className:"card-section",children:[e?c.jsxs("div",{className:"card-section-title",children:[c.jsx("span",{style:{...B(13,"semibold"),color:"var(--text)"},children:e}),c.jsx("span",{style:{flex:1}}),n]}):null,c.jsx("div",{className:"card-section-rows",children:l.map((h,d)=>c.jsxs(x.Fragment,{children:[c.jsx("div",{className:"card-row",children:h}),d<l.length-1?c.jsx("div",{className:"hairline inset"}):null]},d))}),t?c.jsx("div",{className:"card-section-footer",children:t}):null]})}function $C({style:e}){return c.jsx("div",{className:"hairline",style:e})}function Jt({label:e,detail:t,children:n}){return c.jsxs("div",{className:"value-row",children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3,minWidth:0},children:[c.jsx("span",{style:{color:"var(--text)"},children:e}),t?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",lineHeight:1.35},children:t}):null]}),c.jsx("span",{style:{flex:1,minWidth:12}}),c.jsx("span",{style:{color:"var(--secondary)",display:"flex",alignItems:"center"},children:n})]})}function WC({value:e,onChange:t,prompt:n="Search",inputRef:r}){return c.jsxs("div",{className:"search-field",children:[c.jsx(ae,{name:"magnifyingglass",size:12,color:"var(--secondary)"}),c.jsx("input",{ref:r,value:e,placeholder:n,spellCheck:!1,onChange:l=>t(l.target.value)}),e?c.jsx("button",{"aria-label":"Clear search",onClick:()=>t(""),style:{display:"flex",color:"var(--tertiary)"},children:c.jsx(ae,{name:"xmark.circle.fill",size:12})}):null]})}function G2({expanded:e,onToggle:t,label:n,children:r}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("button",{className:"disclosure-label",onClick:t,"aria-expanded":e,children:[n,c.jsx("span",{style:{flex:1,minWidth:8}}),c.jsx("span",{style:{display:"flex",transform:`rotate(${e?90:0}deg)`,transition:"transform var(--layout)",color:"var(--secondary)"},children:c.jsx(ae,{name:"chevron.right",size:10,weight:"semibold"})})]}),e?r:null]})}function K3({children:e,fill:t="var(--background)",outlined:n=!1,style:r}){return c.jsx("span",{className:"pill",style:{background:n?"transparent":t,boxShadow:n?"inset 0 0 0 1px var(--border)":void 0,...r},children:e})}class Br{#e=new Set;#i=0;#t=!1;changed(){this.#t||(this.#t=!0,queueMicrotask(()=>{this.#t=!1,this.#i++;for(const t of[...this.#e])t()}))}subscribe=t=>(this.#e.add(t),()=>{this.#e.delete(t)});getVersion=()=>this.#i}function cn(e){return x.useSyncExternalStore(e?e.subscribe:FC,e?e.getVersion:KC),e}const FC=()=>()=>{},KC=()=>0;function Y3(e){const t=x.useRef({models:e,version:0});t.current.models=e,x.useSyncExternalStore(x.useCallback(n=>{const r=t.current.models.map(l=>l.subscribe(()=>{t.current.version++,n()}));return()=>r.forEach(l=>l())},[e.length,...e]),()=>t.current.version)}function bi(e,t){const n=new Set;let r=(()=>{try{const l=localStorage.getItem(e);return l===null?t:JSON.parse(l)}catch{return t}})();return window.addEventListener("storage",l=>{if(l.key===e){try{r=l.newValue===null?t:JSON.parse(l.newValue)}catch{r=t}for(const h of n)h()}}),{get:()=>r,set(l){r=l;try{localStorage.setItem(e,JSON.stringify(l))}catch{}for(const h of n)h()},subscribe(l){return n.add(l),()=>{n.delete(l)}}}}function ni(e){return[x.useSyncExternalStore(e.subscribe,e.get),e.set]}const Uf=[11,12,13,14,15,16,18],Ua=12;function YC(e,t){return(t?Uf.find(n=>n>e):[...Uf].reverse().find(n=>n<e))??e}const Rt={textSize:bi("conversationFontSize",Ua),sidebarCompact:bi("sidebarCompact",!1),sidebarWidth:bi("desktopSidebarWidth",296),hiddenComputers:bi("hiddenComputers",""),usageIconStyle:bi("usageIconStyle","character"),onboardingDone:bi("macAccountOnboardingCompleted",!1)};function G3(e){const t=Number.isFinite(e)?Math.min(Math.max(e,11),18):Ua;document.documentElement.style.setProperty("--scale",String(t/Ua)),document.documentElement.style.setProperty("--conversation",`${t}px`),document.documentElement.style.setProperty("--chat",`${t+2}px`),document.documentElement.style.setProperty("--chat-scale",String((t+2)/Ua))}Rt.textSize.subscribe(()=>G3(Rt.textSize.get()));const Z3=x.createContext(null);function ns(){const e=x.useContext(Z3);if(!e)throw new Error("AppContext missing");return cn(e)}const en=x.createContext(null);function Ne(){const e=x.useContext(en);if(!e)throw new Error("StoreContext missing");return cn(e)}function Or(){const e=x.useContext(en);if(!e)throw new Error("StoreContext missing");return e}class Ji extends Error{constructor(t,n){super(n),this.status=t}status;static unreachable(){return new Ji(0,"Can't reach your computer. Is it on and connected to the internet?")}get isTransient(){return this.status===0}}class Z2{constructor(t,n){this.baseURL=t,this.token=n}baseURL;token;async call(t,n,r){try{return await window.codync.host.call(this.baseURL,this.token,t,n,r)}catch(l){const h=l;throw new Ji(h.status??0,h.status===401?"This device isn't allowed on that computer anymore.":h.message)}}stream(t,n,r){return window.codync.host.stream(`${this.baseURL}${t}`,this.token,n,l=>r(l?new Ji(l.status,l.message):null))}}function GC(e){let t;try{t=JSON.parse(e)}catch{return null}const n=t.type;switch(n){case"hello":return{type:n,hostId:t.hostId??"",rev:t.rev??0,usage:t.usage??{providers:[]},screen:zf(t.screen)};case"bot":{const r=t.bot;return!r||typeof r.id!="string"?{type:"undecodable",kind:"bot"}:r.deleted?{type:"botDeleted",id:r.id,rev:r.rev??0}:{type:n,bot:Of(r)}}case"entry":{const r=t.entry;return!r||typeof r.id!="string"||typeof r.botId!="string"?{type:"undecodable",kind:"entry"}:{type:n,entry:{...r,data:r.data??{}}}}case"usage":return t.usage?{type:n,usage:t.usage}:null;case"screen":{const r=zf(t.screen);return r?{type:n,screen:r}:null}case"accessRequests":return{type:n,requests:t.requests??[]};case"cloud":return t.cloud?{type:n,cloud:t.cloud}:null;case"resync":return{type:n};default:return null}}class X2{constructor(t){this.transport=t}transport;call(t,n={},r=2e4){return this.transport.call(t,n,r)}events(t,n,r,l){const h=new URLSearchParams({since:String(t),client:n});return this.transport.stream(`/events?${h}`,d=>{const p=GC(d);p&&r(p)},l)}hello(){return this.call("hello").then(t=>({...t,backends:t.backends??[],screen:zf(t.screen)??void 0}))}async history(t,n,r=100){return(await this.call("history",{botId:t,beforeSeq:n,limit:r})).entries}async thread(t,n){return(await this.call("thread",{botId:t,rootId:n})).entries}async send(t,n,r,l,h){return(await this.call("send",{botId:t,text:n,clientNonce:r,threadId:l,attachments:h})).entry}static uploadChunk=384*1024;async upload(t,n,r,l){let h=0;do{const d=Math.min(h+X2.uploadChunk,l.length);await this.call("upload",{botId:t,uploadId:n,name:r,data:X3(l.subarray(h,d)),offset:h,done:d===l.length},6e4),h=d}while(h<l.length)}async readUpload(t,n){const r=[];let l=0;for(;;){const p=await this.call("readUpload",{botId:t,uploadId:n,offset:l},6e4),g=Q3(p.data);if(!g.length||(r.push(g),l+=g.length,l>=p.size))break}const h=new Uint8Array(l);let d=0;for(const p of r)h.set(p,d),d+=p.length;return h}}function X3(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function Q3(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const C_="2.3.0";function k_(e){let t=e.trim();t.startsWith("v")&&(t=t.slice(1)),t=t.split("-")[0].split("+")[0];const n=t.split(".");if(n.length<1||n.length>3)return null;const r=[];for(const l of n){if(!/^[0-9]+$/.test(l))return null;r.push(Number(l))}for(;r.length<3;)r.push(0);return r}function Pf(e,t){const n=k_(e),r=k_(t);if(!n||!r)return!1;for(let l=0;l<3;l++)if(n[l]!==r[l])return n[l]<r[l];return!1}function ZC(e,t,n){return n&&Pf(e,n)?{kind:"updateApp",minimum:n}:Pf(t,C_)?{kind:"updateHost",version:t,minimum:C_}:null}class XC{values=new Map;listeners=new Set;retired=!1;storage;key;onSaveError;constructor(t,n,r){this.storage=t,this.key=n,this.onSaveError=r;try{const l=JSON.parse(t.getItem(n)??"null");if(Array.isArray(l))for(const h of l)Array.isArray(h)&&h.length===2&&typeof h[0]=="string"&&typeof h[1]=="string"&&this.values.set(h[0],h[1])}catch{}}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});get(t,n=null){return this.values.get(JSON.stringify([t,n]))??""}set(t,n,r){if(this.retired)return;const l=JSON.stringify([t,n]);r?this.values.set(l,r):this.values.delete(l),this.save()}removeBot(t){if(!this.retired){for(const n of this.values.keys())try{JSON.parse(n)[0]===t&&this.values.delete(n)}catch{this.values.delete(n)}this.save()}}clear(){this.retired||(this.values.clear(),this.save())}retire(){this.retired=!0}save(){try{this.storage.setItem(this.key,JSON.stringify([...this.values]))}catch{this.onSaveError?.()}for(const t of this.listeners)t()}}class QC extends Br{constructor(t,n,r,l="mac",h=window.codync.appVersion,d="local"){super(),this.isLoopback=n,this.makeTransport=r,this.clientKind=l,this.appVersion=h,this.contextId=d,this.computer=t,this.composerDrafts=new XC(localStorage,`codync-drafts-v1-${JSON.stringify([d,t.id])}`,()=>this.setError("Couldn't save the draft on this device. Your text is still here; keep this window open until you send or copy it.")),this.loadCache()}isLoopback;makeTransport;clientKind;appVersion;contextId;computer;connection={kind:"connecting"};hostRoute=null;client=null;hello=null;hostVersion=null;bots=new Map;entries=new Map;usage={providers:[]};screen=null;accessRequests=[];cloud=null;historyComplete=new Set;routineDrafts=new Map;composerDrafts;lastError=null;selection=null;answering=new Map;onRosterChanged=null;onComputerChanged=null;waiting=0;rev=0;hostId=null;retired=!1;unreadable=!1;saveTimer=null;cacheStamp=null;get isOffline(){const t=this.connection.kind;return t==="computerOffline"||t==="offline"||t==="unauthorized"}get canQueue(){return!1}get shownConnection(){return this.waiting>0&&this.connection.kind==="online"?{kind:"connecting"}:this.connection}get hostName(){return this.hello?.name??this.computer.name}get mismatch(){if(!this.hostVersion)return null;const t=ZC(this.appVersion,this.hostVersion.version,this.hostVersion.minApp);return t||(this.unreadable&&Pf(this.appVersion,this.hostVersion.version)?{kind:"updateApp",minimum:this.hostVersion.version}:null)}get roster(){return[...this.bots.values()].filter(t=>!t.hidden).sort((t,n)=>t.pinned!==n.pinned?t.pinned?-1:1:n.lastAt-t.lastAt)}get hiddenBots(){return[...this.bots.values()].filter(t=>t.hidden).sort((t,n)=>t.name.localeCompare(n.name))}backendName(t){return this.hello?.backends.find(n=>n.id===t)?.name??JC(t)}chat(t){return(this.entries.get(t)??[]).filter(n=>!n.threadId)}allEntries(t){return this.entries.get(t)??[]}replies(t,n){return(this.entries.get(t)??[]).filter(r=>r.threadId===n)}members(t){return t.members.map(n=>this.bots.get(n)).filter(n=>!!n)}authorName(t){return t&&this.bots.get(t)?.name||"A deleted bot"}currentThinking(t,n){const r=this.allEntries(t);for(let l=r.length-1;l>=0;l--){const h=r[l];if((h.threadId??null)===n){if(h.kind==="user"||h.kind==="agent"&&h.data.final===!0)return null;if(h.kind==="thought"&&h.data.text)return h.data.text}}return null}get connectionLabel(){switch(this.shownConnection.kind){case"online":return this.mismatch?"Needs update":"Connected";case"connecting":return"Connecting…";case"computerOffline":case"offline":return"Offline";case"unauthorized":return"No access";case"unpaired":return"Not paired"}}updateComputer(t){const n=t({...this.computer});JSON.stringify(n)!==JSON.stringify(this.computer)&&(this.computer=n,this.onComputerChanged?.(n),this.changed())}upsert(t){const n=[...this.entries.get(t.botId)??[]],r=n.findIndex(l=>l.id===t.id);if(r>=0){if(t.rev<n[r].rev)return;n[r]=t}else{const l=t.kind==="user"?t.data.clientNonce:void 0,h=l?n.filter(p=>p.id!==`local-${l}`):n,d=h[h.length-1];if(d&&d.seq>t.seq&&t.seq>0){const p=h.findIndex(g=>g.seq>t.seq);h.splice(p<0?h.length:p,0,t)}else h.push(t);this.entries.set(t.botId,h);return}this.entries.set(t.botId,n)}setError(t){this.lastError=t,this.changed()}get cacheKey(){return`codync-mirror-${this.contextId}-${this.computer.id}`}loadCache(){try{const t=localStorage.getItem(this.cacheKey);if(!t)return;const n=JSON.parse(t);this.cacheStamp=n.stamp??"",this.hostId=n.hostId??null,this.rev=n.rev,this.bots=new Map(n.bots.map(l=>[l.id,l]));const r=new Map;for(const l of n.entries)r.set(l.botId,[...r.get(l.botId)??[],l]);this.entries=r}catch{}}scheduleSave(){this.retired||(this.saveTimer&&clearTimeout(this.saveTimer),this.saveTimer=setTimeout(()=>this.saveCache(),2e3))}saveCache(){if(this.retired)return;const t=[];for(const r of this.entries.values())t.push(...r.filter(l=>!l.id.startsWith("local-")).slice(-200)),t.push(...r.filter(l=>l.id.startsWith("local-")&&l.data.status==="failed"));const n={stamp:`${this.appVersion}/${this.hello?.version??""}`,hostId:this.hostId,rev:this.rev,bots:[...this.bots.values()],entries:t};try{localStorage.setItem(this.cacheKey,JSON.stringify(n))}catch{}}}function JC(e){switch(e){case"claude":return"Claude Code";case"codex":return"Codex";case"opencode":return"OpenCode";case"grok":return"Grok Build";case"gemini":return"Gemini CLI";default:return"Custom agent"}}const e8=5e3,E_=1e3,M_=2e4,t8=3e4,za=e=>new Promise(t=>setTimeout(t,e)),i8=(e,t)=>e.kind===t.kind&&JSON.stringify(e)===JSON.stringify(t);class s8 extends QC{heldDrop=null;dropTimer=null;closeEvents=null;eventsLoop=0;rewound=!1;readingViews=new Map;retire(){this.retired=!0,this.composerDrafts.retire(),this.stopTransport(),this.saveTimer&&clearTimeout(this.saveTimer),this.onRosterChanged=null,this.onComputerChanged=null,this.client=null,this.selection=null}start(){this.restartStream()}restartStream(){if(this.retired)return;this.stopTransport(),this.connection.kind!=="online"&&this.setConnection({kind:"connecting"});const t=this.makeTransport();this.client=new X2(t),this.hostRoute=this.isLoopback?"loopback":null,this.runEvents(this.client)}stopTransport(){this.eventsLoop++,this.closeEvents?.(),this.closeEvents=null,this.dropTimer&&clearTimeout(this.dropTimer),this.dropTimer=null,this.heldDrop=null}setConnection(t){const n=t.kind==="connecting"||t.kind==="offline"||t.kind==="computerOffline",r=t.kind==="online"&&(this.connection.kind!=="online"||this.heldDrop!==null),l=this.connection.kind==="connecting"&&n&&t.kind!=="connecting";if(n&&(this.connection.kind==="online"||l)){const h=this.connection.kind==="online"?e8:E_;this.heldDrop=t,this.dropTimer||(this.dropTimer=setTimeout(()=>{this.dropTimer=null;const d=this.heldDrop;this.heldDrop=null,d&&!this.retired&&(this.connection=d,this.changed())},h));return}if(this.dropTimer&&clearTimeout(this.dropTimer),this.dropTimer=null,this.heldDrop=null,i8(t,this.connection)||(this.connection=t,this.changed()),r)for(const h of this.readingViews.values())this.markRead(h.botId,h.thread)}runEvents(t){const n=++this.eventsLoop;let r=1e3;const l=()=>n===this.eventsLoop&&!this.retired,h=async()=>{if(l()){try{if(await this.refreshHello(t),!l())return;if(this.mismatch)return this.setConnection({kind:"online"}),await za(t8),void h();if(this.isLoopback){try{this.accessRequests=(await t.call("accessRequests")).requests}catch{}try{this.cloud=await t.call("cloudStatus")}catch{}this.changed()}if(!l())return;await new Promise((d,p)=>{this.closeEvents=t.events(this.rev,this.clientKind,g=>{l()&&(this.setConnection({kind:"online"}),r=1e3,this.apply(g))},g=>g?p(g):d())})}catch(d){if(!l())return;const p=d instanceof Error?d.message:String(d);if(this.setConnection({kind:"offline",message:p}),d instanceof Ji&&d.status===401)return}l()&&(await za(r),r=Math.min(r*2,2e4),h())}};h()}restartEvents(){this.client&&(this.closeEvents?.(),this.runEvents(this.client))}async refreshHello(t){const n=await t.hello();this.retired||(this.hello=n,this.noteHostVersion({version:n.version,minApp:n.minApp}),this.isLoopback&&this.updateComputer(r=>({...r,name:n.name,device:n.device??r.device})),this.changed())}noteHostVersion(t){(this.cacheStamp!==null&&this.cacheStamp!==`${this.appVersion}/${t.version}`||this.hostVersion&&this.hostVersion.version!==t.version)&&(this.rev=0,this.rewound=!1,this.unreadable=!1),this.cacheStamp=null,this.hostVersion=t}apply(t){switch(t.type){case"hello":this.hostId&&this.hostId!==t.hostId&&this.resetMirror(),this.hostId=t.hostId,this.usage=t.usage,this.screen=t.screen,t.rev<this.rev&&(this.rev=0);break;case"bot":this.bots.set(t.bot.id,t.bot),this.bump(t.bot.rev),this.onRosterChanged?.(),t.bot.unread>0&&this.acknowledgeVisible(t.bot.id);break;case"botDeleted":this.composerDrafts.removeBot(t.id),this.bots.delete(t.id),this.entries.delete(t.id),this.bump(t.rev),this.selection===t.id&&(this.selection=null),this.onRosterChanged?.();break;case"entry":this.upsert(t.entry),this.bump(t.entry.rev),this.acknowledgeVisible(t.entry.botId,t.entry);break;case"usage":this.usage=t.usage;break;case"screen":this.screen=t.screen;break;case"accessRequests":this.accessRequests=t.requests;break;case"cloud":this.cloud=t.cloud;break;case"resync":this.restartEvents();break;case"undecodable":this.rewound?this.unreadable||(this.unreadable=!0,this.mismatch&&this.restartEvents()):(this.rewound=!0,this.rev=0,this.restartEvents());break}this.changed(),this.scheduleSave()}resetMirror(){this.composerDrafts.clear(),this.bots=new Map;const t=new Map;for(const[n,r]of this.entries){const l=r.filter(h=>h.id.startsWith("local-"));l.length&&t.set(n,l)}this.entries=t,this.selection=null,this.onRosterChanged?.(),this.rev=0,this.hostId=null,this.historyComplete=new Set,this.screen=null,this.saveCache()}bump(t){this.rev=Math.max(this.rev,t)}get live(){return this.connection.kind==="online"&&!this.heldDrop&&!this.retired?this.client:null}async ready(t=Date.now()+M_){let n=!1,r=!1;try{for(;!this.retired;){if(this.live)return this.live;switch(this.connection.kind){case"online":case"connecting":break;case"offline":if(!r){r=!0,this.restartStream();break}throw Ji.unreachable();case"unpaired":throw Ji.unreachable();case"computerOffline":throw new Ji(0,"Your computer is offline.");case"unauthorized":throw new Ji(401,this.connection.message)}if(Date.now()>=t)break;n||(n=!0,this.waiting++,this.changed()),await za(100)}throw Ji.unreachable()}finally{n&&(this.waiting--,this.changed())}}async withLink(t,n=!1){const r=Date.now()+M_;for(;;){const l=await this.ready(r);try{return await t(l)}catch(h){if(n&&h instanceof Ji&&h.isTransient&&Date.now()<r){await za(500);continue}throw h}}}perform(t,n=!1){this.withLink(t,n).catch(r=>{this.lastError=r instanceof Error?r.message:String(r),this.changed()})}setReading(t,n,r,l){l?(this.readingViews.set(t,{botId:n,thread:r}),this.connection.kind==="online"&&this.markRead(n,r)):this.readingViews.delete(t)}acknowledgeVisible(t,n){if(this.connection.kind!=="online")return;const r=new Set;for(const l of this.readingViews.values()){if(l.botId!==t||n&&(!_o(n)||(n.threadId??null)!==l.thread))continue;const h=`${l.botId}/${l.thread}`;r.has(h)||(r.add(h),this.markRead(t,l.thread))}}markRead(t,n=null){(async()=>{this.live||await za(E_);const r=this.live;if(r)try{await r.call("markRead",{botId:t,threadId:n,all:!1})}catch{}})()}}const n8=100*1024*1024,r8=["👍","❤️","😂","🎉","👀","✅"];class J3 extends s8{outgoingFiles=new Map;send(t,n,r=null,l=[],h=crypto.randomUUID()){const d=t.trim();if(!d&&!l.length||this.retired)return;const p={text:d,status:"sending",clientNonce:h};l.length&&(p.attachments=l.map(g=>({id:g.id,name:g.name,size:g.data.length})),this.outgoingFiles.set(h,l)),this.upsert({id:`local-${h}`,seq:Number.MAX_SAFE_INTEGER,botId:n,threadId:r,rev:0,kind:"user",turn:0,data:p,createdAt:Date.now(),updatedAt:0}),this.changed(),(async()=>{try{const g=await this.withLink(async m=>{let v=null;const _=this.outgoingFiles.get(h);if(_){v=[];for(const S of _){const w=crypto.randomUUID();await m.upload(n,w,S.name,S.data),j_(w,S.data),v.push(w)}}return m.send(n,d,h,r,v)},!0);this.outgoingFiles.delete(h),this.upsert(g),this.changed()}catch(g){this.outgoingFiles.has(h)&&(this.lastError=`Couldn't send the files: ${g instanceof Error?g.message:g}`),this.markLocal(h,n,"failed")}})()}retry(t){const n=t.data.clientNonce&&this.outgoingFiles.get(t.data.clientNonce)||[],r=t.data.text??"";!r&&!n.length||(this.entries.set(t.botId,this.allEntries(t.botId).filter(l=>l.id!==t.id)),this.send(r,t.botId,t.threadId??null,n,t.data.clientNonce??crypto.randomUUID()))}discard(t){t.data.clientNonce&&this.outgoingFiles.delete(t.data.clientNonce),this.entries.set(t.botId,this.allEntries(t.botId).filter(n=>n.id!==t.id)),this.changed(),this.scheduleSave()}cancelQueued(t){}markLocal(t,n,r){const l=this.entries.get(n),h=l?.findIndex(p=>p.id===`local-${t}`)??-1;if(!l||h<0)return;const d=[...l];d[h]={...d[h],data:{...d[h].data,status:r}},this.entries.set(n,d),this.changed(),this.scheduleSave()}async attachmentData(t,n){const r=eS.get(t);if(r)return r;const l=this.live;if(!l)return null;try{const h=await l.readUpload(n,t);return j_(t,h),h}catch{return null}}stop(t){this.perform(n=>n.call("stop",{botId:t}),!0)}newSession(t){this.perform(n=>n.call("newSession",{botId:t}))}logCall(t,n){this.perform(r=>r.call("logCall",{botId:t,seconds:n}))}screenTakeover(t){this.perform(async n=>{this.screen=await n.call("screenTakeover",{on:t}),this.changed()},!0)}async setScreenEnabled(t){this.screen=await(await this.ready()).call("setScreenEnabled",{enabled:t}),this.changed()}react(t,n){const r=this.entries.get(t.botId),l=r?.findIndex(g=>g.id===t.id)??-1;if(!r||l<0)return;const h=[...r[l].data.reactions??[]],d=h.indexOf(n);d>=0?h.splice(d,1):h.push(n);const p=[...r];p[l]={...p[l],data:{...p[l].data,reactions:h}},this.entries.set(t.botId,p),this.changed(),this.perform(async g=>{const m=await g.call("react",{entryId:t.id,emoji:n});this.upsert(m.entry),this.changed()})}respond(t,n){this.answering.has(t.id)||(this.answering.set(t.id,n??""),this.changed(),(async()=>{try{await this.withLink(r=>r.call("respondPermission",{entryId:t.id,optionId:n}),!0),await za(2e3)}catch(r){this.lastError=r instanceof Error?r.message:String(r)}this.answering.delete(t.id),this.changed()})())}markAllRead(t){const n=this.bots.get(t);!n||n.unread<=0||(this.bots.set(t,{...n,unread:0}),this.changed(),this.perform(r=>r.call("markRead",{botId:t,threadId:null,all:!0}),!0))}patchBot(t,n){const r=this.bots.get(t.id);r&&this.bots.set(t.id,{...r,...n}),this.changed(),this.perform(l=>l.call("updateBot",{...a8(t),...n}),!0)}setPinned(t,n){this.patchBot(t,{pinned:n})}setHidden(t,n){this.patchBot(t,{hidden:n})}delete(t){this.composerDrafts.removeBot(t.id),this.bots.delete(t.id),this.entries.delete(t.id),this.onRosterChanged?.(),this.changed(),this.perform(n=>n.call("deleteBot",{botId:t.id}),!0)}async createGroup(t,n,r){const l={kind:"group",name:t,description:n,members:r},h=await(await this.ready()).call("createBot",l);return this.bots.set(h.bot.id,h.bot),this.selection=h.bot.id,this.onRosterChanged?.(),this.changed(),h.bot}async updateGroup(t){const n=await(await this.ready()).call("updateBot",t);this.bots.set(n.bot.id,n.bot),this.changed()}async loadThread(t,n){if(this.client)try{for(const r of await this.client.thread(t,n))this.upsert(r);this.changed()}catch{}}async save(t){const n=await this.ready(),r=t.id?await n.call("updateBot",{...t,model:t.model??null}):await n.call("createBot",t);return this.bots.set(r.bot.id,r.bot),this.onRosterChanged?.(),this.changed(),r.bot}async refreshBackends(){if(!(!this.client||!this.hello))try{const t=await this.client.call("refreshBackends",{},6e4);this.hello={...this.hello,backends:t.backends},this.changed()}catch{}}async listDirs(t){return(await this.ready()).call("listDirs",{path:t})}async refreshUsage(){if(!(this.retired||!this.client))try{this.usage=await this.client.call("usage",{refresh:!0}),this.changed()}catch{}}async loadOlder(t){if(!this.client||this.historyComplete.has(t))return;const n=this.chat(t).find(r=>r.seq>0&&r.seq!==Number.MAX_SAFE_INTEGER)?.seq??Number.MAX_SAFE_INTEGER;try{const r=await this.client.history(t,n,100);r.length<100&&this.historyComplete.add(t);for(const l of r)this.upsert(l);this.changed()}catch{}}setSelection(t){this.selection=t,this.changed()}consumeRoutineDraft(t){const n=this.routineDrafts.get(t);return n!==void 0&&(this.routineDrafts.delete(t),this.changed()),n}setRoutineDraft(t,n){this.routineDrafts.set(t,n),this.changed()}}function a8(e){return{id:e.id,name:e.name,description:e.description,avatarColor:e.avatarColor,avatarShape:e.avatarShape,backend:e.backend,command:e.command??null,cwd:e.managedWorkspace?"":e.cwd,permission:e.permission,model:e.model??null,pinned:e.pinned,hidden:e.hidden,notify:e.notify??null,connectors:e.connectors,skills:e.skills,computer:e.computer}}const eS=new Map;function j_(e,t){eS.set(e,t)}class l8 extends Br{isBusy=!1;isReady=!0;isConfigured=!1;errorMessage=null;user=null;cloudURL=null;get isSignedIn(){return this.user!==null}async start(){const t=await window.codync.account.state();this.apply(t),window.codync.account.onChange(n=>this.apply(n))}apply(t){this.isReady=t.ready,this.isConfigured=t.configured,this.isBusy=t.busy,this.errorMessage=t.error,this.user=t.user,this.cloudURL=t.cloudURL,this.changed()}async signIn(t){await window.codync.account.signIn(t)}async signOut(){await window.codync.account.signOut()}sessionToken(){return window.codync.account.token()}}const Zn=new l8;function Ya(){return cn(Zn)}class tS extends Error{constructor(t,n,r){super(n==="requestExpired"?"The request expired. Ask again.":n==="accountDeleted"?"This account was deleted.":n==="rateLimited"?"Too many requests. Try again in a little while.":r??`Codync cloud error (${n})`),this.status=t,this.code=n}status;code;get isTransient(){return this.status===0||this.status>=500||this.status===429||this.status===401}}async function Es(e,t,n,r=!1){const l=await window.codync.cloud.request(e,t,n,r);if(!l.ok)throw new tS(l.error.status,l.error.code,l.error.message);return l.value}const Aa=bi("cloudDefaultApplied",[]),U0=bi("claimedComputerIds",[]),P0=e=>bi(`keptOutOfAccount.${e}`,[]);class o8 extends Br{constructor(t){super(),this.app=t,Zn.subscribe(()=>this.tick()),t.subscribe(()=>this.tick())}app;computers=[];registeredFor=null;enablingCloud=!1;autoClaiming=!1;fail(t,n=!1){n||t instanceof tS&&t.isTransient||this.app.setError(t instanceof Error?t.message:String(t))}get userId(){return Zn.user?.userId??null}tick(){const t=this.userId;if(!t){this.computers.length&&(this.computers=[],this.changed()),this.registeredFor=null;return}this.registeredFor!==t&&(this.registeredFor=t,(async()=>{try{await Es("POST","v1/devices",{name:await c8(),platform:window.codync.platform==="darwin"?"macos":"linux"},!0)}catch(n){this.fail(n)}await this.refresh()})()),this.applyCloudDefault(),this.autoClaim()}async refresh(){if(this.userId)try{const t=await Es("GET","v1/computers",void 0,!0);this.computers=t.computers,this.changed()}catch(t){this.fail(t)}}applyCloudDefault(){const t=this.app.local;if(!Zn.cloudURL||!t||t.connection.kind!=="online"||!t.cloud)return;const n=t.computer.id;Aa.get().includes(n)||(Aa.set([...Aa.get(),n]),!(t.cloud.enabled||this.enablingCloud)&&(this.enablingCloud=!0,this.enableCloud(t).catch(()=>{}).finally(()=>this.enablingCloud=!1)))}autoClaim(){const t=this.userId,n=this.app.local;t&&n&&n.cloud?.owner?.userId===t&&U0.set([n.computer.id]);const r=this.autoClaimTarget;!r||this.autoClaiming||(this.autoClaiming=!0,(async()=>{let l=3e4;for(;!await this.claim(r,!0)&&(await new Promise(h=>setTimeout(h,l)),l=Math.min(l*2,6e5),this.autoClaimTarget?.computer.id===r.computer.id););this.autoClaiming=!1})())}get autoClaimTarget(){const t=this.userId,n=this.app.local;if(!t||!n||n.connection.kind!=="online")return null;const r=n.cloud;return!r?.enabled||r.owner||P0(t).get().includes(n.computer.id)?null:n}async claim(t,n=!1){const r=this.userId;if(!r||!t.client)return n||this.app.setError("Sign in first."),!1;const l=P0(r);l.set(l.get().filter(h=>h!==t.computer.id));try{const h=await t.ready();t.cloud?.enabled||await this.enableCloud(t);const d=await Es("POST","v1/claims",{}),p=await h.call("claimSign",{claimId:d.claimId,nonce:d.nonce,userId:r});return await Es("POST",`v1/claims/${d.claimId}/complete`,p),await this.refresh(),t===this.app.local&&await this.forgetEarlierIdentities(t.computer.id),!0}catch(h){return this.fail(h,n),!1}}async forgetEarlierIdentities(t){const n=new Set(U0.get().filter(r=>r!==t));for(const r of this.computers)n.has(r.computerId)&&!r.online&&await this.removeFromAccount(r.computerId);U0.set([t])}async unclaim(t){const n=this.userId;if(n){const r=P0(n);r.get().includes(t.computer.id)||r.set([...r.get(),t.computer.id])}try{await(await t.ready()).call("unclaim",{},3e4),await this.refresh()}catch(r){this.fail(r)}}async setCloud(t,n){Aa.get().includes(t.computer.id)||Aa.set([...Aa.get(),t.computer.id]);try{n?await this.enableCloud(t):await(await t.ready()).call("setCloud",{enabled:!1},3e4)}catch(r){this.fail(r)}}async enableCloud(t){return(await t.ready()).call("setCloud",{enabled:!0},3e4)}async removeFromAccount(t){try{await Es("DELETE",`v1/computers/${t}`),await this.refresh()}catch(n){this.fail(n)}}isOlderCopy(t){return t.online?!1:this.app.computers.some(n=>n.id!==t.computerId&&n.name===t.name)||this.computers.some(n=>n.computerId!==t.computerId&&n.name===t.name&&(this.app.store(n.computerId)!==null||!!n.online))}devices(){return Es("GET","v1/devices").then(t=>t.devices)}revokeDevice(t){return Es("DELETE",`v1/devices/${t}`)}grants(t){return Es("GET",`v1/computers/${t}/grants`).then(n=>n.grants)}revokeGrant(t,n){return Es("DELETE",`v1/computers/${t}/grants/${n}`)}async renameComputer(t,n){await Es("PATCH",`v1/computers/${t}`,{name:n}),await this.refresh()}}async function c8(){return window.codync.computerName||(window.codync.platform==="darwin"?"Mac":"Linux")}const T_=e=>`${e.computerId}/${e.botId}`,D_=e=>{const t=e.indexOf("/");return t<0?null:{computerId:e.slice(0,t),botId:e.slice(t+1)}},R_=(e,t)=>!!e&&!!t&&e.computerId===t.computerId&&e.botId===t.botId;class h8 extends Br{constructor(t=!0){super(),this.mirrors=t,this.cloud=new o8(this)}mirrors;host={state:{kind:"starting"},local:null,dev:!1,logPath:""};computers=[];stores=new Map;selection=null;lastError=null;screenNeedsApproval=!1;screenError=null;screenSynced=!1;deferred=new Set;storeSubscriptions=new Map;cloud;setError(t){this.lastError=t,this.changed()}async start(){window.codync.host.onChange(t=>this.setHost(t)),this.setHost(await window.codync.host.snapshot())}setHost(t){const n=this.host.local;this.host=t;const r=t.local;if(!this.mirrors)return this.changed();if(r&&(n?.computerId!==r.computerId||n.token!==r.token||!this.stores.has(r.computerId))){n&&n.computerId!==r.computerId&&this.detach(n.computerId);const h=this.computers.find(p=>p.id===r.computerId)??{id:r.computerId,name:"This computer",signKey:"",urls:[]},d=new J3(h,!0,()=>new Z2(r.baseURL,r.token));this.attach(h,d),d.subscribe(()=>this.syncScreen(d))}else!r&&n&&this.detach(n.computerId);this.changed()}get local(){return this.host.local?this.stores.get(this.host.local.computerId)??null:null}attach(t,n){this.detach(t.id),this.computers=[...this.computers.filter(r=>r.id!==t.id),t],this.stores.set(t.id,n),n.onComputerChanged=r=>{this.computers=this.computers.map(l=>l.id===r.id?r:l),this.changed()},n.onRosterChanged=()=>this.changed(),this.storeSubscriptions.set(t.id,n.subscribe(()=>{if(n.selection){const r=n.selection;n.selection=null,this.select({computerId:t.id,botId:r})}})),n.start(),this.changed()}detach(t){this.storeSubscriptions.get(t)?.(),this.storeSubscriptions.delete(t),this.stores.get(t)?.retire(),this.stores.delete(t),this.computers=this.computers.filter(n=>n.id!==t),this.selection?.computerId===t&&(this.selection=null),this.changed()}store(t){return this.stores.get(t)??null}get roster(){const t=[];for(const n of this.computers){const r=this.stores.get(n.id);if(r)for(const l of r.roster)t.push({ref:{computerId:n.id,botId:l.id},bot:l,computer:r.computer,store:r})}return t.sort((n,r)=>n.bot.pinned!==r.bot.pinned?n.bot.pinned?-1:1:r.bot.lastAt-n.bot.lastAt)}select(t){this.selection=t,this.changed()}get selectedStore(){return this.selection?this.store(this.selection.computerId):null}get managedStores(){return[...this.stores.values()].filter(t=>t.isLoopback)}get approvals(){return this.managedStores.flatMap(t=>t.accessRequests.map(n=>({id:`${t.computer.id}/${n.requestId}`,store:t,request:n})))}get currentApproval(){return this.approvals.find(t=>!this.deferred.has(A_(t)))??null}deferApproval(t){this.deferred.add(A_(t)),this.changed()}reviewApprovals(){this.deferred.clear(),this.changed()}async decide(t,n){await(await t.store.ready()).call("decideAccessRequest",{requestId:t.request.requestId,approve:n},3e4)}get needsAttention(){return this.roster.some(t=>t.bot.status==="needsInput")||this.approvals.length>0}get working(){return this.roster.filter(t=>t.bot.status==="working"||t.bot.status==="needsInput").length}get errorMessage(){if(this.lastError)return this.lastError;for(const t of this.stores.values())if(t.lastError)return t.lastError;return null}async setRemoteScreen(t){const n=this.local;if(n){try{this.screenNeedsApproval=(await window.codync.app.setScreenAgent(t)).needsApproval,await n.setScreenEnabled(t),this.screenError=null}catch(r){this.screenError=r instanceof Error?r.message:String(r)}this.changed()}}syncScreen(t){this.screenSynced||!t.screen||(this.screenSynced=!0,window.codync.app.syncScreenAgent(t.screen.enabled).then(n=>{this.screenNeedsApproval=n.needsApproval,this.changed()}))}clearErrors(){this.lastError=null;for(const t of this.stores.values())t.lastError=null;this.changed()}}const A_=e=>`${e.id}/${e.request.code??""}`;function u8(e,t){const n=t<40;switch(e){case"working":return n?3.9:1.885;case"searching":return n?2.665:2.015;case"listening":return n?3.998:4.388;case"connecting":return n?6.63:3.315}}function Q2(e,t,n,r){const l=Math.sin(e),h=Math.cos(e),d=Math.sin(t),p=Math.cos(t);return g=>{const m=g[0]*h+g[2]*l,v=-g[0]*l+g[2]*h;return[n/2+m*r,n/2-(g[1]*p-v*d)*r,g[1]*d+v*p]}}const tn=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)};function q0(e,t){const n=Math.floor(e),r=Math.floor(t),l=e-n,h=t-r,d=l*l*(3-2*l),p=h*h*(3-2*h),g=tn(n,r),m=tn(n+1,r),v=tn(n,r+1),_=tn(n+1,r+1);return g+(m-g)*d+(v-g)*p+(g-m-v+_)*d*p}const wh=e=>Math.hypot(e[0],e[1],e[2]),ps=(e,t)=>[e[0]*t,e[1]*t,e[2]*t],qf=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]],N_=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]];function d8(e,t){const n=e<40,r=e/2*.82,l=Q2(t*.12,.3,e,1),h=Math.pow(e/300,.6),d=n?2.4:1,p=n?3:12,g=n?10:40,m=[];for(let v=0;v<p;v++){const _=tn(v,1.7),S=tn(v,5.2),w=tn(v,8.9),b=r*(.45+.52*_),k=_*2*Math.PI,E=Math.acos(2*S-1),j=[Math.sin(E)*Math.cos(k),Math.cos(E),Math.sin(E)*Math.sin(k)];let V=[-j[1],j[0],0];V=ps(V,1/Math.max(1e-6,wh(V)));const A=[-j[2]*V[1],j[2]*V[0],j[0]*V[1]-j[1]*V[0]],z=(.25+.55*w)*(w>.5?1:-1);for(let F=0;F<g;F++){const R=F/g*2*Math.PI,I=l(ps(qf(ps(V,Math.cos(R)),ps(A,Math.sin(R))),b)),q=(I[2]/b+1)/2;m.push({x:I[0],y:I[1],z:I[2],radius:.9*d*h,white:.72,alpha:.5*(.4+.6*q)})}for(let F=0;F<3;F++){const R=t*z+F/3*2*Math.PI+S*6,I=l(ps(qf(ps(V,Math.cos(R)),ps(A,Math.sin(R))),b)),q=(I[2]/b+1)/2;m.push({x:I[0],y:I[1],z:I[2],radius:(1.2+1.6*q)*d*h,white:.3-.22*q,alpha:1})}}return{dots:m,lines:[]}}function f8(e,t,n){const r=e<40,l=Math.pow(e/300,.6),h=n?r?5:9:r?6:11,d=n?r?13:23:r?14:29,p=n?r?1.6:1:r?1.75:1.15,g=e/2*(n?.874:.82),m=n?.38:.4+.06*Math.sin(t*.35),v=Q2(t*(n?.18:.5),m,e,n?1:g),_=t*(.5+1.2*(r?4.335:4.08)),S=[];for(let w=0;w<=h;w++){const b=-Math.PI/2+w/h*Math.PI,k=Math.cos(b),E=Math.sin(b),j=.62*Math.sin(t*2.1-w*.52)+.38*Math.sin(t*1.27+w*.83),V=n?g*(.88+.105*j):1,A=Math.max(1,Math.round(Math.abs(k)*d));for(let z=0;z<A;z++){const F=z/A*2*Math.PI,R=v(ps([k*Math.cos(F),E,k*Math.sin(F)],V)),I=(R[2]/(n?g:1)+1)/2;if(n){const q=Math.max(0,j);S.push({x:R[0],y:R[1],z:R[2],radius:(.6+1.7*I)*p*(1+.4*q)*l,white:.66-.56*I-.1*q,alpha:1})}else{const q=F+t*.5-_,U=Math.atan2(Math.sin(q),Math.cos(q)),Y=Math.exp(-(U*U)/.18)*Math.max(0,R[2]);S.push({x:R[0],y:R[1],z:R[2],radius:((.6+1.7*I)*p+Y)*l,white:.62-.54*I,alpha:.45+.55*Math.min(1,Y)})}}}return{dots:S,lines:[]}}function p8(e,t){const n=e<40,r=Math.pow(e/300,.6),l=n?8:41,h=n?1:7,d=n?1.52:.95,p=.72,g=Q2(t*.12,.32,e,e/2*.8),m=Math.PI*(3-Math.sqrt(5)),v=[];for(let w=0;w<l;w++){const b=1-2*(w+.5)/l,k=Math.sqrt(1-b*b),E=w*m,j=[k*Math.cos(E),b,k*Math.sin(E)];j[0]+=.3*(q0(w*.31+9,t*.24)-.5)*2,j[1]+=.3*(q0(w*.53+27,t*.21)-.5)*2,j[2]+=.3*(q0(w*.77+55,t*.27)-.5)*2,v.push(ps(j,1/wh(j)))}const _=[],S=[];for(let w=0;w<l;w++){for(let j=w+1;j<l;j++){const V=wh(N_(v[w],v[j]));if(V>=p)continue;const A=g(v[w]),z=g(v[j]),F=((A[2]+z[2])/2+1)/2;S.push({x1:A[0],y1:A[1],x2:z[0],y2:z[1],white:.42,alpha:(1-V/p)*(.3+.55*F),width:Math.max(.6,.8*r)})}const b=g(v[w]),k=(b[2]+1)/2,E=1+.25*Math.sin(t*1.4+w*2.7);_.push({x:b[0],y:b[1],z:b[2],radius:(1.4+1.8*k)*d*E*r,white:.55-.45*k,alpha:1})}for(let w=0;w<h;w++){const b=Math.floor(t*.55+w*7.31),k=Math.floor(tn(b,w*3.1+1.7)*l),E=Math.floor(tn(b,w*5.7+4.2)*l);if(k===E)continue;const j=t*.55+w*7.31,V=j-Math.floor(j),A=qf(v[k],ps(N_(v[E],v[k]),V)),z=g(ps(A,1/Math.max(1e-6,wh(A)))),F=(z[2]+1)/2;_.push({x:z[0],y:z[1],z:z[2],radius:(1.4*1.5+1.8*F)*d*r,white:.05,alpha:.5+.5*F})}return{dots:_,lines:S}}function g8(e,t,n){const r=e==="working"?d8(t,n):e==="connecting"?p8(t,n):f8(t,n,e==="listening");return{dots:r.dots.filter(l=>l.alpha>=.02).map(l=>({...l,radius:Math.max(.3,l.radius)})).sort((l,h)=>l.z-h.z),lines:r.lines.filter(l=>l.alpha>=.02)}}const L_=(e,t)=>(1-Math.min(1,Math.max(0,e)))*t;function on({state:e="working",size:t=16,color:n="var(--text)",animated:r=!0}){const l=x.useRef(null),h=Ka(),d=F2();return x.useEffect(()=>{const p=l.current;if(!p)return;const g=window.devicePixelRatio||1;p.width=Math.round(t*g),p.height=Math.round(t*g);const m=p.getContext("2d"),v=getComputedStyle(p).color,_=r&&!h,S=performance.now();let w=0,b=0;const k=E=>{if(_&&E-b<1e3/30){w=requestAnimationFrame(k);return}b=E;const j=.6+(_?(E-S)/1e3*u8(e,t):0),V=g8(e,t,j);m.setTransform(g,0,0,g,0,0),m.clearRect(0,0,t,t),m.strokeStyle=v,m.fillStyle=v;for(const A of V.lines)m.globalAlpha=L_(A.white,A.alpha),m.lineWidth=A.width,m.beginPath(),m.moveTo(A.x1,A.y1),m.lineTo(A.x2,A.y2),m.stroke();for(const A of V.dots)m.globalAlpha=L_(A.white,A.alpha),m.beginPath(),m.arc(A.x,A.y,A.radius,0,Math.PI*2),m.fill();m.globalAlpha=1,_&&(w=requestAnimationFrame(k))};return w=requestAnimationFrame(k),()=>cancelAnimationFrame(w)},[e,t,r,h,n,d]),c.jsx("canvas",{ref:l,"aria-hidden":!0,style:{width:t,height:t,color:n,display:"block",flex:"none"}})}const m8=x.memo(function({bot:t,store:n,compact:r,usingComputer:l,members:h}){return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:r?0:8,padding:"6px 0",width:"100%",justifyContent:r?"center":"flex-start"},children:[c.jsx(BC,{bot:t,members:h,size:30}),c.jsxs("div",{"aria-hidden":r,style:{display:"flex",flexDirection:"column",gap:1,minWidth:0,overflow:"hidden",width:r?0:void 0,flex:r?"none":1,opacity:r?0:1,transition:"opacity var(--layout)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:4,minWidth:0},children:[t.pinned?c.jsx(ae,{name:"pin.fill",size:10,color:"var(--tertiary)"}):null,c.jsx("span",{style:{...B("compactBody","semibold"),color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.name}),l?c.jsx(ae,{name:"cursorarrow.motionlines",size:10,color:"var(--accent)",title:"Using the computer"}):null]}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0},children:[c.jsx("div",{style:{flex:1,minWidth:0,display:"flex"},children:c.jsx(v8,{bot:t,store:n})}),t.unread>0?c.jsx("span",{style:{...B("caption2","semibold"),color:"var(--on-accent)",background:"var(--accent-fill)",borderRadius:999,padding:"0 6px",minWidth:18,height:18,display:"grid",placeItems:"center",flex:"none"},children:t.unread}):null]})]})]})}),B_=e=>{const t=e.indexOf(``);return t<0?e:`${e.slice(0,t)}…`},oh={...B("compactSecondary"),whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:0};function v8({bot:e,store:t}){return ln(e)?c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--warning)",minWidth:0},children:[c.jsx(on,{state:"listening",size:16,color:"var(--warning)"}),c.jsx("span",{style:oh,children:e.activity||"Needs your approval"})]}):Jn(e)?c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--secondary)",minWidth:0},children:[c.jsx(on,{size:13,color:"var(--secondary)"}),c.jsx("span",{style:oh,children:e.activity||"Working…"})]}):e.status==="error"?c.jsx("span",{style:{...oh,color:"var(--danger)"},children:B_(e.lastMessage??"Something went wrong")}):c.jsx("span",{style:{...oh,color:"var(--secondary)"},children:B_(e.lastMessage??`${t.backendName(e.backend)} · ${bo(e)}`)})}function iS(e,t){const n=new Set(t.split(",").filter(Boolean)),r=e.filter(d=>!n.has(d)),l=r.length?r:e,h=d=>[...d].sort().join(",");return{shown:l,toggling(d){if(!e.includes(d))return h(new Set(e.filter(g=>!l.includes(g))));const p=new Set(l);return p.has(d)?p.size>1&&p.delete(d):p.add(d),h(new Set(e.filter(g=>!p.has(g))))},only(d){return e.includes(d)?h(new Set(e.filter(p=>p!==d))):""}}}function _8(e){if(!e.length)return"Computers";const t=e.filter(n=>n.kind==="online").length;return t===e.length?`${t} connected`:t>0?`${t}/${e.length} connected`:e.some(n=>n.kind==="connecting")?"Connecting…":e.every(n=>n.kind==="unauthorized")?"No access":e.every(n=>n.kind==="unpaired")?"Not paired":`${e.length} offline`}function O_({hidden:e,setHidden:t,manage:n,compact:r=!1}){const l=ns(),h=iS(l.computers.map(v=>v.id),e),d=h.shown.map(v=>l.store(v)).filter(v=>!!v),p=_8(d.map(v=>v.shownConnection)),g=v=>{const _=l.store(v.id);return _?`${_.hostName} · ${_.connectionLabel}`:v.name},m=()=>{const v=[{title:"All computers",selected:h.shown.length===l.computers.length,action:()=>t("")}];for(const _ of l.computers)v.push({title:g(_),selected:h.shown.includes(_.id),action:()=>t(h.toggling(_.id))});return l.computers.length>1&&l.computers.forEach((_,S)=>v.push({title:`Only ${_.name}`,divider:S===0,action:()=>t(h.only(_.id))})),d.length&&v.push({title:"Reconnect",icon:"arrow.clockwise",divider:!0,action:()=>d.forEach(_=>_.restartStream())}),v.push({title:"Manage computers",icon:"desktopcomputer",action:n}),v};return c.jsxs(Yh,{items:m,title:p,style:{display:"flex",alignItems:"center",gap:4,padding:"6px 0",...B(12,"medium"),color:"var(--secondary)"},children:[r?c.jsx(ae,{name:"desktopcomputer",size:12,weight:"medium"}):c.jsx("span",{style:{whiteSpace:"nowrap"},"aria-label":`Computers, ${p}. Filter conversations`,children:p}),c.jsx(ae,{name:"chevron.down",size:8,weight:"semibold"})]})}const z_={title(e,t){return e.kind==="updateApp"?"Update this app":`Update Codync on ${t}`},detail(e,t,n,r,l=!0){if(e.kind==="updateApp")return`${n?`${t} runs Codync ${n} and`:t} needs this app to be ${e.minimum} or newer. Your chats are safe on the computer.`;const h=r==="macos"?"Open Codync on that Mac and choose Check for Updates.":r==="linux"?"Run codync-host update there.":"Update Codync on that computer.",d=`${t} runs Codync ${e.version}; this app needs ${e.minimum} or newer.`;return l?`${d} ${h}`:d}};function J2(){const e=ns(),t=Ne(),n=t.mismatch;if(!n)return null;const r=n.kind==="updateApp"?["Update Codync",()=>window.codync.updates.check()]:t===e.local&&!e.host.dev&&window.codync.platform==="darwin"?[`Update ${t.hostName}`,()=>window.codync.host.restart()]:null;return c.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12,padding:14,background:"var(--surface)",borderRadius:16},children:[c.jsx(ae,{name:"arrow.down.circle",size:15,color:"var(--warning)"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,flex:1,minWidth:0},children:[c.jsx("div",{style:{...B("subheadline","semibold"),color:"var(--text)"},children:z_.title(n,t.hostName)}),c.jsx("div",{style:{...B("footnote"),color:"var(--secondary)"},children:z_.detail(n,t.hostName,t.hostVersion?.version,t.hello?.os,r===null)}),r?c.jsx(Fe,{onClick:r[1],style:{marginTop:4,alignSelf:"flex-start"},children:r[0]}):null]})]})}function Vf(e){const t=[];let n=null,r=null;for(const l of e){if(!_o(l))continue;const h=l.kind==="user"&&l.data.clientNonce?`user-${l.data.clientNonce}`:l.id;(n===null||l.createdAt-n>36e5)&&(t.push({id:`sep-${h}`,kind:"separator",date:l.createdAt}),r=null);const d=l.kind==="user"?"user":l.kind==="agent"?`agent:${l.data.author??""}`:l.kind;t.push({id:h,kind:"entry",entry:l,groupStart:d!==r}),r=d==="user"||l.kind==="agent"?d:null,n=l.createdAt}return t}function sS(e,t){const n=x.useRef(null),r=x.useRef(new Set);n.current===null&&(n.current=new Set(e));for(const l of e)n.current.has(l)||(n.current.add(l),t&&r.current.add(l));return r.current}function nS(e){return e.kind==="entry"&&e.entry.kind==="user"?"row-in mine":"row-in"}const V0=new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}),$0=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}),y8=new Intl.DateTimeFormat(void 0,{weekday:"long"}),ch=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),e1={time:e=>V0.format(new Date(e)),separator(e){const t=new Date(e),n=new Date,r=new Date(n.getTime()-864e5);return`${ch(t,n)?"Today":ch(t,r)?"Yesterday":$0.format(t)} ${V0.format(t)}`},day(e){const t=new Date(e),n=new Date;return ch(t,n)?V0.format(t):ch(t,new Date(n.getTime()-864e5))?"Yesterday":n.getTime()-e<6*864e5?y8.format(t):$0.format(t)},short(e){const t=Math.max(0,(Date.now()-e)/1e3);return t<60?"now":t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:t<86400*7?`${Math.floor(t/86400)}d`:$0.format(new Date(e))}};function rS(e){const t=e.split(".").pop()?.toLowerCase()??"";return["png","jpg","jpeg","heic","gif","webp","tiff","bmp"].includes(t)?"photo":t==="pdf"?"doc.richtext":["zip","gz","tar","7z"].includes(t)?"doc.zipper":["mov","mp4","m4v"].includes(t)?"film":["mp3","m4a","wav","aac"].includes(t)?"waveform":"doc"}function S8(e){if(e<1e3)return`${e} bytes`;const t=["KB","MB","GB"];let n=e/1e3,r=0;for(;n>=1e3&&r<t.length-1;)n/=1e3,r++;return`${n<10?n.toFixed(1):Math.round(n)} ${t[r]}`}function x8({attachments:e,botId:t}){const[n,r]=x.useState(null);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4},children:[e.map(l=>O3(l.name)?c.jsx("button",{"aria-label":l.name,onClick:()=>r(l),style:{borderRadius:16,overflow:"hidden",maxWidth:220,maxHeight:280,display:"flex"},children:c.jsx(H_,{file:l,botId:t,style:{maxWidth:220,maxHeight:280}})},l.id):c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",background:"var(--bubble-user)",borderRadius:16},children:[c.jsx(ae,{name:rS(l.name),size:16,color:"var(--secondary)"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1,minWidth:0},children:[c.jsx("span",{style:{...B("subheadline"),color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:200},children:l.name}),c.jsx("span",{style:{...B("caption2"),color:"var(--tertiary)"},children:S8(l.size)})]})]},l.id)),c.jsx($t,{open:n!==null,onClose:()=>r(null),width:720,height:560,children:n?c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:n.name}),c.jsx("div",{style:{flex:1,minHeight:0,padding:12,display:"grid",placeItems:"center"},children:c.jsx(H_,{file:n,botId:t,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}})})]}):null})]})}function H_({file:e,botId:t,style:n}){const r=Or(),[l,h]=x.useState(null);return x.useEffect(()=>{let d=!1,p=null;return r.attachmentData(e.id,t).then(g=>{!g||d||(p=URL.createObjectURL(new Blob([g])),h(p))}),()=>{d=!0,p&&URL.revokeObjectURL(p)}},[r,e.id,t]),l?c.jsx("img",{src:l,alt:"",style:{display:"block",...n}}):c.jsx("div",{style:{width:160,height:120,borderRadius:16,background:"var(--bubble-user)",display:"grid",placeItems:"center"},children:c.jsx(ae,{name:"photo",size:13,color:"var(--tertiary)"})})}const w8=e=>e.includes("-")&&[...e].every(t=>"|-: ".includes(t)),I_=e=>{let t=e;return t.startsWith("|")&&(t=t.slice(1)),t.endsWith("|")&&(t=t.slice(0,-1)),t.split("|").map(n=>n.trim())};function b8(e){const t=[];let n=[],r=[],l=null,h="";const d=()=>{n.length&&(t.push({kind:"paragraph",text:n.join(``)}),n=[]),r.length&&(r.length>=2&&w8(r[1])?t.push({kind:"table",header:I_(r[0]),rows:r.slice(2).map(I_)}):t.push({kind:"paragraph",text:r.join(``)}),r=[])};for(const p of e.split(``)){const g=p.trim();if(g.startsWith("```")){l?(t.push({kind:"code",text:l.join(``),language:h}),l=null):(d(),l=[],h=g.slice(3));continue}if(l){l.push(p);continue}if(g.startsWith("|")){n.length&&d(),r.push(g);continue}r.length&&d();const m=Math.min(Math.floor((/^[ \t]*/.exec(p)?.[0].length??0)/2),3),v=/^(#+) (.*)$/.exec(g),_=/^(\d+\.) (.*)$/.exec(g);g?g==="---"||g==="***"||g==="___"?(d(),t.push({kind:"rule"})):v?(d(),t.push({kind:"heading",text:v[2].trim(),level:v[1].length})):/^[-*+•] /.test(g)?(d(),t.push({kind:"bullet",text:g.slice(2),marker:m>0?"◦":"•",depth:m})):_?(d(),t.push({kind:"bullet",text:_[2],marker:_[1],depth:m})):g.startsWith(">")?(d(),t.push({kind:"quote",text:g.slice(1).trim()})):n.push(p):d()}return l&&t.push({kind:"code",text:l.join(`-`),language:h}),d(),t}function Na(e,t="i"){const n=[];return e.split(/(`[^`\n]+`)/).forEach((r,l)=>{r.length>2&&r.startsWith("`")&&r.endsWith("`")?n.push(c.jsx("code",{style:{fontFamily:"var(--mono)",background:"rgba(var(--text-rgb), 0.08)"},children:r.slice(1,-1)},`${t}${l}`)):r&&n.push(...no(r,`${t}${l}-`))}),n}const C8=new RegExp("\\[([^\\]]+)\\]\\(([^)\\s]+)\\)|\\*\\*([^*]+)\\*\\*|__([^_]+)__|~~([^~]+)~~|\\*([^*\\n]+)\\*|(?<![\\w])_([^_\\n]+)_(?![\\w])");function no(e,t){const n=[];let r=e,l=0;for(;r;){const h=C8.exec(r);if(!h){n.push(r);break}h.index>0&&n.push(r.slice(0,h.index));const d=`${t}${l++}`;if(h[1]!==void 0){const p=h[2];n.push(c.jsx("a",{href:p,onClick:g=>{g.preventDefault(),window.codync.app.openExternal(p)},style:{color:"var(--accent)",textDecoration:"none",cursor:"pointer"},children:no(h[1],`${d}-`)},d))}else h[3]!==void 0||h[4]!==void 0?n.push(c.jsx("strong",{style:{fontWeight:600},children:no(h[3]??h[4],`${d}-`)},d)):h[5]!==void 0?n.push(c.jsx("s",{children:no(h[5],`${d}-`)},d)):n.push(c.jsx("em",{children:no(h[6]??h[7],`${d}-`)},d));r=r.slice(h.index+h[0].length)}return n}const k8=e=>e===1?15:e===2?13:11,$f="calc(1.2em + 4px * var(--md-scale))",aS={lineHeight:$f,margin:"calc(-2px * var(--md-scale)) 0"},W0={color:"var(--text)",whiteSpace:"pre-wrap",overflowWrap:"anywhere",...aS},E8=x.memo(function({block:t}){switch(t.kind){case"paragraph":return c.jsx("div",{style:{...W0,fontSize:"var(--conversation)"},children:Na(t.text)});case"heading":return c.jsx("div",{style:{...W0,fontSize:`calc(${k8(t.level)}px * var(--md-scale))`,fontWeight:t.level===2?600:700},children:Na(t.text)});case"bullet":return c.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6,fontSize:"var(--conversation)",paddingLeft:t.depth*16,...aS},children:[c.jsx("span",{style:{color:"var(--secondary)",fontVariantNumeric:"tabular-nums",flex:"none"},children:t.marker}),c.jsx("span",{style:{color:"var(--text)",whiteSpace:"pre-wrap",overflowWrap:"anywhere",minWidth:0},children:Na(t.text)})]});case"rule":return c.jsx("div",{style:{height:1,background:"var(--border)",margin:"4px 0"}});case"table":{const n=Math.max(t.header.length,...t.rows.map(l=>l.length)),r=Array.from({length:n},(l,h)=>h);return c.jsx("div",{style:{overflowX:"auto"},children:c.jsxs("div",{style:{display:"grid",gridTemplateColumns:`repeat(${n}, max-content)`,columnGap:16,rowGap:7,fontSize:"var(--conversation)",color:"var(--text)",padding:"2px 0",width:"max-content",lineHeight:$f},children:[r.map(l=>c.jsx("span",{style:{fontWeight:600},children:Na(t.header[l]??"",`h${l}`)},`h${l}`)),t.rows.map((l,h)=>[c.jsx("div",{style:{gridColumn:`1 / span ${n}`,height:1,background:"var(--border)"}},`l${h}`),...r.map(d=>c.jsx("span",{children:Na(l[d]??"",`${h}-${d}`)},`${h}-${d}`))])]})})}case"quote":return c.jsx("div",{style:{...W0,fontSize:"var(--conversation)",color:"var(--secondary)",paddingLeft:10,boxShadow:"inset 3px 0 0 var(--border)"},children:Na(t.text)});case"code":return c.jsx("div",{style:{background:"var(--code-background)",borderRadius:8,overflowX:"auto"},children:c.jsx("pre",{style:{margin:0,padding:10,fontFamily:"var(--mono)",fontSize:"calc(10px * var(--md-scale))",color:"var(--text)",width:"max-content",lineHeight:$f},children:t.text})})}},(e,t)=>JSON.stringify(e.block)===JSON.stringify(t.block)),lS=x.memo(function({text:t}){const n=b8(t);return c.jsx("div",{className:"markdown selectable",style:{display:"flex",flexDirection:"column",gap:10,minWidth:0},children:n.map((r,l)=>c.jsx(E8,{block:r},l))})}),M8=e=>{switch(e){case"execute":return"Wants to run a command";case"edit":case"delete":case"move":return"Wants to change files";case"fetch":return"Wants to access the web";case"read":case"search":return"Wants to read files";default:return"Wants to use a tool"}},U_={allow_once:0,allow_always:1,reject_once:2,reject_always:3};function j8(e){switch(e.kind){case"allow_once":return"Allow once";case"allow_always":return"Always allow";case"reject_once":return"Deny";case"reject_always":return"Never";default:return e.name}}function T8({entry:e,hostName:t,answering:n,respond:r}){const[l,h]=x.useState(!1),d=e.data,p=d.status==="pending",g=!!d.command||!!d.detail||!!d.diffs?.length,m=[...d.options??[]].sort((_,S)=>(U_[_.kind]??9)-(U_[S.kind]??9)),v=d.cwd?` · ${d.cwd.split("/").filter(Boolean).pop()??d.cwd}`:"";return c.jsx("div",{style:{paddingRight:40},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,padding:16,background:"var(--bubble-agent)",borderRadius:22},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx("span",{style:{...B("headline"),color:"var(--text)"},children:M8(d.toolKind)}),p?c.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--warning)"}}):null]}),c.jsx("div",{className:"selectable",style:{...B("subheadline",void 0,"monospaced"),color:"var(--secondary)",overflowWrap:"anywhere",...l?{}:{display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden"}},children:d.title??""}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,...B("caption"),color:"var(--tertiary)"},children:[c.jsx(ae,{name:"desktopcomputer",size:10}),`Runs on ${t}${v}`]}),g?c.jsx(G2,{expanded:l,onToggle:()=>h(_=>!_),label:c.jsx("span",{style:{...B("caption","medium"),color:"var(--secondary)"},children:"Details"}),children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,paddingTop:6},children:[d.command?c.jsx(Wf,{text:d.command}):null,d.detail?c.jsx(Wf,{text:d.detail.slice(0,2e3)}):null,(d.diffs??[]).map((_,S)=>c.jsx(oS,{diff:_},S))]})}):null,p?c.jsx("div",{style:{background:"var(--background)",borderRadius:14,marginTop:4},children:m.map((_,S)=>c.jsxs("div",{children:[S>0?c.jsx("div",{style:{height:.5,background:"var(--border)"}}):null,c.jsxs("button",{disabled:n!==null,onClick:()=>r(_.optionId),style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:46,padding:"0 14px",opacity:n===null||n===_.optionId?1:.4},children:[c.jsx("span",{style:{...B("body",_.kind==="allow_once"?"semibold":"regular"),color:_.kind.startsWith("allow")?"var(--text)":"var(--danger)",flex:1},children:j8(_)}),n===_.optionId?c.jsx(et,{size:14}):null]})]},_.optionId))}):c.jsx("div",{style:{...B("caption","medium"),color:"var(--secondary)"},children:R8(e)})]})})}function R8(e){const t=e.data;switch(t.status){case"answered":{const n=t.options?.find(r=>r.optionId===t.selected);switch(n?.kind){case"allow_once":return"Allowed once";case"allow_always":return"Always allowed";case"reject_once":return"Denied";case"reject_always":return"Never allowed";default:return n?.name??"Answered"}}case"cancelled":return"Cancelled";default:return"Expired — the agent moved on"}}function Wf({text:e}){return c.jsx("div",{style:{background:"var(--code-background)",borderRadius:8,overflow:"auto",maxHeight:240},children:c.jsx("pre",{className:"selectable",style:{margin:0,padding:8,fontFamily:"var(--mono)",fontSize:Fh(10),color:"var(--text)",width:"max-content"},children:e})})}function oS({diff:e}){const t=e.patch.split(`-`).slice(0,80);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,...B("caption",void 0,"monospaced"),color:"var(--secondary)"},children:[c.jsx(ae,{name:e.isNew?"doc.badge.plus":"doc.text",size:10}),c.jsx("span",{style:{flex:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.path.split("/").pop()}),c.jsxs("span",{style:{color:"var(--added)"},children:["+",e.added]}),c.jsxs("span",{style:{color:"var(--removed)"},children:["−",e.removed]})]}),c.jsx("div",{style:{background:"var(--code-background)",borderRadius:8,overflow:"auto",maxHeight:260},children:c.jsx("div",{style:{padding:8,fontFamily:"var(--mono)",fontSize:Fh(10),width:"max-content"},children:t.map((n,r)=>c.jsx("div",{style:{whiteSpace:"pre",color:n.startsWith("+")?"var(--added)":n.startsWith("-")?"var(--removed)":"var(--secondary)"},children:n||" "},r))})})]})}const qa=e=>e.auth==="signedOut",D8=e=>e.connection?.status==="active",at=e=>e*1e3,Ae={connectors:async e=>(await e.call("connectors")).items,marketConnectors:async(e,t,n=null)=>{const r=await e.call("marketConnectors",{search:t,cursor:n??""},at(60));return{items:r.items,next:r.nextCursor||null}},installConnector:async(e,t,n,r)=>(await e.call("installConnector",{registryName:t,option:n,inputs:r},at(45))).connector,addConnector:async(e,t)=>(await e.call("installConnector",t,at(45))).connector,importConnectors:async(e,t)=>(await e.call("importConnectors",{config:t},at(60))).items,connectorSignIn:(e,t)=>e.call("connectorSignIn",{id:t},at(60)),finishConnectorSignIn:async(e,t,n,r)=>(await e.call("connectorSignInFinish",{state:t,code:n,error:r},at(60))).connector,removeConnector:(e,t)=>e.call("removeConnector",{id:t}),composioStatus:e=>e.call("composioStatus"),setComposioKey:(e,t)=>e.call("setComposioKey",{key:t},at(60)),composioApps:async(e,t)=>(await e.call("composioToolkits",{search:t},at(60))).items,composioConnect:(e,t)=>e.call("composioConnect",{toolkit:t},at(60)),composioConnectFields:(e,t,n,r)=>e.call("composioConnectFields",{toolkit:t,mode:n,fields:r},at(60)),composioConnection:(e,t)=>e.call("composioConnection",{id:t},at(30)),skills:async e=>(await e.call("skills")).items,marketSkills:async e=>(await e.call("marketSkills",{},at(60))).items,installSkill:(e,t)=>e.call("installSkill",{source:t},at(60)),addSkill:(e,t,n,r)=>e.call("installSkill",{name:t,description:n,instructions:r}),removeSkill:(e,t)=>e.call("removeSkill",{id:t}),connectorInfo:(e,t)=>e.call("connectorInfo",{registryName:t},at(60)),verifyConnector:(e,t)=>e.call("connectorVerify",{id:t},at(120)),finishConnectionRequest:(e,t,n={})=>e.call("connectorRequestFinish",{entryId:t,connectorId:n.connectorId??null,value:n.value??null,username:n.username??null,cancel:n.cancel??!1},at(120)),logins:async e=>(await e.call("credentialLogins",{},at(60))).items,saveLogin:(e,t,n,r)=>e.call("credentialSaveLogin",{site:t,username:n,password:r},at(60)),removeLogin:(e,t)=>e.call("credentialRemoveLogin",{id:t},at(60)),credentialStatus:e=>e.call("credentialStatus",{},at(60)),setOnePasswordToken:(e,t)=>e.call("credentialSetOnePassword",{token:t},at(60)),updateConnectorCredentials:(e,t,n)=>e.call("credentialUpdateConnector",{id:t,fields:n},at(120)),agentSetup:async(e,t,n,r,l,h)=>(await e.call("agentSetup",{backend:t,step:n,method:r,cols:l,rows:h},at(300))).term,agentAuth:(e,t)=>e.call("agentAuth",{backend:t},at(300)),agentAuthenticate:(e,t,n)=>e.call("agentAuthenticate",{backend:t,method:n},at(660)),setAgentEnv:(e,t,n)=>e.call("setAgentEnv",{backend:t,vars:n},at(300)),termInput:(e,t,n)=>e.call("termInput",{term:t,data:n}),termResize:(e,t,n,r)=>e.call("termResize",{term:t,cols:n,rows:r}),termClose:(e,t)=>e.call("termClose",{term:t})},Lh=()=>({items:[],visibleCount:12});function cS(e,t,n){const r=new Set(e.items.map(n));return{...e,items:[...e.items,...t.filter(l=>!r.has(n(l))&&(r.add(n(l)),!0))]}}const hS=(e,t)=>cS(Lh(),e,t),Ff=e=>({...e,visibleCount:Math.min(e.items.length,e.visibleCount+12)}),uS=e=>e.items.slice(0,e.visibleCount),Kf=e=>e.items.length>e.visibleCount,lt=e=>e instanceof Error?e.message:String(e),dS=e=>new Promise(t=>setTimeout(t,e));function ro({title:e,children:t}){return c.jsxs("section",{className:"market-section",children:[c.jsx("div",{style:{...B("headline"),color:"var(--text)",paddingLeft:4},children:e}),t]})}function uo({children:e}){return c.jsx("div",{className:"item-grid",children:e})}const Yf={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},Gf=e=>({display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical",overflow:"hidden"});function Ha({title:e,subtitle:t,added:n,busy:r=!1,addLabel:l="Add",icon:h,onAdd:d}){return c.jsxs("div",{className:"market-row",children:[c.jsx("div",{style:{width:46,height:46,flex:"none",display:"grid"},children:h}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0,flex:1},children:[c.jsx("span",{style:{...B("body","medium"),color:"var(--text)",...Yf},title:e,children:e}),c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)",...Yf},title:t,children:t})]}),r?c.jsx("span",{style:{width:60,display:"flex",justifyContent:"center",flex:"none"},children:c.jsx(on,{size:18,color:"var(--secondary)"})}):n?c.jsx("span",{style:{width:60,display:"flex",justifyContent:"center",flex:"none",color:"var(--secondary)"},"aria-label":"Added",title:"Added",children:c.jsx(ae,{name:"checkmark",size:11,weight:"semibold"})}):c.jsx("button",{className:"capsule-action",style:B("subheadline","semibold"),onClick:d,children:l})]})}function Zf(){return c.jsx("div",{className:"item-grid skeleton",children:[0,1,2,3].map(e=>c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"10px 12px"},children:[c.jsx("div",{style:{width:46,height:46,borderRadius:12,background:"var(--bubble-agent)",flex:"none"}}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsx("div",{style:{width:120,height:12,borderRadius:6,background:"var(--bubble-agent)"}}),c.jsx("div",{style:{width:190,height:10,borderRadius:5,background:"var(--bubble-agent)"}})]})]},e))})}function A8({src:e,style:t}){const[n,r]=x.useState(!1);return c.jsx("img",{src:e,alt:"",draggable:!1,onLoad:()=>r(!0),style:{...t,display:n?"block":"none"}})}function N8(e,t,n){if(e&&URL.canParse(e)){const h=new URL(e).hostname;if(h&&h!=="github.com")return h}const r=n?.split("/")[0];if(!r)return null;const l=r.split(".").filter(Boolean);return l.length<2||l[0]==="io"&&l[1]==="github"?t.toLowerCase().includes("github")?"github.com":null:`${l[1]}.${l[0]}`}function Xf({website:e,name:t,registryName:n,size:r=46}){const l=N8(e,t,n),h=r*.26;return c.jsxs("div",{style:{position:"relative",width:r,height:r,borderRadius:h,overflow:"hidden",background:"var(--bubble-agent)",display:"grid",placeItems:"center",flex:"none"},children:[c.jsx("span",{style:{...B(r*.4,"semibold","rounded"),color:"var(--text)"},children:t.slice(0,1).toUpperCase()||"?"}),l?c.jsx(A8,{src:`https://www.google.com/s2/favicons?domain=${encodeURIComponent(l)}&sz=128`,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",padding:r*.2,boxSizing:"border-box",background:"#fff"}}):null]})}function t1({url:e,name:t,size:n=46}){const[r,l]=x.useState(!1);return c.jsxs("div",{"aria-hidden":!0,style:{position:"relative",width:n,height:n,flex:"none",borderRadius:n*.28,background:"var(--bubble-agent)",display:"grid",placeItems:"center"},children:[r?null:c.jsx("span",{style:{...B(n*.4,"semibold"),color:"var(--secondary)"},children:t.slice(0,1).toUpperCase()}),e?c.jsx("img",{src:e,alt:"",draggable:!1,onLoad:()=>l(!0),style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",padding:n*.18,boxSizing:"border-box",display:r?"block":"none"}}):null]})}function Qf({name:e}){return c.jsx("div",{style:{width:"100%",height:"100%",borderRadius:12,background:"var(--bubble-agent)",display:"grid",placeItems:"center",color:"var(--text)"},children:c.jsx(ae,{name:e,size:18,weight:"medium"})})}function fS({size:e}){return c.jsx("div",{style:{width:e??"100%",height:e??"100%",flex:"none",borderRadius:12,background:"var(--bubble-agent)",display:"grid",placeItems:"center",color:"var(--text)"},children:c.jsx(ae,{name:"book.pages",size:13})})}function i1({title:e,url:t,style:n}){return c.jsx("button",{className:"plain-link",style:n,title:t,onClick:()=>window.codync.app.openExternal(t),children:e})}function s1({title:e,onBack:t,trailing:n}){return c.jsxs("div",{style:{position:"relative",height:44,padding:"0 12px",display:"flex",alignItems:"center",gap:6,flex:"none",background:"var(--background)"},children:[c.jsx("div",{style:{position:"absolute",left:60,right:60,textAlign:"center",...B("compactBody","semibold"),color:"var(--text)",...Yf},children:e}),c.jsx(ke,{title:"Back",icon:"chevron.left",onClick:t}),c.jsx("span",{style:{flex:1,minWidth:8}}),n]})}function pS({base:e,top:t}){const{mounted:n,shown:r}=er(t!==null),l=x.useRef(t);return t!==null&&(l.current=t),c.jsxs("div",{className:"market-stack",children:[c.jsx("div",{className:`market-layer ${r?"off-leading":""}`,inert:r,children:e}),n?c.jsx("div",{className:`market-layer ${r?"":"off-trailing"}`,children:t??l.current}):null]})}function Mt({value:e,onChange:t,placeholder:n,secret:r=!1,lines:l,mono:h=!1,label:d}){const p=h?B("callout","regular","monospaced"):{};return l?c.jsx("textarea",{className:"market-field","aria-label":d??n,value:e,placeholder:n,spellCheck:!1,onChange:g=>t(g.target.value),style:{...p,lineHeight:1.3,minHeight:`${l[0]*1.3}em`,maxHeight:`${l[1]*1.3}em`}}):c.jsx("input",{className:"market-field","aria-label":d??n,type:r?"password":"text",value:e,placeholder:n,spellCheck:!1,autoComplete:"off",onChange:g=>t(g.target.value),style:p})}function hn({text:e}){return c.jsx("span",{className:"selectable",style:{color:"var(--danger)"},children:e})}const n1=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==""));function L8(){const[e,t]=x.useState(window.innerHeight);return x.useEffect(()=>{const n=()=>t(window.innerHeight);return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),e}function Ds({open:e,onClose:t,width:n=520,height:r=600,children:l}){const h=L8();return c.jsx($t,{open:e,onClose:t,width:n,height:Math.min(r,h-76),children:l})}class B8 extends Br{constructor(t){super(),this.store=t}store;installedConnectors=[];installedSkills=[];async refresh(){const t=this.store.client;if(!t)return;const[n,r]=await Promise.allSettled([Ae.connectors(t),Ae.skills(t)]);n.status==="fulfilled"&&(this.installedConnectors=n.value),r.status==="fulfilled"&&(this.installedSkills=r.value),this.changed()}async after(t){const n=await t;return await this.refresh(),n}async installConnector(t,n,r){return this.after(Ae.installConnector(await this.store.ready(),t.name,n,r))}async addConnector(t){return this.after(Ae.addConnector(await this.store.ready(),t))}async importConnectors(t){return this.after(Ae.importConnectors(await this.store.ready(),t))}async finishConnectorSignIn(t,n,r){return this.after(Ae.finishConnectorSignIn(await this.store.ready(),t,n,r))}async waitForSignIn(t){for(let n=0;n<150;n++){await dS(2e3),await this.refresh();const r=this.installedConnectors.find(l=>l.id===t);if(r&&!qa(r))return}}async removeConnector(t){await this.after(Ae.removeConnector(await this.store.ready(),t))}async installSkill(t){await this.after(Ae.installSkill(await this.store.ready(),t))}async addSkill(t,n,r){await this.after(Ae.addSkill(await this.store.ready(),t,n,r))}async removeSkill(t){await this.after(Ae.removeSkill(await this.store.ready(),t))}async signIn(t){const n=await Ae.connectorSignIn(await this.store.ready(),t);if(!URL.canParse(n.url))return;if(n.callback!=="app"){window.codync.app.openExternal(n.url),await this.waitForSignIn(t);return}let r;try{r=await window.codync.app.authenticate(n.url,"codync")}catch{return}const l=new URL(r).searchParams;await this.finishConnectorSignIn(l.get("state")??"",l.get("code"),l.get("error_description")??l.get("error"))}}const P_=new WeakMap;function r1(e){let t=P_.get(e);return t||P_.set(e,t=new B8(e)),t}const Ga=e=>cn(r1(e));function O8({query:e,searchToken:t}){const n=Ne(),[r,l]=x.useState(null),[h,d]=x.useState(Lh),[p,g]=x.useState(!0),[m,v]=x.useState(null),[_,S]=x.useState(!1),[w,b]=x.useState(null),k=x.useRef(0),E=x.useRef(e);E.current=e;const j=async()=>{const A=n.client;if(!A)return;const z=++k.current,F=E.current;g(!0);try{const D=await Ae.composioStatus(A),I=D.configured?await Ae.composioApps(A,F):[];if(k.current!==z)return;l(D),d(hS(I,q=>q.slug)),v(null)}catch(D){k.current===z&&v(lt(D))}finally{k.current===z&&g(!1)}};x.useEffect(()=>(j(),()=>{k.current++}),[t]);const V=r?.configured===!0;return c.jsxs(ro,{title:"Apps",children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[V?p?c.jsx(Zf,{}):h.items.length===0?c.jsx("span",{style:{color:"var(--secondary)"},children:e?`No apps match “${e}”.`:"Couldn't load apps."}):c.jsx(uo,{children:uS(h).map(A=>c.jsx(Ha,{title:A.name,subtitle:A.description??A.slug,added:D8(A),addLabel:"Connect",icon:c.jsx(t1,{url:A.logo,name:A.name}),onAdd:()=>b(A)},A.slug))}):c.jsx(uo,{children:c.jsx(Ha,{title:"Composio",subtitle:"Gmail, Slack, GitHub, Notion and 1,000 more apps",added:!1,busy:r===null&&p,addLabel:"Set up",icon:c.jsx(Qf,{name:"square.grid.3x3"}),onAdd:()=>S(!0)})}),!p&&Kf(h)&&V?c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:c.jsx(Fe,{kind:"secondary",onClick:()=>d(Ff),children:"Load more apps"})}):null,m?c.jsx("span",{style:{...B("footnote"),color:"var(--danger)"},children:m}):null,V?c.jsxs("button",{style:{display:"flex",alignItems:"center",gap:4,alignSelf:"flex-start",...B("footnote"),color:"var(--tertiary)"},onClick:()=>S(!0),children:[c.jsx(ae,{name:"key",size:10}),"Composio settings"]}):null]}),c.jsx(Ds,{open:_,onClose:()=>S(!1),children:c.jsx(z8,{status:r,done:A=>{l(A),j()}})}),c.jsx(Ds,{open:w!==null,onClose:()=>b(null),children:w?c.jsx(gS,{app:w,done:()=>{j(),r1(n).refresh()}},w.slug):null})]})}function z8({status:e,done:t}){const n=Ne(),r=ss(),[l,h]=x.useState(""),[d,p]=x.useState(!1),[g,m]=x.useState(null),v=async S=>{const w=n.client;if(w){p(!0);try{t(await Ae.setComposioKey(w,S)),r()}catch(b){m(lt(b))}p(!1)}},_=e?.keyUrl??"https://platform.composio.dev";return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:"Composio",trailing:d?c.jsx(et,{}):c.jsx(ke,{title:"Save",icon:"checkmark",disabled:!l.trim(),onClick:()=>{v(l)}})}),c.jsxs(hi,{children:[c.jsxs(Ee,{title:"Composio API key",footer:`Composio signs you in to apps like Gmail and Slack and runs their tools for your bots. The key stays on ${n.hostName}.`,children:[c.jsx(Mt,{label:"API key",value:l,onChange:h,secret:!0,placeholder:e?.configured?"Saved (paste to replace)":"ak_…"}),URL.canParse(_)?c.jsx(i1,{title:"Get a key from Composio",url:_,style:B("footnote")}):null]}),e?.configured?c.jsx(Ee,{footer:"Bots lose the apps you connected until you add a key again.",children:c.jsx("button",{style:{color:"var(--danger)"},onClick:()=>{v("")},children:"Remove key"})}):null,g?c.jsx(Ee,{children:c.jsx(hn,{text:g})}):null]})]})}function gS({app:e,requestId:t,done:n}){const r=Ne(),l=ss(),[h,d]=x.useState(null),[p,g]=x.useState({}),[m,v]=x.useState(!1),[_,S]=x.useState(!1),[w,b]=x.useState(null),k=x.useRef(!1),E=x.useRef(n);E.current=n;const j=()=>{g({}),k.current=!0,v(!0)};x.useEffect(()=>{let D=!1;return(async()=>{const I=r.client;if(I)try{const q=await Ae.composioConnect(I,e.slug);if(D||(d(q),q.status!=="redirect"||!q.connection))return;q.url&&URL.canParse(q.url)&&window.codync.app.openExternal(q.url);for(let U=0;U<300;U++){if(await dS(2e3),D)return;const Y=await Ae.composioConnection(I,q.connection).catch(()=>null);if(D)return;if(Y){if(Y.status==="active"){if(t)try{await Ae.finishConnectionRequest(I,t,{connectorId:`composio-${e.slug}`})}catch($){D||b(lt($));return}D||j();return}if(Y.status==="failed"||Y.status==="expired"){b(`Signing in to ${e.name} didn't work (${Y.status}). Close and try again.`);return}}}b("Timed out waiting for the sign-in.")}catch(q){D||b(lt(q))}})(),()=>{D=!0,k.current&&E.current()}},[r,e.slug,e.name,t]);const V=async()=>{const D=r.client,I=h?.mode;if(!(!D||!I)){S(!0);try{const q=await Ae.composioConnectFields(D,e.slug,I,n1(p));q.status==="active"?(t&&await Ae.finishConnectionRequest(D,t,{connectorId:`composio-${e.slug}`}),j()):b(`${e.name} says the connection is ${q.status}.`)}catch(q){b(lt(q))}S(!1)}},A=h?.status==="needsFields",z=m?c.jsx(ke,{title:"Done",icon:"checkmark",onClick:l}):A?_?c.jsx(et,{}):c.jsx(ke,{title:"Connect",icon:"checkmark",disabled:h?.fields?.some(D=>D.required&&!p[D.name])??!0,onClick:()=>{V()}}):null,F=D=>c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx(et,{}),c.jsx("span",{style:{color:"var(--secondary)"},children:D})]});return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:`Connect ${e.name}`,trailing:z}),c.jsxs(hi,{children:[c.jsx(Ee,{children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"4px 0"},children:[c.jsx(t1,{url:e.logo,name:e.name,size:52}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0},children:[c.jsx("span",{style:B("title3","semibold"),children:e.name}),e.description?c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)",...Gf(3)},children:e.description}):null]})]})}),m?c.jsx(Ee,{footer:`Turn ${e.name} on for a bot in the bot's settings, under Connectors.`,children:c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--added)"},children:[c.jsx(ae,{name:"checkmark.circle.fill",size:12}),"Connected"]})}):A?c.jsx(Ee,{footer:`Sent to Composio, which keeps it for ${e.name}.`,children:(h?.fields??[]).map(D=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[c.jsx(Mt,{label:D.label,value:p[D.name]??"",secret:D.secret,placeholder:D.label,onChange:I=>g(q=>({...q,[D.name]:I}))}),D.description?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:D.description+(D.required?"":" (optional)")}):null]},D.name))}):h?.status==="redirect"?c.jsxs(Ee,{footer:"Sign in on the page that opened. This updates by itself when you're done.",children:[h.url&&URL.canParse(h.url)?c.jsx("div",{children:c.jsxs(Fe,{kind:"secondary",onClick:()=>window.codync.app.openExternal(h.url),children:[c.jsx(ae,{name:"safari",size:11}),"Open the sign-in page"]})}):null,F("Waiting for you to finish signing in…")]}):w===null?c.jsx(Ee,{children:F("Asking Composio…")}):null,w?c.jsx(Ee,{children:c.jsx(hn,{text:w})}):null]})]})}const a1={display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"};function mS({item:e,requestId:t,done:n}){const r=Ne(),l=Ga(r),h=ss(),[d,p]=x.useState(e.options[0]?.id??""),[g,m]=x.useState({}),[v,_]=x.useState(null),[S,w]=x.useState(!1),[b,k]=x.useState(null),E=x.useRef(!1),j=e.options.find(F=>F.id===d)??e.options[0],V=F=>g[F.name]??"",A=async()=>{if(j){w(!0),k(null);try{const F=await r.ready();let D;v?D=(await Ae.connectors(F)).find(I=>I.id===v.id)??v:(D=await l.installConnector(e,j.id,g),_(D),m({})),qa(D)&&await l.signIn(D.id),t?await Ae.finishConnectionRequest(F,t,{connectorId:D.id}):await Ae.verifyConnector(F,D.id),await l.refresh(),n(),h()}catch(F){k(lt(F))}w(!1)}};x.useEffect(()=>{E.current||(E.current=!0,e.options.length===1&&e.options[0].inputs.length===0&&A())},[]);const z=!j||j.inputs.some(F=>F.required&&!(g[F.name]??F.default??""));return c.jsxs("div",{style:a1,children:[c.jsx(Lt,{title:"Add connector",trailing:S?c.jsx(et,{}):c.jsx(ke,{title:"Add",icon:"plus",disabled:v===null&&z,onClick:()=>{A()}})}),c.jsxs(hi,{children:[c.jsx(Ee,{children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:"4px 0"},children:[c.jsx("span",{style:B("title3","semibold"),children:e.title}),e.description?c.jsx("span",{style:{color:"var(--secondary)"},children:e.description}):null,e.website&&URL.canParse(e.website)?c.jsx(i1,{title:e.website,url:e.website,style:{...B("footnote"),whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}):null]})}),e.options.length>1?c.jsx(Ee,{title:"Runs",children:c.jsx(VC,{selection:d,onChange:p,options:e.options.map(F=>({id:F.id,label:F.kind==="remote"?`Hosted by ${e.title}`:`On ${r.hostName} (${F.kind})`}))})}):null,j?c.jsxs(Ee,{title:"Setup",footer:`Keys are saved on ${r.hostName} only.`,children:[j.inputs.length===0?c.jsx("span",{style:{color:"var(--secondary)"},children:j.kind==="remote"?`No keys needed here. If ${e.title} wants you to sign in, its sign-in page opens next.`:"No setup needed."}):null,j.inputs.map(F=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[c.jsx(Mt,{label:F.name,value:V(F),secret:F.secret,placeholder:F.secret?F.name:F.default??F.placeholder??F.name,onChange:D=>m(I=>({...I,[F.name]:D}))}),F.description?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:F.description+(F.required?"":" (optional)")}):null]},F.name))]}):null,b?c.jsx(Ee,{children:c.jsx(hn,{text:b})}):null]})]})}function H8(){const e=Ne(),t=Ga(e),n=ss(),[r,l]=x.useState(""),[h,d]=x.useState("command"),[p,g]=x.useState(""),[m,v]=x.useState(""),[_,S]=x.useState(""),[w,b]=x.useState(!1),[k,E]=x.useState(null),j=h==="config"?_.trim()!=="":r.trim()!==""&&p.trim()!=="",V={command:`Runs on ${e.hostName} in the bot's project folder. Quotes work like in a shell.`,url:"A remote MCP server, streamable HTTP or SSE.",config:`Paste the MCP config from a README or another app (Claude, Cursor, VS Code). Every server in it is added. Saved on ${e.hostName} only.`}[h],A=async()=>{b(!0),E(null);const z=h==="url",F={};for(const D of m.split(`-`)){const I=D.indexOf(z?":":"=");if(I<0)continue;const q=D.slice(0,I).trim();q&&(F[q]=D.slice(I+1).trim())}try{const D=h==="config"?await t.importConnectors(_):[await t.addConnector({name:r,command:z?null:p,url:z?p:null,env:z?{}:F,headers:z?F:{}})];for(const I of D)qa(I)&&await t.signIn(I.id);n()}catch(D){E(lt(D))}b(!1)};return c.jsxs("div",{style:a1,children:[c.jsx(Lt,{title:"Custom connector",trailing:w?c.jsx(et,{}):c.jsx(ke,{title:"Add",icon:"plus",disabled:!j,onClick:()=>{A()}})}),c.jsxs(hi,{children:[c.jsxs(Ee,{footer:V,children:[c.jsx(qC,{selection:h,onChange:d,options:[{id:"command",label:"Command"},{id:"url",label:"URL"},{id:"config",label:"Config"}]}),h==="config"?c.jsx(Mt,{value:_,onChange:S,placeholder:'{ "mcpServers": { … } }',lines:[6,16],mono:!0}):null,h!=="config"?c.jsx(Mt,{value:r,onChange:l,placeholder:"Name"}):null,h!=="config"?c.jsx(Mt,{value:p,onChange:g,placeholder:h==="url"?"https://example.com/mcp":"npx -y @scope/server",mono:!0}):null]}),h==="url"?c.jsx(Ee,{title:"Headers",footer:`Optional, one Name: value per line. Leave empty if the service has you sign in. Saved on ${e.hostName} only.`,children:c.jsx(Mt,{value:m,onChange:v,placeholder:"Authorization: Bearer …",lines:[2,6],mono:!0})}):h==="command"?c.jsx(Ee,{title:"Environment",footer:`One KEY=value per line. Saved on ${e.hostName} only.`,children:c.jsx(Mt,{value:m,onChange:v,placeholder:"API_KEY=…",lines:[2,6],mono:!0})}):null,k?c.jsx(Ee,{children:c.jsx(hn,{text:k})}):null]})]})}function I8(){const e=Ne(),t=Ga(e),n=ss(),[r,l]=x.useState(""),[h,d]=x.useState(""),[p,g]=x.useState(""),[m,v]=x.useState(!1),[_,S]=x.useState(null),w=async()=>{v(!0);try{await t.addSkill(r,h,p),n()}catch(b){S(lt(b))}v(!1)};return c.jsxs("div",{style:a1,children:[c.jsx(Lt,{title:"New skill",trailing:m?c.jsx(et,{}):c.jsx(ke,{title:"Save",icon:"checkmark",disabled:!r.trim()||!p.trim(),onClick:()=>{w()}})}),c.jsxs(hi,{children:[c.jsxs(Ee,{footer:"The bot sees the name and when to use it, and reads the instructions only when a task fits.",children:[c.jsx(Mt,{value:r,onChange:l,placeholder:"Name"}),c.jsx(Mt,{value:h,onChange:d,placeholder:"When to use it",lines:[2,4]})]}),c.jsx(Ee,{title:"Instructions",children:c.jsx(Mt,{value:p,onChange:g,placeholder:"Step by step, in plain words…",lines:[6,20]})}),_?c.jsx(Ee,{children:c.jsx(hn,{text:_})}):null]})]})}const fo={...B("caption"),color:"var(--secondary)"};function U8({entry:e}){const t=Ne(),n=e.data.connectionRequest,[r,l]=x.useState(null),[h,d]=x.useState(null),[p,g]=x.useState(""),[m,v]=x.useState(""),[_,S]=x.useState(!1),[w,b]=x.useState(null),k=n.kind==="login",E=n.kind==="secret",j=async()=>{const A=t.client;if(A){S(!0),b(null);try{if(n.kind==="app"&&n.toolkit)l({slug:n.toolkit,name:n.title});else if(k)await Ae.finishConnectionRequest(A,e.id,{value:p,username:m}),g("");else if(E)await Ae.finishConnectionRequest(A,e.id,{value:p}),g("");else if(n.connectorId){const z=n.connectorId,F=(await Ae.connectors(A)).find(D=>D.id===z);F&&qa(F)&&await r1(t).signIn(z),await Ae.finishConnectionRequest(A,e.id,{connectorId:z})}else n.registryName&&d(await Ae.connectorInfo(A,n.registryName))}catch(z){b(lt(z))}S(!1)}},V=async()=>{const A=t.client;if(A){S(!0);try{await Ae.finishConnectionRequest(A,e.id,{cancel:!0}),g("")}catch(z){b(lt(z))}S(!1)}};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16,background:"var(--surface)",borderRadius:18},children:[c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,...B("headline")},children:[c.jsx(ae,{name:"lock.shield",size:13}),n.title]}),e.data.text?c.jsx("span",{style:{color:"var(--secondary)"},children:e.data.text}):null,n.status==="pending"?c.jsxs(c.Fragment,{children:[k?c.jsxs(c.Fragment,{children:[c.jsx(Mt,{value:m,onChange:v,placeholder:"Username or email"}),c.jsx(Mt,{value:p,onChange:g,placeholder:"Password or op:// reference",secret:!0}),c.jsx("span",{style:fo,children:"Saved securely on this computer. The bot types it into the sign-in page but never sees it."})]}):E?c.jsxs(c.Fragment,{children:[c.jsx("span",{style:fo,children:`${n.field??"Credential"} · ${n.location??""}`}),c.jsx(Mt,{value:p,onChange:g,placeholder:"Credential or op:// reference",secret:!0}),c.jsx("span",{style:fo,children:"Saved securely on this computer. Never added to the conversation."})]}):null,c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx(Fe,{disabled:_||(E||k)&&!p,onClick:()=>{j()},children:k?"Save login":E?"Save and connect":"Connect"}),c.jsx(Fe,{kind:"secondary",disabled:_,onClick:()=>{V()},children:"Cancel"}),_?c.jsx(et,{}):null]})]}):c.jsx("span",{style:{color:"var(--secondary)"},children:n.status==="ready"?k?"Saved":"Connected":"Cancelled"}),w?c.jsx("span",{style:{...B("footnote"),color:"var(--danger)"},children:w}):null,c.jsx(Ds,{open:h!==null,onClose:()=>d(null),children:h?c.jsx(mS,{item:h,requestId:e.id,done:()=>d(null)}):null}),c.jsx(Ds,{open:r!==null,onClose:()=>l(null),children:r?c.jsx(gS,{app:r,requestId:e.id,done:()=>l(null)}):null})]})}function P8(){const e=Ne(),t=Ga(e),[n,r]=x.useState(null),[l,h]=x.useState(""),[d,p]=x.useState(null),[g,m]=x.useState(!1),[v,_]=x.useState(null);x.useEffect(()=>{(async()=>{await t.refresh();const w=e.client;if(w)try{p(await Ae.credentialStatus(w))}catch(b){_(lt(b))}})()},[t,e]);const S=async w=>{const b=e.client;if(b){m(!0),_(null);try{p(await Ae.setOnePasswordToken(b,w)),h("")}catch(k){_(lt(k))}m(!1)}};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:"Credentials"}),c.jsxs(hi,{children:[c.jsxs(Ee,{title:"Storage",children:[c.jsx("span",{children:d?.provider??"System credential store"}),c.jsx("span",{style:{color:"var(--secondary)"},children:"Credentials are encrypted on the connected computer. Linux uses Secret Service; macOS uses Keychain."})]}),c.jsxs(Ee,{title:"Saved connections",children:[t.installedConnectors.filter(w=>w.keys.length>0).map(w=>c.jsxs("button",{className:"plain-row-button",onClick:()=>r(w),children:[c.jsx("span",{style:{flex:1},children:w.name}),c.jsx(ae,{name:"chevron.right",size:10})]},w.id)),c.jsx("span",{style:fo,children:"Values stay hidden. Select a connection to replace its credentials."})]}),c.jsx(q8,{}),c.jsxs(Ee,{title:"1Password",footer:"Use a service account with read access only to a dedicated shared vault. The 1Password CLI must be installed on the computer.",children:[c.jsx("span",{children:d?.onePasswordConnected?"Connected":"Connect a shared vault"}),c.jsx(Mt,{value:l,onChange:h,placeholder:"Service account token",secret:!0}),c.jsx("div",{children:c.jsx(Fe,{disabled:g||!l,onClick:()=>{S(l)},children:"Connect"})}),d?.onePasswordConnected?c.jsx("div",{children:c.jsx(Fe,{kind:"secondary",disabled:g,onClick:()=>{S("")},children:"Disconnect"})}):null,c.jsx("span",{style:{...B("footnote"),color:"var(--secondary)"},children:"Use op://vault/item/field in a connector's credential field. Codync retrieves the value when the connector runs."})]}),g?c.jsx(et,{}):null,v?c.jsx(hn,{text:v}):null]}),c.jsx(Ds,{open:n!==null,onClose:()=>r(null),children:n?c.jsx(V8,{connector:n},n.id):null})]})}function q8(){const e=Ne(),[t,n]=x.useState([]),[r,l]=x.useState(""),[h,d]=x.useState(""),[p,g]=x.useState(""),[m,v]=x.useState(!1),[_,S]=x.useState(null),w=async()=>{const E=e.client;try{n(E?await Ae.logins(E):[])}catch(j){S(lt(j))}};x.useEffect(()=>{w()},[]);const b=async()=>{const E=e.client;if(E){v(!0),S(null);try{await Ae.saveLogin(E,r,h,p),l(""),d(""),g(""),await w()}catch(j){S(lt(j))}v(!1)}},k=async E=>{const j=e.client;if(j)try{await Ae.removeLogin(j,E.id),n(V=>V.filter(A=>A.id!==E.id))}catch(V){S(lt(V))}};return c.jsxs(Ee,{title:"Sign-ins",footer:"Bots type these into the matching website or app and never see the password. You can use an op:// reference.",children:[t.map(E=>c.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0},children:[c.jsx("span",{children:E.site}),E.username?c.jsx("span",{style:fo,children:E.username}):null]}),c.jsx(ke,{title:"Remove",icon:"trash",onClick:()=>{k(E)}})]},E.id)),c.jsx(Mt,{value:r,onChange:l,placeholder:"Website or app, e.g. github.com"}),c.jsx(Mt,{value:h,onChange:d,placeholder:"Username or email"}),c.jsx(Mt,{value:p,onChange:g,placeholder:"Password or op:// reference",secret:!0}),c.jsx("div",{children:c.jsx(Fe,{disabled:m||!r||!p,onClick:()=>{b()},children:"Save sign-in"})}),_?c.jsx("span",{style:{...B("footnote"),color:"var(--danger)"},children:_}):null]})}function V8({connector:e}){const t=Ne(),n=ss(),[r,l]=x.useState({}),[h,d]=x.useState(!1),[p,g]=x.useState(null),m=async()=>{const v=t.client;if(v){d(!0),g(null);try{await Ae.updateConnectorCredentials(v,e.id,n1(r)),l({}),n()}catch(_){g(lt(_))}d(!1)}};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:e.name,trailing:h?c.jsx(et,{}):c.jsx(ke,{title:"Save credentials",icon:"checkmark",disabled:Object.values(r).every(v=>!v),onClick:()=>{m()}})}),c.jsxs(hi,{children:[c.jsx(Ee,{footer:"Enter only the values you want to replace. You can use an op:// reference.",children:e.keys.map(v=>c.jsx(Mt,{label:v,value:r[v]??"",placeholder:v,secret:!0,onChange:_=>l(S=>({...S,[v]:_}))},v))}),p?c.jsx(hn,{text:p}):null]})]})}function Bh(e,t){return{emoji:r8,chosen:t.data.reactions??[],toggle:n=>e.react(t,n)}}const Jf=x.memo(function({entry:t,groupStart:n,chat:r,openTrace:l,openThread:h}){const d=h?()=>h(t):void 0,p=t.data.thread&&t.data.thread.count>0&&h?c.jsx(W8,{summary:t.data.thread,open:()=>h(t)}):null;switch(t.kind){case"user":return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,paddingTop:n?12:4},children:[c.jsx(F8,{entry:t,botWorking:!!r&&Jn(r),reply:d}),c.jsx(V_,{entry:t}),p]});case"agent":return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4,paddingTop:n?12:4},children:[r&&At(r)&&n?c.jsx(q_,{botId:t.data.author}):null,c.jsx(Y8,{entry:t,openTrace:l,reply:d}),c.jsxs("div",{style:{paddingLeft:r&&At(r)?34:0,display:"flex",flexDirection:"column",gap:4},children:[c.jsx(V_,{entry:t}),p]})]});case"permission":return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,paddingTop:12},children:[r&&At(r)?c.jsx(q_,{botId:t.data.author}):null,c.jsx($8,{entry:t})]});default:return t.data.connectionRequest?c.jsx("div",{style:{paddingTop:12},children:c.jsx(U8,{entry:t})}):c.jsx("div",{style:{paddingTop:10},children:c.jsx(G8,{entry:t})})}});function $8({entry:e}){const t=Ne();return c.jsx(T8,{entry:e,hostName:t.hostName,answering:t.answering.get(e.id)??null,respond:n=>t.respond(e,n)})}function q_({botId:e}){const t=Or(),n=e?t.bots.get(e):void 0;return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n?c.jsx(Ui,{bot:n,size:26,animated:!1}):null,c.jsx("span",{style:{...B("subheadline","medium"),color:n?ko(n.avatarColor):"var(--secondary)"},children:t.authorName(e)})]})}function W8({summary:e,open:t}){const n=Or(),r=e.authors.map(h=>n.bots.get(h)).filter(h=>!!h).slice(0,3),l=e.unread??0;return c.jsxs("button",{className:"press thread-chip",onClick:t,title:"View thread","aria-label":`View thread, ${e.count} ${e.count===1?"reply":"replies"}${l>0?`, ${l} new`:""}`,children:[r.length?c.jsx("span",{style:{display:"flex"},children:r.map((h,d)=>c.jsx("span",{style:{marginLeft:d?-6:0},children:c.jsx(Ui,{bot:h,size:18,animated:!1})},h.id))}):null,c.jsx("span",{style:{...B("footnote","semibold"),color:"var(--accent)"},children:e.count===1?"1 reply":`${e.count} replies`}),l>0?c.jsxs("span",{style:{...B("footnote","semibold"),color:"var(--text)"},children:[l," new"]}):c.jsx("span",{style:{...B("footnote"),color:"var(--tertiary)"},children:e1.day(e.lastAt)}),c.jsx(ae,{name:"chevron.right",size:10,color:"var(--tertiary)"})]})}function vS({className:e,items:t,reactions:n,children:r}){const l=PC();return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:e,onContextMenu:l.onContextMenu,children:r}),c.jsx(Pa,{open:l.open,onClose:l.close,point:l.point,items:t,reactions:n})]})}const _S=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"});function F8({entry:e,botWorking:t,reply:n}){const r=Or(),[l,h]=x.useState(!1),d=e.data.status,p=()=>e.data.text&&window.codync.app.copy(e.data.text);return c.jsx("div",{className:"message user",title:_S.format(e.createdAt),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:c.jsxs("div",{className:"message-body",children:[e.data.attachments?.length?c.jsx(x8,{attachments:e.data.attachments,botId:e.botId}):null,e.data.text?c.jsx(vS,{className:"bubble user selectable",reactions:Bh(r,e),items:()=>[{title:"Copy",icon:"square.on.square",action:p},...n?[{title:"Reply in thread",icon:"arrowshape.turn.up.left",action:n}]:[]],children:e.data.text}):null,d&&d!=="sent"?c.jsx(K8,{entry:e,botWorking:t,hovering:l}):null,c.jsx(SS,{className:"leading",visible:l,reactions:Bh(r,e),reply:n,copy:p})]})})}function K8({entry:e,botWorking:t,hovering:n}){const r=Or(),l={...B("caption2"),color:"var(--tertiary)"};switch(e.data.status){case"sending":return c.jsx("span",{style:l,children:"Sending…"});case"queued":return c.jsx("span",{style:l,children:t?"Queued until this response finishes":"Queued"});case"failed":return c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10,...B("caption2","semibold")},children:[c.jsx("span",{style:{color:"var(--danger)"},children:"Failed to send"}),c.jsx("button",{title:"Resend","aria-label":"Resend",style:{display:"flex"},onClick:()=>r.retry(e),children:c.jsx(ae,{name:"arrow.clockwise",size:10,weight:"semibold"})}),c.jsx("button",{title:"Delete","aria-label":"Delete",style:{display:"flex"},onClick:()=>r.discard(e),children:c.jsx(ae,{name:"trash",size:10,weight:"semibold"})})]});case"cancelled":return c.jsx("span",{style:l,children:"Not sent — stopped"});case"waiting":return c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10,...B("caption2")},children:[c.jsx("span",{style:{color:"var(--tertiary)"},children:"Waiting for the computer to come online"}),c.jsx("button",{title:"Don't send","aria-label":"Don't send",style:{display:"flex"},onClick:()=>r.cancelQueued(e),children:c.jsx(ae,{name:"xmark.circle",size:10})})]});case"delivering":return c.jsx("span",{style:l,children:"Delivered to the computer"});default:return c.jsx("span",{style:{...B(10),color:"var(--tertiary)",opacity:n?1:0,transition:"opacity var(--hover)"},children:e1.time(e.createdAt)})}}function Y8({entry:e,openTrace:t,reply:n}){const r=Or(),[l,h]=x.useState(!1),d=()=>e.data.text&&window.codync.app.copy(e.data.text);return c.jsx("div",{className:"message agent",title:_S.format(e.createdAt),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:c.jsxs("div",{className:"message-body",children:[c.jsx(vS,{className:"bubble agent",reactions:Bh(r,e),items:()=>[{title:"Copy",icon:"square.on.square",action:d},...n?[{title:"Reply in thread",icon:"arrowshape.turn.up.left",action:n}]:[],{title:"Show what it did",icon:"list.bullet",action:t}],children:c.jsx(lS,{text:e.data.text??""})}),c.jsx(SS,{className:"trailing",visible:l,reactions:Bh(r,e),reply:n,trace:t,copy:d})]})})}function G8({entry:e}){const t=e.data.text??"";if(e.data.callSeconds!==void 0){const n=e.data.callSeconds;return c.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:6,...B("footnote"),fontVariantNumeric:"tabular-nums",color:"var(--secondary)"},children:[c.jsx(ae,{name:"waveform",size:10}),`${t} · ${String(Math.floor(n/60)).padStart(2,"0")}:${String(n%60).padStart(2,"0")}`]})}switch(e.data.style){case"divider":return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"6px 0"},children:[c.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}}),c.jsx("span",{style:{...B("caption2"),color:"var(--tertiary)",textAlign:"center",maxWidth:260},children:t}),c.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}})]});case"error":return c.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8,padding:12,borderRadius:12,background:"color-mix(in srgb, var(--danger) 12%, transparent)"},children:[c.jsx(ae,{name:"exclamationmark.triangle.fill",size:10,color:"var(--danger)"}),c.jsx("span",{className:"selectable",style:{...B("footnote"),color:"var(--text)"},children:t})]});default:return c.jsx("div",{style:{...B("footnote"),color:"var(--secondary)",textAlign:"center"},children:t})}}function yS({bot:e,thinking:t}){const[n,r]=x.useState(!1),l=ln(e);return c.jsx("div",{style:{display:"flex",alignItems:"center",gap:10,paddingRight:40},children:c.jsxs("button",{className:"working",disabled:!t,onClick:()=>r(h=>!h),"aria-expanded":t?n:void 0,children:[c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx(on,{state:l?"listening":"working",size:16,color:l?"var(--warning)":"var(--secondary)"}),c.jsx("span",{style:{...B("subheadline"),color:l?"var(--warning)":"var(--secondary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.activity||"Working…"}),e.startedAt?c.jsx(Z8,{since:e.startedAt}):null,t?c.jsx("span",{style:{display:"flex",transform:`rotate(${n?180:0}deg)`,transition:"transform var(--layout)"},children:c.jsx(ae,{name:"chevron.down",size:10,weight:"semibold",color:"var(--tertiary)"})}):null]}),n&&t?c.jsx("div",{className:"selectable thinking",style:{...B("footnote"),color:"var(--secondary)"},ref:h=>{h&&(h.scrollTop=h.scrollHeight)},children:t}):null]})})}function Z8({since:e}){const[t,n]=x.useState(Date.now());x.useEffect(()=>{const p=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(p)},[]);const r=Math.max(0,Math.floor((t-e)/1e3)),l=Math.floor(r/3600),h=Math.floor(r%3600/60),d=String(r%60).padStart(2,"0");return c.jsx("span",{style:{...B("footnote"),fontVariantNumeric:"tabular-nums",color:"var(--tertiary)"},children:l?`${l}:${String(h).padStart(2,"0")}:${d}`:`${h}:${d}`})}function V_({entry:e}){const t=Or(),n=e.data.reactions;return n?.length?c.jsx("div",{style:{display:"flex",gap:4},children:n.map(r=>c.jsx("button",{className:"press reaction-chip",title:`Remove ${r}`,"aria-label":`Remove reaction ${r}`,onClick:()=>t.react(e,r),children:c.jsx("span",{style:{fontSize:Fh(13)},children:r})},r))}):null}function SS({visible:e,className:t,reactions:n,reply:r,trace:l,copy:h}){const[d,p]=x.useState(null),g=x.useRef(null),m=x.useRef(null),v=e||d!==null;return c.jsxs("div",{className:`message-actions ${t}`,style:{opacity:v?1:0,pointerEvents:v?"auto":"none"},"aria-hidden":!v,children:[c.jsx("button",{ref:g,className:"message-action",title:"Add reaction","aria-label":"Add reaction",onClick:()=>p("reactions"),children:c.jsx(ae,{name:"face.smiling",size:14})}),r?c.jsx(ke,{title:"Reply in thread",icon:"arrowshape.turn.up.left",size:26,onClick:r}):null,c.jsx("button",{ref:m,className:"message-action",title:"More message actions","aria-label":"More message actions",onClick:()=>p("more"),children:c.jsx(ae,{name:"ellipsis",size:14})}),c.jsx(Pa,{open:d==="reactions",onClose:()=>p(null),anchor:g,items:()=>[],reactions:n}),c.jsx(Pa,{open:d==="more",onClose:()=>p(null),anchor:m,items:()=>[{title:"Copy",icon:"square.on.square",action:h},...l?[{title:"Show what it did",icon:"list.bullet",action:l}]:[]]})]})}function X8(e){return e.key!=="Enter"||e.isComposing||e.keyCode===229?"ignore":e.shiftKey||e.altKey?"newline":e.repeat?"ignore":"send"}function Q8({file:e,remove:t}){const[n,r]=x.useState(null),[l,h]=x.useState(!1);return x.useEffect(()=>{if(!O3(e.name))return;const d=URL.createObjectURL(new Blob([e.data]));return r(d),()=>URL.revokeObjectURL(d)},[e]),n&&!l?c.jsxs("span",{className:"attachment-tile","aria-label":`Image attachment: ${e.name}`,title:e.name,children:[c.jsx("img",{src:n,alt:"",onError:()=>h(!0)}),c.jsx("button",{className:"press attachment-remove","aria-label":`Remove ${e.name}`,title:"Remove",onClick:t,children:c.jsx(ae,{name:"xmark",size:11,weight:"bold",color:"#fff"})})]}):c.jsxs("span",{className:"file-chip",children:[c.jsx(ae,{name:rS(e.name),size:10,color:"var(--secondary)"}),c.jsx("span",{style:{...B("footnote"),color:"var(--text)",maxWidth:160,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.name}),c.jsx("button",{"aria-label":`Remove ${e.name}`,title:"Remove",style:{display:"flex"},onClick:t,children:c.jsx(ae,{name:"xmark",size:10,weight:"bold",color:"var(--secondary)"})})]})}function xS({botId:e,thread:t=null,onCall:n,onInterrupt:r}){const l=Ne();return c.jsx(J8,{botId:e,thread:t,onCall:n,onInterrupt:r},JSON.stringify([l.contextId,l.computer.id,e,t]))}function J8({botId:e,thread:t,onCall:n,onInterrupt:r}){const l=Ne(),h=l.bots.get(e)??null,d=l.composerDrafts,p=x.useSyncExternalStore(d.subscribe,()=>d.get(e,t)),g=O=>d.set(e,t,O),[m,v]=x.useState([]),_=x.useRef(null),S=x.useRef(null),w=x.useRef(!1),b=!!h&&$2(h,e,t),E=!(!p.trim()&&!m.length)&&(l.connection.kind==="online"||l.canQueue&&!m.length),j=!!h&&!At(h),V=t?"Reply…":h&&At(h)?`Message ${h.name} · @ to ask one bot`:b?`Queue a message for ${h?.name??""}`:`Ask ${h?.name??""}`,A=l.routineDrafts.get(e);x.useEffect(()=>{if(t||A===void 0)return;const O=l.consumeRoutineDraft(e);if(O===void 0)return;const P=d.get(e,t);d.set(e,t,P?`${P}-${O}`:O),_.current?.focus()},[A,t,e,l,d]),x.useLayoutEffect(()=>{const O=_.current,P=S.current;if(!O||!P)return;const te=()=>{const ce=getComputedStyle(O),re=parseFloat(ce.lineHeight),de=parseFloat(ce.paddingTop)+parseFloat(ce.paddingBottom),Ce=Math.min(P.getBoundingClientRect().height,re*8+de);O.style.height=`${Ce}px`};te();const Q=new ResizeObserver(te);return Q.observe(P),()=>Q.disconnect()},[]);const z=(()=>{if(!h||!At(h))return null;const O=p.lastIndexOf("@");if(O<0||O>0&&!/\s/.test(p[O-1]))return null;const P=p.slice(O+1);return/\n/.test(P)||P.length>24?null:P})(),F=z!==null&&h?l.members(h).filter(O=>!z||O.name.toLowerCase().includes(z.toLowerCase())):[],D=O=>{const P=p.lastIndexOf("@");P<0||(g(`${p.slice(0,P)}@${O.name} `),_.current?.focus())},I=O=>{if(!j)return;const P=[];for(const te of O){if(te.data.length>n8){l.setError(`${te.name} is larger than 100 MB.`);continue}P.push({id:crypto.randomUUID(),name:te.name,data:te.data})}v(te=>[...te,...P])},q=()=>{E&&(l.send(p,e,t,m),g(""),v([]),_.current?.focus())},U=r&&!p&&!m.length?"interrupt":b&&!p&&!m.length?"stop":n&&!p&&!m.length?"call":"send",[Y,$]={interrupt:["stop.fill","Interrupt"],stop:["stop.fill","Stop"],call:["waveform","Call"],send:["arrow.up","Send"]}[U],M=U==="interrupt"?"var(--danger)":U==="send"?E?"var(--accent-fill)":"var(--accent-dim)":"var(--accent-fill)",N=U==="interrupt"?"#fff":U==="send"?E?"var(--on-accent)":"var(--tertiary)":"var(--on-accent)",L=U!=="send"||E;return c.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[c.jsx($_,{open:F.length>0,children:c.jsx("div",{className:"mentions",children:F.map(O=>c.jsxs("button",{className:"press mention",onClick:()=>D(O),children:[c.jsx(Ui,{bot:O,size:18,animated:!1}),c.jsx("span",{style:{...B("subheadline"),color:"var(--text)"},children:O.name})]},O.id))})}),c.jsx("div",{className:"composer",onDragOver:O=>{j&&O.dataTransfer.types.includes("Files")&&O.preventDefault()},onDrop:O=>{j&&(O.preventDefault(),Promise.all([...O.dataTransfer.files].map(async P=>({name:P.name,data:new Uint8Array(await P.arrayBuffer())}))).then(I))},children:c.jsxs("div",{className:"composer-surface",children:[c.jsx($_,{open:m.length>0,children:c.jsx("div",{className:"file-chips",children:m.map(O=>c.jsx(Q8,{file:O,remove:()=>v(P=>P.filter(te=>te.id!==O.id))},O.id))})}),c.jsxs("div",{className:"composer-box",children:[j?c.jsx("button",{className:"press composer-add","aria-label":"Add files",title:"Add files",onClick:()=>{window.codync.app.pickFiles().then(I)},children:c.jsx(ae,{name:"plus",size:13,weight:"medium",color:"var(--text)"})}):null,c.jsxs("div",{className:"composer-field",children:[c.jsx("div",{ref:S,className:"composer-measure","aria-hidden":"true",children:p+""}),c.jsx("textarea",{ref:_,rows:1,value:p,placeholder:V,spellCheck:!0,"aria-label":t?"Reply":"Message","aria-keyshortcuts":"Enter Shift+Enter",onCompositionStart:()=>{w.current=!0},onCompositionEnd:()=>{w.current=!1},onChange:O=>g(O.target.value),onKeyDown:O=>{const P=X8({key:O.key,shiftKey:O.shiftKey,altKey:O.altKey,repeat:O.repeat,isComposing:w.current||O.nativeEvent.isComposing,keyCode:O.keyCode});O.key==="Enter"&&O.repeat&&!O.shiftKey&&!O.altKey&&O.preventDefault(),P==="send"&&(O.preventDefault(),q())},onPaste:O=>{if(!j)return;const P=[...O.clipboardData.types];!P.includes("Files")||P.includes("text/plain")&&!O.clipboardData.files.length||(O.preventDefault(),window.codync.app.readClipboardFiles().then(Q=>Q.length?I(Q):Promise.all([...O.clipboardData.files].map(async ce=>({name:ce.name||`pasted-${Date.now()}.png`,data:new Uint8Array(await ce.arrayBuffer())}))).then(I)))}})]}),c.jsx("button",{className:"press composer-send",disabled:!L,"aria-label":$,title:$,style:{background:M,color:N},onClick:()=>{U==="interrupt"?r?.():U==="stop"?l.stop(e):U==="call"?n?.():q()},children:["stop.fill","waveform","arrow.up"].map(O=>c.jsx("span",{"aria-hidden":"true",className:`composer-symbol ${O===Y?"active":""}`,children:c.jsx(ae,{name:O,size:O==="stop.fill"?12:O==="waveform"?15:14,weight:"bold"})},O))})]})]})})]})}function $_({open:e,children:t}){const{mounted:n,shown:r}=er(e),l=x.useRef(t);return e&&(l.current=t),c.jsx("div",{className:`composer-reveal ${r?"shown":""}`,inert:!e,children:c.jsx("div",{children:n?e?t:l.current:null})})}function e7({open:e,width:t,children:n}){const{mounted:r,shown:l}=er(e,300,!1),h=x.useRef({width:t,children:n});e&&(h.current={width:t,children:n});const d=e?{width:t,children:n}:h.current;return c.jsx("div",{className:`side-panel ${l?"shown":""}`,inert:!e,style:{width:l?d.width+1:0},children:r?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"side-panel-border"}),c.jsx("div",{style:{width:d.width,height:"100%",flex:"none"},children:d.children})]}):null})}const t7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3ccircle%20cx='8'%20cy='8'%20r='7'%20stroke='currentColor'%20stroke-width='1.5'/%3e%3cpath%20d='M5.5%2010.5L8%204L10.5%2010.5'%20stroke='currentColor'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cline%20x1='6.25'%20y1='8.75'%20x2='9.75'%20y2='8.75'%20stroke='currentColor'%20stroke-width='1.2'%20stroke-linecap='round'/%3e%3c/svg%3e",i7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M13.9197%2013.61L17.3816%2026.566L14.242%2027.4049L11.2645%2016.2643L0.119926%2013.2906L0.957817%2010.15L13.9197%2013.61Z'%20fill='currentColor'/%3e%3cpath%20d='M13.7391%2016.0892L4.88169%2024.9056L2.58872%2022.6019L11.4461%2013.7865L13.7391%2016.0892Z'%20fill='currentColor'/%3e%3cpath%20d='M18.9386%208.58315L22.4005%2021.5392L19.2609%2022.3781L16.2833%2011.2374L5.13879%208.26381L5.97668%205.12318L18.9386%208.58315Z'%20fill='currentColor'/%3e%3cpath%20d='M23.9803%203.55632L27.4422%2016.5124L24.3025%2017.3512L21.325%206.21062L10.1805%203.23698L11.0183%200.0963593L23.9803%203.55632Z'%20fill='currentColor'/%3e%3c/svg%3e",s7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14.1452%2014.6818C14.9937%2015.3182%2016.2664%2014.894%2015.0997%2013.7273C11.5998%2010.3333%2012.3421%201%207.99366%201C3.64518%201%204.3876%2010.3333%200.887603%2013.7273C-0.385123%2015%200.993664%2015.3182%201.84215%2014.6818C5.13002%2012.4545%204.9179%208.5303%207.99366%208.5303C11.0694%208.5303%2010.8573%2012.4545%2014.1452%2014.6818Z'%20fill='currentColor'/%3e%3c/svg%3e",n7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M9.972%2013.193h2.577q.187%200%20.277-.09t.091-.294V10.47q0-.324.133-.59.135-.27.36-.424a1%201%200%200%201%20.099-.06%201%201%200%200%201-.1-.058%201.1%201.1%200%200%201-.359-.424%201.3%201.3%200%200%201-.133-.59v-2.33q0-.202-.091-.293t-.277-.089H9.972a.38.38%200%200%201-.294-.124.4.4%200%200%201-.108-.281q.002-.176.131-.293a.46.46%200%200%201%20.313-.111h2.775c.36%200%20.642.097.836.288q.293.29.294.832V8.24q0%20.39.152.562.148.168.555.178a.4.4%200%200%201%20.27.128.41.41%200%200%201%20.104.287.44.44%200%200%201-.1.282.34.34%200%200%201-.277.132c-.266.006-.452.066-.55.177q-.151.174-.152.573v2.318c0%20.235-.043.44-.128.607a.85.85%200%200%201-.389.387%201.3%201.3%200%200%201-.534.124V14h-2.854a.45.45%200%200%201-.315-.118.38.38%200%200%201-.129-.286q0-.164.109-.282a.38.38%200%200%201%20.293-.123zM1.103%209.108a.4.4%200%200%201%20.276-.128q.4-.008.55-.177.15-.173.151-.562V5.923q.002-.543.294-.832c.195-.191.477-.288.836-.288h2.775q.188%200%20.313.111a.37.37%200%200%201%20.131.293.4.4%200%200%201-.108.281.38.38%200%200%201-.293.123H3.45q-.186%200-.277.09t-.092.292v2.33c0%20.213-.044.413-.133.59a1.1%201.1%200%200%201-.359.424%201%201%200%200%201-.1.059%201%201%200%200%201%20.1.059q.225.156.359.423t.133.59v2.34q0%20.203.092.293.088.09.277.089h2.577a.38.38%200%200%201%20.294.123q.108.12.108.281a.38.38%200%200%201-.13.286.45.45%200%200%201-.314.118l-2.775-.003a1.4%201.4%200%200%201-.613-.126.87.87%200%200%201-.388-.387%201.34%201.34%200%200%201-.129-.608v-2.318q0-.4-.151-.572-.151-.168-.55-.177a.35.35%200%200%201-.278-.132.42.42%200%200%201-.102-.28q0-.173.103-.287'/%3e%3cpath%20fill='currentColor'%20d='M5.437%2010.36a.986.986%200%200%201-.994-.975c0-.538.446-.976.994-.976s.994.438.994.976a.986.986%200%200%201-.994.976M10.562%208.41c.548%200%20.994.437.994.975a.986.986%200%200%201-.994.976.986.986%200%200%201-.994-.976c0-.538.446-.976.994-.976M8.74%202c.37%200%20.446.15.446.275v.034q0%20.034-.009.201-.01.162-.017.549-.018.378-.044%201.06c0%20.106-.065.233-.375.233-.311%200-.376-.126-.376-.23l-.07-1.835v-.003c0-.13.078-.284.446-.284M7.256%202c.369%200%20.446.15.446.275v.034q0%20.034-.01.201-.007.162-.017.549-.017.378-.043%201.06c0%20.106-.065.233-.376.233-.31%200-.375-.126-.375-.23l-.07-1.835v-.003C6.81%202.154%206.887%202%207.256%202'/%3e%3c/svg%3e",r7=""+new URL("autohand-bkvwPcbN.svg",import.meta.url).href,a7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%201200%201200'%3e%3cpath%20fill='currentColor'%20d='M%20233.959793%20800.214905%20L%20468.644287%20668.536987%20L%20472.590637%20657.100647%20L%20468.644287%20650.738403%20L%20457.208069%20650.738403%20L%20417.986633%20648.322144%20L%20283.892639%20644.69812%20L%20167.597321%20639.865845%20L%2054.926208%20633.825623%20L%2026.577238%20627.785339%20L%203.3e-05%20592.751709%20L%202.73832%20575.27533%20L%2026.577238%20559.248352%20L%2060.724873%20562.228149%20L%20136.187973%20567.382629%20L%20249.422867%20575.194763%20L%20331.570496%20580.026978%20L%20453.261841%20592.671082%20L%20472.590637%20592.671082%20L%20475.328857%20584.859009%20L%20468.724915%20580.026978%20L%20463.570557%20575.194763%20L%20346.389313%20495.785217%20L%20219.543671%20411.865906%20L%20153.100723%20363.543762%20L%20117.181267%20339.060425%20L%2099.060455%20316.107361%20L%2091.248367%20266.01355%20L%20123.865784%20230.093994%20L%20167.677887%20233.073853%20L%20178.872513%20236.053772%20L%20223.248367%20270.201477%20L%20318.040283%20343.570496%20L%20441.825592%20434.738342%20L%20459.946411%20449.798706%20L%20467.194672%20444.64447%20L%20468.080597%20441.020203%20L%20459.946411%20427.409485%20L%20392.617493%20305.718323%20L%20320.778564%20181.932983%20L%20288.80542%20130.630859%20L%20280.348999%2099.865845%20C%20277.369171%2087.221436%20275.194641%2076.590698%20275.194641%2063.624268%20L%20312.322174%2013.20813%20L%20332.8591%206.604126%20L%20382.389313%2013.20813%20L%20403.248352%2031.328979%20L%20434.013519%20101.71814%20L%20483.865753%20212.537048%20L%20561.181274%20363.221497%20L%20583.812134%20407.919434%20L%20595.892639%20449.315491%20L%20600.40271%20461.959839%20L%20608.214783%20461.959839%20L%20608.214783%20454.711609%20L%20614.577271%20369.825623%20L%20626.335632%20265.61084%20L%20637.771851%20131.516846%20L%20641.718201%2093.745117%20L%20660.402832%2048.483276%20L%20697.530334%2024.000122%20L%20726.52356%2037.852417%20L%20750.362549%2072%20L%20747.060486%2094.067139%20L%20732.886047%20186.201416%20L%20705.100708%20330.52356%20L%20686.979919%20427.167847%20L%20697.530334%20427.167847%20L%20709.61084%20415.087341%20L%20758.496704%20350.174561%20L%20840.644348%20247.490051%20L%20876.885925%20206.738342%20L%20919.167847%20161.71814%20L%20946.308838%20140.29541%20L%20997.61084%20140.29541%20L%201035.38269%20196.429626%20L%201018.469849%20254.416199%20L%20965.637634%20321.422852%20L%20921.825562%20378.201538%20L%20859.006714%20462.765259%20L%20819.785278%20530.41626%20L%20823.409424%20535.812073%20L%20832.75177%20534.92627%20L%20974.657776%20504.724915%20L%201051.328979%20490.872559%20L%201142.818848%20475.167786%20L%201184.214844%20494.496582%20L%201188.724854%20514.147644%20L%201172.456421%20554.335693%20L%201074.604126%20578.496765%20L%20959.838989%20601.449829%20L%20788.939636%20641.879272%20L%20786.845764%20643.409485%20L%20789.261841%20646.389343%20L%20866.255127%20653.637634%20L%20899.194702%20655.409424%20L%20979.812134%20655.409424%20L%201129.932861%20666.604187%20L%201169.154419%20692.537109%20L%201192.671265%20724.268677%20L%201188.724854%20748.429688%20L%201128.322144%20779.194641%20L%201046.818848%20759.865845%20L%20856.590759%20714.604126%20L%20791.355774%20698.335754%20L%20782.335693%20698.335754%20L%20782.335693%20703.731567%20L%20836.69812%20756.885986%20L%20936.322205%20846.845581%20L%201061.073975%20962.81897%20L%201067.436279%20991.490112%20L%201051.409424%201014.120911%20L%201034.496704%201011.704712%20L%20924.885986%20929.234924%20L%20882.604126%20892.107544%20L%20786.845764%20811.48999%20L%20780.483276%20811.48999%20L%20780.483276%20819.946289%20L%20802.550415%20852.241699%20L%20919.087341%201027.409424%20L%20925.127625%201081.127686%20L%20916.671204%201098.604126%20L%20886.469849%201109.154419%20L%20853.288696%201103.114136%20L%20785.073914%201007.355835%20L%20714.684631%20899.516785%20L%20657.906067%20802.872498%20L%20650.979858%20806.81897%20L%20617.476624%201167.704834%20L%20601.771851%201186.147705%20L%20565.530212%201200%20L%20535.328857%201177.046997%20L%20519.302124%201139.919556%20L%20535.328857%201066.550537%20L%20554.657776%20970.792053%20L%20570.362488%20894.68457%20L%20584.536926%20800.134277%20L%20592.993347%20768.724976%20L%20592.429626%20766.630859%20L%20585.503479%20767.516968%20L%20514.22821%20865.369263%20L%20405.825531%201011.865906%20L%20320.053711%201103.677979%20L%20299.516815%201111.812256%20L%20263.919525%201093.369263%20L%20267.221497%201060.429688%20L%20287.114136%201031.114136%20L%20405.825531%20880.107361%20L%20477.422913%20786.52356%20L%20523.651062%20732.483276%20L%20523.328918%20724.671265%20L%20520.590698%20724.671265%20L%20205.288605%20929.395935%20L%20149.154434%20936.644409%20L%20124.993355%20914.01355%20L%20127.973183%20876.885986%20L%20139.409409%20864.80542%20L%20234.201385%20799.570435%20L%20233.879227%20799.8927%20Z'/%3e%3c/svg%3e",l7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2092%2096'%20fill='currentColor'%3e%3cpath%20d='M65.45%2016.3c10.89%200%2019.71%208.86%2019.71%2019.8v6.6l5.74%2011.46a4.48%204.48%200%200%201-.01%203.6L85.16%2069.1v6.6c0%2010.94-8.83%2019.8-19.71%2019.8H26.02c-10.89%200-19.71-8.86-19.71-19.8v-6.6L.45%2057.8a4.48%204.48%200%200%201-.01-3.67L6.31%2042.7v-6.6c0-10.94%208.83-19.8%2019.71-19.8h39.43zm-2.52%205.7H29.19c-9.32%200-16.87%207.56-16.87%2016.88v5.62l-4.88%209.46a4.48%204.48%200%200%200%20.01%203.68l4.87%209.36v5.62c0%209.32%207.55%2016.88%2016.87%2016.88h33.74c9.32%200%2016.87-7.55%2016.87-16.88V67l4.77-9.39a4.48%204.48%200%200%200%200-3.61L79.8%2044.5v-5.62C79.8%2029.56%2072.25%2022%2062.93%2022z'%20fill-rule='nonzero'/%3e%3ccircle%20cx='45.73'%20cy='11'%20r='11'/%3e%3crect%20stroke='currentColor'%20stroke-width='8'%20x='31'%20y='44.5'%20width='5'%20height='22'%20rx='2.5'/%3e%3crect%20stroke='currentColor'%20stroke-width='8'%20x='55'%20y='44.5'%20width='5'%20height='22'%20rx='2.5'/%3e%3c/svg%3e",o7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M12.13%201.25c.15-.14.16-.14.28-.15.18%200%20.36.08.64.34.68.62%201.61%201.89%202.2%202.97l.22.42.32.16c.3.16.81.48%201.02.65.09.08.11.08.21.04.45-.18%201.09.05%201.65.6.51.49%201%201.33%201.18%202.03.03.11.06.36.07.54.04.64-.16%201.14-.55%201.37-.08.04-.08.06-.08.26.02.95-.23%201.89-.74%202.82-.58%201.04-1.6%202.11-2.98%203.12-.74.55-2.5%201.58-3.3%201.95-1.9.86-3.43%201.2-4.76%201.03-.79-.09-1.69-.41-2.22-.77-.14-.1-.16-.1-.27-.07-.57.16-1.31-.18-1.94-.88-.25-.28-.66-.98-.79-1.35-.3-.87-.25-1.65.16-2.12.11-.12.09-.33.09-.33-.04-.33-.05-.82-.04-1.14v-.3l-.43-.79c-.68-1.23-1.12-2.25-1.28-3.04-.09-.43-.09-.62.02-.77.07-.09.28-.18.54-.22.66-.12%202.09-.01%203.69.27l.16.03.36-.32c.61-.54%201.01-.84%201.75-1.31.77-.48%201.64-.89%202.62-1.2l.32-.1.17-.46c.62-1.65%201.25-2.86%201.71-3.27h0Zm-5.19%208.45c-.7.41-1.05.61-1.3.84-1.04.93-1.43%202.39-.99%203.71.11.33.31.68.71%201.39.41.71.61%201.06.83%201.32.92%201.05%202.37%201.45%203.68%201%20.32-.11.68-.31%201.38-.72l4.02-2.34c.7-.41%201.05-.61%201.3-.84%201.04-.93%201.43-2.39.99-3.71-.11-.33-.31-.68-.71-1.39s-.61-1.06-.83-1.32c-.92-1.05-2.37-1.45-3.68-1-.32.11-.67.31-1.38.72l-4.02%202.34Z'/%3e%3cpath%20fill='currentColor'%20fill-opacity='0.4'%20d='M8.02%2012.13c.38-.22.87-.09%201.09.29l.86%201.5c.22.38.09.88-.29%201.09-.38.22-.86.09-1.09-.29l-.86-1.5c-.22-.38-.09-.87.29-1.09Z'/%3e%3cpath%20fill='currentColor'%20fill-opacity='0.4'%20d='M12.31%209.64c.38-.22.87-.09%201.09.29l.86%201.5c.22.38.09.87-.29%201.09s-.87.09-1.09-.29l-.86-1.5c-.22-.38-.09-.88.29-1.09Z'/%3e%3c/svg%3e",c7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='currentColor'%20d='M22.282%209.821a5.985%205.985%200%200%200-.516-4.91%206.046%206.046%200%200%200-6.51-2.9A6.065%206.065%200%200%200%204.981%204.18a5.985%205.985%200%200%200-3.998%202.9%206.046%206.046%200%200%200%20.743%207.097%205.98%205.98%200%200%200%20.51%204.911%206.051%206.051%200%200%200%206.515%202.9A5.985%205.985%200%200%200%2013.26%2024a6.056%206.056%200%200%200%205.772-4.206%205.99%205.99%200%200%200%203.997-2.9%206.056%206.056%200%200%200-.747-7.073zM13.26%2022.43a4.476%204.476%200%200%201-2.876-1.04l.141-.081%204.779-2.758a.795.795%200%200%200%20.392-.681v-6.737l2.02%201.168a.071.071%200%200%201%20.038.052v5.583a4.504%204.504%200%200%201-4.494%204.494zM3.6%2018.304a4.47%204.47%200%200%201-.535-3.014l.142.085%204.783%202.759a.771.771%200%200%200%20.78%200l5.843-3.369v2.332a.08.08%200%200%201-.033.062L9.74%2019.95a4.5%204.5%200%200%201-6.14-1.646zM2.34%207.896a4.485%204.485%200%200%201%202.366-1.973V11.6a.766.766%200%200%200%20.388.676l5.815%203.355-2.02%201.168a.076.076%200%200%201-.071%200l-4.83-2.786A4.504%204.504%200%200%201%202.34%207.872zm16.597%203.855l-5.833-3.387L15.119%207.2a.076.076%200%200%201%20.071%200l4.83%202.791a4.494%204.494%200%200%201-.676%208.105v-5.678a.79.79%200%200%200-.407-.667zm2.01-3.023l-.141-.085-4.774-2.782a.776.776%200%200%200-.785%200L9.409%209.23V6.897a.066.066%200%200%201%20.028-.061l4.83-2.787a4.5%204.5%200%200%201%206.68%204.66zm-12.64%204.135l-2.02-1.164a.08.08%200%200%201-.038-.057V6.075a4.5%204.5%200%200%201%207.375-3.453l-.142.08L8.704%205.46a.795.795%200%200%200-.393.681zm1.097-2.365l2.602-1.5%202.607%201.5v2.999l-2.597%201.5-2.607-1.5z'/%3e%3c/svg%3e",h7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20362%20362'%20overflow='hidden'%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='M1562.63,107.07h-4.18v5.15h4.18c1.94,0,3.21-.87,3.21-2.53,0-1.75-1.17-2.62-3.21-2.62ZM1553.3,102.31h9.42c5.15,0,8.55,2.82,8.55,7.19,0,2.72-1.36,4.76-3.4,6.02l3.69,5.34v1.07h-5.34l-3.59-5.15h-4.18v5.15h-5.15v-19.62ZM1579.63,112.51c0-10.49-6.99-18.46-17.68-18.46s-17.49,7.58-17.49,18.46,6.99,18.46,17.49,18.46,17.68-7.97,17.68-18.46ZM1584,112.51c0,12.34-8.26,22.63-22.05,22.63s-21.86-10.39-21.86-22.63,8.16-22.63,21.86-22.63,22.05,10.3,22.05,22.63ZM348.21,156.4l-42.55,24.61,42.55,24.54c10.75,6.22,14.42,19.9,8.21,30.67-6.2,10.7-19.92,14.37-30.63,8.18l-76.21-44c-5.08-2.96-8.61-7.59-10.18-12.8-.74-2.4-1.09-4.87-1-7.31.04-1.76.3-3.53.79-5.29,1.52-5.48,5.1-10.38,10.39-13.46l76.21-43.97c10.71-6.19,24.43-2.51,30.63,8.22,6.22,10.72,2.54,24.41-8.21,30.61ZM307.93,275.68l-76.19-43.94c-4.09-2.38-8.63-3.3-12.99-2.93-11.62.83-20.75,10.53-20.75,22.34v87.98c0,12.4,10,22.45,22.42,22.45s22.45-10.05,22.45-22.45v-49.21l42.66,24.63c10.72,6.23,24.43,2.54,30.61-8.17,6.17-10.74,2.53-24.5-8.21-30.7ZM220.01,189.61l-31.67,31.63c-.91.93-2.65,1.69-3.98,1.69h-9.31c-1.28,0-3.06-.76-3.98-1.69l-31.66-31.63c-.91-.89-1.64-2.68-1.64-3.94v-9.33c0-1.29.73-3.09,1.64-3.99l31.66-31.63c.92-.93,2.7-1.66,3.98-1.66h9.31c1.29,0,3.07.73,3.98,1.66l31.67,31.63c.9.9,1.63,2.7,1.63,3.99v9.33c0,1.26-.73,3.05-1.63,3.94ZM194.7,180.83c0-1.28-.77-3.06-1.68-4l-9.17-9.13c-.9-.9-2.68-1.65-3.96-1.65h-.36c-1.28,0-3.05.75-3.94,1.65l-9.17,9.13c-.92.95-1.62,2.73-1.62,4v.36c0,1.26.7,3.03,1.62,3.95l9.17,9.16c.9.9,2.67,1.65,3.94,1.65h.36c1.28,0,3.06-.75,3.96-1.65l9.17-9.16c.9-.92,1.68-2.68,1.68-3.95v-.36ZM51.48,86.28l76.21,43.99c4.09,2.35,8.64,3.29,13.01,2.93,11.6-.86,20.75-10.58,20.75-22.37V22.84c0-12.37-10.06-22.41-22.42-22.41s-22.45,10.05-22.45,22.41v49.23l-42.7-24.66c-10.71-6.2-24.4-2.53-30.61,8.2-6.19,10.76-2.53,24.47,8.2,30.67ZM218.75,133.19c4.36.36,8.9-.57,12.99-2.93l76.19-43.99c10.74-6.2,14.38-19.91,8.21-30.67-6.18-10.72-19.89-14.4-30.61-8.2l-42.66,24.66V22.84c0-12.37-10.03-22.41-22.45-22.41s-22.42,10.05-22.42,22.41v87.98c0,11.8,9.13,21.51,20.75,22.37ZM140.71,228.8c-4.38-.37-8.92.54-13.01,2.93l-76.21,43.94c-10.72,6.2-14.38,19.96-8.2,30.7,6.22,10.71,19.91,14.4,30.61,8.17l42.7-24.63v49.21c0,12.4,10.03,22.45,22.45,22.45s22.42-10.05,22.42-22.45v-87.98c0-11.81-9.16-21.51-20.75-22.34ZM120.04,187.6c.76-2.4,1.08-4.87,1.02-7.31-.09-1.76-.32-3.53-.82-5.29-1.51-5.48-5.08-10.38-10.44-13.46l-76.15-43.97c-10.75-6.19-24.45-2.51-30.63,8.22-6.23,10.72-2.55,24.41,8.2,30.61l42.55,24.61-42.55,24.54c-10.75,6.22-14.41,19.9-8.2,30.67,6.17,10.7,19.88,14.37,30.63,8.18l76.15-44c5.14-2.96,8.63-7.59,10.23-12.8Z'/%3e%3c/svg%3e",u7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2012%2012'%3e%3cg%20transform='matrix(0.00160555,0,0,-0.0014599,-0.26812129,11.08482)'%20fill='currentColor'%3e%3cpath%20d='m%20297,6493%20c%20-4,-3%20-7,-1357%20-7,-3008%200,-2390%203,-3005%2012,-3012%2013,-10%201199,-9%201224,1%2011,4%2013,61%2010,295%20-2,159%20-7,294%20-10,299%20-4,7%20-112,11%20-312,11%20-168,0%20-309,3%20-314,6%20-12,7%20-13,4775%20-2,4792%206,10%2085,13%20317,15%20l%20310,3%20v%20600%20l%20-611,3%20c%20-336,1%20-614,-1%20-617,-5%20z'/%3e%3cpath%20d='m%206287,6493%20c%20-4,-3%20-7,-136%20-7,-294%200,-219%203,-290%2013,-296%206,-4%20152,-10%20322,-13%20l%20310,-5%203,-2394%20c%201,-1545%20-1,-2398%20-8,-2405%20-6,-6%20-127,-9%20-316,-7%20-246,2%20-309,0%20-315,-11%20-5,-7%20-9,-145%20-9,-305%20V%20470%20l%2023,-1%20c%20158,-4%201192,-2%201200,3%2014,9%2022,5964%207,6002%20l%20-10,26%20h%20-603%20c%20-332,0%20-607,-3%20-610,-7%20z'/%3e%3cg%20transform='matrix(1.0249,0,0,1.0566,-429.39,51.322)'%3e%3cpath%20d='m%202476.7,5111.6%20c%20-64.95,-6.2305%20-71.077,-28.66%20-73.528,-325.23%20-3.6765,-261.68%204.9018,-351.4%2036.764,-371.34%207.3528,-4.9844%20583.32,-12.461%201276.9,-16.199%20l%201262.2,-6.2306%2073.528,-34.891%20c%20191.17,-90.966%20300.24,-292.84%20284.31,-527.1%20-15.931,-223.05%20-134.8,-392.52%20-314.95,-449.85%20-61.274,-19.938%20-133.58,-21.184%20-727.93,-18.692%20-607.83,3.7384%20-661.75,2.4922%20-682.59,-17.446%20-22.058,-19.938%20-23.284,-43.614%20-23.284,-331.47%200,-190.65%204.9019,-320.25%2012.255,-335.2%2011.029,-21.184%2026.96,-23.676%20123.77,-23.676%20h%20110.29%20l%2066.176,-63.552%20c%2036.764,-34.891%20125,-125.86%20198.53,-201.87%2072.303,-76.013%20322.3,-333.96%20555.14,-571.96%20l%20424.01,-434.89%20519.6,3.7383%20c%20390.93,2.4922%20520.83,7.4767%20520.83,18.692%200,7.4766%20-223.04,249.22%20-496.32,534.58%20-562.49,589.41%20-666.66,701.56%20-660.53,707.79%202.451,2.4922%2052.695,8.7227%20111.52,13.707%20322.3,24.922%20593.13,194.39%20790.43,495.95%20129.9,199.38%20187.5,391.28%20196.08,660.44%208.5783,245.48%20-14.706,368.85%20-116.42,600.63%20-123.77,286.61%20-328.43,492.21%20-596.8,601.87%20-232.84,95.95%20-167.89,92.212%20-1574.7,93.458%20-691.17,1.2462%20-1274.5,1.2462%20-1295.3,-1.2461%20z'/%3e%3cpath%20d='m%202430.1,3942.7%20c%20-24.509,-18.692%20-24.509,-33.645%20-24.509,-1254.8%200,-1163.9%201.2255,-1238.6%2022.058,-1271%20l%2020.833,-33.645%20h%20337%20c%20289.21,0%20338.23,2.4922%20354.16,19.938%2018.382,17.446%2019.608,145.79%2018.382,1267.3%20-1.2255,1115.3%20-2.4509,1251.1%20-19.608,1271%20-18.382,18.692%20-50.244,21.184%20-351.71,21.184%20-276.96,-1.2461%20-335.78,-3.7383%20-356.61,-19.938%20z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",d7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%20366%20368'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill='currentColor'%20d='m%2026,275.93574%20c%200.65,-9.32%208.46,-15.43%2015,-20.96%2015.43,-13.04%2035.67,-21.92%2053,-32.71%2020.67,-12.88%2061.58,-40.31%2080,-55.03%200,0%2021,-18.39%2021,-18.39%200,0%2028,-23.91%2028,-23.91%2010,-8.33%2014.1,-11.65%2025,-18.92%207.42,-4.94%2019.07,-12.550001%2024.52,-19.330001%207.17,-8.93%204.16,-18.82%20-4.53,-25.45%20-5.67,-4.32%20-23.5,-8.94%20-30.99,-10.66%20-3.1,-0.72%20-11.45,-1.57%20-13.38,-3.62%20-3.22,-3.43%201.67,-6.99%204.38,-8.45%206.61,-3.54%2017.51,-5.73%2025,-5.82%200,0%204,0%204,0%2016.51,-0.2%2018.85,-12.47%2040,-11.99%209.26,0.21%2021.16,2.48%2029,7.54%207.87,5.07%2012.2,11.73%2017.05,19.45%206.31,10.05%2012.35,21.16%2014.49,33%201.42,7.88%20-0.45,13.62%20-0.54,21.000001%20-0.28,24.26%206.68,37.92%20-2.44,63%20-5.9,16.24%20-14.87,35.36%20-23.98,50%20-9.34,15%20-20.81,30.64%20-35.58,40.64%200,0%20-16,9.36%20-16,9.36%20-3.3,1.9%20-6.18,2.94%20-6.64,7.04%20-0.68,2.83%20-0.16,7.11%200,9.96%200,0%201.29,8%201.29,8%201.62,5.16%208.51,12.15%2012.35,16%203.36,3.37%206.84,7.82%2012,7.89%204.2,0.06%208.14,-2.87%2012,-4.44%205.24,-2.13%2011.35,-3.55%2017,-3.94%206.33,-0.43%2017.05,1.85%2014,10.49%20-2.84,-3.54%20-6.09,-6.36%20-11,-5.57%20-2.47,0.4%20-10.06,3.6%20-8.09,7.08%201.19,2.08%207.67,3.01%2010.09,3.88%206.26,2.25%2010.83,5.76%2014,11.61%200,0%20-17,-6.33%20-17,-6.33%20-9.74,-2.08%20-18.73,0.62%20-28,3.33%205.49,3.71%208.06,5.51%2012,11%20-8.23,-1.96%20-13.6,-7.46%20-26,-6.96%20-9.64,0.39%20-11.89,4.13%20-27,3.96%20-9.42,-0.11%20-17.78,-4.36%20-27,-3.96%20-9.45,0.41%20-13.16,5.64%20-21,8.96%203.16,-14.88%2019.73,-16%2032,-16%20-7.31,-10.21%20-20.46,-18.11%20-23.28,-26%20-0.7,-1.97%20-0.69,-3.94%20-0.71,-6%200,0%200,-14%200,-14%200.23,-2.35%201.13,-5.62%200,-7.73%20-1.66,-2.77%20-8.94,-4.64%20-12.01,-5.55%20-20.1,-5.96%20-24.58,-0.84%20-43,2.01%200,0%20-14,2.11%20-14,2.11%20-9.78,1.06%20-18.83,0.92%20-28,5.02%200,0%20-15,7.88%20-15,7.88%20-16.76,8.6%20-42.02,22.27%20-59,27.93%20-9.14,3.04%20-16.2,6.24%20-26,6.33%200,0%205,-10%205,-10%20-3.92,0.18%20-15.76,3.08%20-17.92,-0.51%20-2.44,-4.07%205.28,-9.01%207.92,-10.91%200,0%2036,-24.58%2036,-24.58%200,0%20-19,3.25%20-19,3.25%20z%20m%20227,1.75%20c%20-2.98,0.84%20-11.45,3.61%20-12.96,6.27%20-0.95,1.89%20-0.18,5.54%200,7.73%200.04,2.47%20-0.13,4.56%200.61,7%201.52,5.07%2011.84,17.33%2016.35,19.88%203.38,1.91%2015.93,0.11%2020,-0.88%20-4.12,-8.71%20-16.66,-15.05%20-21.99,-24%20-3.43,-5.75%20-0.8,-10.06%20-2.01,-16%20z'%20/%3e%3c/svg%3e",f7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20466.73%20532.09'%3e%3cpath%20fill='currentColor'%20d='M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z'/%3e%3c/svg%3e",p7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20128%20128'%3e%3cpath%20fill='currentColor'%20d='M40.1024%2085.0722C47.6207%2077.5537%2051.8469%2067.3453%2051.8469%2056.7136C51.8469%2046.0818%2047.617%2035.8734%2040.1024%2028.355L11.7446%200C4.22995%207.5185%200%2017.7269%200%2028.3586C0%2038.9903%204.22995%2049.1987%2011.7446%2056.7172L40.0987%2085.0722H40.1024Z'/%3e%3cpath%20fill='currentColor'%20d='M99.4385%2087.698C91.9239%2080.1832%2081.7121%2075.9531%2071.0844%2075.9531C60.4566%2075.9531%2050.2448%2080.1832%2042.7266%2087.698L71.0844%20116.057C78.599%20123.571%2088.8107%20127.802%2099.4421%20127.802C110.074%20127.802%20120.282%20123.571%20127.8%20116.057L99.4421%2087.698H99.4385Z'/%3e%3cpath%20fill='currentColor'%20d='M11.8146%20115.987C19.3329%20123.502%2029.541%20127.732%2040.1724%20127.732V87.6289H0.0664062C0.0700559%2098.2606%204.29635%20108.469%2011.8146%20115.987Z'/%3e%3cpath%20fill='currentColor'%20d='M110.387%2045.7684C102.869%2038.2535%2092.6608%2034.0198%2082.0258%2034.0234C71.3943%2034.0234%2061.1863%2038.2535%2053.668%2045.772L82.0258%2074.1306L110.387%2045.7684Z'/%3e%3c/svg%3e",g7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20263%20300'%3e%3cpath%20fill='currentColor'%20d='M1.84577e-10%20100.797V38.6224C1.88813e-05%2035.8899%201.45777%2033.365%203.82414%2031.9988L57.6539%200.920185C60.0203%20-0.446051%2062.9358%20-0.446051%2065.3022%200.920185L119.132%2031.9988C121.498%2033.3651%20122.956%2035.8899%20122.956%2038.6224V70.375C123.192%2080.9262%20128.769%2091.103%20138.577%2096.7655C148.384%20102.428%20159.986%20102.169%20169.242%2097.0979L196.74%2081.2217C199.107%2079.8554%20202.022%2079.8554%20204.388%2081.2217L258.218%20112.3C260.585%20113.667%20262.042%20116.191%20262.042%20118.924V181.081C262.042%20183.814%20260.585%20186.339%20258.218%20187.705L204.388%20218.783C202.022%20220.15%20199.107%20220.15%20196.74%20218.783L169.464%20203.036C160.173%20197.847%20148.465%20197.536%20138.579%20203.244C128.772%20208.906%20123.195%20219.083%20122.959%20229.634V261.378C122.959%20264.111%20121.501%20266.635%20119.135%20268.002L65.3048%20299.08C62.9384%20300.447%2060.0229%20300.447%2057.6566%20299.08L3.82673%20268.002C1.46036%20266.635%200.00260562%20264.111%200.00260562%20261.378V199.221C0.0026245%20196.488%201.46038%20193.963%203.82675%20192.597L57.6565%20161.519C60.0229%20160.152%2062.9384%20160.152%2065.3048%20161.519L92.8656%20177.431C102.11%20182.467%20113.679%20182.711%20123.463%20177.062C133.349%20171.355%20138.934%20161.06%20139.086%20150.419C138.85%20139.868%20133.274%20128.601%20123.466%20122.938C113.658%20117.276%20102.056%20117.534%2092.8007%20122.606L65.1758%20138.645C62.7991%20140.025%2059.8649%20140.024%2057.4894%20138.642L3.80216%20107.407C1.44816%20106.038%20-1.88809e-05%20103.52%201.84577e-10%20100.797Z'/%3e%3c/svg%3e",m7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.12109%2011.0078H1.99902V5.49316H3.12109V11.0078ZM3.7041%205.49316C4.91979%205.49316%205.31142%205.57449%205.80762%205.7373C6.50208%205.97365%206.85299%206.40958%206.86133%207.04492V9.45605C6.86125%2010.207%206.37767%2010.6797%205.41016%2010.874C4.95546%2010.9633%204.69632%2011.0078%203.7041%2011.0078V10.6064C4.72131%2010.6064%204.95994%2010.5507%205.34863%2010.4404C5.91072%2010.2671%206.19576%209.93907%206.2041%209.45605V7.04492C6.20402%206.4883%205.83211%206.13886%205.08789%205.99707C4.74057%205.93405%204.58897%205.89978%203.7041%205.89453V5.49316ZM9.16797%205.49316V11.0078H8.0459V5.49316H9.16797ZM14%206.79297V11.0078H12.8779V8.0791L13.8877%206.79297H14ZM14%205.49316V5.7373L11.3594%208.97852H10.7852L9.74219%206.94531V6.07812H9.86719L11.0723%208.33203L13.4258%205.49316H14Z'%20fill='currentColor'/%3e%3c/svg%3e",v7="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2IiBmaWxsPSJjdXJyZW50Q29sb3IiPgogIDx0ZXh0IHg9IjgiIHk9IjEwIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LXNpemU9IjEwLjUiIGZvbnQtZmFtaWx5PSJHZW9yZ2lhLCBzZXJpZiIgZm9udC1zdHlsZT0iaXRhbGljIiBmaWxsPSJjdXJyZW50Q29sb3IiPs60PC90ZXh0PgogIDxsaW5lIHgxPSIxIiB5MT0iMTQiIHgyPSIxNSIgeTI9IjE0IiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLW9wYWNpdHk9IjAuNCIgc3Ryb2tlLXdpZHRoPSIxIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KICA8bGluZSB4MT0iOCIgeTE9IjE0IiB4Mj0iOCIgeTI9IjEyIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIxIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KICA8Y2lyY2xlIGN4PSI4IiBjeT0iMTEuNSIgcj0iMC43IiBmaWxsPSJjdXJyZW50Q29sb3IiLz4KPC9zdmc+Cg==",_7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20900%20900'%20fill='none'%3e%3cpath%20fill='currentColor'%20d='M622.037%20192.524a10.58%2010.58%200%200%201-4.056-2.001%2010.573%2010.573%200%200%201-3.98-7.89%2010.595%2010.595%200%200%201%20.804-4.452c20.214-49.194%2029.134-88.555%2014.74-105.033-38.123-43.716-191.004%2043.219-239.75%2072.663a10.596%2010.596%200%200%201-10.841.041%2010.576%2010.576%200%200%201-4.396-5.07c-20.491-49.089-42.031-83.233-63.865-84.714-57.871-3.96-104.516%20165.624-118.17%20220.895a10.574%2010.574%200%200%201-1.993%204.057%2010.572%2010.572%200%200%201-7.884%203.977%2010.586%2010.586%200%200%201-4.447-.802c-49.194-20.215-88.572-29.134-105.033-14.74-43.717%2038.123%2043.202%20191.005%2072.644%20239.75a10.553%2010.553%200%200%201%201.454%204.279%2010.573%2010.573%200%200%201-6.481%2010.958c-49.072%2020.491-83.216%2042.031-84.715%2063.864-3.944%2057.871%20165.624%20104.516%20220.913%20118.171a10.566%2010.566%200%200%201%205.658%203.601%2010.57%2010.57%200%200%201%202.355%206.281%2010.58%2010.58%200%200%201-.799%204.442c-20.214%2049.194-29.134%2088.572-14.739%20105.033%2038.121%2043.717%20191.021-43.202%20239.767-72.644a10.566%2010.566%200%200%201%2015.238%205.027c20.489%2049.072%2042.013%2083.216%2063.862%2084.715%2057.871%203.944%20104.516-165.624%20118.153-220.913a10.603%2010.603%200%200%201%209.895-8.021%2010.566%2010.566%200%200%201%204.449.808c49.193%2020.214%2088.553%2029.116%20105.032%2014.738%2043.718-38.121-43.219-191.022-72.663-239.767a10.602%2010.602%200%200%201%201.326-12.655%2010.604%2010.604%200%200%201%203.703-2.582c49.089-20.49%2083.233-42.031%2084.714-63.863%203.96-57.871-165.624-104.516-220.895-118.153Zm-66.394-55.478c11.123%2019.938-46.196%20152.797-88.83%20245.724a8.36%208.36%200%200%201-8.239%204.855%208.374%208.374%200%200%201-7.412-6.043c-17.219-60.42-36.899-131.411-57.957-191.675a10.557%2010.557%200%200%201%204.924-12.759c52.586-28.721%20142.568-66.86%20157.514-40.102ZM303.635%20153.49c21.953%206.233%2075.365%20140.709%20110.92%20236.564a8.364%208.364%200%200%201-2.394%209.249%208.364%208.364%200%200%201-9.504.978c-54.943-30.493-119.013-66.824-176.522-94.546a10.565%2010.565%200%200%201-5.528-12.501c16.926-57.44%2053.532-148.095%2083.028-139.744ZM137.064%20343.322c19.921-11.123%20152.795%2046.197%20245.707%2088.83a8.369%208.369%200%200%201-1.189%2015.652c-60.401%2017.219-131.411%2036.899-191.675%2057.957a10.552%2010.552%200%200%201-12.742-4.925c-28.668-52.584-66.876-142.568-40.101-157.514Zm16.443%20252.009c6.217-21.953%20140.709-75.365%20236.564-110.921a8.368%208.368%200%200%201%2010.227%2011.898c-30.511%2054.945-66.842%20119.014-94.563%20176.507a10.548%2010.548%200%200%201-5.229%205.075%2010.544%2010.544%200%200%201-7.271.468c-57.441-16.822-148.095-53.531-139.728-83.027ZM343.34%20761.902c-11.14-19.922%2046.197-152.796%2088.829-245.707a8.383%208.383%200%200%201%205.713-4.66%208.38%208.38%200%200%201%207.182%201.664%208.371%208.371%200%200%201%202.758%204.184c17.217%2060.403%2036.898%20131.412%2057.957%20191.675a10.558%2010.558%200%200%201-4.942%2012.743c-52.568%2028.668-142.568%2066.875-157.445%2040.101h-.052Zm252.009-16.443c-21.971-6.216-75.383-140.709-110.939-236.564a8.37%208.37%200%200%201%2011.916-10.228c54.926%2030.494%20119.014%2066.842%20176.506%2094.563a10.538%2010.538%200%200%201%205.527%2012.502c-16.909%2057.526-53.515%20148.094-83.01%20139.727Zm166.57-189.834c-19.938%2011.141-152.796-46.197-245.724-88.83a8.367%208.367%200%200%201-2.993-12.892%208.378%208.378%200%200%201%204.182-2.759c60.419-17.218%20131.41-36.899%20191.675-57.958a10.577%2010.577%200%200%201%2012.758%204.943c28.652%2052.568%2066.86%20142.569%2040.102%20157.496Zm-16.444-252.009c-6.232%2021.971-140.709%2075.383-236.562%20110.94a8.371%208.371%200%200%201-10.229-11.917c30.495-54.926%2066.825-119.012%2094.547-176.505a10.555%2010.555%200%200%201%2012.5-5.528c57.441%2016.909%20148.096%2053.516%20139.744%2083.01Z'/%3e%3c/svg%3e",y7=""+new URL("fast-agent-C0GPnwYP.svg",import.meta.url).href,S7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='currentColor'%20d='M11.04%2019.32Q12%2021.51%2012%2024q0-2.49.93-4.68.96-2.19%202.58-3.81t3.81-2.55Q21.51%2012%2024%2012q-2.49%200-4.68-.93a12.3%2012.3%200%200%201-3.81-2.58%2012.3%2012.3%200%200%201-2.58-3.81Q12%202.49%2012%200q0%202.49-.96%204.68-.93%202.19-2.55%203.81a12.3%2012.3%200%200%201-3.81%202.58Q2.49%2012%200%2012q2.49%200%204.68.96%202.19.93%203.81%202.55t2.55%203.81'/%3e%3c/svg%3e",x7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.99816%2014.2779C12.0678%2014.2779%2014.9997%2011.6274%2014.9997%2010.9574V9.3189C14.939%208.77306%2014.4165%207.82349%2013.6074%207.48636C13.5959%207.42498%2013.5859%207.36153%2013.5756%207.29542C13.5506%207.13548%2013.5231%206.95977%2013.4649%206.75954C13.6409%206.31508%2013.6873%205.81187%2013.6873%205.31135C13.6873%204.54947%2013.5757%203.76321%2013.0811%203.13712C12.5745%202.4959%2011.7737%202.15372%2010.6972%202.03411C9.64215%201.91688%208.71828%202.06409%208.12157%202.70342C8.07827%202.74981%208.0345%202.79812%207.99655%202.84746C7.95861%202.79812%207.91805%202.74981%207.87475%202.70342C7.27804%202.06409%206.35416%201.91688%205.29908%202.03411C4.22263%202.15372%203.42181%202.4959%202.91521%203.13712C2.42057%203.76321%202.30905%204.54947%202.30905%205.31135C2.30905%205.81187%202.35539%206.31508%202.53142%206.75954C2.47323%206.95977%202.44574%207.13542%202.42072%207.29536C2.41037%207.3615%202.40044%207.42496%202.38893%207.48636C1.57983%207.82349%201.05728%208.77306%200.996582%209.3189V10.9574C0.996582%2011.6274%203.92849%2014.2779%207.99816%2014.2779ZM10.5523%203.33859C9.63863%203.23707%209.25001%203.41798%209.0811%203.59896C8.90273%203.79007%208.76738%204.19254%208.86971%205.0112C8.94909%205.64627%209.13423%206.08757%209.41018%206.36929C9.67188%206.63645%2010.0966%206.8426%2010.8435%206.8426C11.6506%206.8426%2011.9631%206.66867%2012.1051%206.51046C12.2619%206.33577%2012.3748%206.00462%2012.3748%205.31135C12.3748%204.64141%2012.2675%204.22455%2012.0513%203.95077C11.8469%203.69214%2011.4446%203.43773%2010.5523%203.33859ZM6.91639%203.59896C6.74748%203.41798%206.35886%203.23707%205.44518%203.33859C4.55289%203.43773%204.15058%203.69214%203.94624%203.95077C3.72994%204.22455%203.62271%204.64141%203.62271%205.31135C3.62271%206.00462%203.73563%206.33577%203.89239%206.51046C4.03436%206.66867%204.34693%206.8426%205.15396%206.8426C5.90092%206.8426%206.32561%206.63645%206.58731%206.36929C6.86326%206.08757%207.0484%205.64627%207.12778%205.0112C7.23011%204.19254%207.09476%203.79007%206.91639%203.59896ZM7.99818%2012.9788C9.99307%2012.9788%2012.0088%2012.0076%2012.3748%2011.7248V8.00133L12.3546%207.90026C11.9257%208.08369%2011.4142%208.1551%2010.8435%208.1551C9.84049%208.1551%209.04148%207.86851%208.47257%207.28773C8.28092%207.09208%208.12536%206.87308%207.99978%206.6378C7.8742%206.87308%207.71544%207.09208%207.52378%207.28773C6.95488%207.86851%206.15587%208.1551%205.15283%208.1551C4.58212%208.1551%204.07068%208.08369%203.6418%207.90026L3.62158%208.00133V11.7248C3.98755%2012.0076%206.00329%2012.9788%207.99818%2012.9788Z'%20fill='currentColor'/%3e%3cpath%20d='M6.46854%209.0301C6.83097%209.0301%207.12479%209.32391%207.12479%209.68635V10.9988C7.12479%2011.3613%206.83097%2011.6551%206.46854%2011.6551C6.1061%2011.6551%205.81229%2011.3613%205.81229%2010.9988V9.68635C5.81229%209.32391%206.1061%209.0301%206.46854%209.0301Z'%20fill='currentColor'/%3e%3cpath%20d='M10.1873%209.68635C10.1873%209.32391%209.89347%209.0301%209.53104%209.0301C9.1686%209.0301%208.87479%209.32391%208.87479%209.68635V10.9988C8.87479%2011.3613%209.1686%2011.6551%209.53104%2011.6551C9.89347%2011.6551%2010.1873%2011.3613%2010.1873%2010.9988V9.68635Z'%20fill='currentColor'/%3e%3c/svg%3e",w7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='currentColor'%20fill-rule='evenodd'%3e%3ctitle%3eZ.ai%3c/title%3e%3cpath%20d='M8.07%201.333L6.618%203.302H.435L1.887%201.333h6.184zM15.503%2012.699L14.052%2014.667h-6.161l1.449-1.968h6.163zM16%201.333L6.176%2014.667H0L9.824%201.333H16z'/%3e%3c/svg%3e",b7=""+new URL("goose-y93b4F4V.svg",import.meta.url).href,C7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M0.58392448,14.9254204%20L0.8326,14.66295%20C2.004465,13.42985%203.1678,12.2082%202.45814,10.48105%20C1.50813,8.1701%202.061355,5.4619%203.820575,3.70057%20C5.6495,1.8709%208.3431,1.40957%2010.59295,2.336505%20C11.0907,2.52161%2011.5245,2.785025%2011.86295,3.02993%20L9.98425,3.89849%20C8.235,3.163775%206.23115,3.66355%205.0081,4.88809%20C3.354105,6.5426%203.019895,9.4117%204.95835,11.2656%20L-0.335,15.99995%20C-0.066496,15.62975%200.2538896,15.275934%200.58392448,14.9254204%20Z%20M14.0391,2.288155%20L16.33165,2.57749377e-12%20L16.20795,0.172288%20C14.4658,2.574355%2013.6153,3.749045%2014.29795,6.6879%20C14.76445,8.68415%2014.261,10.90255%2012.63545,12.53005%20C10.5861,14.58325%207.3066,15.0403%204.6059,13.19215%20L6.48885,12.3193%20C8.2125,12.99705%2010.0983,12.69945%2011.4536,11.34255%20C12.80895,9.9856%2013.1133,8.00925%2012.4321,6.3647%20C12.30265,6.05285%2011.9144,5.97455%2011.64275,6.1753%20L6.102,10.27035%20L14.0391,2.288155%20Z'/%3e%3c/svg%3e",k7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M11.2%201.4%2014.6%204.8a1%201%200%200%201%200%201.4l-1.5%201.5-4.8-4.8%201.5-1.5a1%201%200%200%201%201.4%200ZM7.6%203.6l4.8%204.8-6.9%206.9a1%201%200%200%201-.5.27l-3.4.73a.6.6%200%200%201-.71-.71l.73-3.4a1%201%200%200%201%20.27-.5l5.6-5.6Zm-4.5%208.1-.4%201.9%201.9-.4-1.5-1.5Z'/%3e%3c/svg%3e",E7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2040%2040'%20fill='none'%3e%3cpath%20d='M25%2015H35V16.75C35%2029%2030.5001%2035%2016.5001%2035H15V25H16.5001C22.6251%2025%2025%2022.875%2025%2016.75V15Z'%20fill='currentColor'/%3e%3crect%20x='5'%20y='15'%20width='10'%20height='10'%20fill='currentColor'/%3e%3crect%20x='15'%20y='5'%20width='10'%20height='10'%20fill='currentColor'/%3e%3c/svg%3e",M7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2040%2040'%3e%3cpath%20fill='currentColor'%20d='M27.9998324,34.6666921h6.6666279v5.3333023h-8.3809037l-3.6190266-3.6190266v-8.3809037h5.3333023v6.6666279ZM39.9997627,26.2857884l-3.6190266-3.6190266h-8.3809037v5.3333023h6.6666279v6.6666279h5.3333023v-8.3809037ZM17.3332326,22.6667578h-5.3333023v5.3333023h5.3333023v-5.3333023ZM0,36.3809638l3.6190266,3.6190266h13.714206v-5.3333023H5.3333023v-11.9999302H0v13.714206ZM33.9600959,11.9999247V3.619021L30.3410693-.0000056h-7.6745392v5.3333023h5.9602634v6.6666279h-5.9602634v5.3333023h17.3332326v-5.3333023h-6.0396668ZM5.3333023,0H0v17.3332326h5.3333023v-5.9999651h6.6666279v5.9999651h5.3333023v-5.9999651l-5.3333023-5.3333023h-6.6666279V0ZM17.3332326,0h-5.3333023v5.9999651h5.3333023V0Z'/%3e%3c/svg%3e",j7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M3%201h2.5v5.5L9%201h3L8.5%206.5%2012.5%2013H9.5L6%208v5H3V1z'/%3e%3c/svg%3e",T7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='currentColor'%20d='M19.514%207.342C19.711%207.862%2019.814%208.413%2019.816%208.969C19.816%2012.494%2015.998%2014.697%2012.946%2012.934C11.529%2012.116%2010.657%2010.605%2010.657%208.969C10.657%205.646%2014.085%203.431%2017.115%204.793C15.26%203.373%2012.99%202.607%2010.655%202.612C4.772%202.614%200.005%207.381%200%2013.265C0.002%2019.148%204.772%2023.918%2010.655%2023.92C16.538%2023.916%2021.306%2019.147%2021.31%2013.265C21.312%2011.155%2020.687%209.095%2019.514%207.342ZM14.841%204.666C14.841%208.191%2018.657%2010.395%2021.709%208.632C23.127%207.814%2024%206.302%2024%204.666C24%201.14%2020.184-1.061%2017.13%200.699C15.714%201.519%2014.841%203.03%2014.841%204.666'/%3e%3c/svg%3e",R7="data:image/svg+xml,%3csvg%20width='1200'%20height='1200'%20viewBox='0%200%201200%201200'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='1200'%20height='1200'%20rx='260'%20fill='%239046FF'/%3e%3cmask%20id='mask0_1106_4856'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='272'%20y='202'%20width='655'%20height='796'%3e%3cpath%20d='M926.578%20202.793H272.637V997.857H926.578V202.793Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_1106_4856)'%3e%3cpath%20d='M398.554%20818.914C316.315%201001.03%20491.477%201046.74%20620.672%20940.156C658.687%201059.66%20801.052%20970.473%20852.234%20877.795C964.787%20673.567%20919.318%20465.357%20907.64%20422.374C827.637%20129.443%20427.623%20128.946%20358.8%20423.865C342.651%20475.544%20342.402%20534.18%20333.458%20595.051C328.986%20625.86%20325.507%20645.488%20313.83%20677.785C306.873%20696.424%20297.68%20712.819%20282.773%20740.645C259.915%20783.881%20269.604%20867.113%20387.87%20823.883L399.051%20818.914H398.554Z'%20fill='white'/%3e%3cpath%20d='M636.123%20549.353C603.328%20549.353%20598.359%20510.097%20598.359%20486.742C598.359%20465.623%20602.086%20448.977%20609.293%20438.293C615.504%20428.852%20624.697%20424.131%20636.123%20424.131C647.555%20424.131%20657.492%20428.852%20664.447%20438.541C672.398%20449.474%20676.623%20466.12%20676.623%20486.742C676.623%20525.998%20661.471%20549.353%20636.375%20549.353H636.123Z'%20fill='black'/%3e%3cpath%20d='M771.24%20549.353C738.445%20549.353%20733.477%20510.097%20733.477%20486.742C733.477%20465.623%20737.203%20448.977%20744.41%20438.293C750.621%20428.852%20759.814%20424.131%20771.24%20424.131C782.672%20424.131%20792.609%20428.852%20799.564%20438.541C807.516%20449.474%20811.74%20466.12%20811.74%20486.742C811.74%20525.998%20796.588%20549.353%20771.492%20549.353H771.24Z'%20fill='black'/%3e%3c/g%3e%3c/svg%3e",D7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M2%203h3l3%205%203-5h3v10h-2V6.5l-4%206-4-6V13H2V3Z'/%3e%3c/svg%3e",A7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3crect%20fill='none'%20stroke='currentColor'%20stroke-width='1.1'%20x='4.5'%20y='2.5'%20width='7'%20height='10'%20rx='3.5'/%3e%3cline%20stroke='currentColor'%20stroke-width='1'%20x1='3'%20y1='5.5'%20x2='13'%20y2='5.5'/%3e%3ccircle%20fill='none'%20stroke='currentColor'%20stroke-width='1'%20cx='6.5'%20cy='5.5'%20r='1.6'/%3e%3ccircle%20fill='none'%20stroke='currentColor'%20stroke-width='1'%20cx='9.5'%20cy='5.5'%20r='1.6'/%3e%3ccircle%20fill='currentColor'%20cx='6.8'%20cy='5.6'%20r='0.55'/%3e%3ccircle%20fill='currentColor'%20cx='9.8'%20cy='5.6'%20r='0.55'/%3e%3cpath%20fill='none'%20stroke='currentColor'%20stroke-width='0.6'%20stroke-linecap='round'%20d='M7%208.3%20Q8%209%209%208.3'/%3e%3cpath%20fill='none'%20stroke='currentColor'%20stroke-width='0.9'%20stroke-linecap='round'%20d='M4.5%208%20L3%209.5'/%3e%3cpath%20fill='none'%20stroke='currentColor'%20stroke-width='0.9'%20stroke-linecap='round'%20d='M11.5%208%20L13%209.5'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.7'%20x1='5'%20y1='9.5'%20x2='11'%20y2='9.5'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.9'%20x1='6.5'%20y1='12.5'%20x2='6.5'%20y2='14'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.9'%20x1='9.5'%20y1='12.5'%20x2='9.5'%20y2='14'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.9'%20stroke-linecap='round'%20x1='6.5'%20y1='14'%20x2='5.5'%20y2='14'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.9'%20stroke-linecap='round'%20x1='9.5'%20y1='14'%20x2='10.5'%20y2='14'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.7'%20stroke-linecap='round'%20x1='8'%20y1='2.5'%20x2='7.3'%20y2='0.8'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.7'%20stroke-linecap='round'%20x1='8'%20y1='2.5'%20x2='8'%20y2='0.5'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.7'%20stroke-linecap='round'%20x1='8'%20y1='2.5'%20x2='8.7'%20y2='0.8'/%3e%3c/svg%3e",N7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.8147%205.35803H5.35791V8.46914H8.8147V5.35803Z'%20fill='currentColor'/%3e%3cpath%20d='M22.6419%205.35803H19.1851V8.46914H22.6419V5.35803Z'%20fill='currentColor'/%3e%3cpath%20d='M15.7283%2015.7284H12.2715V18.8395H15.7283V15.7284Z'%20fill='currentColor'/%3e%3cpath%20d='M8.8147%2015.7284H5.35791V18.8395H8.8147V15.7284Z'%20fill='currentColor'/%3e%3cpath%20d='M22.6419%2015.7284H19.1851V18.8395H22.6419V15.7284Z'%20fill='currentColor'/%3e%3cpath%20d='M12.2715%208.81482H5.35791V11.9259H12.2715V8.81482Z'%20fill='currentColor'/%3e%3cpath%20d='M12.2718%2019.1852H1.90137V22.2963H12.2718V19.1852Z'%20fill='currentColor'/%3e%3cpath%20d='M26.0989%2019.1852H15.7285V22.2963H26.0989V19.1852Z'%20fill='currentColor'/%3e%3cpath%20d='M22.6419%2012.2716H5.35791V15.3827H22.6419V12.2716Z'%20fill='currentColor'/%3e%3cpath%20d='M22.6421%208.81482H15.7285V11.9259H22.6421V8.81482Z'%20fill='currentColor'/%3e%3c/svg%3e",L7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3ccircle%20cx='8'%20cy='8'%20r='6'%20fill='none'%20stroke='currentColor'%20stroke-width='1'/%3e%3ccircle%20cx='8'%20cy='8'%20r='4.5'%20fill='none'%20stroke='currentColor'%20stroke-width='0.3'%20opacity='0.5'/%3e%3cline%20x1='8'%20y1='8'%20x2='13.5'%20y2='13.5'%20stroke='currentColor'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cpolygon%20points='14.5,14.5%2012.3,13.5%2013.5,12.3'%20fill='currentColor'/%3e%3cline%20x1='8'%20y1='8'%20x2='2.5'%20y2='2.5'%20stroke='currentColor'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cpolygon%20points='1.5,1.5%203.7,2.5%202.5,3.7'%20fill='currentColor'/%3e%3ccircle%20cx='8'%20cy='8'%20r='1.3'%20fill='currentColor'/%3e%3ccircle%20cx='8'%20cy='8'%20r='0.6'%20fill='none'%20stroke='currentColor'%20stroke-width='0.5'%20opacity='0.7'/%3e%3c/svg%3e",B7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13%2014H3V2H13V14ZM10.5%204.4H5.5V11.6H10.5V4.4Z'%20fill='currentColor'/%3e%3c/svg%3e",O7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M1%201H11.7692V7.9999H8.17942V11.4999H4.58982V15H1V1ZM4.58982%204.50005V7.9999H8.17942V4.50005H4.58982Z'%20fill='currentColor'/%3e%3cpath%20d='M11.7692%207.46154H15V15H11.7692V7.46154Z'%20fill='currentColor'/%3e%3c/svg%3e",z7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.63653%205.50522L2.18735%205.28559C2.09852%205.46726%202.12787%205.68456%202.26172%205.83616C2.39558%205.98775%202.60757%206.04379%202.79884%205.97814L2.63653%205.50522ZM5.83578%206.94285L5.3732%207.13265L5.5645%207.59886L6.02919%207.40392L5.83578%206.94285ZM10.7441%209.44034L10.2614%209.57083L10.393%2010.0573L10.8784%209.92198L10.7441%209.44034ZM2.5%208.24963C2.4998%207.97349%202.27577%207.74979%201.99963%207.75C1.72349%207.75021%201.4998%207.97423%201.5%208.25037L2.5%208.24963ZM13.4143%2010.7751C12.0197%2013.6273%208.57701%2014.8089%205.72485%2013.4143L5.28559%2014.3126C8.63389%2015.9498%2012.6754%2014.5627%2014.3126%2011.2144L13.4143%2010.7751ZM3.08571%205.72485C4.48031%202.87269%207.92299%201.69111%2010.7751%203.08571L11.2144%202.18735C7.86611%200.550151%203.82455%201.93728%202.18735%205.28559L3.08571%205.72485ZM10.7751%203.08571C13.6273%204.48031%2014.8089%207.92299%2013.4143%2010.7751L14.3126%2011.2144C15.9498%207.86611%2014.5627%203.82455%2011.2144%202.18735L10.7751%203.08571ZM2.79884%205.97814C3.02201%205.90155%203.54835%205.84926%204.09141%206.00587C4.61256%206.15616%205.10736%206.48476%205.3732%207.13265L6.29835%206.75304C5.89213%205.76303%205.11508%205.26032%204.3685%205.04503C3.64385%204.83605%202.9066%204.8839%202.47422%205.0323L2.79884%205.97814ZM6.02919%207.40392C6.25314%207.30998%206.55771%207.25841%206.85281%207.36034C7.13062%207.45631%207.49214%207.72014%207.78743%208.4398L8.71257%208.0602C8.3358%207.14195%207.79046%206.62626%207.17931%206.41515C6.58544%206.21001%206.01893%206.32381%205.64236%206.48177L6.02919%207.40392ZM6.26827%207.19375C6.80493%206.26869%208.18817%204.18684%2011.1653%203.10654L10.8242%202.16652C7.53166%203.36127%205.99463%205.67263%205.40329%206.69195L6.26827%207.19375ZM14.3364%2010.8325C14.1845%2010.39%2013.7564%209.79897%2013.14%209.37995C12.504%208.94759%2011.6302%208.67426%2010.6099%208.9587L10.8784%209.92198C11.5634%209.73102%2012.1368%209.90713%2012.5779%2010.207C13.0385%2010.5201%2013.3174%2010.9441%2013.3905%2011.1571L14.3364%2010.8325ZM11.2268%209.30984C11.1236%208.92833%2010.8783%208.39265%2010.3638%208.02453C9.82769%207.6409%209.08331%207.49864%208.11574%207.76836L8.38426%208.73164C9.1221%208.52595%209.53979%208.66454%209.78189%208.83777C10.0457%209.02651%2010.1946%209.32371%2010.2614%209.57083L11.2268%209.30984ZM11.216%209.60556C11.6225%208.44463%2012.4244%205.47936%2011.4712%202.48487L10.5183%202.78819C11.3726%205.47172%2010.6545%208.18331%2010.2722%209.27512L11.216%209.60556ZM7.80082%208.03037L5.05604%2013.6438L5.9544%2014.0831L8.69918%208.46963L7.80082%208.03037ZM5.72485%2013.4143C3.68742%2012.4181%202.50158%2010.3763%202.5%208.24963L1.5%208.25037C1.50185%2010.7441%202.89229%2013.1424%205.28559%2014.3126L5.72485%2013.4143Z'%20fill='currentColor'/%3e%3c/svg%3e",H7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M8%201C4.134%201%201%204.134%201%208s3.134%207%207%207c1.5%200%202.9-.47%204.05-1.28l1.12%201.12a.75.75%200%201%200%201.06-1.06l-1.12-1.12A6.97%206.97%200%200%200%2015%208c0-3.866-3.134-7-7-7Zm0%202c2.761%200%205%202.239%205%205s-2.239%205-5%205-5-2.239-5-5%202.239-5%205-5Z'/%3e%3c/svg%3e",I7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20data-name='图层%202'%20viewBox='0%200%20141.38%20140'%20width='16'%20height='16'%3e%3cpath%20fill='currentColor'%20d='m140.93%2085-16.35-28.33-1.93-3.34%208.66-15a3.323%203.323%200%200%200%200-3.34l-9.62-16.67c-.3-.51-.72-.93-1.22-1.22s-1.07-.45-1.67-.45H82.23l-8.66-15a3.33%203.33%200%200%200-2.89-1.67H51.43c-.59%200-1.17.16-1.66.45-.5.29-.92.71-1.22%201.22L32.19%2029.98l-1.92%203.33H12.96c-.59%200-1.17.16-1.66.45-.5.29-.93.71-1.22%201.22L.45%2051.66a3.323%203.323%200%200%200%200%203.34l18.28%2031.67-8.66%2015a3.32%203.32%200%200%200%200%203.34l9.62%2016.67c.3.51.72.93%201.22%201.22s1.07.45%201.67.45h36.56l8.66%2015a3.35%203.35%200%200%200%202.89%201.67h19.25a3.34%203.34%200%200%200%202.89-1.67l18.28-31.67h17.32c.6%200%201.17-.16%201.67-.45s.92-.71%201.22-1.22l9.62-16.67a3.323%203.323%200%200%200%200-3.34ZM51.44%203.33%2061.07%2020l-9.63%2016.66h76.98l-9.62%2016.66H45.67l-11.54-20zM57.21%20120H22.58l9.63-16.67h19.25l-38.5-66.67h19.25l9.62%2016.67L68.78%20100l-11.55%2020Zm61.59-33.34-9.62-16.67-38.49%2066.67-9.63-16.67%209.63-16.66%2026.94-46.67h23.1l17.32%2030z'%20data-name='图层%201'/%3e%3c/svg%3e",U7=""+new URL("sigit-DPmZBS3L.svg",import.meta.url).href,P7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M6.53%204.412h5.883v3.587H9.471v3.588H3.588V7.999H6.53Z'/%3e%3c/svg%3e",q7="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNMC41IDUuNUwyLjUgOCAwLjUgMTAuNSIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KICA8dGV4dCB4PSIzLjIiIHk9IjExLjUiIGZvbnQtZmFtaWx5PSInU0YgTW9ubycsICdGaXJhIENvZGUnLCAnQ29uc29sYXMnLCBtb25vc3BhY2UiIGZvbnQtc2l6ZT0iMTAiIGZvbnQtd2VpZ2h0PSI2MDAiIGxldHRlci1zcGFjaW5nPSItMC41IiBmaWxsPSJjdXJyZW50Q29sb3IiPlZUPC90ZXh0Pgo8L3N2Zz4=",V7=Object.assign({"../assets/agents/agoragentic-acp.svg":t7,"../assets/agents/amp-acp.svg":i7,"../assets/agents/antigravity-acp.svg":s7,"../assets/agents/auggie.svg":n7,"../assets/agents/autohand.svg":r7,"../assets/agents/claude-acp.svg":a7,"../assets/agents/cline.svg":l7,"../assets/agents/codebuddy-code.svg":o7,"../assets/agents/codex-acp.svg":c7,"../assets/agents/cortex-code.svg":h7,"../assets/agents/corust-agent.svg":u7,"../assets/agents/crow-cli.svg":d7,"../assets/agents/cursor.svg":f7,"../assets/agents/deepagents.svg":p7,"../assets/agents/devin.svg":g7,"../assets/agents/dimcode.svg":m7,"../assets/agents/dirac.svg":v7,"../assets/agents/factory-droid.svg":_7,"../assets/agents/fast-agent.svg":y7,"../assets/agents/gemini.svg":S7,"../assets/agents/github-copilot-cli.svg":x7,"../assets/agents/glm-acp-agent.svg":w7,"../assets/agents/goose.svg":b7,"../assets/agents/grok-build.svg":C7,"../assets/agents/harn.svg":k7,"../assets/agents/junie.svg":E7,"../assets/agents/kilo.svg":M7,"../assets/agents/kimchi.svg":j7,"../assets/agents/kimi.svg":T7,"../assets/agents/kiro.svg":R7,"../assets/agents/minimax-code.svg":D7,"../assets/agents/minion-code.svg":A7,"../assets/agents/mistral-vibe.svg":N7,"../assets/agents/nova.svg":L7,"../assets/agents/opencode.svg":B7,"../assets/agents/pi-acp.svg":O7,"../assets/agents/poolside.svg":z7,"../assets/agents/qoder.svg":H7,"../assets/agents/qwen-code.svg":I7,"../assets/agents/sigit.svg":U7,"../assets/agents/stakpak.svg":P7,"../assets/agents/vtcode.svg":q7}),$7=new Map(Object.entries(V7).map(([e,t])=>[e.split("/").pop().replace(".svg",""),t]));function l1(e){return e?$7.get(e)??null:null}function wS({registry:e,size:t,color:n="currentColor"}){const r=l1(e);return r?c.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:t,height:t,flex:"none",backgroundColor:n,WebkitMaskImage:`url("${r}")`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):c.jsx(ae,{name:"terminal",size:t*.8,scaled:!1,color:n})}const W_=e=>e[Math.floor(Math.random()*e.length)];function W7(){return{name:"",description:"",avatarColor:W_(Ah).id,avatarShape:W_(q3),backend:"claude",cwd:"",permission:"auto"}}const e2=e=>!e.id||e.name.trim()!=="",bS=e=>e.backend==="custom"?e:{...e,command:null};function t2(e,t,n){const r={...t},l=e.hello?.backends??[],h=l.find(d=>d.available);return l.find(d=>d.id===r.backend)?.available!==!0&&h&&(r.backend=h.id),r.connectors===void 0&&n.length&&(r.connectors=n.map(d=>d.id)),r}async function CS(e){const t=e.client;if(!t)return{connectors:[],skills:[]};const[n,r]=await Promise.allSettled([t.call("connectors"),t.call("skills")]);return{connectors:n.status==="fulfilled"?n.value.items:[],skills:r.status==="fulfilled"?r.value.items:[]}}function kS(e){const[t,n]=x.useState(null),r=e.connection.kind==="online";return x.useEffect(()=>{let l=!0;return CS(e).then(h=>l&&n(h)),()=>{l=!1}},[e,r]),t}async function F7(e){const{connectors:t}=await CS(e),n=await e.save(t2(e,W7(),t));return e.setSelection(n.id),n}const o1=e=>e.split("/").filter(Boolean).pop()??e,Ar=e=>e instanceof Error?e.message:String(e);function K7({backend:e,selection:t,onChange:n}){const r=Ne(),l=r.connection.kind==="online",[h,d]=x.useState(null),p=x.useRef(null),[g,m]=x.useState(!1),[v,_]=x.useState(null),[S,w]=x.useState(0),b=e==="custom",k=x.useRef(e);x.useEffect(()=>{k.current!==e&&(k.current=e,n(null))},[e,n]),x.useEffect(()=>{const I=`${r.computer.id}/${e}`;if(p.current!==I&&(d(null),p.current=I),_(null),m(!1),b)return;const q=r.client;if(!l||!q){_("Connect to this computer to load its models. You can still enter a model ID.");return}let U=!1;return m(!0),q.call("agentModels",{backend:e},3e5).then(Y=>!U&&d(Y)).catch(Y=>!U&&_(`Couldn't load models: ${Ar(Y)}`)).finally(()=>!U&&m(!1)),()=>{U=!0}},[r.computer.id,r.client,e,l,S,b]);const E=h?.models.find(I=>I.name.toLowerCase().startsWith("default")),j=(h?.models??[]).filter(I=>I.id!==E?.id),V=j.find(I=>I.id===h?.currentModelId)?.name,A=[{id:"",label:E?.name??(V?`Default · ${V}`:"Default")},...j.map(I=>({id:I.id,label:I.name}))];t&&t!==E?.id&&!j.some(I=>I.id===t)&&A.push({id:t,label:t});const z=t===E?.id?"":t??"",F=I=>n(I||null),D=h?.models.length===0;return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx("span",{style:{color:"var(--text)",whiteSpace:"nowrap"},children:"Model"}),c.jsx("span",{style:{flex:1}}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[b?null:c.jsxs("div",{style:{width:28,height:28,display:"grid",placeItems:"center",flex:"none"},children:[c.jsx("div",{style:{gridArea:"1 / 1",opacity:g?0:1,transition:"opacity var(--fade)",pointerEvents:g?"none":void 0},children:c.jsx(ke,{title:v?"Retry model list":"Refresh model list",icon:"arrow.clockwise",disabled:g,onClick:()=>w(I=>I+1)})}),g?c.jsx("div",{className:"fade-in",style:{gridArea:"1 / 1",display:"flex"},"aria-label":"Loading available models",children:c.jsx(et,{size:12})}):null]}),b||!g&&(!h||D)?c.jsx(K3,{outlined:!0,style:{minWidth:0,maxWidth:160},children:c.jsx("input",{value:z,placeholder:"Default",spellCheck:!1,onChange:I=>F(I.target.value),style:{textAlign:"right",width:142,maxWidth:"100%",minWidth:0,color:"var(--text)",userSelect:"text"}})}):c.jsx("div",{style:{display:"flex",minWidth:0},children:c.jsx(Ci,{selection:z,options:A,onChange:F})})]})]}),!b&&!g&&v?c.jsx("span",{style:{...B("caption"),color:"var(--warning)"},children:v}):!b&&!g&&D?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:"This agent doesn't advertise a model list. Leave Default or enter a model ID."}):null,c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:"Changing the model starts a new agent session. Chat history is kept."})]})}function Y7({botId:e}){const n=Ne().client,[r,l]=x.useState([]),[h,d]=x.useState(!1),[p,g]=x.useState(!1),m=x.useCallback(async()=>{if(n){try{l((await n.call("memory",{botId:e})).facts)}catch{l([])}d(!0)}},[n,e]);x.useEffect(()=>{m()},[m]);const v=S=>{l(w=>w.filter(b=>b.id!==S.id)),n?.call("forgetMemory",{botId:e,id:S.id}).catch(()=>{}).then(m)},_=()=>{l([]),n?.call("clearMemory",{botId:e}).catch(()=>{}).then(m)};return c.jsxs(c.Fragment,{children:[c.jsxs(Ee,{title:"Memory",accessory:r.length?c.jsx("button",{className:"press",style:{display:"flex",color:"var(--secondary)"},title:"Forget everything","aria-label":"Forget everything",onClick:()=>g(!0),children:c.jsx(ae,{name:"trash",size:12})}):null,children:[r.length?null:c.jsx("span",{style:{color:"var(--secondary)"},children:h?"Nothing yet. The bot remembers who you are and what you work on as you chat.":"Loading…"}),r.map(S=>c.jsxs("div",{className:"fade-in",style:{display:"flex",alignItems:"baseline",gap:10},children:[c.jsx("span",{style:{display:"flex"},title:S.kind==="profile"?"About you":"History",children:c.jsx(ae,{name:S.kind==="profile"?"person":"clock",size:10,color:"var(--tertiary)"})}),c.jsx("span",{className:"selectable",style:{flex:1,minWidth:0,color:"var(--text)"},children:S.content}),c.jsx("button",{className:"press",style:{display:"flex",color:"var(--tertiary)"},title:"Forget","aria-label":"Forget",onClick:()=>v(S),children:c.jsx(ae,{name:"xmark",size:10})})]},S.id))]}),c.jsx(ts,{open:p,title:"Forget everything this bot remembers?",actions:[{title:"Forget everything",destructive:!0,action:_}],onClose:()=>g(!1)})]})}function po({label:e,detail:t,children:n}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[c.jsx("span",{style:{color:"var(--text)"},children:e}),t?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",lineHeight:1.35},children:t}):null]}),n]})}function i2({title:e,detail:t,on:n,onChange:r}){return c.jsx(rn,{on:n,onChange:r,children:c.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:3},children:[c.jsx("span",{style:{color:"var(--text)"},children:e}),t?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",lineHeight:1.35},children:t}):null]})})}function c1({value:e,onChange:t,placeholder:n,minRows:r,maxRows:l,className:h,onKeyDown:d}){const p=x.useRef(null);return x.useLayoutEffect(()=>{const g=p.current;if(!g)return;const m=getComputedStyle(g),v=parseFloat(m.lineHeight)||15,_=parseFloat(m.paddingTop)+parseFloat(m.paddingBottom);g.style.height="0px",g.style.height=`${Math.min(Math.max(g.scrollHeight,v*r+_),v*l+_)}px`},[e,r,l]),c.jsx("textarea",{ref:p,rows:r,className:h,value:e,placeholder:n,onChange:g=>t(g.target.value),onKeyDown:d})}function ES({bot:e,onRemove:t}){return c.jsxs("span",{className:"bot-chip",children:[c.jsx(Ui,{bot:e,size:20,animated:!1}),c.jsx("span",{style:{...B("body"),color:"var(--text)",maxWidth:220,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.name}),c.jsx("button",{style:{width:18,height:18,display:"grid",placeItems:"center"},"aria-label":`Remove ${e.name}`,title:`Remove ${e.name}`,onClick:t,children:c.jsx(ae,{name:"xmark",size:10,weight:"semibold",color:"var(--secondary)"})})]})}function G7({open:e,onClose:t,anchor:n,children:r}){const{mounted:l,shown:h}=er(e,120),[d,p]=x.useState(null);if(x.useLayoutEffect(()=>{e&&n.current&&p(n.current.getBoundingClientRect())},[e,n]),x.useEffect(()=>{if(!e)return;const w=b=>{b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),t())};return window.addEventListener("keydown",w,!0),()=>window.removeEventListener("keydown",w,!0)},[e,t]),!l||!d)return null;const g=window.innerWidth,m=window.innerHeight,v=m-d.bottom>=d.top,_=d.left+d.width/2<g*.6,S=Math.max(8,g-Math.min(320,g-16)-8);return Kh.createPortal(c.jsx("div",{className:`anchored ${h?"shown":""}`,onMouseDown:w=>w.target===w.currentTarget&&t(),children:c.jsx("div",{className:"anchored-panel",style:{position:"absolute",[v?"top":"bottom"]:v?d.bottom+6:m-d.top+6,..._?{left:Math.min(Math.max(8,d.left),S)}:{right:Math.min(Math.max(8,g-d.right),S)},transformOrigin:`${v?"top":"bottom"} ${_?"left":"right"}`},children:r})}),document.body)}function Z7({draft:e}){const t=Ne(),n=ss(),r=kS(t),l=!e.id,[h,d]=x.useState(()=>l?t2(t,e,[]):e),[p,g]=x.useState(!1),[m,v]=x.useState(null),_=t.connection.kind==="online";x.useEffect(()=>{l&&r&&d(w=>t2(t,w,r.connectors))},[l,r,t]);const S=()=>{!e2(h)||p||!_||(g(!0),v(null),t.save(bS(h)).then(w=>{n(),l&&t.setSelection(w.id)}).catch(w=>v(Ar(w))).finally(()=>g(!1)))};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:l?"New bot":"Settings",trailing:p?c.jsx(et,{}):c.jsx(ke,{title:l?"Create":"Save",icon:"checkmark",disabled:!e2(h)||p||!_,onClick:S})}),c.jsx("div",{style:{flex:1,minHeight:0},children:c.jsx(MS,{draft:h,onChange:d,error:m,plugins:r})})]})}function X7({botId:e}){const t=Ne(),n=kS(t),[r,l]=x.useState(null),[h,d]=x.useState(null),p=x.useCallback(g=>l(m=>m&&g(m)),[]);return x.useEffect(()=>{const g=t.bots.get(e);l(g?yo(g):null)},[e]),x.useEffect(()=>{const g=t.bots.get(e);if(!r||!g||JSON.stringify(r)===JSON.stringify(yo(g))||!e2(r))return;const m=setTimeout(()=>{t.save(bS(r)).then(()=>d(null)).catch(v=>d(Ar(v)))},600);return()=>clearTimeout(m)},[r]),r?c.jsx(MS,{draft:r,onChange:p,error:h,plugins:n}):null}function MS({draft:e,onChange:t,error:n,plugins:r}){const l=Ne(),[h,d]=x.useState(!1),[p,g]=x.useState(!1),m=x.useRef(null),v=(E,j)=>t(V=>({...V,[E]:j})),_=x.useCallback(E=>t(j=>({...j,model:E})),[t]),S=l.hello?.backends??[],w=S.find(E=>E.id===e.backend),b=r?.connectors??[],k=r?.skills??[];return c.jsxs("div",{className:"bot-form",children:[c.jsxs("div",{className:"bot-form-content",children:[c.jsxs("div",{style:{display:"flex",justifyContent:"center"},children:[c.jsx("button",{ref:m,className:"avatar-button",title:"Edit Bot avatar","aria-label":"Edit Bot avatar",onClick:()=>d(E=>!E),children:c.jsx(nn,{shape:e.avatarShape,color:e.avatarColor,size:56})}),c.jsx(G7,{open:h,onClose:()=>d(!1),anchor:m,children:c.jsx("div",{style:{padding:14,width:300},children:c.jsx(Q7,{shape:e.avatarShape,color:e.avatarColor,onShape:E=>v("avatarShape",E),onColor:E=>v("avatarColor",E)})})})]}),c.jsxs(Ee,{title:"Profile",children:[e.id?c.jsx(po,{label:"Name",children:c.jsx("input",{className:"field-box",value:e.name,placeholder:"Name",onChange:E=>v("name",E.target.value)})}):null,c.jsx(po,{label:"Standing instructions",detail:"Rules that always apply. Put task-specific requests in the chat instead.",children:c.jsx(c1,{className:"field-box",value:e.description,placeholder:"e.g. Reviews PRs. Never pushes without asking.",minRows:3,maxRows:8,onChange:E=>v("description",E)})})]}),c.jsxs(Ee,{title:"Agent",children:[c.jsx(Jt,{label:"Computer",children:c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.hostName})}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsx(Jt,{label:"Agent",children:c.jsx(Ci,{selection:e.backend,options:[...S.map(E=>({id:E.id,label:E.available?E.name:`${E.name} (not installed)`})),{id:"custom",label:"Custom command"}],onChange:E=>v("backend",E)})}),w&&!w.available?c.jsx("span",{style:{...B("caption"),color:"var(--warning)"},children:w.installHint}):null,e.backend==="custom"?c.jsx("input",{className:"field-box fade-in",style:B("callout",void 0,"monospaced"),value:e.command??"",placeholder:"ACP command, e.g. my-agent --acp",spellCheck:!1,onChange:E=>v("command",E.target.value||null)}):null]}),c.jsx(K7,{backend:e.backend,selection:e.model,onChange:_}),c.jsx(Jt,{label:"Workspace",detail:e.cwd?"This project is the default starting folder. The bot can work elsewhere when you ask.":"This bot has its own space for files. It can work in other folders when you ask.",children:c.jsx(Yh,{title:e.cwd||"A persistent workspace allocated for this bot",items:()=>[{title:"Personal workspace",selected:!e.cwd,action:()=>v("cwd","")},{title:"Choose project folder…",selected:!!e.cwd,action:()=>g(!0)}],children:c.jsxs(K3,{outlined:!0,style:{gap:6,color:"var(--text)"},children:[c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:160},children:e.cwd?o1(e.cwd):"Personal"}),c.jsx(ae,{name:"chevron.down",size:10,weight:"semibold",color:"var(--secondary)"})]})})}),c.jsx(Jt,{label:"Permissions",detail:e.permission==="auto"?"Tool requests are approved automatically. Your agent's own settings (like Claude Code's permission rules) still apply.":"You'll get an approval card and a notification whenever the agent asks.",children:c.jsx(Ci,{selection:e.permission,options:[{id:"ask",label:"Ask me"},{id:"auto",label:"Approve automatically"}],onChange:E=>v("permission",E)})})]}),c.jsxs(Ee,{title:"Activity",children:[c.jsx(i2,{title:"Notifications",detail:"Get notified when this bot finishes or needs you",on:e.notify??!0,onChange:E=>v("notify",E)}),l.screen?c.jsx(i2,{title:"Use the computer",detail:l.screen.enabled?"Let this bot see the screen and use the mouse and keyboard. You can watch and take over from your phone.":"Let this bot see the screen and use the mouse and keyboard. Turn on Remote screen in Codync's menu on the computer first.",on:e.computer??!1,onChange:E=>v("computer",E)}):null]}),c.jsx(F_,{title:"Connectors",empty:"No connectors yet. Add GitHub, Linear, Notion and more from Plugins.",items:b.map(E=>({id:E.id,name:E.name,detail:E.command??E.url??""})),selection:e.connectors??[],onChange:E=>v("connectors",E)}),c.jsx(F_,{title:"Skills",empty:"No skills yet. Get some from Plugins, or write your own.",items:k.map(E=>({id:E.id,name:E.name,detail:E.description})),selection:e.skills??[],onChange:E=>v("skills",E)}),e.id?c.jsx(Y7,{botId:e.id}):null,n?c.jsx("span",{className:"fade-in",style:{...B("footnote"),color:"var(--danger)"},children:n}):null]}),c.jsx($t,{open:p,onClose:()=>g(!1),width:460,height:520,children:c.jsx(J7,{start:e.cwd||l.hello?.home||null,onPick:E=>{v("cwd",E),g(!1)}})})]})}function F_({title:e,empty:t,items:n,selection:r,onChange:l}){return c.jsxs(Ee,{title:e,children:[n.length?null:c.jsx("span",{style:{color:"var(--secondary)"},children:t}),n.map(h=>c.jsx(i2,{title:h.name,detail:h.detail||null,on:r.includes(h.id),onChange:d=>l([...r.filter(p=>p!==h.id),...d?[h.id]:[]])},h.id))]})}function Q7({shape:e,color:t,onShape:n,onColor:r}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[c.jsx("div",{className:"swatch-row",children:q3.map(l=>c.jsx("button",{className:`swatch ${l===e?"on":""}`,"aria-label":`${l} shape`,"aria-pressed":l===e,onClick:()=>n(l),children:c.jsx(nn,{shape:l,color:t,size:36})},l))}),c.jsx("div",{className:"swatch-row",children:Ah.map(l=>c.jsx("button",{className:`swatch ${l.id===t?"on":""}`,"aria-label":l.label,"aria-pressed":l.id===t,onClick:()=>r(l.id),children:c.jsx("span",{style:{width:26,height:26,borderRadius:"50%",background:l.hex,display:"block"}})},l.id))})]})}function J7({start:e,onPick:t}){const[n,r]=x.useState([e]),[l,h]=x.useState(!0),d=n[n.length-1]??null;return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[n.length>1?c.jsx("div",{className:"fade-in",style:{paddingLeft:10,display:"flex"},children:c.jsx(ke,{title:"Back",icon:"chevron.left",onClick:()=>{h(!1),r(p=>p.slice(0,-1))}})}):null,c.jsx("div",{style:{flex:1,minWidth:0},children:c.jsx(Lt,{title:d?o1(d):"Folders"})})]}),c.jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden"},children:c.jsx(e9,{path:d,forward:l,onPick:t,onOpen:p=>{h(!0),r(g=>[...g,p])}},n.length)})]})}function e9({path:e,forward:t,onPick:n,onOpen:r}){const l=Ne(),[h,d]=x.useState(null),[p,g]=x.useState(null),[m,v]=x.useState("");x.useEffect(()=>{let S=!0;return l.listDirs(e).then(w=>S&&d(w)).catch(w=>S&&g(Ar(w))),()=>{S=!1}},[l,e]);const _=h?.dirs.filter(S=>!m||S.name.toLowerCase().includes(m.toLowerCase()))??[];return c.jsx("div",{className:`bot-form level-slide ${t?"from-trailing":"from-leading"}`,children:c.jsxs("div",{className:"bot-form-content",style:{gap:14},children:[c.jsx(WC,{value:m,onChange:v}),h?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{footer:h.path,children:c.jsxs("button",{className:"press",style:{display:"flex",alignItems:"center",gap:8,...B("headline"),color:"var(--accent)"},onClick:()=>n(h.path),children:[c.jsx(ae,{name:"checkmark.circle.fill",size:13}),c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:`Use “${o1(h.path)}”`})]})}),_.length?c.jsx(Ee,{children:_.map(S=>c.jsxs("button",{className:"press",style:{display:"flex",alignItems:"center",gap:10},onClick:()=>r(S.path),children:[c.jsx("span",{style:{width:20,display:"flex",justifyContent:"center"},children:c.jsx(ae,{name:S.isGit?"arrow.triangle.branch":"folder",size:12,color:S.isGit?"var(--accent)":"var(--secondary)"})}),c.jsx("span",{style:{flex:1,minWidth:0,color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:S.name}),c.jsx(ae,{name:"chevron.right",size:10,weight:"semibold",color:"var(--tertiary)"})]},S.path))}):null]}):p?c.jsx("span",{style:{color:"var(--danger)"},children:p}):c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:c.jsx(et,{size:20})})]})})}const t9="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%23000'%20fill-rule='evenodd'%20d='M12%201.8C9%201.8%207.6%204.2%207.6%207c0%201.6-.6%202.8-1.6%204.2C4.8%2012.9%204%2014.8%204%2016.8c0%201.2.4%202.2%201%203l-1%201.7c-.2.5.2.9.7.8l3.8-.7c1.1.4%202.3.6%203.5.6s2.4-.2%203.5-.6l3.8.7c.5.1.9-.3.7-.8l-1-1.7c.6-.8%201-1.8%201-3%200-2-.8-3.9-2-5.6-1-1.4-1.6-2.6-1.6-4.2%200-2.8-1.4-5.2-4.4-5.2ZM12%2010.6c-2.4%200-4%202.7-4%205.6%200%202.4%201.7%203.8%204%203.8s4-1.4%204-3.8c0-2.9-1.6-5.6-4-5.6ZM10.4%205.3a.9.9%200%201%200%200%201.8.9.9%200%200%200%200-1.8Zm3.2%200a.9.9%200%201%200%200%201.8.9.9%200%200%200%200-1.8ZM10.9%208.1h2.2L12%209.5Z'/%3e%3c/svg%3e",i9=e=>({laptop:"laptopcomputer",macmini:"macmini",macstudio:"macstudio",imac:"desktopcomputer",macpro:"macpro.gen3"})[e??""]??"desktopcomputer";function Va({computer:e,size:t=36}){const n=e?.color?ko(e.color):"var(--text)";return c.jsx("span",{"aria-hidden":!0,style:{width:t,height:t,display:"grid",placeItems:"center",flex:"none",color:n},children:e?.device==="linux"?c.jsx("span",{style:{width:t*.55,height:t*.55,backgroundColor:n,WebkitMaskImage:`url("${t9}")`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):c.jsx(ae,{name:i9(e?.device),size:t*.5,weight:"medium"})})}const s9=e=>["pending","starting","running","recovering"].includes(e.status),n9=()=>({kind:"cron",amount:"1",unit:3600,calendarStyle:"daily",weekday:1,selectedDays:[],monthDay:1,minuteStep:15,hour:9,minute:0,at:0,expression:"",zone:"",original:[]}),K_=(e,t)=>!!e&&!!t&&JSON.stringify(e)===JSON.stringify(t),Kn=e=>e instanceof Error?e.message:String(e);function Wn({label:e,detail:t,children:n}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[c.jsx("span",{style:{color:"var(--text)"},children:e}),t?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",lineHeight:1.4},children:t}):null]}),n]})}function r9({botId:e,routineId:t}){const n=Ne(),[r,l]=x.useState(null),[h,d]=x.useState(null),[p,g]=x.useState(!1),[m,v]=x.useState(null),[_,S]=x.useState(!1),[w,b]=x.useState(!1),k=async V=>{b(V);try{const A=await(await n.ready()).call("routineWebhook",{botId:e,id:t,rotate:V});l(A),V&&(v(null),g(!0)),d(null)}catch(A){d(Kn(A))}finally{b(!1)}};x.useEffect(()=>{k(!1)},[t]);const E=(V,A,z)=>c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 6px 8px 12px",background:"var(--bubble-user)",borderRadius:12},children:[c.jsx("span",{style:{...B("callout",void 0,"monospaced"),flex:1,minWidth:0,userSelect:"text",wordBreak:"break-all",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:V}),z,c.jsx(ke,{title:m===A?"Copied":"Copy",icon:m===A?"checkmark":"doc.on.doc",onClick:()=>{r&&(window.codync.app.copy(A==="key"?r.key:r.url??r.localUrl),v(A))}})]}),j={...B("caption"),paddingLeft:4,lineHeight:1.4};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[r?c.jsxs(c.Fragment,{children:[c.jsx(Wn,{label:r.url?"URL":"Local URL",children:E(r.url??r.localUrl,"url")}),c.jsx(Wn,{label:"Key",children:E(p?r.key:"•".repeat(16),"key",c.jsxs(c.Fragment,{children:[c.jsx(ke,{title:p?"Hide key":"Show key",icon:p?"eye.slash":"eye",onClick:()=>g(V=>!V)}),c.jsx(ke,{title:"Replace key",icon:"arrow.triangle.2.circlepath",disabled:w||n.isOffline,onClick:()=>S(!0)})]}))}),c.jsx("span",{style:{...j,color:"var(--secondary)"},children:r.url?"POST with Authorization: Bearer <key>. For GitHub, use content type application/json and the key as the secret. Deliveries wait up to 72 hours while this computer is off. They pass through the Codync cloud, which can read them.":"The Codync cloud is off, so only this computer can send to it."})]}):h?c.jsx("span",{style:{...j,color:"var(--danger)"},children:h}):c.jsx("span",{style:{...j,color:"var(--secondary)"},children:"Loading webhook…"}),c.jsx(ts,{open:_,title:"Replace the key?",message:"Senders using the current key stop working until they get the new one.",actions:[{title:"Replace key",destructive:!0,action:()=>{k(!0)}}],onClose:()=>S(!1)})]})}const F0={...B("caption"),paddingLeft:4,lineHeight:1.4};function a9({botId:e,routine:t,saved:n}){const r=Ne(),[l,h]=x.useState(t?.name??""),[d,p]=x.useState(t?.instruction??""),[g,m]=x.useState(n9),[v,_]=x.useState(String(t?.timeoutSeconds??3600)),[S,w]=x.useState(!1),[b,k]=x.useState(null),[E,j]=x.useState(!1),[V,A]=x.useState(!1),[z,F]=x.useState(null),[D,I]=x.useState(null),[q,U]=x.useState(null),[Y,$]=x.useState(!1),[M,N]=x.useState(!1),L=x.useRef(g);L.current=g;const O=t?t.triggers.length===1?!["cron","webhook"].includes(t.triggers[0].type):t.triggers.length>0:!1,P=[...t&&O?[{id:"keep",label:t.triggerDescriptions.join(" · ")}]:[],{id:"cron",label:"Schedule"},{id:"webhook",label:"Webhook"}],te=!!l.trim()&&!!d.trim()&&!r.isOffline&&!S&&V&&K_(q,g)&&D===null,Q=async()=>{try{const le=await(await r.ready()).call("routineSchedule",{triggers:t?.triggers??[],timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone}),he={...le.draft,calendarStyle:"custom"};["cron","webhook"].includes(he.kind)||(he.kind="keep"),m(he),F(le),U(le.draft),A(!0),k(null)}catch(J){k(Kn(J))}},ce=async()=>{const J=L.current;F(null),I(null),U(null);try{const le=await(await r.ready()).call("routineSchedule",{draft:J});if(L.current!==J)return;F(le),U(J)}catch(le){if(L.current!==J)return;I(Kn(le))}};x.useEffect(()=>{Q()},[]),x.useEffect(()=>{if(!V)return;const J=setTimeout(()=>{ce()},300);return()=>clearTimeout(J)},[g]);const re=async()=>{if(te){document.activeElement?.blur(),w(!0),k(null);try{const le=await(await r.ready()).call("saveRoutine",{botId:e,id:t?.id??null,name:l,instruction:d,schedule:g,timeoutSeconds:v});n(le.routine)}catch(J){k(Kn(J))}finally{w(!1)}}},de=x.useRef(re);de.current=re,x.useEffect(()=>{const J=le=>{(le.metaKey||le.ctrlKey)&&le.key==="s"&&(le.preventDefault(),de.current())};return window.addEventListener("keydown",J),()=>window.removeEventListener("keydown",J)},[]);const Ce=J=>m(le=>({...le,...J})),je=K_(q,g)?z:null,R=()=>{switch(g.kind){case"cron":return c.jsxs("div",{className:"routine-cron",style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{className:"routine-cron-fields",children:[c.jsx(Wn,{label:"Cron",children:c.jsx("input",{className:"routine-input",style:B("body",void 0,"monospaced"),value:g.expression,placeholder:"0 9 * * 1-5",spellCheck:!1,autoCorrect:"off",onChange:J=>Ce({expression:J.target.value})})}),c.jsx(Wn,{label:"Time zone",children:c.jsx("input",{className:"routine-input",value:g.zone,placeholder:"Asia/Taipei",spellCheck:!1,autoCorrect:"off",onChange:J=>Ce({zone:J.target.value})})})]}),c.jsx("div",{style:{paddingLeft:4},children:D?c.jsx("span",{style:{...B("caption"),color:"var(--danger)",lineHeight:1.4},children:D}):je?c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[c.jsx("span",{style:B("caption","medium"),children:je.summary}),je.nextRunAt?c.jsxs("span",{style:{...B("caption"),color:"var(--secondary)"},children:["Next ",new Date(je.nextRunAt).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})]}):null,je.warning?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:je.warning}):null]}):c.jsx("span",{style:{...B("caption",void 0,"monospaced"),color:"var(--tertiary)",whiteSpace:"pre"},children:"minute hour day month weekday"})})]});case"webhook":return t&&t.triggers.some(J=>J.type==="webhook"||J.type==="event")?c.jsx(r9,{botId:e,routineId:t.id}):c.jsx("span",{style:{...F0,color:"var(--secondary)"},children:"Runs each time something is posted to its URL. Save to get the URL and key."});default:return c.jsx("span",{style:{...F0,color:"var(--secondary)"},children:"Set up by the bot. Pick Schedule or Webhook to replace it."})}};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",maxHeight:700,minHeight:0,background:"var(--background)",color:"var(--text)",...B(13)},children:[c.jsx(Lt,{title:t?"Edit routine":"Set up a routine"}),c.jsx("fieldset",{className:"routine-form",disabled:S||!V,style:{flex:"1 1 auto",minHeight:0,overflowY:"auto"},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24,padding:20},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[c.jsx(Wn,{label:"Name",children:c.jsx("input",{className:"routine-input",value:l,placeholder:"e.g. Morning summary",onChange:J=>h(J.target.value)})}),c.jsx(Wn,{label:"Instruction",children:c.jsx("textarea",{className:"routine-input",value:d,placeholder:"Describe what this bot should do each time it runs.",onChange:J=>p(J.target.value)})})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[c.jsx(Wn,{label:"When to run",children:c.jsx(Ci,{selection:g.kind,options:P,onChange:J=>Ce({kind:J}),fits:!0})}),V?R():c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--secondary)"},children:[c.jsx(ae,{name:"clock",size:12}),"Loading schedule…"]})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[c.jsxs("button",{className:"press","aria-expanded":E,onClick:()=>j(J=>!J),style:{display:"flex",alignItems:"center",gap:6,paddingLeft:4,...B("compactSecondary"),color:"var(--secondary)",width:"100%"},children:["Run settings",c.jsx("span",{style:{display:"flex",transform:`rotate(${E?180:0}deg)`,transition:"transform var(--layout)"},children:c.jsx(ae,{name:"chevron.down",size:10,weight:"semibold"})}),c.jsx("span",{style:{flex:1}}),E?null:c.jsxs("span",{style:{color:"var(--tertiary)"},children:["Timeout ",v,"s"]})]}),E?c.jsxs("div",{className:"routine-fade",style:{display:"flex",flexDirection:"column",gap:12},children:[c.jsx(Wn,{label:"Timeout (seconds)",children:c.jsx("input",{className:"routine-input",value:v,placeholder:"3600",onChange:J=>_(J.target.value)})}),c.jsx("span",{style:{...F0,color:"var(--secondary)"},children:"A run is stopped after this long. 1 second to 24 hours."})]}):null]})]})}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:20,flex:"none"},children:[D!==null?c.jsx("button",{className:"press",style:{alignSelf:"flex-start"},disabled:r.isOffline,onClick:()=>{ce()},children:"Check schedule again"}):null,!V&&b!==null?c.jsx("button",{className:"press",style:{alignSelf:"flex-start"},onClick:()=>{Q()},children:"Retry loading schedule"}):null,g.kind!=="cron"&&D?c.jsx("span",{style:{...B("caption"),color:"var(--danger)"},children:D}):null,b?c.jsxs("span",{style:{display:"flex",gap:6,alignItems:"flex-start",...B("callout"),color:"var(--danger)",userSelect:"text"},children:[c.jsx(ae,{name:"exclamationmark.circle",size:12,style:{marginTop:1}}),b]}):null,r.isOffline?c.jsxs("span",{style:{display:"flex",gap:6,alignItems:"center",...B("caption"),color:"var(--danger)"},children:[c.jsx(ae,{name:"wifi.slash",size:10}),"Connect to this computer to save your routine."]}):null,c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[t?c.jsxs(c.Fragment,{children:[c.jsx(ke,{title:"Delete routine",icon:"trash",onClick:()=>$(!0)}),c.jsx(ke,{title:M?"Started":"Test run",icon:M?"checkmark":"play.circle",disabled:M||r.isOffline,onClick:async()=>{try{await(await r.ready()).call("runRoutine",{botId:e,id:t.id}),N(!0)}catch(J){k(Kn(J))}}})]}):null,c.jsx("span",{style:{flex:1}}),c.jsxs(Fe,{disabled:!te,onClick:()=>{re()},title:"Save (⌘S)",children:[S?c.jsx(et,{size:12}):null,S?"Saving…":t?"Save changes":"Create routine"]})]})]}),c.jsx(ts,{open:Y,title:"Delete routine?",message:"This deletes the routine and stops its future runs. This can't be undone.",actions:[{title:"Delete routine",destructive:!0,action:async()=>{if(t)try{await(await r.ready()).call("deleteRoutine",{botId:e,id:t.id}),n(null)}catch(J){k(Kn(J))}}}],onClose:()=>$(!1)})]})}function Y_(e){switch(e.status){case"pending":return"Queued";case"starting":return"Starting";case"running":return"Running";case"recovering":return"Resuming after restart";case"failed":return"Failed";case"interrupted":return"Interrupted";default:return e.status.charAt(0).toUpperCase()+e.status.slice(1)}}function l9({botId:e,initialId:t,onClose:n}){const r=Ne(),[l,h]=x.useState([]),[d,p]=x.useState([]),[g,m]=x.useState(null),[v,_]=x.useState(!1),[S,w]=x.useState(!1),[b,k]=x.useState(null),[E,j]=x.useState(null),V=x.useRef(e);V.current=e;const A=Y=>m({id:crypto.randomUUID(),routineId:Y}),z=async()=>{const Y=e;try{const $=await(await r.ready()).call("routines",{botId:Y});if(V.current!==Y)return;h($.routines),p($.runs),_(!0),j(null)}catch($){V.current===Y&&j(Kn($))}};x.useEffect(()=>{t&&A(t)},[t]),x.useEffect(()=>{h([]),p([]),_(!1);let Y=!1,$;const M=async()=>{await z(),Y||($=setTimeout(M,3e3))};return M(),()=>{Y=!0,clearTimeout($)}},[e]);const F=async(Y,$,M)=>{if(!S){w(!0);try{await(await r.ready()).call(Y,{botId:e,id:$.id,enabled:M??null}),k(null),await z()}catch(N){k(Kn(N))}finally{w(!1)}}},D=Y=>{const $=d.find(N=>N.routineId===Y.id&&s9(N));if($)return Y_($);if(Y.lastError)return"Schedule needs attention";const M=d.find(N=>N.routineId===Y.id);return M&&["failed","interrupted"].includes(M.status)?`Last run ${Y_(M).toLowerCase()}`:Y.triggerDescriptions.join(" · ")},I=(Y,$)=>{$&&h(M=>M.some(N=>N.id===$.id)?M.map(N=>N.id===$.id?$:N):[...M,$]),Y.routineId===null&&$&&$.triggers.some(M=>M.type==="webhook")?m({id:Y.id,routineId:$.id}):m(null),z()},q=l.find(Y=>Y.id===g?.routineId)??null,U={background:"var(--surface)",borderRadius:16};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:n?16:10,color:"var(--text)",...B(13)},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c.jsx("span",{style:{...B(13,"semibold"),paddingLeft:2},children:"Routines"}),c.jsx("span",{style:{flex:1}}),c.jsx(ke,{title:"Ask the bot for a routine",icon:"text.bubble",disabled:r.isOffline,onClick:()=>{r.setRoutineDraft(e,"I want a routine that "),n?.()}}),c.jsx(ke,{title:"Set up a routine",icon:"plus",disabled:r.isOffline,onClick:()=>A(null)}),n?c.jsx(ke,{title:"Close routines",icon:"xmark",onClick:n}):null]}),E?c.jsx("span",{style:{...B("caption"),color:"var(--danger)"},children:E}):null,b?c.jsx("span",{style:{...B("caption"),color:"var(--danger)",userSelect:"text"},children:b}):null,l.length===0?c.jsx("div",{style:{...U,...B(12),lineHeight:1.45,color:"var(--secondary)",padding:14},children:v?"No routines yet. Ask the bot for one, or set it up yourself with +.":"Loading routines…"}):c.jsx("div",{style:{...U,padding:"0 14px"},children:l.map((Y,$)=>c.jsxs(x.Fragment,{children:[$>0?c.jsx($C,{}):null,c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[c.jsxs("button",{className:"routine-row",onClick:()=>A(Y.id),children:[c.jsx("span",{style:{color:"var(--text)"},children:Y.name}),c.jsx("span",{style:{...B("caption"),color:Y.lastError?"var(--danger)":"var(--secondary)"},children:D(Y)})]}),c.jsx("span",{"aria-label":Y.name,style:{display:"flex"},children:c.jsx(rn,{on:Y.enabled,disabled:S||r.isOffline,onChange:M=>{F("setRoutineEnabled",Y,M)}})})]})]},Y.id))}),c.jsx($t,{open:g!==null&&(g.routineId===null||q!==null),onClose:()=>m(null),width:540,children:g?c.jsx(a9,{botId:e,routine:q,saved:Y=>I(g,Y)},g.id):null})]})}function h1({title:e,icon:t,onClick:n,direction:r=[0,0],size:l=32,className:h}){return c.jsx("button",{className:`mac-chat-button ${h??""}`,title:e,"aria-label":e,onClick:n,style:{width:l,height:l,"--dx":r[0],"--dy":r[1]},children:c.jsx(ae,{name:t,size:l/2,weight:"medium"})})}const G_=window.codync.platform==="darwin";function o9({botId:e,routineId:t,editing:n,setEditing:r,editGroup:l,share:h,close:d}){const g=Ne().bots.get(e)??null,[m,v]=x.useState(!1);let _;return n?_=c.jsxs(c.Fragment,{children:[c.jsx(Gl,{label:"Back to details",symbol:"chevron.left",action:()=>{v(!0),r(!1)}}),c.jsx(K0,{children:"Settings"}),c.jsx("span",{style:{flex:1}})]}):g&&At(g)?_=c.jsxs(c.Fragment,{children:[c.jsx(K0,{children:"Members"}),c.jsx("span",{style:{flex:1}}),c.jsx(Gl,{label:"Edit group",symbol:"gearshape",action:l})]}):_=c.jsxs(c.Fragment,{children:[c.jsx(K0,{children:"Details"}),c.jsx("span",{style:{flex:1}}),c.jsx(Gl,{label:"Create template",symbol:"square.and.arrow.up",action:h}),c.jsx(Gl,{label:"Bot settings",symbol:"gearshape",action:()=>r(!0)})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,height:54,padding:"0 12px",flex:"none"},children:[_,c.jsx(Gl,{label:"Close details",symbol:"chevron.right.2",action:d})]}),c.jsx("div",{style:{flex:1,minHeight:0,position:"relative",overflow:"hidden"},children:g&&At(g)?c.jsx(c9,{group:g}):n?c.jsx("div",{className:"panel-slide from-trailing",style:{height:"100%"},children:c.jsx(X7,{botId:e})}):c.jsx("div",{className:m?"panel-slide from-leading":void 0,style:{height:"100%",overflowY:"auto"},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:28,padding:"4px 16px 24px"},children:[c.jsx(h9,{botId:e}),c.jsx(l9,{botId:e,initialId:t}),g?c.jsx(u9,{bot:g}):null]})})})]})}function K0({children:e}){return c.jsx("span",{style:{...B(15,"semibold"),color:"var(--text)",paddingLeft:4},children:e})}function Gl({label:e,symbol:t,action:n}){return c.jsx(h1,{title:e,icon:t,direction:t==="chevron.right.2"?[1,0]:[0,0],onClick:n})}function c9({group:e}){const t=Ne();return c.jsxs("div",{style:{height:"100%",overflowY:"auto",padding:"0 16px"},children:[c.jsxs("div",{style:{...B(13,"semibold"),paddingBottom:6},children:[e.members.length," bots"]}),t.members(e).map(n=>c.jsxs("button",{className:"press",title:`Open ${n.name}'s own chat`,onClick:()=>t.setSelection(n.id),style:{display:"flex",alignItems:"center",gap:10,padding:"6px 0",width:"100%"},children:[c.jsx(Ui,{bot:n,size:26}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:1,minWidth:0,flex:1},children:[c.jsx("span",{style:{...B(13),color:"var(--text)"},children:n.name}),c.jsx("span",{style:{...B(11),color:"var(--tertiary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Jn(n)?n.activity||"Working…":bo(n)})]})]},n.id))]})}function h9({botId:e}){const t=Ne(),n=t.screen,r=!t.isOffline&&!!n?.enabled&&n.connected&&n.capture,l=n?.enabled?n.connected?n.capture?n.agentBot===e?"cursorarrow.motionlines":"checkmark.circle":"exclamationmark.circle":"arrow.triangle.2.circlepath":"power",h=n?.enabled?n.connected?n.capture?n.agentBot===e?`This bot is using your ${G_?"Mac":"computer"}`:"Ready to connect":"Screen recording permission needed":"Connecting to computer…":"Remote screen is off";return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:16,background:"var(--surface)",borderRadius:16},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[c.jsx(Va,{computer:t.computer,size:32}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,minWidth:0},children:[c.jsx("span",{style:{...B(15,"medium"),color:"var(--text)",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:t.hostName}),c.jsx("span",{style:{...B(13),color:"var(--secondary)"},children:"Remote screen"})]})]}),t.isOffline?null:c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,...B(13),color:"var(--text)"},children:[c.jsx(ae,{name:l,size:13}),h]}),r?c.jsxs("div",{style:{...B(12),color:"var(--secondary)",marginTop:-8},children:["View and control this ",G_?"Mac":"computer"," from your iPhone."]}):null]})}function Y0({label:e,children:t,title:n}){return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,...B(13)},children:[c.jsx("span",{style:{color:"var(--secondary)"},children:e}),c.jsx("span",{style:{flex:1,minWidth:8}}),c.jsx("span",{title:n,style:{color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"flex",alignItems:"center",gap:6,minWidth:0},children:t})]})}function u9({bot:e}){const t=Ne();return c.jsxs(Ee,{title:"Agent",footer:e.description||null,children:[c.jsxs(Y0,{label:"Runtime",children:[c.jsx(wS,{registry:t.hello?.backends.find(n=>n.id===e.backend)?.registry,size:14}),c.jsx("span",{children:t.backendName(e.backend)})]}),c.jsx(Y0,{label:e.managedWorkspace?"Workspace":"Folder",title:e.managedWorkspace?"Personal workspace, managed by Codync":e.cwd,children:e.managedWorkspace?"Personal":bo(e)}),e.model?c.jsx(Y0,{label:"Model",children:e.model}):null]})}function jS({botId:e,thread:t=null}){const n=Ne(),r=new Map;for(const d of n.allEntries(e))(d.threadId??null)===t&&r.set(d.turn,[...r.get(d.turn)??[],d]);const l=[...r.entries()].sort((d,p)=>d[0]-p[0]),h=x.useRef(null);return x.useLayoutEffect(()=>{const d=h.current;d&&(d.scrollTop=d.scrollHeight)},[]),c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:"Full conversation"}),c.jsx("div",{ref:h,style:{flex:1,overflowY:"auto"},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14,padding:14,fontSize:"calc(12px * var(--scale))"},children:[l.length===0?c.jsx("span",{style:{color:"var(--tertiary)"},children:"Nothing yet."}):null,l.map(([d,p])=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsx("div",{style:{...B("compactSecondary","semibold"),color:"var(--text)",paddingLeft:4,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.find(g=>g.kind==="user")?.data.text??`Turn ${d}`}),c.jsx(Ee,{children:p.map(g=>c.jsx(d9,{entry:g},g.id))})]},d))]})})]})}function hh({icon:e,children:t,style:n}){return c.jsxs("span",{style:{display:"flex",alignItems:"flex-start",gap:6,...n},children:[c.jsx("span",{style:{display:"flex",alignItems:"center",minHeight:"1.25em"},children:e}),c.jsx("span",{style:{minWidth:0},children:t})]})}function d9({entry:e}){const[t,n]=x.useState(!1),r=e.data;switch(e.kind){case"user":return c.jsx(hh,{icon:c.jsx(ae,{name:"person.fill",size:11,color:"var(--secondary)"}),style:B("subheadline"),children:c.jsx("span",{style:{color:"var(--text)"},children:r.text??""})});case"agent":return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[c.jsx("span",{style:{...B("caption2","semibold"),color:"var(--tertiary)"},children:r.final?"Reply":"Said"}),c.jsx(lS,{text:r.text??""})]});case"thought":return c.jsx(G2,{expanded:t,onToggle:()=>n(l=>!l),label:c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,...B("subheadline"),color:"var(--secondary)"},children:[c.jsx(on,{size:16,color:"var(--secondary)",animated:!1}),"Thinking"]}),children:c.jsx("div",{className:"selectable",style:{...B("footnote"),color:"var(--secondary)",whiteSpace:"pre-wrap"},children:r.text??""})});case"tool":return c.jsx(p9,{data:r});case"plan":return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[c.jsx(hh,{icon:c.jsx(ae,{name:"checklist",size:11,weight:"bold"}),style:B("subheadline","bold"),children:"Plan"}),(r.entries??[]).map((l,h)=>c.jsx(hh,{style:B("footnote"),icon:c.jsx(ae,{name:l.status==="completed"?"checkmark.circle.fill":l.status==="in_progress"?"circle.dotted":"circle",size:10,color:l.status==="completed"?"var(--accent)":"var(--tertiary)"}),children:c.jsx("span",{style:{color:"var(--text)",textDecoration:l.status==="completed"?"line-through":void 0},children:l.content})},h))]});case"permission":return c.jsx(hh,{icon:c.jsx(ae,{name:"hand.raised",size:11}),style:{...B("subheadline"),color:"var(--secondary)"},children:r.title??"Approval"});default:return c.jsx("span",{style:{...B("footnote"),color:"var(--tertiary)"},children:r.text??""})}}const f9=e=>({read:"doc.text",edit:"pencil",delete:"trash",move:"arrow.right.doc.on.clipboard",search:"magnifyingglass",execute:"terminal",think:"brain",fetch:"globe"})[e??""]??"wrench.and.screwdriver";function p9({data:e}){const[t,n]=x.useState(!1),r=!!e.output||!!e.diffs?.length,l=c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8,...B("caption"),flex:1,minWidth:0},children:[c.jsx("span",{style:{width:18,display:"flex",justifyContent:"center",color:"var(--secondary)"},children:c.jsx(ae,{name:f9(e.toolKind),size:10})}),c.jsx("span",{style:{...B("subheadline"),color:"var(--text)",flex:1,minWidth:0,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:e.title??"Tool"}),e.status==="completed"?c.jsx(ae,{name:"checkmark",size:10,color:"var(--accent)"}):e.status==="failed"?c.jsx(ae,{name:"xmark",size:10,color:"var(--danger)"}):c.jsx(on,{state:e.toolKind==="search"?"searching":e.toolKind==="fetch"?"connecting":"working",size:16,color:"var(--secondary)"})]});return r?c.jsx(G2,{expanded:t,onToggle:()=>n(h=>!h),label:l,children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(e.diffs??[]).map((h,d)=>c.jsx(oS,{diff:h},d)),e.output?c.jsx(Wf,{text:e.output}):null]})}):l}function TS(e,t,n){const r=x.useId(),l=e.connection.kind;x.useEffect(()=>{const h=()=>e.setReading(r,t,n,document.visibilityState==="visible"&&document.hasFocus());return h(),window.addEventListener("focus",h),window.addEventListener("blur",h),document.addEventListener("visibilitychange",h),()=>{window.removeEventListener("focus",h),window.removeEventListener("blur",h),document.removeEventListener("visibilitychange",h),e.setReading(r,t,n,!1)}},[e,r,t,n,l])}function Z_({botId:e,rootId:t,close:n}){const r=Ne(),l=r.bots.get(e)??null,h=r.allEntries(e).find(b=>b.id===t),d=r.replies(e,t),p=!!l&&$2(l,e,t)&&!r.isOffline,g=Vf(d),m=sS([...g.map(b=>b.id),...p?["working"]:[]],!0),[v,_]=x.useState(!1),S=x.useRef(null);TS(r,e,t),x.useEffect(()=>{r.loadThread(e,t)},[r,e,t]),x.useLayoutEffect(()=>{const b=S.current;b&&(b.scrollTop=b.scrollHeight)},[d.length,d[d.length-1]?.data.text,p]);const w=()=>_(!0);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,height:48,padding:"0 10px 0 16px",flex:"none"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[c.jsx("span",{style:{...B("compactBody","semibold"),color:"var(--text)"},children:"Thread"}),c.jsx("span",{style:{...B("caption"),color:"var(--tertiary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l?.name??""})]}),c.jsx(ke,{title:"Close thread",icon:"xmark",onClick:n})]}),c.jsx("div",{style:{height:.5,background:"var(--border)",flex:"none"}}),c.jsx("div",{ref:S,style:{flex:1,overflowY:"auto"},children:c.jsxs("div",{style:{padding:"8px 16px 0"},children:[h?c.jsxs(c.Fragment,{children:[c.jsx(Jf,{entry:h,groupStart:!0,chat:l,openTrace:w}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"12px 0"},children:[c.jsx("span",{style:{...B("caption"),color:"var(--tertiary)",whiteSpace:"nowrap"},children:d.length===0?"No replies yet":d.length===1?"1 reply":`${d.length} replies`}),c.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}})]})]}):null,g.map(b=>b.kind==="entry"?c.jsx("div",{className:m.has(b.id)?nS(b):void 0,children:c.jsx(Jf,{entry:b.entry,groupStart:b.groupStart,chat:l,openTrace:w})},b.id):null),l&&p?c.jsx("div",{className:m.has("working")?"row-in":void 0,style:{paddingTop:6},children:c.jsx(yS,{bot:l,thinking:r.currentThinking(e,t)})}):null,c.jsx("div",{style:{height:8}})]})}),c.jsx("div",{style:{flex:"none"},children:r.mismatch?c.jsx("div",{style:{padding:"0 16px 8px"},children:c.jsx(J2,{})}):c.jsx(xS,{botId:e,thread:t})}),c.jsx($t,{open:v,onClose:()=>_(!1),width:620,height:560,children:c.jsx(jS,{botId:e,thread:t})})]})}function g9({group:e,members:t=[]}){const n=Ne(),r=ss(),l=e?.id??null,[h,d]=x.useState(e?.name??""),[p,g]=x.useState(e?.description??""),[m,v]=x.useState(e?.members??t),[_,S]=x.useState(""),[w,b]=x.useState(!1),[k,E]=x.useState(null),[j,V]=x.useState(null),A=m.map(M=>n.bots.get(M)).filter(M=>!!M),z=_.trim().toLowerCase(),F=n.roster.filter(M=>!At(M)&&!m.includes(M.id)&&(!z||M.name.toLowerCase().includes(z))),D=l===null,I=m.length>0&&!w,q=A.length?A.map(M=>M.name).join(", "):"Name",U=l?n.bots.get(l):void 0,Y=M=>{v(N=>N.includes(M)?N.filter(L=>L!==M):[...N,M]),S("")},$=()=>{b(!0),E(null);const N=h.trim()||q,L=p.trim(),O=l?n.updateGroup({id:l,kind:"group",name:N,description:L,members:m,pinned:n.bots.get(l)?.pinned}):n.createGroup(N,L,m);Promise.resolve(O).then(()=>r()).catch(P=>E(Ar(P))).finally(()=>b(!1))};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:D?"New group chat":"Group chat",trailing:w?c.jsx(et,{}):c.jsx(ke,{title:D?"Create":"Save",icon:"checkmark",disabled:!I,onClick:$})}),c.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto"},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16,...B("body")},children:[c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:c.jsx(Eo,{members:A,size:72})}),c.jsxs(po,{label:`Bots · ${m.length}`,children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[A.length?c.jsx("div",{className:"chip-row",children:A.map(M=>c.jsx(ES,{bot:M,onRemove:()=>Y(M.id)},M.id))}):null,c.jsx("input",{className:"field-box",value:_,placeholder:A.length?"Add another bot":"Search bots",onChange:M=>S(M.target.value),onKeyDown:M=>{M.key==="Enter"&&!M.nativeEvent.isComposing&&F[0]&&Y(F[0].id)}}),c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:F.map(M=>c.jsxs("button",{className:"press pick-row fade-in","aria-label":`Add ${M.name}`,onClick:()=>Y(M.id),children:[c.jsx(Ui,{bot:M,size:26,animated:!1}),c.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[c.jsx("span",{style:{color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:M.name}),c.jsx("span",{style:{...B("caption"),color:"var(--tertiary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:bo(M)})]}),c.jsx(ae,{name:"plus.circle",size:20,color:"var(--tertiary)"})]},M.id))})]}),c.jsx("span",{style:{...B("caption"),color:"var(--tertiary)"},children:"Everyone answers in turn unless you @mention someone. Each bot works in its own folder with its own tools."})]}),c.jsx(po,{label:"Name",children:c.jsx("input",{className:"field-box",value:h,placeholder:q,onChange:M=>d(M.target.value)})}),c.jsx(po,{label:"About",children:c.jsx(c1,{className:"field-box",value:p,placeholder:"What this group works on (optional)",minRows:2,maxRows:5,onChange:g})}),k?c.jsx("span",{className:"fade-in",style:{...B("footnote"),color:"var(--danger)"},children:k}):null,U?c.jsx("div",{style:{paddingTop:8},children:c.jsx(Fe,{kind:"secondary",onClick:()=>V(U),children:"Delete group chat"})}):null]})}),c.jsx(m9,{bot:j,onClose:()=>V(null),onDeleted:r})]})}function m9({bot:e,onClose:t,onDeleted:n}){const r=Ne();return c.jsx(ts,{open:e!==null,title:`Delete ${e?.name??"bot"}?`,message:e&&At(e)?"Its bots and their own chats stay.":"Files it changed on your computer stay as they are.",actions:[{title:"Delete bot and its conversation",destructive:!0,action:()=>{e&&r.delete(e),n()}}],onClose:t})}function v9(e){const{id:t,pinned:n,hidden:r,...l}=e,h=Object.fromEntries(Object.entries(l).filter(([,d])=>d!=null).sort(([d],[p])=>d<p?-1:d>p?1:0));return JSON.stringify(h,null,2).replace(/^(\s*"(?:[^"\\]|\\.)*"): /gm,"$1 : ")}function _9({draft:e}){const t=x.useMemo(()=>v9(e),[e]),[n,r]=x.useState(!1),l=()=>{navigator.clipboard.writeText(t).then(()=>r(!0))};return x.useEffect(()=>{const h=d=>{d.key==="Enter"&&!d.isComposing&&(d.preventDefault(),l())};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)}),c.jsxs("div",{style:{width:560,height:540,display:"flex",flexDirection:"column",background:"var(--background)"},children:[c.jsx(Lt,{title:"Create template"}),c.jsxs("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",gap:20,padding:"0 24px 24px"},children:[c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)"},children:e.name}),c.jsx("span",{style:{...B("callout"),color:"var(--secondary)"},children:"Copy this bot’s settings to reuse as a template. Conversation history and conversation ID are excluded."}),c.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto",background:"var(--surface)",borderRadius:12},children:c.jsx("pre",{className:"selectable",style:{...B(12,"regular","monospaced"),margin:0,padding:16,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:t})}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",flex:1},children:"Includes workspace preferences and agent configuration."}),c.jsxs("button",{className:"press",style:{...B(13,"semibold"),display:"flex",alignItems:"center",gap:6,padding:"9px 14px",color:"var(--on-accent)",background:"var(--accent-fill)",borderRadius:9},onClick:l,children:[c.jsx(ae,{name:n?"checkmark":"square.on.square",size:13,weight:"semibold",className:"fade-in"},n?"checkmark":"square.on.square"),n?"Copied":"Copy template"]})]})]})]})}const y9=["openai","gemini"],Xn={openai:{name:"OpenAI",keyPage:"https://platform.openai.com/api-keys",keyPrompt:"sk-…",defaults:{realtime:"gpt-realtime-2.1",transcribe:"gpt-transcribe",speech:"gpt-4o-mini-tts"},voices:["marin","cedar","alloy","ash","ballad","coral","echo","sage","shimmer","verse"]},gemini:{name:"Gemini",keyPage:"https://aistudio.google.com/apikey",keyPrompt:"AIza…",defaults:{realtime:"gemini-3.8-live",transcribe:"gemini-3.8-flash",speech:"gemini-3.8-flash-tts"},voices:["Kore","Puck","Charon","Fenrir","Aoede","Leda","Orus","Zephyr"]}},RS=e=>e==="openai"||e==="gemini",G0=(e,t)=>e.providers.some(n=>n.provider===t&&n.configured),DS=bi("callEngine","device"),AS=.5,NS=bi("callRate",AS),s2=bi("callPause",1.5),LS=bi("callLanguage","");function S9(e){const t=new Intl.DisplayNames([navigator.language],{type:"language"}),n=r=>{try{return t.of(r.replace("_","-"))??r}catch{return r}};return[{id:"",label:"System"},...e.map(r=>({id:r,label:n(r)})).sort((r,l)=>r.label.localeCompare(l.label))]}const Z0=new Map;function an(e,t){return Z0.has(e)||Z0.set(e,bi(e,t)),Z0.get(e)}const u1=e=>an(`callMode.${e}`,"realtime"),BS=e=>an(`callVoice.${e}`,null),OS=e=>an(`callDefaults.${e}`,null),X_=e=>an(`callModels.${e}`,null),zS={realtime:e=>an(`callModel.${e}`,null),transcribe:e=>an(`callSpeechToText.${e}`,null),speech:e=>an(`callSpeechModel.${e}`,null)},HS=e=>OS(e).get()??Xn[e].defaults;function IS(e,t){t&&OS(e).set(t)}function US(e){for(const t of e.providers)IS(t.provider,t.defaults)}const Js=(e,t)=>zS[t](e).get()??HS(e)[t];function x9(e,t,n){zS[t](e).set(!n||n===HS(e)[t]?null:n)}function PS(e){const t=BS(e).get();return t&&Xn[e].voices.includes(t)?t:Xn[e].voices[0]}const w9=(e,t)=>BS(e).set(t),qS=(e,t)=>`callUsage.${e}.${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}`;function b9(e,t,n=new Date){if(e<=0)return;const r=an(qS(t,n),0);r.set(r.get()+e)}const C9=(e,t=new Date)=>Math.floor((an(qS(e,t),0).get()+59)/60),k9=e=>e.call("voiceStatus"),Q_=(e,t,n)=>e.call("setVoiceKey",{provider:t,key:n},3e4),E9=async(e,t,n,r)=>(await e.call("voiceSession",{provider:t,model:n,voice:r},3e4)).credential,M9=(e,t)=>e.call("voiceModels",{provider:t},3e4),j9=(e,t,n,r,l)=>e.call("voiceSpeak",{provider:t,model:n,voice:r,text:l},9e4),uh=e=>Xn[e].name,T9={openai:600,gemini:150},J_=()=>window.codync.speech.available,Oh=()=>window.codync.platform==="darwin"?"On-device speech isn't available in this build.":"On-device speech isn't available on Linux.",Qi={provider:()=>{const e=DS.get();return RS(e)?e:null},model:e=>Js(e,"realtime"),transcribeModel:e=>Js(e,"transcribe"),speechModel:e=>Js(e,"speech"),voice:PS,isSpeechMode:e=>u1(e).get()==="speech",remember:US,pause:()=>s2.get()>0?s2.get():1.5,rate:()=>NS.get(),language:()=>LS.get()},R9=(e,t)=>b9(Math.floor(e),t);class Gh extends Br{phase="starting";failure=null;level=0;onActivityChanged=null;ended=!1;mutedValue=!1;get isActive(){return this.phase==="listening"||this.phase==="speaking"}get muted(){return this.mutedValue}set muted(t){t!==this.mutedValue&&(this.mutedValue=t,this.mutedChanged(t),this.changed())}mutedChanged(t){}setPhase(t){this.phase=t,this.changed(),this.onActivityChanged?.(!this.ended&&this.isActive)}fail(t){this.end(),this.failure=t,this.setPhase("failed")}}const Yn=e=>e instanceof Error?e.message:String(e),D9="Allow the microphone for Codync in Settings to talk to your bots.";async function VS(){try{return await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1}})}catch(e){throw e instanceof DOMException&&(e.name==="NotAllowedError"||e.name==="SecurityError")?new Error(D9):new Error(`Couldn't use the microphone: ${Yn(e)}`)}}async function $S(e){const t=await VS(),n=new AudioContext({sampleRate:16e3}),r=n.createMediaStreamSource(t),l=n.createScriptProcessor(2048,1,1);return l.onaudioprocess=h=>{const d=h.inputBuffer.getChannelData(0),p=new Int16Array(d.length);let g=0;for(let m=0;m<d.length;m++){const v=Math.max(-1,Math.min(1,d[m]));p[m]=v<0?v*32768:v*32767,g+=v*v}e(p,A9(g,d.length))},r.connect(l),l.connect(n.destination),n.state==="suspended"&&await n.resume(),()=>{l.onaudioprocess=null,r.disconnect(),l.disconnect();for(const h of t.getTracks())h.stop();n.close()}}function A9(e,t){const n=10*Math.log10(Math.max(e/Math.max(t,1),1e-10));return Math.min(1,Math.max(0,(n+50)/50))}function N9(e){const t=e.reduce((d,p)=>d+p.length,0),n=new Uint8Array(44+t*2),r=new DataView(n.buffer),l=(d,p)=>[...p].forEach((g,m)=>r.setUint8(d+m,g.charCodeAt(0)));l(0,"RIFF"),r.setUint32(4,36+t*2,!0),l(8,"WAVEfmt "),r.setUint32(16,16,!0),r.setUint16(20,1,!0),r.setUint16(22,1,!0),r.setUint32(24,16e3,!0),r.setUint32(28,32e3,!0),r.setUint16(32,2,!0),r.setUint16(34,16,!0),l(36,"data"),r.setUint32(40,t*2,!0);let h=44;for(const d of e)for(let p=0;p<d.length;p++,h+=2)r.setInt16(h,d[p],!0);return n}function WS(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function FS(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function zh(e){const t=[[/```[\s\S]*?```/g,""],[/!?\[([^\]]*)\]\([^)]*\)/g,"$1"],[/`([^`]*)`/g,"$1"],[/^\s{0,3}(#{1,6}|>|[-*+]|\d+\.)\s+/gm,""],[/(\*\*|\*|~~)(\S[^\n]*?)\1/g,"$2"],[/^[ \t]*\|?[ \t:|-]{3,}\|?[ \t]*$/gm,""],[/^[ \t]*\|[ \t]*|[ \t]*\|[ \t]*$/gm,""],[/[ \t]*\|[ \t]*/g,", "],[/\n{2,}/g,`-`]];let n=e;for(const[r,l]of t)n=n.replace(r,l);return n.trim()}const KS=window.codync.platform==="darwin",go=KS?"this Mac":"this computer";function $a({show:e,children:t,style:n}){const{mounted:r,shown:l}=er(e);return r?c.jsx("div",{className:`settings-reveal ${l?"shown":""}`,style:n,children:c.jsx("div",{children:t})}):null}function ey({title:e,children:t}){return c.jsxs("div",{className:"settings-section-header",children:[c.jsx("span",{role:"heading","aria-level":3,style:{...B(13,"semibold"),color:"var(--text)"},children:e}),c.jsx("span",{style:{flex:1}}),t]})}const Wa=e=>e instanceof Error?e.message:typeof e=="object"&&e&&"message"in e?String(e.message):String(e);function YS(e,t=new Date){const n=l=>new Date(l.getFullYear(),l.getMonth(),l.getDate()).getTime(),r=Math.round((n(t)-n(e))/864e5);return r===0?e.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):r===1?"Yesterday":t.getTime()-e.getTime()<6*864e5?e.toLocaleDateString(void 0,{weekday:"long"}):e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function n2(e){const t=e.connection;switch(t.kind){case"online":return e.mismatch?"Needs update":"Online";case"connecting":return"Connecting…";case"computerOffline":return t.lastSeen?`Offline · seen ${YS(new Date(t.lastSeen))}`:"Offline";case"offline":return"Can't reach";case"unauthorized":return t.message;case"unpaired":return"Not paired"}}const Hh=e=>e.connection.kind==="online"?e.client:null,L9=e=>e.length===6?`${e.slice(0,3)} ${e.slice(3)}`:e;function d1({showsHeader:e=!0}){const[t,n]=ni(DS),[r,l]=ni(NS),[h,d]=ni(LS),p=x.useMemo(()=>S9(window.codync.speech.locales()),[]),g=RS(t)?t:null,[m,v]=ni(u1(g??"openai")),_=g?`Your own ${Xn[g].name} key, billed by ${Xn[g].name}. Applies from the next call.`:window.codync.speech.available?"On-device speech, on this computer. Applies from the next call.":Oh();return c.jsxs("div",{style:{display:"flex",flexDirection:"column",background:"var(--background)",width:e?440:void 0,height:e?600:"100%"},children:[e?c.jsx(Lt,{title:"Voice chat"}):null,c.jsx("div",{style:{flex:1,minHeight:0},children:c.jsxs(hi,{children:[c.jsx(Ee,{title:"Voice",footer:_,children:[c.jsx(Jt,{label:"Engine",children:c.jsx(Ci,{selection:t,options:[...window.codync.speech.available||t==="device"?[{id:"device",label:"On device"}]:[],...y9.map(S=>({id:S,label:Xn[S].name}))],onChange:n})},"engine"),...g?[c.jsx(Jt,{label:"Mode",detail:m==="speech"?"Sent when you pause, replies read aloud.":"A live conversation. Talk over replies.",children:c.jsx(Ci,{selection:m,options:[{id:"realtime",label:"Realtime"},{id:"speech",label:"Speech"}],onChange:v})},"mode"),...m==="speech"?[c.jsx(ty,{},"pause")]:[]]:[c.jsx(Jt,{label:"Language",detail:"The language you speak in calls.",children:c.jsx(Ci,{selection:h,options:p,onChange:d})},"language"),c.jsx(Jt,{label:"Reading speed",children:c.jsx(Ci,{selection:r,options:[{id:.42,label:"Slower"},{id:AS,label:"Normal"},{id:.56,label:"Faster"}],onChange:l})},"rate"),c.jsx(ty,{},"pause")]]}),g?c.jsx(B9,{provider:g},g):null]})})]})}function ty(){const[e,t]=ni(s2);return c.jsx("div",{className:"settings-appear",children:c.jsx(Jt,{label:"Send after a pause of",detail:"Longer leaves time to think mid-sentence.",children:c.jsx(Ci,{selection:e,options:[{id:1,label:"1 s"},{id:1.5,label:"1.5 s"},{id:2.5,label:"2.5 s"}],onChange:t})})})}function B9({provider:e}){const t=Ne(),n=Xn[e],[r]=ni(u1(e)),[l,h]=x.useState(null),[d,p]=x.useState(!1),[g,m]=x.useState(""),[v,_]=x.useState(!1),[S,w]=x.useState(null),[b,k]=x.useState(()=>PS(e)),[E,j]=x.useState(()=>Js(e,"realtime")),[V,A]=x.useState(()=>Js(e,"transcribe")),[z,F]=x.useState(()=>Js(e,"speech")),[D,I]=x.useState(()=>X_(e).get()??{models:[],transcribe:[],speech:[]}),q=x.useRef(!1),U=r==="speech",Y=l===!0,$={ok:!1,text:`Not connected to ${t.hostName}.`},M=async re=>{let de;try{de=await M9(re,e)}catch{return}I(de),IS(e,de.defaults),j(Js(e,"realtime")),A(Js(e,"transcribe")),F(Js(e,"speech")),X_(e).set(de)};x.useEffect(()=>{let re=!1;return(async()=>{const de=Hh(t);if(!de)return h(!1),w($);let Ce;try{const je=await k9(de);US(je),Ce=G0(je,e)}catch(je){return re?void 0:(h(!1),w({ok:!1,text:Wa(je)}))}re||(h(Ce),Ce&&await M(de))})(),()=>{re=!0}},[e]);const N=(re,de)=>Ce=>{de(Ce),x9(e,re,Ce)},L=re=>{if(q.current)return;const de=Hh(t);if(!de)return w($);q.current=!0,_(!0),w(null),re(de).catch(Ce=>w({ok:!1,text:Wa(Ce)})).finally(()=>{q.current=!1,_(!1)})},O=()=>{const re=g.trim();!re&&!Y||L(async de=>{!re||!d&&Y?(U?await j9(de,e,z,b,"OK"):await E9(de,e,E,b),w({ok:!0,text:"Key works"})):(h(G0(await Q_(de,e,re),e)),m(""),p(!1),w({ok:!0,text:`Key works and is saved on ${t.hostName}`})),await M(de)})},P=()=>L(async re=>{h(G0(await Q_(re,e,""),e)),w(null)}),te=(re,de,Ce)=>{const je=de.includes(re)?de:[re,...de];return c.jsx(Ci,{selection:re,options:je.map(R=>({id:R,label:R})),onChange:Ce})},Q={opacity:Y?1:.55,pointerEvents:Y?void 0:"none",transition:"opacity var(--layout)"},ce=c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[Y&&!d?c.jsxs("div",{className:"settings-row",children:[c.jsx(ae,{name:"key.fill",size:13,color:"var(--secondary)"}),c.jsxs("div",{className:"settings-stack",style:{flex:1},children:[c.jsx("span",{style:{color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Key saved"}),c.jsxs("span",{style:{...B("caption"),color:"var(--tertiary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:["Stays on ",t.hostName]})]}),v?c.jsx(et,{}):c.jsxs(c.Fragment,{children:[c.jsx(ke,{title:"Test key",icon:"checkmark.seal",onClick:O}),c.jsx(ke,{title:"Replace key",icon:"pencil",onClick:()=>{p(!0),w(null)}}),c.jsx(ke,{title:"Remove key",icon:"trash",onClick:P})]})]}):c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[c.jsxs("div",{className:"settings-row",style:{gap:8},children:[c.jsx("input",{type:"password","aria-label":"API key",placeholder:n.keyPrompt,value:g,spellCheck:!1,autoComplete:"off",style:{flex:1,minWidth:0},onChange:re=>m(re.target.value),onKeyDown:re=>re.key==="Enter"&&O()}),v?c.jsx(et,{}):c.jsx(Fe,{onClick:O,disabled:!g.trim(),children:"Save"})]}),c.jsxs("div",{className:"settings-row",style:B("footnote"),children:[c.jsxs("button",{style:{color:"var(--text)",textDecoration:"underline"},onClick:()=>window.codync.app.openExternal(n.keyPage),children:["Get a key from ",n.name]}),c.jsx("span",{style:{flex:1}}),d?c.jsx("button",{style:{color:"var(--secondary)"},onClick:()=>{p(!1),m(""),w(null)},children:"Cancel"}):null]})]}),c.jsx($a,{show:S!==null,children:S?c.jsxs("span",{style:{...B("footnote"),display:"flex",alignItems:"center",gap:5,color:S.ok?"var(--secondary)":"var(--danger)"},children:[c.jsx(ae,{name:S.ok?"checkmark.circle.fill":"exclamationmark.circle.fill",size:10}),S.text]}):null})]},"key");return c.jsx(Ee,{title:n.name,footer:Y?null:`Add a key to choose from ${n.name}'s models.`,children:[ce,...U?[c.jsx("div",{style:Q,children:c.jsx(Jt,{label:"Speech to text",children:te(V,D.transcribe,N("transcribe",A))})},"stt"),c.jsx("div",{style:Q,children:c.jsx(Jt,{label:"Text to speech",children:te(z,D.speech,N("speech",F))})},"tts")]:[c.jsx("div",{style:Q,children:c.jsx(Jt,{label:"Model",children:te(E,D.models,N("realtime",j))})},"model")],c.jsx("div",{style:Q,children:c.jsx(Jt,{label:"Voice",children:c.jsx(Ci,{selection:b,options:n.voices.map(re=>({id:re,label:re})),onChange:re=>{k(re),w9(e,re)}})})},"voice"),c.jsx("div",{style:Q,children:c.jsxs(Jt,{label:"This month",children:["≈ ",C9(e)," min"]})},"minutes")]})}const GS=[{name:"send_to_bot",description:"Send a message to the bot on the computer, exactly as if the user typed it. Its reply arrives later.",parameters:{type:"object",properties:{text:{type:"string",description:"The message"}},required:["text"]}},{name:"bot_status",description:"Whether the bot is idle or working, what it is doing, and any approval it is waiting for.",parameters:{type:"object",properties:{}}},{name:"recent_messages",description:"The latest messages in the chat with the bot, oldest first.",parameters:{type:"object",properties:{count:{type:"integer",description:"How many, 1–20"}}}},{name:"answer_approval",description:"Answer the bot's pending approval request with one of its options.",parameters:{type:"object",properties:{option:{type:"string",description:"The option's name"}},required:["option"]}}];class O9{constructor(t,n){this.store=t,this.botId=n}store;botId;get instructions(){const t=this.store.bots.get(this.botId),n=t?.name??"the bot",r=t?.description?` (${t.description})`:"";return[`You are the voice on a phone call between the user and ${n}${r}, a coding agent running on the user's computer. ${n} does all the actual work; you relay.`,"- When the user asks for something to be done, changed, checked or answered about their code or computer, call send_to_bot with their request in their own words (keep details, names and code terms exactly). Don't do the work or invent results yourself.",'- Use bot_status and recent_messages for "what are you doing?" or "what did it say?".',"- Call answer_approval only after the user has clearly said which option to pick.",`- Messages starting with [${n} replied] or [Notice] come from the computer: tell the user what they say, shortened for speech (no code blocks, no long lists, no URLs).`,"- Reply in the user's language. Keep spoken answers short and natural."].join(`+`),language:h}),d(),t}function Na(e,t="i"){const n=[];return e.split(/(`[^`\n]+`)/).forEach((r,l)=>{r.length>2&&r.startsWith("`")&&r.endsWith("`")?n.push(c.jsx("code",{style:{fontFamily:"var(--mono)",background:"rgba(var(--text-rgb), 0.08)"},children:r.slice(1,-1)},`${t}${l}`)):r&&n.push(...no(r,`${t}${l}-`))}),n}const C8=new RegExp("\\[([^\\]]+)\\]\\(([^)\\s]+)\\)|\\*\\*([^*]+)\\*\\*|__([^_]+)__|~~([^~]+)~~|\\*([^*\\n]+)\\*|(?<![\\w])_([^_\\n]+)_(?![\\w])");function no(e,t){const n=[];let r=e,l=0;for(;r;){const h=C8.exec(r);if(!h){n.push(r);break}h.index>0&&n.push(r.slice(0,h.index));const d=`${t}${l++}`;if(h[1]!==void 0){const p=h[2];n.push(c.jsx("a",{href:p,onClick:g=>{g.preventDefault(),window.codync.app.openExternal(p)},style:{color:"var(--accent)",textDecoration:"none",cursor:"pointer"},children:no(h[1],`${d}-`)},d))}else h[3]!==void 0||h[4]!==void 0?n.push(c.jsx("strong",{style:{fontWeight:600},children:no(h[3]??h[4],`${d}-`)},d)):h[5]!==void 0?n.push(c.jsx("s",{children:no(h[5],`${d}-`)},d)):n.push(c.jsx("em",{children:no(h[6]??h[7],`${d}-`)},d));r=r.slice(h.index+h[0].length)}return n}const k8=e=>e===1?15:e===2?13:11,$f="calc(1.2em + 4px * var(--md-scale))",aS={lineHeight:$f,margin:"calc(-2px * var(--md-scale)) 0"},W0={color:"var(--text)",whiteSpace:"pre-wrap",overflowWrap:"anywhere",...aS},E8=x.memo(function({block:t}){switch(t.kind){case"paragraph":return c.jsx("div",{style:{...W0,fontSize:"var(--conversation)"},children:Na(t.text)});case"heading":return c.jsx("div",{style:{...W0,fontSize:`calc(${k8(t.level)}px * var(--md-scale))`,fontWeight:t.level===2?600:700},children:Na(t.text)});case"bullet":return c.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6,fontSize:"var(--conversation)",paddingLeft:t.depth*16,...aS},children:[c.jsx("span",{style:{color:"var(--secondary)",fontVariantNumeric:"tabular-nums",flex:"none"},children:t.marker}),c.jsx("span",{style:{color:"var(--text)",whiteSpace:"pre-wrap",overflowWrap:"anywhere",minWidth:0},children:Na(t.text)})]});case"rule":return c.jsx("div",{style:{height:1,background:"var(--border)",margin:"4px 0"}});case"table":{const n=Math.max(t.header.length,...t.rows.map(l=>l.length)),r=Array.from({length:n},(l,h)=>h);return c.jsx("div",{style:{overflowX:"auto"},children:c.jsxs("div",{style:{display:"grid",gridTemplateColumns:`repeat(${n}, max-content)`,columnGap:16,rowGap:7,fontSize:"var(--conversation)",color:"var(--text)",padding:"2px 0",width:"max-content",lineHeight:$f},children:[r.map(l=>c.jsx("span",{style:{fontWeight:600},children:Na(t.header[l]??"",`h${l}`)},`h${l}`)),t.rows.map((l,h)=>[c.jsx("div",{style:{gridColumn:`1 / span ${n}`,height:1,background:"var(--border)"}},`l${h}`),...r.map(d=>c.jsx("span",{children:Na(l[d]??"",`${h}-${d}`)},`${h}-${d}`))])]})})}case"quote":return c.jsx("div",{style:{...W0,fontSize:"var(--conversation)",color:"var(--secondary)",paddingLeft:10,boxShadow:"inset 3px 0 0 var(--border)"},children:Na(t.text)});case"code":return c.jsx("div",{style:{background:"var(--code-background)",borderRadius:8,overflowX:"auto"},children:c.jsx("pre",{style:{margin:0,padding:10,fontFamily:"var(--mono)",fontSize:"calc(10px * var(--md-scale))",color:"var(--text)",width:"max-content",lineHeight:$f},children:t.text})})}},(e,t)=>JSON.stringify(e.block)===JSON.stringify(t.block)),lS=x.memo(function({text:t}){const n=b8(t);return c.jsx("div",{className:"markdown selectable",style:{display:"flex",flexDirection:"column",gap:10,minWidth:0},children:n.map((r,l)=>c.jsx(E8,{block:r},l))})}),M8=e=>{switch(e){case"execute":return"Wants to run a command";case"edit":case"delete":case"move":return"Wants to change files";case"fetch":return"Wants to access the web";case"read":case"search":return"Wants to read files";default:return"Wants to use a tool"}},U_={allow_once:0,allow_always:1,reject_once:2,reject_always:3};function j8(e){switch(e.kind){case"allow_once":return"Allow once";case"allow_always":return"Always allow";case"reject_once":return"Deny";case"reject_always":return"Never";default:return e.name}}function T8({entry:e,hostName:t,answering:n,respond:r}){const[l,h]=x.useState(!1),d=e.data,p=d.status==="pending",g=!!d.command||!!d.detail||!!d.diffs?.length,m=[...d.options??[]].sort((_,S)=>(U_[_.kind]??9)-(U_[S.kind]??9)),v=d.cwd?` · ${d.cwd.split("/").filter(Boolean).pop()??d.cwd}`:"";return c.jsx("div",{style:{paddingRight:40},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,padding:16,background:"var(--bubble-agent)",borderRadius:22},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx("span",{style:{...B("headline"),color:"var(--text)"},children:M8(d.toolKind)}),p?c.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--warning)"}}):null]}),c.jsx("div",{className:"selectable",style:{...B("subheadline",void 0,"monospaced"),color:"var(--secondary)",overflowWrap:"anywhere",...l?{}:{display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden"}},children:d.title??""}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,...B("caption"),color:"var(--tertiary)"},children:[c.jsx(ae,{name:"desktopcomputer",size:10}),`Runs on ${t}${v}`]}),g?c.jsx(G2,{expanded:l,onToggle:()=>h(_=>!_),label:c.jsx("span",{style:{...B("caption","medium"),color:"var(--secondary)"},children:"Details"}),children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,paddingTop:6},children:[d.command?c.jsx(Wf,{text:d.command}):null,d.detail?c.jsx(Wf,{text:d.detail.slice(0,2e3)}):null,(d.diffs??[]).map((_,S)=>c.jsx(oS,{diff:_},S))]})}):null,p?c.jsx("div",{style:{background:"var(--background)",borderRadius:14,marginTop:4},children:m.map((_,S)=>c.jsxs("div",{children:[S>0?c.jsx("div",{style:{height:.5,background:"var(--border)"}}):null,c.jsxs("button",{disabled:n!==null,onClick:()=>r(_.optionId),style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:46,padding:"0 14px",opacity:n===null||n===_.optionId?1:.4},children:[c.jsx("span",{style:{...B("body",_.kind==="allow_once"?"semibold":"regular"),color:_.kind.startsWith("allow")?"var(--text)":"var(--danger)",flex:1},children:j8(_)}),n===_.optionId?c.jsx(et,{size:14}):null]})]},_.optionId))}):c.jsx("div",{style:{...B("caption","medium"),color:"var(--secondary)"},children:D8(e)})]})})}function D8(e){const t=e.data;switch(t.status){case"answered":{const n=t.options?.find(r=>r.optionId===t.selected);switch(n?.kind){case"allow_once":return"Allowed once";case"allow_always":return"Always allowed";case"reject_once":return"Denied";case"reject_always":return"Never allowed";default:return n?.name??"Answered"}}case"cancelled":return"Cancelled";default:return"Expired — the agent moved on"}}function Wf({text:e}){return c.jsx("div",{style:{background:"var(--code-background)",borderRadius:8,overflow:"auto",maxHeight:240},children:c.jsx("pre",{className:"selectable",style:{margin:0,padding:8,fontFamily:"var(--mono)",fontSize:Fh(10),color:"var(--text)",width:"max-content"},children:e})})}function oS({diff:e}){const t=e.patch.split(`+`).slice(0,80);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,...B("caption",void 0,"monospaced"),color:"var(--secondary)"},children:[c.jsx(ae,{name:e.isNew?"doc.badge.plus":"doc.text",size:10}),c.jsx("span",{style:{flex:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.path.split("/").pop()}),c.jsxs("span",{style:{color:"var(--added)"},children:["+",e.added]}),c.jsxs("span",{style:{color:"var(--removed)"},children:["−",e.removed]})]}),c.jsx("div",{style:{background:"var(--code-background)",borderRadius:8,overflow:"auto",maxHeight:260},children:c.jsx("div",{style:{padding:8,fontFamily:"var(--mono)",fontSize:Fh(10),width:"max-content"},children:t.map((n,r)=>c.jsx("div",{style:{whiteSpace:"pre",color:n.startsWith("+")?"var(--added)":n.startsWith("-")?"var(--removed)":"var(--secondary)"},children:n||" "},r))})})]})}const qa=e=>e.auth==="signedOut",R8=e=>e.connection?.status==="active",at=e=>e*1e3,Ae={connectors:async e=>(await e.call("connectors")).items,marketConnectors:async(e,t,n=null)=>{const r=await e.call("marketConnectors",{search:t,cursor:n??""},at(60));return{items:r.items,next:r.nextCursor||null}},installConnector:async(e,t,n,r)=>(await e.call("installConnector",{registryName:t,option:n,inputs:r},at(45))).connector,addConnector:async(e,t)=>(await e.call("installConnector",t,at(45))).connector,importConnectors:async(e,t)=>(await e.call("importConnectors",{config:t},at(60))).items,connectorSignIn:(e,t)=>e.call("connectorSignIn",{id:t},at(60)),finishConnectorSignIn:async(e,t,n,r)=>(await e.call("connectorSignInFinish",{state:t,code:n,error:r},at(60))).connector,removeConnector:(e,t)=>e.call("removeConnector",{id:t}),composioStatus:e=>e.call("composioStatus"),setComposioKey:(e,t)=>e.call("setComposioKey",{key:t},at(60)),composioApps:async(e,t)=>(await e.call("composioToolkits",{search:t},at(60))).items,composioConnect:(e,t)=>e.call("composioConnect",{toolkit:t},at(60)),composioConnectFields:(e,t,n,r)=>e.call("composioConnectFields",{toolkit:t,mode:n,fields:r},at(60)),composioConnection:(e,t)=>e.call("composioConnection",{id:t},at(30)),skills:async e=>(await e.call("skills")).items,marketSkills:async e=>(await e.call("marketSkills",{},at(60))).items,installSkill:(e,t)=>e.call("installSkill",{source:t},at(60)),addSkill:(e,t,n,r)=>e.call("installSkill",{name:t,description:n,instructions:r}),removeSkill:(e,t)=>e.call("removeSkill",{id:t}),connectorInfo:(e,t)=>e.call("connectorInfo",{registryName:t},at(60)),verifyConnector:(e,t)=>e.call("connectorVerify",{id:t},at(120)),finishConnectionRequest:(e,t,n={})=>e.call("connectorRequestFinish",{entryId:t,connectorId:n.connectorId??null,value:n.value??null,username:n.username??null,cancel:n.cancel??!1},at(120)),logins:async e=>(await e.call("credentialLogins",{},at(60))).items,saveLogin:(e,t,n,r)=>e.call("credentialSaveLogin",{site:t,username:n,password:r},at(60)),removeLogin:(e,t)=>e.call("credentialRemoveLogin",{id:t},at(60)),credentialStatus:e=>e.call("credentialStatus",{},at(60)),setOnePasswordToken:(e,t)=>e.call("credentialSetOnePassword",{token:t},at(60)),updateConnectorCredentials:(e,t,n)=>e.call("credentialUpdateConnector",{id:t,fields:n},at(120)),agentSetup:async(e,t,n,r,l,h)=>(await e.call("agentSetup",{backend:t,step:n,method:r,cols:l,rows:h},at(300))).term,agentAuth:(e,t)=>e.call("agentAuth",{backend:t},at(300)),agentAuthenticate:(e,t,n)=>e.call("agentAuthenticate",{backend:t,method:n},at(660)),setAgentEnv:(e,t,n)=>e.call("setAgentEnv",{backend:t,vars:n},at(300)),termInput:(e,t,n)=>e.call("termInput",{term:t,data:n}),termResize:(e,t,n,r)=>e.call("termResize",{term:t,cols:n,rows:r}),termClose:(e,t)=>e.call("termClose",{term:t})},Lh=()=>({items:[],visibleCount:12});function cS(e,t,n){const r=new Set(e.items.map(n));return{...e,items:[...e.items,...t.filter(l=>!r.has(n(l))&&(r.add(n(l)),!0))]}}const hS=(e,t)=>cS(Lh(),e,t),Ff=e=>({...e,visibleCount:Math.min(e.items.length,e.visibleCount+12)}),uS=e=>e.items.slice(0,e.visibleCount),Kf=e=>e.items.length>e.visibleCount,lt=e=>e instanceof Error?e.message:String(e),dS=e=>new Promise(t=>setTimeout(t,e));function ro({title:e,children:t}){return c.jsxs("section",{className:"market-section",children:[c.jsx("div",{style:{...B("headline"),color:"var(--text)",paddingLeft:4},children:e}),t]})}function uo({children:e}){return c.jsx("div",{className:"item-grid",children:e})}const Yf={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},Gf=e=>({display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical",overflow:"hidden"});function Ha({title:e,subtitle:t,added:n,busy:r=!1,addLabel:l="Add",icon:h,onAdd:d}){return c.jsxs("div",{className:"market-row",children:[c.jsx("div",{style:{width:46,height:46,flex:"none",display:"grid"},children:h}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0,flex:1},children:[c.jsx("span",{style:{...B("body","medium"),color:"var(--text)",...Yf},title:e,children:e}),c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)",...Yf},title:t,children:t})]}),r?c.jsx("span",{style:{width:60,display:"flex",justifyContent:"center",flex:"none"},children:c.jsx(on,{size:18,color:"var(--secondary)"})}):n?c.jsx("span",{style:{width:60,display:"flex",justifyContent:"center",flex:"none",color:"var(--secondary)"},"aria-label":"Added",title:"Added",children:c.jsx(ae,{name:"checkmark",size:11,weight:"semibold"})}):c.jsx("button",{className:"capsule-action",style:B("subheadline","semibold"),onClick:d,children:l})]})}function Zf(){return c.jsx("div",{className:"item-grid skeleton",children:[0,1,2,3].map(e=>c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"10px 12px"},children:[c.jsx("div",{style:{width:46,height:46,borderRadius:12,background:"var(--bubble-agent)",flex:"none"}}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsx("div",{style:{width:120,height:12,borderRadius:6,background:"var(--bubble-agent)"}}),c.jsx("div",{style:{width:190,height:10,borderRadius:5,background:"var(--bubble-agent)"}})]})]},e))})}function A8({src:e,style:t}){const[n,r]=x.useState(!1);return c.jsx("img",{src:e,alt:"",draggable:!1,onLoad:()=>r(!0),style:{...t,display:n?"block":"none"}})}function N8(e,t,n){if(e&&URL.canParse(e)){const h=new URL(e).hostname;if(h&&h!=="github.com")return h}const r=n?.split("/")[0];if(!r)return null;const l=r.split(".").filter(Boolean);return l.length<2||l[0]==="io"&&l[1]==="github"?t.toLowerCase().includes("github")?"github.com":null:`${l[1]}.${l[0]}`}function Xf({website:e,name:t,registryName:n,size:r=46}){const l=N8(e,t,n),h=r*.26;return c.jsxs("div",{style:{position:"relative",width:r,height:r,borderRadius:h,overflow:"hidden",background:"var(--bubble-agent)",display:"grid",placeItems:"center",flex:"none"},children:[c.jsx("span",{style:{...B(r*.4,"semibold","rounded"),color:"var(--text)"},children:t.slice(0,1).toUpperCase()||"?"}),l?c.jsx(A8,{src:`https://www.google.com/s2/favicons?domain=${encodeURIComponent(l)}&sz=128`,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",padding:r*.2,boxSizing:"border-box",background:"#fff"}}):null]})}function t1({url:e,name:t,size:n=46}){const[r,l]=x.useState(!1);return c.jsxs("div",{"aria-hidden":!0,style:{position:"relative",width:n,height:n,flex:"none",borderRadius:n*.28,background:"var(--bubble-agent)",display:"grid",placeItems:"center"},children:[r?null:c.jsx("span",{style:{...B(n*.4,"semibold"),color:"var(--secondary)"},children:t.slice(0,1).toUpperCase()}),e?c.jsx("img",{src:e,alt:"",draggable:!1,onLoad:()=>l(!0),style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",padding:n*.18,boxSizing:"border-box",display:r?"block":"none"}}):null]})}function Qf({name:e}){return c.jsx("div",{style:{width:"100%",height:"100%",borderRadius:12,background:"var(--bubble-agent)",display:"grid",placeItems:"center",color:"var(--text)"},children:c.jsx(ae,{name:e,size:18,weight:"medium"})})}function fS({size:e}){return c.jsx("div",{style:{width:e??"100%",height:e??"100%",flex:"none",borderRadius:12,background:"var(--bubble-agent)",display:"grid",placeItems:"center",color:"var(--text)"},children:c.jsx(ae,{name:"book.pages",size:13})})}function i1({title:e,url:t,style:n}){return c.jsx("button",{className:"plain-link",style:n,title:t,onClick:()=>window.codync.app.openExternal(t),children:e})}function s1({title:e,onBack:t,trailing:n}){return c.jsxs("div",{style:{position:"relative",height:44,padding:"0 12px",display:"flex",alignItems:"center",gap:6,flex:"none",background:"var(--background)"},children:[c.jsx("div",{style:{position:"absolute",left:60,right:60,textAlign:"center",...B("compactBody","semibold"),color:"var(--text)",...Yf},children:e}),c.jsx(ke,{title:"Back",icon:"chevron.left",onClick:t}),c.jsx("span",{style:{flex:1,minWidth:8}}),n]})}function pS({base:e,top:t}){const{mounted:n,shown:r}=er(t!==null),l=x.useRef(t);return t!==null&&(l.current=t),c.jsxs("div",{className:"market-stack",children:[c.jsx("div",{className:`market-layer ${r?"off-leading":""}`,inert:r,children:e}),n?c.jsx("div",{className:`market-layer ${r?"":"off-trailing"}`,children:t??l.current}):null]})}function Mt({value:e,onChange:t,placeholder:n,secret:r=!1,lines:l,mono:h=!1,label:d}){const p=h?B("callout","regular","monospaced"):{};return l?c.jsx("textarea",{className:"market-field","aria-label":d??n,value:e,placeholder:n,spellCheck:!1,onChange:g=>t(g.target.value),style:{...p,lineHeight:1.3,minHeight:`${l[0]*1.3}em`,maxHeight:`${l[1]*1.3}em`}}):c.jsx("input",{className:"market-field","aria-label":d??n,type:r?"password":"text",value:e,placeholder:n,spellCheck:!1,autoComplete:"off",onChange:g=>t(g.target.value),style:p})}function hn({text:e}){return c.jsx("span",{className:"selectable",style:{color:"var(--danger)"},children:e})}const n1=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==""));function L8(){const[e,t]=x.useState(window.innerHeight);return x.useEffect(()=>{const n=()=>t(window.innerHeight);return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),e}function Rs({open:e,onClose:t,width:n=520,height:r=600,children:l}){const h=L8();return c.jsx($t,{open:e,onClose:t,width:n,height:Math.min(r,h-76),children:l})}class B8 extends Br{constructor(t){super(),this.store=t}store;installedConnectors=[];installedSkills=[];async refresh(){const t=this.store.client;if(!t)return;const[n,r]=await Promise.allSettled([Ae.connectors(t),Ae.skills(t)]);n.status==="fulfilled"&&(this.installedConnectors=n.value),r.status==="fulfilled"&&(this.installedSkills=r.value),this.changed()}async after(t){const n=await t;return await this.refresh(),n}async installConnector(t,n,r){return this.after(Ae.installConnector(await this.store.ready(),t.name,n,r))}async addConnector(t){return this.after(Ae.addConnector(await this.store.ready(),t))}async importConnectors(t){return this.after(Ae.importConnectors(await this.store.ready(),t))}async finishConnectorSignIn(t,n,r){return this.after(Ae.finishConnectorSignIn(await this.store.ready(),t,n,r))}async waitForSignIn(t){for(let n=0;n<150;n++){await dS(2e3),await this.refresh();const r=this.installedConnectors.find(l=>l.id===t);if(r&&!qa(r))return}}async removeConnector(t){await this.after(Ae.removeConnector(await this.store.ready(),t))}async installSkill(t){await this.after(Ae.installSkill(await this.store.ready(),t))}async addSkill(t,n,r){await this.after(Ae.addSkill(await this.store.ready(),t,n,r))}async removeSkill(t){await this.after(Ae.removeSkill(await this.store.ready(),t))}async signIn(t){const n=await Ae.connectorSignIn(await this.store.ready(),t);if(!URL.canParse(n.url))return;if(n.callback!=="app"){window.codync.app.openExternal(n.url),await this.waitForSignIn(t);return}let r;try{r=await window.codync.app.authenticate(n.url,"codync")}catch{return}const l=new URL(r).searchParams;await this.finishConnectorSignIn(l.get("state")??"",l.get("code"),l.get("error_description")??l.get("error"))}}const P_=new WeakMap;function r1(e){let t=P_.get(e);return t||P_.set(e,t=new B8(e)),t}const Ga=e=>cn(r1(e));function O8({query:e,searchToken:t}){const n=Ne(),[r,l]=x.useState(null),[h,d]=x.useState(Lh),[p,g]=x.useState(!0),[m,v]=x.useState(null),[_,S]=x.useState(!1),[w,b]=x.useState(null),k=x.useRef(0),E=x.useRef(e);E.current=e;const j=async()=>{const A=n.client;if(!A)return;const z=++k.current,F=E.current;g(!0);try{const R=await Ae.composioStatus(A),I=R.configured?await Ae.composioApps(A,F):[];if(k.current!==z)return;l(R),d(hS(I,q=>q.slug)),v(null)}catch(R){k.current===z&&v(lt(R))}finally{k.current===z&&g(!1)}};x.useEffect(()=>(j(),()=>{k.current++}),[t]);const V=r?.configured===!0;return c.jsxs(ro,{title:"Apps",children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[V?p?c.jsx(Zf,{}):h.items.length===0?c.jsx("span",{style:{color:"var(--secondary)"},children:e?`No apps match “${e}”.`:"Couldn't load apps."}):c.jsx(uo,{children:uS(h).map(A=>c.jsx(Ha,{title:A.name,subtitle:A.description??A.slug,added:R8(A),addLabel:"Connect",icon:c.jsx(t1,{url:A.logo,name:A.name}),onAdd:()=>b(A)},A.slug))}):c.jsx(uo,{children:c.jsx(Ha,{title:"Composio",subtitle:"Gmail, Slack, GitHub, Notion and 1,000 more apps",added:!1,busy:r===null&&p,addLabel:"Set up",icon:c.jsx(Qf,{name:"square.grid.3x3"}),onAdd:()=>S(!0)})}),!p&&Kf(h)&&V?c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:c.jsx(Fe,{kind:"secondary",onClick:()=>d(Ff),children:"Load more apps"})}):null,m?c.jsx("span",{style:{...B("footnote"),color:"var(--danger)"},children:m}):null,V?c.jsxs("button",{style:{display:"flex",alignItems:"center",gap:4,alignSelf:"flex-start",...B("footnote"),color:"var(--tertiary)"},onClick:()=>S(!0),children:[c.jsx(ae,{name:"key",size:10}),"Composio settings"]}):null]}),c.jsx(Rs,{open:_,onClose:()=>S(!1),children:c.jsx(z8,{status:r,done:A=>{l(A),j()}})}),c.jsx(Rs,{open:w!==null,onClose:()=>b(null),children:w?c.jsx(gS,{app:w,done:()=>{j(),r1(n).refresh()}},w.slug):null})]})}function z8({status:e,done:t}){const n=Ne(),r=ss(),[l,h]=x.useState(""),[d,p]=x.useState(!1),[g,m]=x.useState(null),v=async S=>{const w=n.client;if(w){p(!0);try{t(await Ae.setComposioKey(w,S)),r()}catch(b){m(lt(b))}p(!1)}},_=e?.keyUrl??"https://platform.composio.dev";return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:"Composio",trailing:d?c.jsx(et,{}):c.jsx(ke,{title:"Save",icon:"checkmark",disabled:!l.trim(),onClick:()=>{v(l)}})}),c.jsxs(hi,{children:[c.jsxs(Ee,{title:"Composio API key",footer:`Composio signs you in to apps like Gmail and Slack and runs their tools for your bots. The key stays on ${n.hostName}.`,children:[c.jsx(Mt,{label:"API key",value:l,onChange:h,secret:!0,placeholder:e?.configured?"Saved (paste to replace)":"ak_…"}),URL.canParse(_)?c.jsx(i1,{title:"Get a key from Composio",url:_,style:B("footnote")}):null]}),e?.configured?c.jsx(Ee,{footer:"Bots lose the apps you connected until you add a key again.",children:c.jsx("button",{style:{color:"var(--danger)"},onClick:()=>{v("")},children:"Remove key"})}):null,g?c.jsx(Ee,{children:c.jsx(hn,{text:g})}):null]})]})}function gS({app:e,requestId:t,done:n}){const r=Ne(),l=ss(),[h,d]=x.useState(null),[p,g]=x.useState({}),[m,v]=x.useState(!1),[_,S]=x.useState(!1),[w,b]=x.useState(null),k=x.useRef(!1),E=x.useRef(n);E.current=n;const j=()=>{g({}),k.current=!0,v(!0)};x.useEffect(()=>{let R=!1;return(async()=>{const I=r.client;if(I)try{const q=await Ae.composioConnect(I,e.slug);if(R||(d(q),q.status!=="redirect"||!q.connection))return;q.url&&URL.canParse(q.url)&&window.codync.app.openExternal(q.url);for(let U=0;U<300;U++){if(await dS(2e3),R)return;const Y=await Ae.composioConnection(I,q.connection).catch(()=>null);if(R)return;if(Y){if(Y.status==="active"){if(t)try{await Ae.finishConnectionRequest(I,t,{connectorId:`composio-${e.slug}`})}catch($){R||b(lt($));return}R||j();return}if(Y.status==="failed"||Y.status==="expired"){b(`Signing in to ${e.name} didn't work (${Y.status}). Close and try again.`);return}}}b("Timed out waiting for the sign-in.")}catch(q){R||b(lt(q))}})(),()=>{R=!0,k.current&&E.current()}},[r,e.slug,e.name,t]);const V=async()=>{const R=r.client,I=h?.mode;if(!(!R||!I)){S(!0);try{const q=await Ae.composioConnectFields(R,e.slug,I,n1(p));q.status==="active"?(t&&await Ae.finishConnectionRequest(R,t,{connectorId:`composio-${e.slug}`}),j()):b(`${e.name} says the connection is ${q.status}.`)}catch(q){b(lt(q))}S(!1)}},A=h?.status==="needsFields",z=m?c.jsx(ke,{title:"Done",icon:"checkmark",onClick:l}):A?_?c.jsx(et,{}):c.jsx(ke,{title:"Connect",icon:"checkmark",disabled:h?.fields?.some(R=>R.required&&!p[R.name])??!0,onClick:()=>{V()}}):null,F=R=>c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx(et,{}),c.jsx("span",{style:{color:"var(--secondary)"},children:R})]});return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:`Connect ${e.name}`,trailing:z}),c.jsxs(hi,{children:[c.jsx(Ee,{children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"4px 0"},children:[c.jsx(t1,{url:e.logo,name:e.name,size:52}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0},children:[c.jsx("span",{style:B("title3","semibold"),children:e.name}),e.description?c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)",...Gf(3)},children:e.description}):null]})]})}),m?c.jsx(Ee,{footer:`Turn ${e.name} on for a bot in the bot's settings, under Connectors.`,children:c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--added)"},children:[c.jsx(ae,{name:"checkmark.circle.fill",size:12}),"Connected"]})}):A?c.jsx(Ee,{footer:`Sent to Composio, which keeps it for ${e.name}.`,children:(h?.fields??[]).map(R=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[c.jsx(Mt,{label:R.label,value:p[R.name]??"",secret:R.secret,placeholder:R.label,onChange:I=>g(q=>({...q,[R.name]:I}))}),R.description?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:R.description+(R.required?"":" (optional)")}):null]},R.name))}):h?.status==="redirect"?c.jsxs(Ee,{footer:"Sign in on the page that opened. This updates by itself when you're done.",children:[h.url&&URL.canParse(h.url)?c.jsx("div",{children:c.jsxs(Fe,{kind:"secondary",onClick:()=>window.codync.app.openExternal(h.url),children:[c.jsx(ae,{name:"safari",size:11}),"Open the sign-in page"]})}):null,F("Waiting for you to finish signing in…")]}):w===null?c.jsx(Ee,{children:F("Asking Composio…")}):null,w?c.jsx(Ee,{children:c.jsx(hn,{text:w})}):null]})]})}const a1={display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"};function mS({item:e,requestId:t,done:n}){const r=Ne(),l=Ga(r),h=ss(),[d,p]=x.useState(e.options[0]?.id??""),[g,m]=x.useState({}),[v,_]=x.useState(null),[S,w]=x.useState(!1),[b,k]=x.useState(null),E=x.useRef(!1),j=e.options.find(F=>F.id===d)??e.options[0],V=F=>g[F.name]??"",A=async()=>{if(j){w(!0),k(null);try{const F=await r.ready();let R;v?R=(await Ae.connectors(F)).find(I=>I.id===v.id)??v:(R=await l.installConnector(e,j.id,g),_(R),m({})),qa(R)&&await l.signIn(R.id),t?await Ae.finishConnectionRequest(F,t,{connectorId:R.id}):await Ae.verifyConnector(F,R.id),await l.refresh(),n(),h()}catch(F){k(lt(F))}w(!1)}};x.useEffect(()=>{E.current||(E.current=!0,e.options.length===1&&e.options[0].inputs.length===0&&A())},[]);const z=!j||j.inputs.some(F=>F.required&&!(g[F.name]??F.default??""));return c.jsxs("div",{style:a1,children:[c.jsx(Lt,{title:"Add connector",trailing:S?c.jsx(et,{}):c.jsx(ke,{title:"Add",icon:"plus",disabled:v===null&&z,onClick:()=>{A()}})}),c.jsxs(hi,{children:[c.jsx(Ee,{children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:"4px 0"},children:[c.jsx("span",{style:B("title3","semibold"),children:e.title}),e.description?c.jsx("span",{style:{color:"var(--secondary)"},children:e.description}):null,e.website&&URL.canParse(e.website)?c.jsx(i1,{title:e.website,url:e.website,style:{...B("footnote"),whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}):null]})}),e.options.length>1?c.jsx(Ee,{title:"Runs",children:c.jsx(VC,{selection:d,onChange:p,options:e.options.map(F=>({id:F.id,label:F.kind==="remote"?`Hosted by ${e.title}`:`On ${r.hostName} (${F.kind})`}))})}):null,j?c.jsxs(Ee,{title:"Setup",footer:`Keys are saved on ${r.hostName} only.`,children:[j.inputs.length===0?c.jsx("span",{style:{color:"var(--secondary)"},children:j.kind==="remote"?`No keys needed here. If ${e.title} wants you to sign in, its sign-in page opens next.`:"No setup needed."}):null,j.inputs.map(F=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[c.jsx(Mt,{label:F.name,value:V(F),secret:F.secret,placeholder:F.secret?F.name:F.default??F.placeholder??F.name,onChange:R=>m(I=>({...I,[F.name]:R}))}),F.description?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:F.description+(F.required?"":" (optional)")}):null]},F.name))]}):null,b?c.jsx(Ee,{children:c.jsx(hn,{text:b})}):null]})]})}function H8(){const e=Ne(),t=Ga(e),n=ss(),[r,l]=x.useState(""),[h,d]=x.useState("command"),[p,g]=x.useState(""),[m,v]=x.useState(""),[_,S]=x.useState(""),[w,b]=x.useState(!1),[k,E]=x.useState(null),j=h==="config"?_.trim()!=="":r.trim()!==""&&p.trim()!=="",V={command:`Runs on ${e.hostName} in the bot's project folder. Quotes work like in a shell.`,url:"A remote MCP server, streamable HTTP or SSE.",config:`Paste the MCP config from a README or another app (Claude, Cursor, VS Code). Every server in it is added. Saved on ${e.hostName} only.`}[h],A=async()=>{b(!0),E(null);const z=h==="url",F={};for(const R of m.split(`+`)){const I=R.indexOf(z?":":"=");if(I<0)continue;const q=R.slice(0,I).trim();q&&(F[q]=R.slice(I+1).trim())}try{const R=h==="config"?await t.importConnectors(_):[await t.addConnector({name:r,command:z?null:p,url:z?p:null,env:z?{}:F,headers:z?F:{}})];for(const I of R)qa(I)&&await t.signIn(I.id);n()}catch(R){E(lt(R))}b(!1)};return c.jsxs("div",{style:a1,children:[c.jsx(Lt,{title:"Custom connector",trailing:w?c.jsx(et,{}):c.jsx(ke,{title:"Add",icon:"plus",disabled:!j,onClick:()=>{A()}})}),c.jsxs(hi,{children:[c.jsxs(Ee,{footer:V,children:[c.jsx(qC,{selection:h,onChange:d,options:[{id:"command",label:"Command"},{id:"url",label:"URL"},{id:"config",label:"Config"}]}),h==="config"?c.jsx(Mt,{value:_,onChange:S,placeholder:'{ "mcpServers": { … } }',lines:[6,16],mono:!0}):null,h!=="config"?c.jsx(Mt,{value:r,onChange:l,placeholder:"Name"}):null,h!=="config"?c.jsx(Mt,{value:p,onChange:g,placeholder:h==="url"?"https://example.com/mcp":"npx -y @scope/server",mono:!0}):null]}),h==="url"?c.jsx(Ee,{title:"Headers",footer:`Optional, one Name: value per line. Leave empty if the service has you sign in. Saved on ${e.hostName} only.`,children:c.jsx(Mt,{value:m,onChange:v,placeholder:"Authorization: Bearer …",lines:[2,6],mono:!0})}):h==="command"?c.jsx(Ee,{title:"Environment",footer:`One KEY=value per line. Saved on ${e.hostName} only.`,children:c.jsx(Mt,{value:m,onChange:v,placeholder:"API_KEY=…",lines:[2,6],mono:!0})}):null,k?c.jsx(Ee,{children:c.jsx(hn,{text:k})}):null]})]})}function I8(){const e=Ne(),t=Ga(e),n=ss(),[r,l]=x.useState(""),[h,d]=x.useState(""),[p,g]=x.useState(""),[m,v]=x.useState(!1),[_,S]=x.useState(null),w=async()=>{v(!0);try{await t.addSkill(r,h,p),n()}catch(b){S(lt(b))}v(!1)};return c.jsxs("div",{style:a1,children:[c.jsx(Lt,{title:"New skill",trailing:m?c.jsx(et,{}):c.jsx(ke,{title:"Save",icon:"checkmark",disabled:!r.trim()||!p.trim(),onClick:()=>{w()}})}),c.jsxs(hi,{children:[c.jsxs(Ee,{footer:"The bot sees the name and when to use it, and reads the instructions only when a task fits.",children:[c.jsx(Mt,{value:r,onChange:l,placeholder:"Name"}),c.jsx(Mt,{value:h,onChange:d,placeholder:"When to use it",lines:[2,4]})]}),c.jsx(Ee,{title:"Instructions",children:c.jsx(Mt,{value:p,onChange:g,placeholder:"Step by step, in plain words…",lines:[6,20]})}),_?c.jsx(Ee,{children:c.jsx(hn,{text:_})}):null]})]})}const fo={...B("caption"),color:"var(--secondary)"};function U8({entry:e}){const t=Ne(),n=e.data.connectionRequest,[r,l]=x.useState(null),[h,d]=x.useState(null),[p,g]=x.useState(""),[m,v]=x.useState(""),[_,S]=x.useState(!1),[w,b]=x.useState(null),k=n.kind==="login",E=n.kind==="secret",j=async()=>{const A=t.client;if(A){S(!0),b(null);try{if(n.kind==="app"&&n.toolkit)l({slug:n.toolkit,name:n.title});else if(k)await Ae.finishConnectionRequest(A,e.id,{value:p,username:m}),g("");else if(E)await Ae.finishConnectionRequest(A,e.id,{value:p}),g("");else if(n.connectorId){const z=n.connectorId,F=(await Ae.connectors(A)).find(R=>R.id===z);F&&qa(F)&&await r1(t).signIn(z),await Ae.finishConnectionRequest(A,e.id,{connectorId:z})}else n.registryName&&d(await Ae.connectorInfo(A,n.registryName))}catch(z){b(lt(z))}S(!1)}},V=async()=>{const A=t.client;if(A){S(!0);try{await Ae.finishConnectionRequest(A,e.id,{cancel:!0}),g("")}catch(z){b(lt(z))}S(!1)}};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16,background:"var(--surface)",borderRadius:18},children:[c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,...B("headline")},children:[c.jsx(ae,{name:"lock.shield",size:13}),n.title]}),e.data.text?c.jsx("span",{style:{color:"var(--secondary)"},children:e.data.text}):null,n.status==="pending"?c.jsxs(c.Fragment,{children:[k?c.jsxs(c.Fragment,{children:[c.jsx(Mt,{value:m,onChange:v,placeholder:"Username or email"}),c.jsx(Mt,{value:p,onChange:g,placeholder:"Password or op:// reference",secret:!0}),c.jsx("span",{style:fo,children:"Saved securely on this computer. The bot types it into the sign-in page but never sees it."})]}):E?c.jsxs(c.Fragment,{children:[c.jsx("span",{style:fo,children:`${n.field??"Credential"} · ${n.location??""}`}),c.jsx(Mt,{value:p,onChange:g,placeholder:"Credential or op:// reference",secret:!0}),c.jsx("span",{style:fo,children:"Saved securely on this computer. Never added to the conversation."})]}):null,c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx(Fe,{disabled:_||(E||k)&&!p,onClick:()=>{j()},children:k?"Save login":E?"Save and connect":"Connect"}),c.jsx(Fe,{kind:"secondary",disabled:_,onClick:()=>{V()},children:"Cancel"}),_?c.jsx(et,{}):null]})]}):c.jsx("span",{style:{color:"var(--secondary)"},children:n.status==="ready"?k?"Saved":"Connected":"Cancelled"}),w?c.jsx("span",{style:{...B("footnote"),color:"var(--danger)"},children:w}):null,c.jsx(Rs,{open:h!==null,onClose:()=>d(null),children:h?c.jsx(mS,{item:h,requestId:e.id,done:()=>d(null)}):null}),c.jsx(Rs,{open:r!==null,onClose:()=>l(null),children:r?c.jsx(gS,{app:r,requestId:e.id,done:()=>l(null)}):null})]})}function P8(){const e=Ne(),t=Ga(e),[n,r]=x.useState(null),[l,h]=x.useState(""),[d,p]=x.useState(null),[g,m]=x.useState(!1),[v,_]=x.useState(null);x.useEffect(()=>{(async()=>{await t.refresh();const w=e.client;if(w)try{p(await Ae.credentialStatus(w))}catch(b){_(lt(b))}})()},[t,e]);const S=async w=>{const b=e.client;if(b){m(!0),_(null);try{p(await Ae.setOnePasswordToken(b,w)),h("")}catch(k){_(lt(k))}m(!1)}};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:"Credentials"}),c.jsxs(hi,{children:[c.jsxs(Ee,{title:"Storage",children:[c.jsx("span",{children:d?.provider??"System credential store"}),c.jsx("span",{style:{color:"var(--secondary)"},children:"Credentials are encrypted on the connected computer. Linux uses Secret Service; macOS uses Keychain."})]}),c.jsxs(Ee,{title:"Saved connections",children:[t.installedConnectors.filter(w=>w.keys.length>0).map(w=>c.jsxs("button",{className:"plain-row-button",onClick:()=>r(w),children:[c.jsx("span",{style:{flex:1},children:w.name}),c.jsx(ae,{name:"chevron.right",size:10})]},w.id)),c.jsx("span",{style:fo,children:"Values stay hidden. Select a connection to replace its credentials."})]}),c.jsx(q8,{}),c.jsxs(Ee,{title:"1Password",footer:"Use a service account with read access only to a dedicated shared vault. The 1Password CLI must be installed on the computer.",children:[c.jsx("span",{children:d?.onePasswordConnected?"Connected":"Connect a shared vault"}),c.jsx(Mt,{value:l,onChange:h,placeholder:"Service account token",secret:!0}),c.jsx("div",{children:c.jsx(Fe,{disabled:g||!l,onClick:()=>{S(l)},children:"Connect"})}),d?.onePasswordConnected?c.jsx("div",{children:c.jsx(Fe,{kind:"secondary",disabled:g,onClick:()=>{S("")},children:"Disconnect"})}):null,c.jsx("span",{style:{...B("footnote"),color:"var(--secondary)"},children:"Use op://vault/item/field in a connector's credential field. Codync retrieves the value when the connector runs."})]}),g?c.jsx(et,{}):null,v?c.jsx(hn,{text:v}):null]}),c.jsx(Rs,{open:n!==null,onClose:()=>r(null),children:n?c.jsx(V8,{connector:n},n.id):null})]})}function q8(){const e=Ne(),[t,n]=x.useState([]),[r,l]=x.useState(""),[h,d]=x.useState(""),[p,g]=x.useState(""),[m,v]=x.useState(!1),[_,S]=x.useState(null),w=async()=>{const E=e.client;try{n(E?await Ae.logins(E):[])}catch(j){S(lt(j))}};x.useEffect(()=>{w()},[]);const b=async()=>{const E=e.client;if(E){v(!0),S(null);try{await Ae.saveLogin(E,r,h,p),l(""),d(""),g(""),await w()}catch(j){S(lt(j))}v(!1)}},k=async E=>{const j=e.client;if(j)try{await Ae.removeLogin(j,E.id),n(V=>V.filter(A=>A.id!==E.id))}catch(V){S(lt(V))}};return c.jsxs(Ee,{title:"Sign-ins",footer:"Bots type these into the matching website or app and never see the password. You can use an op:// reference.",children:[t.map(E=>c.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0},children:[c.jsx("span",{children:E.site}),E.username?c.jsx("span",{style:fo,children:E.username}):null]}),c.jsx(ke,{title:"Remove",icon:"trash",onClick:()=>{k(E)}})]},E.id)),c.jsx(Mt,{value:r,onChange:l,placeholder:"Website or app, e.g. github.com"}),c.jsx(Mt,{value:h,onChange:d,placeholder:"Username or email"}),c.jsx(Mt,{value:p,onChange:g,placeholder:"Password or op:// reference",secret:!0}),c.jsx("div",{children:c.jsx(Fe,{disabled:m||!r||!p,onClick:()=>{b()},children:"Save sign-in"})}),_?c.jsx("span",{style:{...B("footnote"),color:"var(--danger)"},children:_}):null]})}function V8({connector:e}){const t=Ne(),n=ss(),[r,l]=x.useState({}),[h,d]=x.useState(!1),[p,g]=x.useState(null),m=async()=>{const v=t.client;if(v){d(!0),g(null);try{await Ae.updateConnectorCredentials(v,e.id,n1(r)),l({}),n()}catch(_){g(lt(_))}d(!1)}};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:e.name,trailing:h?c.jsx(et,{}):c.jsx(ke,{title:"Save credentials",icon:"checkmark",disabled:Object.values(r).every(v=>!v),onClick:()=>{m()}})}),c.jsxs(hi,{children:[c.jsx(Ee,{footer:"Enter only the values you want to replace. You can use an op:// reference.",children:e.keys.map(v=>c.jsx(Mt,{label:v,value:r[v]??"",placeholder:v,secret:!0,onChange:_=>l(S=>({...S,[v]:_}))},v))}),p?c.jsx(hn,{text:p}):null]})]})}function Bh(e,t){return{emoji:r8,chosen:t.data.reactions??[],toggle:n=>e.react(t,n)}}const Jf=x.memo(function({entry:t,groupStart:n,chat:r,openTrace:l,openThread:h}){const d=h?()=>h(t):void 0,p=t.data.thread&&t.data.thread.count>0&&h?c.jsx(W8,{summary:t.data.thread,open:()=>h(t)}):null;switch(t.kind){case"user":return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,paddingTop:n?12:4},children:[c.jsx(F8,{entry:t,botWorking:!!r&&Jn(r),reply:d}),c.jsx(V_,{entry:t}),p]});case"agent":return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4,paddingTop:n?12:4},children:[r&&At(r)&&n?c.jsx(q_,{botId:t.data.author}):null,c.jsx(Y8,{entry:t,openTrace:l,reply:d}),c.jsxs("div",{style:{paddingLeft:r&&At(r)?34:0,display:"flex",flexDirection:"column",gap:4},children:[c.jsx(V_,{entry:t}),p]})]});case"permission":return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,paddingTop:12},children:[r&&At(r)?c.jsx(q_,{botId:t.data.author}):null,c.jsx($8,{entry:t})]});default:return t.data.connectionRequest?c.jsx("div",{style:{paddingTop:12},children:c.jsx(U8,{entry:t})}):c.jsx("div",{style:{paddingTop:10},children:c.jsx(G8,{entry:t})})}});function $8({entry:e}){const t=Ne();return c.jsx(T8,{entry:e,hostName:t.hostName,answering:t.answering.get(e.id)??null,respond:n=>t.respond(e,n)})}function q_({botId:e}){const t=Or(),n=e?t.bots.get(e):void 0;return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n?c.jsx(Ui,{bot:n,size:26,animated:!1}):null,c.jsx("span",{style:{...B("subheadline","medium"),color:n?ko(n.avatarColor):"var(--secondary)"},children:t.authorName(e)})]})}function W8({summary:e,open:t}){const n=Or(),r=e.authors.map(h=>n.bots.get(h)).filter(h=>!!h).slice(0,3),l=e.unread??0;return c.jsxs("button",{className:"press thread-chip",onClick:t,title:"View thread","aria-label":`View thread, ${e.count} ${e.count===1?"reply":"replies"}${l>0?`, ${l} new`:""}`,children:[r.length?c.jsx("span",{style:{display:"flex"},children:r.map((h,d)=>c.jsx("span",{style:{marginLeft:d?-6:0},children:c.jsx(Ui,{bot:h,size:18,animated:!1})},h.id))}):null,c.jsx("span",{style:{...B("footnote","semibold"),color:"var(--accent)"},children:e.count===1?"1 reply":`${e.count} replies`}),l>0?c.jsxs("span",{style:{...B("footnote","semibold"),color:"var(--text)"},children:[l," new"]}):c.jsx("span",{style:{...B("footnote"),color:"var(--tertiary)"},children:e1.day(e.lastAt)}),c.jsx(ae,{name:"chevron.right",size:10,color:"var(--tertiary)"})]})}function vS({className:e,items:t,reactions:n,children:r}){const l=PC();return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:e,onContextMenu:l.onContextMenu,children:r}),c.jsx(Pa,{open:l.open,onClose:l.close,point:l.point,items:t,reactions:n})]})}const _S=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"});function F8({entry:e,botWorking:t,reply:n}){const r=Or(),[l,h]=x.useState(!1),d=e.data.status,p=()=>e.data.text&&window.codync.app.copy(e.data.text);return c.jsx("div",{className:"message user",title:_S.format(e.createdAt),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:c.jsxs("div",{className:"message-body",children:[e.data.attachments?.length?c.jsx(x8,{attachments:e.data.attachments,botId:e.botId}):null,e.data.text?c.jsx(vS,{className:"bubble user selectable",reactions:Bh(r,e),items:()=>[{title:"Copy",icon:"square.on.square",action:p},...n?[{title:"Reply in thread",icon:"arrowshape.turn.up.left",action:n}]:[]],children:e.data.text}):null,d&&d!=="sent"?c.jsx(K8,{entry:e,botWorking:t,hovering:l}):null,c.jsx(SS,{className:"leading",visible:l,reactions:Bh(r,e),reply:n,copy:p})]})})}function K8({entry:e,botWorking:t,hovering:n}){const r=Or(),l={...B("caption2"),color:"var(--tertiary)"};switch(e.data.status){case"sending":return c.jsx("span",{style:l,children:"Sending…"});case"queued":return c.jsx("span",{style:l,children:t?"Queued until this response finishes":"Queued"});case"failed":return c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10,...B("caption2","semibold")},children:[c.jsx("span",{style:{color:"var(--danger)"},children:"Failed to send"}),c.jsx("button",{title:"Resend","aria-label":"Resend",style:{display:"flex"},onClick:()=>r.retry(e),children:c.jsx(ae,{name:"arrow.clockwise",size:10,weight:"semibold"})}),c.jsx("button",{title:"Delete","aria-label":"Delete",style:{display:"flex"},onClick:()=>r.discard(e),children:c.jsx(ae,{name:"trash",size:10,weight:"semibold"})})]});case"cancelled":return c.jsx("span",{style:l,children:"Not sent — stopped"});case"waiting":return c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10,...B("caption2")},children:[c.jsx("span",{style:{color:"var(--tertiary)"},children:"Waiting for the computer to come online"}),c.jsx("button",{title:"Don't send","aria-label":"Don't send",style:{display:"flex"},onClick:()=>r.cancelQueued(e),children:c.jsx(ae,{name:"xmark.circle",size:10})})]});case"delivering":return c.jsx("span",{style:l,children:"Delivered to the computer"});default:return c.jsx("span",{style:{...B(10),color:"var(--tertiary)",opacity:n?1:0,transition:"opacity var(--hover)"},children:e1.time(e.createdAt)})}}function Y8({entry:e,openTrace:t,reply:n}){const r=Or(),[l,h]=x.useState(!1),d=()=>e.data.text&&window.codync.app.copy(e.data.text);return c.jsx("div",{className:"message agent",title:_S.format(e.createdAt),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:c.jsxs("div",{className:"message-body",children:[c.jsx(vS,{className:"bubble agent",reactions:Bh(r,e),items:()=>[{title:"Copy",icon:"square.on.square",action:d},...n?[{title:"Reply in thread",icon:"arrowshape.turn.up.left",action:n}]:[],{title:"Show what it did",icon:"list.bullet",action:t}],children:c.jsx(lS,{text:e.data.text??""})}),c.jsx(SS,{className:"trailing",visible:l,reactions:Bh(r,e),reply:n,trace:t,copy:d})]})})}function G8({entry:e}){const t=e.data.text??"";if(e.data.callSeconds!==void 0){const n=e.data.callSeconds;return c.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:6,...B("footnote"),fontVariantNumeric:"tabular-nums",color:"var(--secondary)"},children:[c.jsx(ae,{name:"waveform",size:10}),`${t} · ${String(Math.floor(n/60)).padStart(2,"0")}:${String(n%60).padStart(2,"0")}`]})}switch(e.data.style){case"divider":return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"6px 0"},children:[c.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}}),c.jsx("span",{style:{...B("caption2"),color:"var(--tertiary)",textAlign:"center",maxWidth:260},children:t}),c.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}})]});case"error":return c.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8,padding:12,borderRadius:12,background:"color-mix(in srgb, var(--danger) 12%, transparent)"},children:[c.jsx(ae,{name:"exclamationmark.triangle.fill",size:10,color:"var(--danger)"}),c.jsx("span",{className:"selectable",style:{...B("footnote"),color:"var(--text)"},children:t})]});default:return c.jsx("div",{style:{...B("footnote"),color:"var(--secondary)",textAlign:"center"},children:t})}}function yS({bot:e,thinking:t}){const[n,r]=x.useState(!1),l=ln(e);return c.jsx("div",{style:{display:"flex",alignItems:"center",gap:10,paddingRight:40},children:c.jsxs("button",{className:"working",disabled:!t,onClick:()=>r(h=>!h),"aria-expanded":t?n:void 0,children:[c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx(on,{state:l?"listening":"working",size:16,color:l?"var(--warning)":"var(--secondary)"}),c.jsx("span",{style:{...B("subheadline"),color:l?"var(--warning)":"var(--secondary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.activity||"Working…"}),e.startedAt?c.jsx(Z8,{since:e.startedAt}):null,t?c.jsx("span",{style:{display:"flex",transform:`rotate(${n?180:0}deg)`,transition:"transform var(--layout)"},children:c.jsx(ae,{name:"chevron.down",size:10,weight:"semibold",color:"var(--tertiary)"})}):null]}),n&&t?c.jsx("div",{className:"selectable thinking",style:{...B("footnote"),color:"var(--secondary)"},ref:h=>{h&&(h.scrollTop=h.scrollHeight)},children:t}):null]})})}function Z8({since:e}){const[t,n]=x.useState(Date.now());x.useEffect(()=>{const p=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(p)},[]);const r=Math.max(0,Math.floor((t-e)/1e3)),l=Math.floor(r/3600),h=Math.floor(r%3600/60),d=String(r%60).padStart(2,"0");return c.jsx("span",{style:{...B("footnote"),fontVariantNumeric:"tabular-nums",color:"var(--tertiary)"},children:l?`${l}:${String(h).padStart(2,"0")}:${d}`:`${h}:${d}`})}function V_({entry:e}){const t=Or(),n=e.data.reactions;return n?.length?c.jsx("div",{style:{display:"flex",gap:4},children:n.map(r=>c.jsx("button",{className:"press reaction-chip",title:`Remove ${r}`,"aria-label":`Remove reaction ${r}`,onClick:()=>t.react(e,r),children:c.jsx("span",{style:{fontSize:Fh(13)},children:r})},r))}):null}function SS({visible:e,className:t,reactions:n,reply:r,trace:l,copy:h}){const[d,p]=x.useState(null),g=x.useRef(null),m=x.useRef(null),v=e||d!==null;return c.jsxs("div",{className:`message-actions ${t}`,style:{opacity:v?1:0,pointerEvents:v?"auto":"none"},"aria-hidden":!v,children:[c.jsx("button",{ref:g,className:"message-action",title:"Add reaction","aria-label":"Add reaction",onClick:()=>p("reactions"),children:c.jsx(ae,{name:"face.smiling",size:14})}),r?c.jsx(ke,{title:"Reply in thread",icon:"arrowshape.turn.up.left",size:26,onClick:r}):null,c.jsx("button",{ref:m,className:"message-action",title:"More message actions","aria-label":"More message actions",onClick:()=>p("more"),children:c.jsx(ae,{name:"ellipsis",size:14})}),c.jsx(Pa,{open:d==="reactions",onClose:()=>p(null),anchor:g,items:()=>[],reactions:n}),c.jsx(Pa,{open:d==="more",onClose:()=>p(null),anchor:m,items:()=>[{title:"Copy",icon:"square.on.square",action:h},...l?[{title:"Show what it did",icon:"list.bullet",action:l}]:[]]})]})}function X8(e){return e.key!=="Enter"||e.isComposing||e.keyCode===229?"ignore":e.shiftKey||e.altKey?"newline":e.repeat?"ignore":"send"}function Q8({file:e,remove:t}){const[n,r]=x.useState(null),[l,h]=x.useState(!1);return x.useEffect(()=>{if(!O3(e.name))return;const d=URL.createObjectURL(new Blob([e.data]));return r(d),()=>URL.revokeObjectURL(d)},[e]),n&&!l?c.jsxs("span",{className:"attachment-tile","aria-label":`Image attachment: ${e.name}`,title:e.name,children:[c.jsx("img",{src:n,alt:"",onError:()=>h(!0)}),c.jsx("button",{className:"press attachment-remove","aria-label":`Remove ${e.name}`,title:"Remove",onClick:t,children:c.jsx(ae,{name:"xmark",size:11,weight:"bold",color:"#fff"})})]}):c.jsxs("span",{className:"file-chip",children:[c.jsx(ae,{name:rS(e.name),size:10,color:"var(--secondary)"}),c.jsx("span",{style:{...B("footnote"),color:"var(--text)",maxWidth:160,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.name}),c.jsx("button",{"aria-label":`Remove ${e.name}`,title:"Remove",style:{display:"flex"},onClick:t,children:c.jsx(ae,{name:"xmark",size:10,weight:"bold",color:"var(--secondary)"})})]})}function xS({botId:e,thread:t=null,onCall:n,onInterrupt:r}){const l=Ne();return c.jsx(J8,{botId:e,thread:t,onCall:n,onInterrupt:r},JSON.stringify([l.contextId,l.computer.id,e,t]))}function J8({botId:e,thread:t,onCall:n,onInterrupt:r}){const l=Ne(),h=l.bots.get(e)??null,d=l.composerDrafts,p=x.useSyncExternalStore(d.subscribe,()=>d.get(e,t)),g=O=>d.set(e,t,O),[m,v]=x.useState([]),_=x.useRef(null),S=x.useRef(null),w=x.useRef(!1),b=!!h&&$2(h,e,t),E=!(!p.trim()&&!m.length)&&(l.connection.kind==="online"||l.canQueue&&!m.length),j=!!h&&!At(h),V=t?"Reply…":h&&At(h)?`Message ${h.name} · @ to ask one bot`:b?`Queue a message for ${h?.name??""}`:`Ask ${h?.name??""}`,A=l.routineDrafts.get(e);x.useEffect(()=>{if(t||A===void 0)return;const O=l.consumeRoutineDraft(e);if(O===void 0)return;const P=d.get(e,t);d.set(e,t,P?`${P}+${O}`:O),_.current?.focus()},[A,t,e,l,d]),x.useLayoutEffect(()=>{const O=_.current,P=S.current;if(!O||!P)return;const te=()=>{const ce=getComputedStyle(O),re=parseFloat(ce.lineHeight),de=parseFloat(ce.paddingTop)+parseFloat(ce.paddingBottom),Ce=Math.min(P.getBoundingClientRect().height,re*8+de);O.style.height=`${Ce}px`};te();const Q=new ResizeObserver(te);return Q.observe(P),()=>Q.disconnect()},[]);const z=(()=>{if(!h||!At(h))return null;const O=p.lastIndexOf("@");if(O<0||O>0&&!/\s/.test(p[O-1]))return null;const P=p.slice(O+1);return/\n/.test(P)||P.length>24?null:P})(),F=z!==null&&h?l.members(h).filter(O=>!z||O.name.toLowerCase().includes(z.toLowerCase())):[],R=O=>{const P=p.lastIndexOf("@");P<0||(g(`${p.slice(0,P)}@${O.name} `),_.current?.focus())},I=O=>{if(!j)return;const P=[];for(const te of O){if(te.data.length>n8){l.setError(`${te.name} is larger than 100 MB.`);continue}P.push({id:crypto.randomUUID(),name:te.name,data:te.data})}v(te=>[...te,...P])},q=()=>{E&&(l.send(p,e,t,m),g(""),v([]),_.current?.focus())},U=r&&!p&&!m.length?"interrupt":b&&!p&&!m.length?"stop":n&&!p&&!m.length?"call":"send",[Y,$]={interrupt:["stop.fill","Interrupt"],stop:["stop.fill","Stop"],call:["waveform","Call"],send:["arrow.up","Send"]}[U],M=U==="interrupt"?"var(--danger)":U==="send"?E?"var(--accent-fill)":"var(--accent-dim)":"var(--accent-fill)",N=U==="interrupt"?"#fff":U==="send"?E?"var(--on-accent)":"var(--tertiary)":"var(--on-accent)",L=U!=="send"||E;return c.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[c.jsx($_,{open:F.length>0,children:c.jsx("div",{className:"mentions",children:F.map(O=>c.jsxs("button",{className:"press mention",onClick:()=>R(O),children:[c.jsx(Ui,{bot:O,size:18,animated:!1}),c.jsx("span",{style:{...B("subheadline"),color:"var(--text)"},children:O.name})]},O.id))})}),c.jsx("div",{className:"composer",onDragOver:O=>{j&&O.dataTransfer.types.includes("Files")&&O.preventDefault()},onDrop:O=>{j&&(O.preventDefault(),Promise.all([...O.dataTransfer.files].map(async P=>({name:P.name,data:new Uint8Array(await P.arrayBuffer())}))).then(I))},children:c.jsxs("div",{className:"composer-surface",children:[c.jsx($_,{open:m.length>0,children:c.jsx("div",{className:"file-chips",children:m.map(O=>c.jsx(Q8,{file:O,remove:()=>v(P=>P.filter(te=>te.id!==O.id))},O.id))})}),c.jsxs("div",{className:"composer-box",children:[j?c.jsx("button",{className:"press composer-add","aria-label":"Add files",title:"Add files",onClick:()=>{window.codync.app.pickFiles().then(I)},children:c.jsx(ae,{name:"plus",size:13,weight:"medium",color:"var(--text)"})}):null,c.jsxs("div",{className:"composer-field",children:[c.jsx("div",{ref:S,className:"composer-measure","aria-hidden":"true",children:p+""}),c.jsx("textarea",{ref:_,rows:1,value:p,placeholder:V,spellCheck:!0,"aria-label":t?"Reply":"Message","aria-keyshortcuts":"Enter Shift+Enter",onCompositionStart:()=>{w.current=!0},onCompositionEnd:()=>{w.current=!1},onChange:O=>g(O.target.value),onKeyDown:O=>{const P=X8({key:O.key,shiftKey:O.shiftKey,altKey:O.altKey,repeat:O.repeat,isComposing:w.current||O.nativeEvent.isComposing,keyCode:O.keyCode});O.key==="Enter"&&O.repeat&&!O.shiftKey&&!O.altKey&&O.preventDefault(),P==="send"&&(O.preventDefault(),q())},onPaste:O=>{if(!j)return;const P=[...O.clipboardData.types];!P.includes("Files")||P.includes("text/plain")&&!O.clipboardData.files.length||(O.preventDefault(),window.codync.app.readClipboardFiles().then(Q=>Q.length?I(Q):Promise.all([...O.clipboardData.files].map(async ce=>({name:ce.name||`pasted-${Date.now()}.png`,data:new Uint8Array(await ce.arrayBuffer())}))).then(I)))}})]}),c.jsx("button",{className:"press composer-send",disabled:!L,"aria-label":$,title:$,style:{background:M,color:N},onClick:()=>{U==="interrupt"?r?.():U==="stop"?l.stop(e):U==="call"?n?.():q()},children:["stop.fill","waveform","arrow.up"].map(O=>c.jsx("span",{"aria-hidden":"true",className:`composer-symbol ${O===Y?"active":""}`,children:c.jsx(ae,{name:O,size:O==="stop.fill"?12:O==="waveform"?15:14,weight:"bold"})},O))})]})]})})]})}function $_({open:e,children:t}){const{mounted:n,shown:r}=er(e),l=x.useRef(t);return e&&(l.current=t),c.jsx("div",{className:`composer-reveal ${r?"shown":""}`,inert:!e,children:c.jsx("div",{children:n?e?t:l.current:null})})}function e7({open:e,width:t,children:n}){const{mounted:r,shown:l}=er(e,300,!1),h=x.useRef({width:t,children:n});e&&(h.current={width:t,children:n});const d=e?{width:t,children:n}:h.current;return c.jsx("div",{className:`side-panel ${l?"shown":""}`,inert:!e,style:{width:l?d.width+1:0},children:r?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"side-panel-border"}),c.jsx("div",{style:{width:d.width,height:"100%",flex:"none"},children:d.children})]}):null})}const t7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3ccircle%20cx='8'%20cy='8'%20r='7'%20stroke='currentColor'%20stroke-width='1.5'/%3e%3cpath%20d='M5.5%2010.5L8%204L10.5%2010.5'%20stroke='currentColor'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cline%20x1='6.25'%20y1='8.75'%20x2='9.75'%20y2='8.75'%20stroke='currentColor'%20stroke-width='1.2'%20stroke-linecap='round'/%3e%3c/svg%3e",i7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M13.9197%2013.61L17.3816%2026.566L14.242%2027.4049L11.2645%2016.2643L0.119926%2013.2906L0.957817%2010.15L13.9197%2013.61Z'%20fill='currentColor'/%3e%3cpath%20d='M13.7391%2016.0892L4.88169%2024.9056L2.58872%2022.6019L11.4461%2013.7865L13.7391%2016.0892Z'%20fill='currentColor'/%3e%3cpath%20d='M18.9386%208.58315L22.4005%2021.5392L19.2609%2022.3781L16.2833%2011.2374L5.13879%208.26381L5.97668%205.12318L18.9386%208.58315Z'%20fill='currentColor'/%3e%3cpath%20d='M23.9803%203.55632L27.4422%2016.5124L24.3025%2017.3512L21.325%206.21062L10.1805%203.23698L11.0183%200.0963593L23.9803%203.55632Z'%20fill='currentColor'/%3e%3c/svg%3e",s7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14.1452%2014.6818C14.9937%2015.3182%2016.2664%2014.894%2015.0997%2013.7273C11.5998%2010.3333%2012.3421%201%207.99366%201C3.64518%201%204.3876%2010.3333%200.887603%2013.7273C-0.385123%2015%200.993664%2015.3182%201.84215%2014.6818C5.13002%2012.4545%204.9179%208.5303%207.99366%208.5303C11.0694%208.5303%2010.8573%2012.4545%2014.1452%2014.6818Z'%20fill='currentColor'/%3e%3c/svg%3e",n7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M9.972%2013.193h2.577q.187%200%20.277-.09t.091-.294V10.47q0-.324.133-.59.135-.27.36-.424a1%201%200%200%201%20.099-.06%201%201%200%200%201-.1-.058%201.1%201.1%200%200%201-.359-.424%201.3%201.3%200%200%201-.133-.59v-2.33q0-.202-.091-.293t-.277-.089H9.972a.38.38%200%200%201-.294-.124.4.4%200%200%201-.108-.281q.002-.176.131-.293a.46.46%200%200%201%20.313-.111h2.775c.36%200%20.642.097.836.288q.293.29.294.832V8.24q0%20.39.152.562.148.168.555.178a.4.4%200%200%201%20.27.128.41.41%200%200%201%20.104.287.44.44%200%200%201-.1.282.34.34%200%200%201-.277.132c-.266.006-.452.066-.55.177q-.151.174-.152.573v2.318c0%20.235-.043.44-.128.607a.85.85%200%200%201-.389.387%201.3%201.3%200%200%201-.534.124V14h-2.854a.45.45%200%200%201-.315-.118.38.38%200%200%201-.129-.286q0-.164.109-.282a.38.38%200%200%201%20.293-.123zM1.103%209.108a.4.4%200%200%201%20.276-.128q.4-.008.55-.177.15-.173.151-.562V5.923q.002-.543.294-.832c.195-.191.477-.288.836-.288h2.775q.188%200%20.313.111a.37.37%200%200%201%20.131.293.4.4%200%200%201-.108.281.38.38%200%200%201-.293.123H3.45q-.186%200-.277.09t-.092.292v2.33c0%20.213-.044.413-.133.59a1.1%201.1%200%200%201-.359.424%201%201%200%200%201-.1.059%201%201%200%200%201%20.1.059q.225.156.359.423t.133.59v2.34q0%20.203.092.293.088.09.277.089h2.577a.38.38%200%200%201%20.294.123q.108.12.108.281a.38.38%200%200%201-.13.286.45.45%200%200%201-.314.118l-2.775-.003a1.4%201.4%200%200%201-.613-.126.87.87%200%200%201-.388-.387%201.34%201.34%200%200%201-.129-.608v-2.318q0-.4-.151-.572-.151-.168-.55-.177a.35.35%200%200%201-.278-.132.42.42%200%200%201-.102-.28q0-.173.103-.287'/%3e%3cpath%20fill='currentColor'%20d='M5.437%2010.36a.986.986%200%200%201-.994-.975c0-.538.446-.976.994-.976s.994.438.994.976a.986.986%200%200%201-.994.976M10.562%208.41c.548%200%20.994.437.994.975a.986.986%200%200%201-.994.976.986.986%200%200%201-.994-.976c0-.538.446-.976.994-.976M8.74%202c.37%200%20.446.15.446.275v.034q0%20.034-.009.201-.01.162-.017.549-.018.378-.044%201.06c0%20.106-.065.233-.375.233-.311%200-.376-.126-.376-.23l-.07-1.835v-.003c0-.13.078-.284.446-.284M7.256%202c.369%200%20.446.15.446.275v.034q0%20.034-.01.201-.007.162-.017.549-.017.378-.043%201.06c0%20.106-.065.233-.376.233-.31%200-.375-.126-.375-.23l-.07-1.835v-.003C6.81%202.154%206.887%202%207.256%202'/%3e%3c/svg%3e",r7="/demo/desktop/assets/autohand-bkvwPcbN.svg",a7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%201200%201200'%3e%3cpath%20fill='currentColor'%20d='M%20233.959793%20800.214905%20L%20468.644287%20668.536987%20L%20472.590637%20657.100647%20L%20468.644287%20650.738403%20L%20457.208069%20650.738403%20L%20417.986633%20648.322144%20L%20283.892639%20644.69812%20L%20167.597321%20639.865845%20L%2054.926208%20633.825623%20L%2026.577238%20627.785339%20L%203.3e-05%20592.751709%20L%202.73832%20575.27533%20L%2026.577238%20559.248352%20L%2060.724873%20562.228149%20L%20136.187973%20567.382629%20L%20249.422867%20575.194763%20L%20331.570496%20580.026978%20L%20453.261841%20592.671082%20L%20472.590637%20592.671082%20L%20475.328857%20584.859009%20L%20468.724915%20580.026978%20L%20463.570557%20575.194763%20L%20346.389313%20495.785217%20L%20219.543671%20411.865906%20L%20153.100723%20363.543762%20L%20117.181267%20339.060425%20L%2099.060455%20316.107361%20L%2091.248367%20266.01355%20L%20123.865784%20230.093994%20L%20167.677887%20233.073853%20L%20178.872513%20236.053772%20L%20223.248367%20270.201477%20L%20318.040283%20343.570496%20L%20441.825592%20434.738342%20L%20459.946411%20449.798706%20L%20467.194672%20444.64447%20L%20468.080597%20441.020203%20L%20459.946411%20427.409485%20L%20392.617493%20305.718323%20L%20320.778564%20181.932983%20L%20288.80542%20130.630859%20L%20280.348999%2099.865845%20C%20277.369171%2087.221436%20275.194641%2076.590698%20275.194641%2063.624268%20L%20312.322174%2013.20813%20L%20332.8591%206.604126%20L%20382.389313%2013.20813%20L%20403.248352%2031.328979%20L%20434.013519%20101.71814%20L%20483.865753%20212.537048%20L%20561.181274%20363.221497%20L%20583.812134%20407.919434%20L%20595.892639%20449.315491%20L%20600.40271%20461.959839%20L%20608.214783%20461.959839%20L%20608.214783%20454.711609%20L%20614.577271%20369.825623%20L%20626.335632%20265.61084%20L%20637.771851%20131.516846%20L%20641.718201%2093.745117%20L%20660.402832%2048.483276%20L%20697.530334%2024.000122%20L%20726.52356%2037.852417%20L%20750.362549%2072%20L%20747.060486%2094.067139%20L%20732.886047%20186.201416%20L%20705.100708%20330.52356%20L%20686.979919%20427.167847%20L%20697.530334%20427.167847%20L%20709.61084%20415.087341%20L%20758.496704%20350.174561%20L%20840.644348%20247.490051%20L%20876.885925%20206.738342%20L%20919.167847%20161.71814%20L%20946.308838%20140.29541%20L%20997.61084%20140.29541%20L%201035.38269%20196.429626%20L%201018.469849%20254.416199%20L%20965.637634%20321.422852%20L%20921.825562%20378.201538%20L%20859.006714%20462.765259%20L%20819.785278%20530.41626%20L%20823.409424%20535.812073%20L%20832.75177%20534.92627%20L%20974.657776%20504.724915%20L%201051.328979%20490.872559%20L%201142.818848%20475.167786%20L%201184.214844%20494.496582%20L%201188.724854%20514.147644%20L%201172.456421%20554.335693%20L%201074.604126%20578.496765%20L%20959.838989%20601.449829%20L%20788.939636%20641.879272%20L%20786.845764%20643.409485%20L%20789.261841%20646.389343%20L%20866.255127%20653.637634%20L%20899.194702%20655.409424%20L%20979.812134%20655.409424%20L%201129.932861%20666.604187%20L%201169.154419%20692.537109%20L%201192.671265%20724.268677%20L%201188.724854%20748.429688%20L%201128.322144%20779.194641%20L%201046.818848%20759.865845%20L%20856.590759%20714.604126%20L%20791.355774%20698.335754%20L%20782.335693%20698.335754%20L%20782.335693%20703.731567%20L%20836.69812%20756.885986%20L%20936.322205%20846.845581%20L%201061.073975%20962.81897%20L%201067.436279%20991.490112%20L%201051.409424%201014.120911%20L%201034.496704%201011.704712%20L%20924.885986%20929.234924%20L%20882.604126%20892.107544%20L%20786.845764%20811.48999%20L%20780.483276%20811.48999%20L%20780.483276%20819.946289%20L%20802.550415%20852.241699%20L%20919.087341%201027.409424%20L%20925.127625%201081.127686%20L%20916.671204%201098.604126%20L%20886.469849%201109.154419%20L%20853.288696%201103.114136%20L%20785.073914%201007.355835%20L%20714.684631%20899.516785%20L%20657.906067%20802.872498%20L%20650.979858%20806.81897%20L%20617.476624%201167.704834%20L%20601.771851%201186.147705%20L%20565.530212%201200%20L%20535.328857%201177.046997%20L%20519.302124%201139.919556%20L%20535.328857%201066.550537%20L%20554.657776%20970.792053%20L%20570.362488%20894.68457%20L%20584.536926%20800.134277%20L%20592.993347%20768.724976%20L%20592.429626%20766.630859%20L%20585.503479%20767.516968%20L%20514.22821%20865.369263%20L%20405.825531%201011.865906%20L%20320.053711%201103.677979%20L%20299.516815%201111.812256%20L%20263.919525%201093.369263%20L%20267.221497%201060.429688%20L%20287.114136%201031.114136%20L%20405.825531%20880.107361%20L%20477.422913%20786.52356%20L%20523.651062%20732.483276%20L%20523.328918%20724.671265%20L%20520.590698%20724.671265%20L%20205.288605%20929.395935%20L%20149.154434%20936.644409%20L%20124.993355%20914.01355%20L%20127.973183%20876.885986%20L%20139.409409%20864.80542%20L%20234.201385%20799.570435%20L%20233.879227%20799.8927%20Z'/%3e%3c/svg%3e",l7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2092%2096'%20fill='currentColor'%3e%3cpath%20d='M65.45%2016.3c10.89%200%2019.71%208.86%2019.71%2019.8v6.6l5.74%2011.46a4.48%204.48%200%200%201-.01%203.6L85.16%2069.1v6.6c0%2010.94-8.83%2019.8-19.71%2019.8H26.02c-10.89%200-19.71-8.86-19.71-19.8v-6.6L.45%2057.8a4.48%204.48%200%200%201-.01-3.67L6.31%2042.7v-6.6c0-10.94%208.83-19.8%2019.71-19.8h39.43zm-2.52%205.7H29.19c-9.32%200-16.87%207.56-16.87%2016.88v5.62l-4.88%209.46a4.48%204.48%200%200%200%20.01%203.68l4.87%209.36v5.62c0%209.32%207.55%2016.88%2016.87%2016.88h33.74c9.32%200%2016.87-7.55%2016.87-16.88V67l4.77-9.39a4.48%204.48%200%200%200%200-3.61L79.8%2044.5v-5.62C79.8%2029.56%2072.25%2022%2062.93%2022z'%20fill-rule='nonzero'/%3e%3ccircle%20cx='45.73'%20cy='11'%20r='11'/%3e%3crect%20stroke='currentColor'%20stroke-width='8'%20x='31'%20y='44.5'%20width='5'%20height='22'%20rx='2.5'/%3e%3crect%20stroke='currentColor'%20stroke-width='8'%20x='55'%20y='44.5'%20width='5'%20height='22'%20rx='2.5'/%3e%3c/svg%3e",o7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M12.13%201.25c.15-.14.16-.14.28-.15.18%200%20.36.08.64.34.68.62%201.61%201.89%202.2%202.97l.22.42.32.16c.3.16.81.48%201.02.65.09.08.11.08.21.04.45-.18%201.09.05%201.65.6.51.49%201%201.33%201.18%202.03.03.11.06.36.07.54.04.64-.16%201.14-.55%201.37-.08.04-.08.06-.08.26.02.95-.23%201.89-.74%202.82-.58%201.04-1.6%202.11-2.98%203.12-.74.55-2.5%201.58-3.3%201.95-1.9.86-3.43%201.2-4.76%201.03-.79-.09-1.69-.41-2.22-.77-.14-.1-.16-.1-.27-.07-.57.16-1.31-.18-1.94-.88-.25-.28-.66-.98-.79-1.35-.3-.87-.25-1.65.16-2.12.11-.12.09-.33.09-.33-.04-.33-.05-.82-.04-1.14v-.3l-.43-.79c-.68-1.23-1.12-2.25-1.28-3.04-.09-.43-.09-.62.02-.77.07-.09.28-.18.54-.22.66-.12%202.09-.01%203.69.27l.16.03.36-.32c.61-.54%201.01-.84%201.75-1.31.77-.48%201.64-.89%202.62-1.2l.32-.1.17-.46c.62-1.65%201.25-2.86%201.71-3.27h0Zm-5.19%208.45c-.7.41-1.05.61-1.3.84-1.04.93-1.43%202.39-.99%203.71.11.33.31.68.71%201.39.41.71.61%201.06.83%201.32.92%201.05%202.37%201.45%203.68%201%20.32-.11.68-.31%201.38-.72l4.02-2.34c.7-.41%201.05-.61%201.3-.84%201.04-.93%201.43-2.39.99-3.71-.11-.33-.31-.68-.71-1.39s-.61-1.06-.83-1.32c-.92-1.05-2.37-1.45-3.68-1-.32.11-.67.31-1.38.72l-4.02%202.34Z'/%3e%3cpath%20fill='currentColor'%20fill-opacity='0.4'%20d='M8.02%2012.13c.38-.22.87-.09%201.09.29l.86%201.5c.22.38.09.88-.29%201.09-.38.22-.86.09-1.09-.29l-.86-1.5c-.22-.38-.09-.87.29-1.09Z'/%3e%3cpath%20fill='currentColor'%20fill-opacity='0.4'%20d='M12.31%209.64c.38-.22.87-.09%201.09.29l.86%201.5c.22.38.09.87-.29%201.09s-.87.09-1.09-.29l-.86-1.5c-.22-.38-.09-.88.29-1.09Z'/%3e%3c/svg%3e",c7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='currentColor'%20d='M22.282%209.821a5.985%205.985%200%200%200-.516-4.91%206.046%206.046%200%200%200-6.51-2.9A6.065%206.065%200%200%200%204.981%204.18a5.985%205.985%200%200%200-3.998%202.9%206.046%206.046%200%200%200%20.743%207.097%205.98%205.98%200%200%200%20.51%204.911%206.051%206.051%200%200%200%206.515%202.9A5.985%205.985%200%200%200%2013.26%2024a6.056%206.056%200%200%200%205.772-4.206%205.99%205.99%200%200%200%203.997-2.9%206.056%206.056%200%200%200-.747-7.073zM13.26%2022.43a4.476%204.476%200%200%201-2.876-1.04l.141-.081%204.779-2.758a.795.795%200%200%200%20.392-.681v-6.737l2.02%201.168a.071.071%200%200%201%20.038.052v5.583a4.504%204.504%200%200%201-4.494%204.494zM3.6%2018.304a4.47%204.47%200%200%201-.535-3.014l.142.085%204.783%202.759a.771.771%200%200%200%20.78%200l5.843-3.369v2.332a.08.08%200%200%201-.033.062L9.74%2019.95a4.5%204.5%200%200%201-6.14-1.646zM2.34%207.896a4.485%204.485%200%200%201%202.366-1.973V11.6a.766.766%200%200%200%20.388.676l5.815%203.355-2.02%201.168a.076.076%200%200%201-.071%200l-4.83-2.786A4.504%204.504%200%200%201%202.34%207.872zm16.597%203.855l-5.833-3.387L15.119%207.2a.076.076%200%200%201%20.071%200l4.83%202.791a4.494%204.494%200%200%201-.676%208.105v-5.678a.79.79%200%200%200-.407-.667zm2.01-3.023l-.141-.085-4.774-2.782a.776.776%200%200%200-.785%200L9.409%209.23V6.897a.066.066%200%200%201%20.028-.061l4.83-2.787a4.5%204.5%200%200%201%206.68%204.66zm-12.64%204.135l-2.02-1.164a.08.08%200%200%201-.038-.057V6.075a4.5%204.5%200%200%201%207.375-3.453l-.142.08L8.704%205.46a.795.795%200%200%200-.393.681zm1.097-2.365l2.602-1.5%202.607%201.5v2.999l-2.597%201.5-2.607-1.5z'/%3e%3c/svg%3e",h7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20362%20362'%20overflow='hidden'%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='M1562.63,107.07h-4.18v5.15h4.18c1.94,0,3.21-.87,3.21-2.53,0-1.75-1.17-2.62-3.21-2.62ZM1553.3,102.31h9.42c5.15,0,8.55,2.82,8.55,7.19,0,2.72-1.36,4.76-3.4,6.02l3.69,5.34v1.07h-5.34l-3.59-5.15h-4.18v5.15h-5.15v-19.62ZM1579.63,112.51c0-10.49-6.99-18.46-17.68-18.46s-17.49,7.58-17.49,18.46,6.99,18.46,17.49,18.46,17.68-7.97,17.68-18.46ZM1584,112.51c0,12.34-8.26,22.63-22.05,22.63s-21.86-10.39-21.86-22.63,8.16-22.63,21.86-22.63,22.05,10.3,22.05,22.63ZM348.21,156.4l-42.55,24.61,42.55,24.54c10.75,6.22,14.42,19.9,8.21,30.67-6.2,10.7-19.92,14.37-30.63,8.18l-76.21-44c-5.08-2.96-8.61-7.59-10.18-12.8-.74-2.4-1.09-4.87-1-7.31.04-1.76.3-3.53.79-5.29,1.52-5.48,5.1-10.38,10.39-13.46l76.21-43.97c10.71-6.19,24.43-2.51,30.63,8.22,6.22,10.72,2.54,24.41-8.21,30.61ZM307.93,275.68l-76.19-43.94c-4.09-2.38-8.63-3.3-12.99-2.93-11.62.83-20.75,10.53-20.75,22.34v87.98c0,12.4,10,22.45,22.42,22.45s22.45-10.05,22.45-22.45v-49.21l42.66,24.63c10.72,6.23,24.43,2.54,30.61-8.17,6.17-10.74,2.53-24.5-8.21-30.7ZM220.01,189.61l-31.67,31.63c-.91.93-2.65,1.69-3.98,1.69h-9.31c-1.28,0-3.06-.76-3.98-1.69l-31.66-31.63c-.91-.89-1.64-2.68-1.64-3.94v-9.33c0-1.29.73-3.09,1.64-3.99l31.66-31.63c.92-.93,2.7-1.66,3.98-1.66h9.31c1.29,0,3.07.73,3.98,1.66l31.67,31.63c.9.9,1.63,2.7,1.63,3.99v9.33c0,1.26-.73,3.05-1.63,3.94ZM194.7,180.83c0-1.28-.77-3.06-1.68-4l-9.17-9.13c-.9-.9-2.68-1.65-3.96-1.65h-.36c-1.28,0-3.05.75-3.94,1.65l-9.17,9.13c-.92.95-1.62,2.73-1.62,4v.36c0,1.26.7,3.03,1.62,3.95l9.17,9.16c.9.9,2.67,1.65,3.94,1.65h.36c1.28,0,3.06-.75,3.96-1.65l9.17-9.16c.9-.92,1.68-2.68,1.68-3.95v-.36ZM51.48,86.28l76.21,43.99c4.09,2.35,8.64,3.29,13.01,2.93,11.6-.86,20.75-10.58,20.75-22.37V22.84c0-12.37-10.06-22.41-22.42-22.41s-22.45,10.05-22.45,22.41v49.23l-42.7-24.66c-10.71-6.2-24.4-2.53-30.61,8.2-6.19,10.76-2.53,24.47,8.2,30.67ZM218.75,133.19c4.36.36,8.9-.57,12.99-2.93l76.19-43.99c10.74-6.2,14.38-19.91,8.21-30.67-6.18-10.72-19.89-14.4-30.61-8.2l-42.66,24.66V22.84c0-12.37-10.03-22.41-22.45-22.41s-22.42,10.05-22.42,22.41v87.98c0,11.8,9.13,21.51,20.75,22.37ZM140.71,228.8c-4.38-.37-8.92.54-13.01,2.93l-76.21,43.94c-10.72,6.2-14.38,19.96-8.2,30.7,6.22,10.71,19.91,14.4,30.61,8.17l42.7-24.63v49.21c0,12.4,10.03,22.45,22.45,22.45s22.42-10.05,22.42-22.45v-87.98c0-11.81-9.16-21.51-20.75-22.34ZM120.04,187.6c.76-2.4,1.08-4.87,1.02-7.31-.09-1.76-.32-3.53-.82-5.29-1.51-5.48-5.08-10.38-10.44-13.46l-76.15-43.97c-10.75-6.19-24.45-2.51-30.63,8.22-6.23,10.72-2.55,24.41,8.2,30.61l42.55,24.61-42.55,24.54c-10.75,6.22-14.41,19.9-8.2,30.67,6.17,10.7,19.88,14.37,30.63,8.18l76.15-44c5.14-2.96,8.63-7.59,10.23-12.8Z'/%3e%3c/svg%3e",u7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2012%2012'%3e%3cg%20transform='matrix(0.00160555,0,0,-0.0014599,-0.26812129,11.08482)'%20fill='currentColor'%3e%3cpath%20d='m%20297,6493%20c%20-4,-3%20-7,-1357%20-7,-3008%200,-2390%203,-3005%2012,-3012%2013,-10%201199,-9%201224,1%2011,4%2013,61%2010,295%20-2,159%20-7,294%20-10,299%20-4,7%20-112,11%20-312,11%20-168,0%20-309,3%20-314,6%20-12,7%20-13,4775%20-2,4792%206,10%2085,13%20317,15%20l%20310,3%20v%20600%20l%20-611,3%20c%20-336,1%20-614,-1%20-617,-5%20z'/%3e%3cpath%20d='m%206287,6493%20c%20-4,-3%20-7,-136%20-7,-294%200,-219%203,-290%2013,-296%206,-4%20152,-10%20322,-13%20l%20310,-5%203,-2394%20c%201,-1545%20-1,-2398%20-8,-2405%20-6,-6%20-127,-9%20-316,-7%20-246,2%20-309,0%20-315,-11%20-5,-7%20-9,-145%20-9,-305%20V%20470%20l%2023,-1%20c%20158,-4%201192,-2%201200,3%2014,9%2022,5964%207,6002%20l%20-10,26%20h%20-603%20c%20-332,0%20-607,-3%20-610,-7%20z'/%3e%3cg%20transform='matrix(1.0249,0,0,1.0566,-429.39,51.322)'%3e%3cpath%20d='m%202476.7,5111.6%20c%20-64.95,-6.2305%20-71.077,-28.66%20-73.528,-325.23%20-3.6765,-261.68%204.9018,-351.4%2036.764,-371.34%207.3528,-4.9844%20583.32,-12.461%201276.9,-16.199%20l%201262.2,-6.2306%2073.528,-34.891%20c%20191.17,-90.966%20300.24,-292.84%20284.31,-527.1%20-15.931,-223.05%20-134.8,-392.52%20-314.95,-449.85%20-61.274,-19.938%20-133.58,-21.184%20-727.93,-18.692%20-607.83,3.7384%20-661.75,2.4922%20-682.59,-17.446%20-22.058,-19.938%20-23.284,-43.614%20-23.284,-331.47%200,-190.65%204.9019,-320.25%2012.255,-335.2%2011.029,-21.184%2026.96,-23.676%20123.77,-23.676%20h%20110.29%20l%2066.176,-63.552%20c%2036.764,-34.891%20125,-125.86%20198.53,-201.87%2072.303,-76.013%20322.3,-333.96%20555.14,-571.96%20l%20424.01,-434.89%20519.6,3.7383%20c%20390.93,2.4922%20520.83,7.4767%20520.83,18.692%200,7.4766%20-223.04,249.22%20-496.32,534.58%20-562.49,589.41%20-666.66,701.56%20-660.53,707.79%202.451,2.4922%2052.695,8.7227%20111.52,13.707%20322.3,24.922%20593.13,194.39%20790.43,495.95%20129.9,199.38%20187.5,391.28%20196.08,660.44%208.5783,245.48%20-14.706,368.85%20-116.42,600.63%20-123.77,286.61%20-328.43,492.21%20-596.8,601.87%20-232.84,95.95%20-167.89,92.212%20-1574.7,93.458%20-691.17,1.2462%20-1274.5,1.2462%20-1295.3,-1.2461%20z'/%3e%3cpath%20d='m%202430.1,3942.7%20c%20-24.509,-18.692%20-24.509,-33.645%20-24.509,-1254.8%200,-1163.9%201.2255,-1238.6%2022.058,-1271%20l%2020.833,-33.645%20h%20337%20c%20289.21,0%20338.23,2.4922%20354.16,19.938%2018.382,17.446%2019.608,145.79%2018.382,1267.3%20-1.2255,1115.3%20-2.4509,1251.1%20-19.608,1271%20-18.382,18.692%20-50.244,21.184%20-351.71,21.184%20-276.96,-1.2461%20-335.78,-3.7383%20-356.61,-19.938%20z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",d7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%20366%20368'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill='currentColor'%20d='m%2026,275.93574%20c%200.65,-9.32%208.46,-15.43%2015,-20.96%2015.43,-13.04%2035.67,-21.92%2053,-32.71%2020.67,-12.88%2061.58,-40.31%2080,-55.03%200,0%2021,-18.39%2021,-18.39%200,0%2028,-23.91%2028,-23.91%2010,-8.33%2014.1,-11.65%2025,-18.92%207.42,-4.94%2019.07,-12.550001%2024.52,-19.330001%207.17,-8.93%204.16,-18.82%20-4.53,-25.45%20-5.67,-4.32%20-23.5,-8.94%20-30.99,-10.66%20-3.1,-0.72%20-11.45,-1.57%20-13.38,-3.62%20-3.22,-3.43%201.67,-6.99%204.38,-8.45%206.61,-3.54%2017.51,-5.73%2025,-5.82%200,0%204,0%204,0%2016.51,-0.2%2018.85,-12.47%2040,-11.99%209.26,0.21%2021.16,2.48%2029,7.54%207.87,5.07%2012.2,11.73%2017.05,19.45%206.31,10.05%2012.35,21.16%2014.49,33%201.42,7.88%20-0.45,13.62%20-0.54,21.000001%20-0.28,24.26%206.68,37.92%20-2.44,63%20-5.9,16.24%20-14.87,35.36%20-23.98,50%20-9.34,15%20-20.81,30.64%20-35.58,40.64%200,0%20-16,9.36%20-16,9.36%20-3.3,1.9%20-6.18,2.94%20-6.64,7.04%20-0.68,2.83%20-0.16,7.11%200,9.96%200,0%201.29,8%201.29,8%201.62,5.16%208.51,12.15%2012.35,16%203.36,3.37%206.84,7.82%2012,7.89%204.2,0.06%208.14,-2.87%2012,-4.44%205.24,-2.13%2011.35,-3.55%2017,-3.94%206.33,-0.43%2017.05,1.85%2014,10.49%20-2.84,-3.54%20-6.09,-6.36%20-11,-5.57%20-2.47,0.4%20-10.06,3.6%20-8.09,7.08%201.19,2.08%207.67,3.01%2010.09,3.88%206.26,2.25%2010.83,5.76%2014,11.61%200,0%20-17,-6.33%20-17,-6.33%20-9.74,-2.08%20-18.73,0.62%20-28,3.33%205.49,3.71%208.06,5.51%2012,11%20-8.23,-1.96%20-13.6,-7.46%20-26,-6.96%20-9.64,0.39%20-11.89,4.13%20-27,3.96%20-9.42,-0.11%20-17.78,-4.36%20-27,-3.96%20-9.45,0.41%20-13.16,5.64%20-21,8.96%203.16,-14.88%2019.73,-16%2032,-16%20-7.31,-10.21%20-20.46,-18.11%20-23.28,-26%20-0.7,-1.97%20-0.69,-3.94%20-0.71,-6%200,0%200,-14%200,-14%200.23,-2.35%201.13,-5.62%200,-7.73%20-1.66,-2.77%20-8.94,-4.64%20-12.01,-5.55%20-20.1,-5.96%20-24.58,-0.84%20-43,2.01%200,0%20-14,2.11%20-14,2.11%20-9.78,1.06%20-18.83,0.92%20-28,5.02%200,0%20-15,7.88%20-15,7.88%20-16.76,8.6%20-42.02,22.27%20-59,27.93%20-9.14,3.04%20-16.2,6.24%20-26,6.33%200,0%205,-10%205,-10%20-3.92,0.18%20-15.76,3.08%20-17.92,-0.51%20-2.44,-4.07%205.28,-9.01%207.92,-10.91%200,0%2036,-24.58%2036,-24.58%200,0%20-19,3.25%20-19,3.25%20z%20m%20227,1.75%20c%20-2.98,0.84%20-11.45,3.61%20-12.96,6.27%20-0.95,1.89%20-0.18,5.54%200,7.73%200.04,2.47%20-0.13,4.56%200.61,7%201.52,5.07%2011.84,17.33%2016.35,19.88%203.38,1.91%2015.93,0.11%2020,-0.88%20-4.12,-8.71%20-16.66,-15.05%20-21.99,-24%20-3.43,-5.75%20-0.8,-10.06%20-2.01,-16%20z'%20/%3e%3c/svg%3e",f7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20466.73%20532.09'%3e%3cpath%20fill='currentColor'%20d='M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z'/%3e%3c/svg%3e",p7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20128%20128'%3e%3cpath%20fill='currentColor'%20d='M40.1024%2085.0722C47.6207%2077.5537%2051.8469%2067.3453%2051.8469%2056.7136C51.8469%2046.0818%2047.617%2035.8734%2040.1024%2028.355L11.7446%200C4.22995%207.5185%200%2017.7269%200%2028.3586C0%2038.9903%204.22995%2049.1987%2011.7446%2056.7172L40.0987%2085.0722H40.1024Z'/%3e%3cpath%20fill='currentColor'%20d='M99.4385%2087.698C91.9239%2080.1832%2081.7121%2075.9531%2071.0844%2075.9531C60.4566%2075.9531%2050.2448%2080.1832%2042.7266%2087.698L71.0844%20116.057C78.599%20123.571%2088.8107%20127.802%2099.4421%20127.802C110.074%20127.802%20120.282%20123.571%20127.8%20116.057L99.4421%2087.698H99.4385Z'/%3e%3cpath%20fill='currentColor'%20d='M11.8146%20115.987C19.3329%20123.502%2029.541%20127.732%2040.1724%20127.732V87.6289H0.0664062C0.0700559%2098.2606%204.29635%20108.469%2011.8146%20115.987Z'/%3e%3cpath%20fill='currentColor'%20d='M110.387%2045.7684C102.869%2038.2535%2092.6608%2034.0198%2082.0258%2034.0234C71.3943%2034.0234%2061.1863%2038.2535%2053.668%2045.772L82.0258%2074.1306L110.387%2045.7684Z'/%3e%3c/svg%3e",g7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20263%20300'%3e%3cpath%20fill='currentColor'%20d='M1.84577e-10%20100.797V38.6224C1.88813e-05%2035.8899%201.45777%2033.365%203.82414%2031.9988L57.6539%200.920185C60.0203%20-0.446051%2062.9358%20-0.446051%2065.3022%200.920185L119.132%2031.9988C121.498%2033.3651%20122.956%2035.8899%20122.956%2038.6224V70.375C123.192%2080.9262%20128.769%2091.103%20138.577%2096.7655C148.384%20102.428%20159.986%20102.169%20169.242%2097.0979L196.74%2081.2217C199.107%2079.8554%20202.022%2079.8554%20204.388%2081.2217L258.218%20112.3C260.585%20113.667%20262.042%20116.191%20262.042%20118.924V181.081C262.042%20183.814%20260.585%20186.339%20258.218%20187.705L204.388%20218.783C202.022%20220.15%20199.107%20220.15%20196.74%20218.783L169.464%20203.036C160.173%20197.847%20148.465%20197.536%20138.579%20203.244C128.772%20208.906%20123.195%20219.083%20122.959%20229.634V261.378C122.959%20264.111%20121.501%20266.635%20119.135%20268.002L65.3048%20299.08C62.9384%20300.447%2060.0229%20300.447%2057.6566%20299.08L3.82673%20268.002C1.46036%20266.635%200.00260562%20264.111%200.00260562%20261.378V199.221C0.0026245%20196.488%201.46038%20193.963%203.82675%20192.597L57.6565%20161.519C60.0229%20160.152%2062.9384%20160.152%2065.3048%20161.519L92.8656%20177.431C102.11%20182.467%20113.679%20182.711%20123.463%20177.062C133.349%20171.355%20138.934%20161.06%20139.086%20150.419C138.85%20139.868%20133.274%20128.601%20123.466%20122.938C113.658%20117.276%20102.056%20117.534%2092.8007%20122.606L65.1758%20138.645C62.7991%20140.025%2059.8649%20140.024%2057.4894%20138.642L3.80216%20107.407C1.44816%20106.038%20-1.88809e-05%20103.52%201.84577e-10%20100.797Z'/%3e%3c/svg%3e",m7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.12109%2011.0078H1.99902V5.49316H3.12109V11.0078ZM3.7041%205.49316C4.91979%205.49316%205.31142%205.57449%205.80762%205.7373C6.50208%205.97365%206.85299%206.40958%206.86133%207.04492V9.45605C6.86125%2010.207%206.37767%2010.6797%205.41016%2010.874C4.95546%2010.9633%204.69632%2011.0078%203.7041%2011.0078V10.6064C4.72131%2010.6064%204.95994%2010.5507%205.34863%2010.4404C5.91072%2010.2671%206.19576%209.93907%206.2041%209.45605V7.04492C6.20402%206.4883%205.83211%206.13886%205.08789%205.99707C4.74057%205.93405%204.58897%205.89978%203.7041%205.89453V5.49316ZM9.16797%205.49316V11.0078H8.0459V5.49316H9.16797ZM14%206.79297V11.0078H12.8779V8.0791L13.8877%206.79297H14ZM14%205.49316V5.7373L11.3594%208.97852H10.7852L9.74219%206.94531V6.07812H9.86719L11.0723%208.33203L13.4258%205.49316H14Z'%20fill='currentColor'/%3e%3c/svg%3e",v7="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2IiBmaWxsPSJjdXJyZW50Q29sb3IiPgogIDx0ZXh0IHg9IjgiIHk9IjEwIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LXNpemU9IjEwLjUiIGZvbnQtZmFtaWx5PSJHZW9yZ2lhLCBzZXJpZiIgZm9udC1zdHlsZT0iaXRhbGljIiBmaWxsPSJjdXJyZW50Q29sb3IiPs60PC90ZXh0PgogIDxsaW5lIHgxPSIxIiB5MT0iMTQiIHgyPSIxNSIgeTI9IjE0IiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLW9wYWNpdHk9IjAuNCIgc3Ryb2tlLXdpZHRoPSIxIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KICA8bGluZSB4MT0iOCIgeTE9IjE0IiB4Mj0iOCIgeTI9IjEyIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIxIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KICA8Y2lyY2xlIGN4PSI4IiBjeT0iMTEuNSIgcj0iMC43IiBmaWxsPSJjdXJyZW50Q29sb3IiLz4KPC9zdmc+Cg==",_7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20900%20900'%20fill='none'%3e%3cpath%20fill='currentColor'%20d='M622.037%20192.524a10.58%2010.58%200%200%201-4.056-2.001%2010.573%2010.573%200%200%201-3.98-7.89%2010.595%2010.595%200%200%201%20.804-4.452c20.214-49.194%2029.134-88.555%2014.74-105.033-38.123-43.716-191.004%2043.219-239.75%2072.663a10.596%2010.596%200%200%201-10.841.041%2010.576%2010.576%200%200%201-4.396-5.07c-20.491-49.089-42.031-83.233-63.865-84.714-57.871-3.96-104.516%20165.624-118.17%20220.895a10.574%2010.574%200%200%201-1.993%204.057%2010.572%2010.572%200%200%201-7.884%203.977%2010.586%2010.586%200%200%201-4.447-.802c-49.194-20.215-88.572-29.134-105.033-14.74-43.717%2038.123%2043.202%20191.005%2072.644%20239.75a10.553%2010.553%200%200%201%201.454%204.279%2010.573%2010.573%200%200%201-6.481%2010.958c-49.072%2020.491-83.216%2042.031-84.715%2063.864-3.944%2057.871%20165.624%20104.516%20220.913%20118.171a10.566%2010.566%200%200%201%205.658%203.601%2010.57%2010.57%200%200%201%202.355%206.281%2010.58%2010.58%200%200%201-.799%204.442c-20.214%2049.194-29.134%2088.572-14.739%20105.033%2038.121%2043.717%20191.021-43.202%20239.767-72.644a10.566%2010.566%200%200%201%2015.238%205.027c20.489%2049.072%2042.013%2083.216%2063.862%2084.715%2057.871%203.944%20104.516-165.624%20118.153-220.913a10.603%2010.603%200%200%201%209.895-8.021%2010.566%2010.566%200%200%201%204.449.808c49.193%2020.214%2088.553%2029.116%20105.032%2014.738%2043.718-38.121-43.219-191.022-72.663-239.767a10.602%2010.602%200%200%201%201.326-12.655%2010.604%2010.604%200%200%201%203.703-2.582c49.089-20.49%2083.233-42.031%2084.714-63.863%203.96-57.871-165.624-104.516-220.895-118.153Zm-66.394-55.478c11.123%2019.938-46.196%20152.797-88.83%20245.724a8.36%208.36%200%200%201-8.239%204.855%208.374%208.374%200%200%201-7.412-6.043c-17.219-60.42-36.899-131.411-57.957-191.675a10.557%2010.557%200%200%201%204.924-12.759c52.586-28.721%20142.568-66.86%20157.514-40.102ZM303.635%20153.49c21.953%206.233%2075.365%20140.709%20110.92%20236.564a8.364%208.364%200%200%201-2.394%209.249%208.364%208.364%200%200%201-9.504.978c-54.943-30.493-119.013-66.824-176.522-94.546a10.565%2010.565%200%200%201-5.528-12.501c16.926-57.44%2053.532-148.095%2083.028-139.744ZM137.064%20343.322c19.921-11.123%20152.795%2046.197%20245.707%2088.83a8.369%208.369%200%200%201-1.189%2015.652c-60.401%2017.219-131.411%2036.899-191.675%2057.957a10.552%2010.552%200%200%201-12.742-4.925c-28.668-52.584-66.876-142.568-40.101-157.514Zm16.443%20252.009c6.217-21.953%20140.709-75.365%20236.564-110.921a8.368%208.368%200%200%201%2010.227%2011.898c-30.511%2054.945-66.842%20119.014-94.563%20176.507a10.548%2010.548%200%200%201-5.229%205.075%2010.544%2010.544%200%200%201-7.271.468c-57.441-16.822-148.095-53.531-139.728-83.027ZM343.34%20761.902c-11.14-19.922%2046.197-152.796%2088.829-245.707a8.383%208.383%200%200%201%205.713-4.66%208.38%208.38%200%200%201%207.182%201.664%208.371%208.371%200%200%201%202.758%204.184c17.217%2060.403%2036.898%20131.412%2057.957%20191.675a10.558%2010.558%200%200%201-4.942%2012.743c-52.568%2028.668-142.568%2066.875-157.445%2040.101h-.052Zm252.009-16.443c-21.971-6.216-75.383-140.709-110.939-236.564a8.37%208.37%200%200%201%2011.916-10.228c54.926%2030.494%20119.014%2066.842%20176.506%2094.563a10.538%2010.538%200%200%201%205.527%2012.502c-16.909%2057.526-53.515%20148.094-83.01%20139.727Zm166.57-189.834c-19.938%2011.141-152.796-46.197-245.724-88.83a8.367%208.367%200%200%201-2.993-12.892%208.378%208.378%200%200%201%204.182-2.759c60.419-17.218%20131.41-36.899%20191.675-57.958a10.577%2010.577%200%200%201%2012.758%204.943c28.652%2052.568%2066.86%20142.569%2040.102%20157.496Zm-16.444-252.009c-6.232%2021.971-140.709%2075.383-236.562%20110.94a8.371%208.371%200%200%201-10.229-11.917c30.495-54.926%2066.825-119.012%2094.547-176.505a10.555%2010.555%200%200%201%2012.5-5.528c57.441%2016.909%20148.096%2053.516%20139.744%2083.01Z'/%3e%3c/svg%3e",y7="/demo/desktop/assets/fast-agent-C0GPnwYP.svg",S7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='currentColor'%20d='M11.04%2019.32Q12%2021.51%2012%2024q0-2.49.93-4.68.96-2.19%202.58-3.81t3.81-2.55Q21.51%2012%2024%2012q-2.49%200-4.68-.93a12.3%2012.3%200%200%201-3.81-2.58%2012.3%2012.3%200%200%201-2.58-3.81Q12%202.49%2012%200q0%202.49-.96%204.68-.93%202.19-2.55%203.81a12.3%2012.3%200%200%201-3.81%202.58Q2.49%2012%200%2012q2.49%200%204.68.96%202.19.93%203.81%202.55t2.55%203.81'/%3e%3c/svg%3e",x7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.99816%2014.2779C12.0678%2014.2779%2014.9997%2011.6274%2014.9997%2010.9574V9.3189C14.939%208.77306%2014.4165%207.82349%2013.6074%207.48636C13.5959%207.42498%2013.5859%207.36153%2013.5756%207.29542C13.5506%207.13548%2013.5231%206.95977%2013.4649%206.75954C13.6409%206.31508%2013.6873%205.81187%2013.6873%205.31135C13.6873%204.54947%2013.5757%203.76321%2013.0811%203.13712C12.5745%202.4959%2011.7737%202.15372%2010.6972%202.03411C9.64215%201.91688%208.71828%202.06409%208.12157%202.70342C8.07827%202.74981%208.0345%202.79812%207.99655%202.84746C7.95861%202.79812%207.91805%202.74981%207.87475%202.70342C7.27804%202.06409%206.35416%201.91688%205.29908%202.03411C4.22263%202.15372%203.42181%202.4959%202.91521%203.13712C2.42057%203.76321%202.30905%204.54947%202.30905%205.31135C2.30905%205.81187%202.35539%206.31508%202.53142%206.75954C2.47323%206.95977%202.44574%207.13542%202.42072%207.29536C2.41037%207.3615%202.40044%207.42496%202.38893%207.48636C1.57983%207.82349%201.05728%208.77306%200.996582%209.3189V10.9574C0.996582%2011.6274%203.92849%2014.2779%207.99816%2014.2779ZM10.5523%203.33859C9.63863%203.23707%209.25001%203.41798%209.0811%203.59896C8.90273%203.79007%208.76738%204.19254%208.86971%205.0112C8.94909%205.64627%209.13423%206.08757%209.41018%206.36929C9.67188%206.63645%2010.0966%206.8426%2010.8435%206.8426C11.6506%206.8426%2011.9631%206.66867%2012.1051%206.51046C12.2619%206.33577%2012.3748%206.00462%2012.3748%205.31135C12.3748%204.64141%2012.2675%204.22455%2012.0513%203.95077C11.8469%203.69214%2011.4446%203.43773%2010.5523%203.33859ZM6.91639%203.59896C6.74748%203.41798%206.35886%203.23707%205.44518%203.33859C4.55289%203.43773%204.15058%203.69214%203.94624%203.95077C3.72994%204.22455%203.62271%204.64141%203.62271%205.31135C3.62271%206.00462%203.73563%206.33577%203.89239%206.51046C4.03436%206.66867%204.34693%206.8426%205.15396%206.8426C5.90092%206.8426%206.32561%206.63645%206.58731%206.36929C6.86326%206.08757%207.0484%205.64627%207.12778%205.0112C7.23011%204.19254%207.09476%203.79007%206.91639%203.59896ZM7.99818%2012.9788C9.99307%2012.9788%2012.0088%2012.0076%2012.3748%2011.7248V8.00133L12.3546%207.90026C11.9257%208.08369%2011.4142%208.1551%2010.8435%208.1551C9.84049%208.1551%209.04148%207.86851%208.47257%207.28773C8.28092%207.09208%208.12536%206.87308%207.99978%206.6378C7.8742%206.87308%207.71544%207.09208%207.52378%207.28773C6.95488%207.86851%206.15587%208.1551%205.15283%208.1551C4.58212%208.1551%204.07068%208.08369%203.6418%207.90026L3.62158%208.00133V11.7248C3.98755%2012.0076%206.00329%2012.9788%207.99818%2012.9788Z'%20fill='currentColor'/%3e%3cpath%20d='M6.46854%209.0301C6.83097%209.0301%207.12479%209.32391%207.12479%209.68635V10.9988C7.12479%2011.3613%206.83097%2011.6551%206.46854%2011.6551C6.1061%2011.6551%205.81229%2011.3613%205.81229%2010.9988V9.68635C5.81229%209.32391%206.1061%209.0301%206.46854%209.0301Z'%20fill='currentColor'/%3e%3cpath%20d='M10.1873%209.68635C10.1873%209.32391%209.89347%209.0301%209.53104%209.0301C9.1686%209.0301%208.87479%209.32391%208.87479%209.68635V10.9988C8.87479%2011.3613%209.1686%2011.6551%209.53104%2011.6551C9.89347%2011.6551%2010.1873%2011.3613%2010.1873%2010.9988V9.68635Z'%20fill='currentColor'/%3e%3c/svg%3e",w7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='currentColor'%20fill-rule='evenodd'%3e%3ctitle%3eZ.ai%3c/title%3e%3cpath%20d='M8.07%201.333L6.618%203.302H.435L1.887%201.333h6.184zM15.503%2012.699L14.052%2014.667h-6.161l1.449-1.968h6.163zM16%201.333L6.176%2014.667H0L9.824%201.333H16z'/%3e%3c/svg%3e",b7="/demo/desktop/assets/goose-y93b4F4V.svg",C7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M0.58392448,14.9254204%20L0.8326,14.66295%20C2.004465,13.42985%203.1678,12.2082%202.45814,10.48105%20C1.50813,8.1701%202.061355,5.4619%203.820575,3.70057%20C5.6495,1.8709%208.3431,1.40957%2010.59295,2.336505%20C11.0907,2.52161%2011.5245,2.785025%2011.86295,3.02993%20L9.98425,3.89849%20C8.235,3.163775%206.23115,3.66355%205.0081,4.88809%20C3.354105,6.5426%203.019895,9.4117%204.95835,11.2656%20L-0.335,15.99995%20C-0.066496,15.62975%200.2538896,15.275934%200.58392448,14.9254204%20Z%20M14.0391,2.288155%20L16.33165,2.57749377e-12%20L16.20795,0.172288%20C14.4658,2.574355%2013.6153,3.749045%2014.29795,6.6879%20C14.76445,8.68415%2014.261,10.90255%2012.63545,12.53005%20C10.5861,14.58325%207.3066,15.0403%204.6059,13.19215%20L6.48885,12.3193%20C8.2125,12.99705%2010.0983,12.69945%2011.4536,11.34255%20C12.80895,9.9856%2013.1133,8.00925%2012.4321,6.3647%20C12.30265,6.05285%2011.9144,5.97455%2011.64275,6.1753%20L6.102,10.27035%20L14.0391,2.288155%20Z'/%3e%3c/svg%3e",k7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M11.2%201.4%2014.6%204.8a1%201%200%200%201%200%201.4l-1.5%201.5-4.8-4.8%201.5-1.5a1%201%200%200%201%201.4%200ZM7.6%203.6l4.8%204.8-6.9%206.9a1%201%200%200%201-.5.27l-3.4.73a.6.6%200%200%201-.71-.71l.73-3.4a1%201%200%200%201%20.27-.5l5.6-5.6Zm-4.5%208.1-.4%201.9%201.9-.4-1.5-1.5Z'/%3e%3c/svg%3e",E7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2040%2040'%20fill='none'%3e%3cpath%20d='M25%2015H35V16.75C35%2029%2030.5001%2035%2016.5001%2035H15V25H16.5001C22.6251%2025%2025%2022.875%2025%2016.75V15Z'%20fill='currentColor'/%3e%3crect%20x='5'%20y='15'%20width='10'%20height='10'%20fill='currentColor'/%3e%3crect%20x='15'%20y='5'%20width='10'%20height='10'%20fill='currentColor'/%3e%3c/svg%3e",M7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2040%2040'%3e%3cpath%20fill='currentColor'%20d='M27.9998324,34.6666921h6.6666279v5.3333023h-8.3809037l-3.6190266-3.6190266v-8.3809037h5.3333023v6.6666279ZM39.9997627,26.2857884l-3.6190266-3.6190266h-8.3809037v5.3333023h6.6666279v6.6666279h5.3333023v-8.3809037ZM17.3332326,22.6667578h-5.3333023v5.3333023h5.3333023v-5.3333023ZM0,36.3809638l3.6190266,3.6190266h13.714206v-5.3333023H5.3333023v-11.9999302H0v13.714206ZM33.9600959,11.9999247V3.619021L30.3410693-.0000056h-7.6745392v5.3333023h5.9602634v6.6666279h-5.9602634v5.3333023h17.3332326v-5.3333023h-6.0396668ZM5.3333023,0H0v17.3332326h5.3333023v-5.9999651h6.6666279v5.9999651h5.3333023v-5.9999651l-5.3333023-5.3333023h-6.6666279V0ZM17.3332326,0h-5.3333023v5.9999651h5.3333023V0Z'/%3e%3c/svg%3e",j7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M3%201h2.5v5.5L9%201h3L8.5%206.5%2012.5%2013H9.5L6%208v5H3V1z'/%3e%3c/svg%3e",T7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='currentColor'%20d='M19.514%207.342C19.711%207.862%2019.814%208.413%2019.816%208.969C19.816%2012.494%2015.998%2014.697%2012.946%2012.934C11.529%2012.116%2010.657%2010.605%2010.657%208.969C10.657%205.646%2014.085%203.431%2017.115%204.793C15.26%203.373%2012.99%202.607%2010.655%202.612C4.772%202.614%200.005%207.381%200%2013.265C0.002%2019.148%204.772%2023.918%2010.655%2023.92C16.538%2023.916%2021.306%2019.147%2021.31%2013.265C21.312%2011.155%2020.687%209.095%2019.514%207.342ZM14.841%204.666C14.841%208.191%2018.657%2010.395%2021.709%208.632C23.127%207.814%2024%206.302%2024%204.666C24%201.14%2020.184-1.061%2017.13%200.699C15.714%201.519%2014.841%203.03%2014.841%204.666'/%3e%3c/svg%3e",D7="data:image/svg+xml,%3csvg%20width='1200'%20height='1200'%20viewBox='0%200%201200%201200'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='1200'%20height='1200'%20rx='260'%20fill='%239046FF'/%3e%3cmask%20id='mask0_1106_4856'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='272'%20y='202'%20width='655'%20height='796'%3e%3cpath%20d='M926.578%20202.793H272.637V997.857H926.578V202.793Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_1106_4856)'%3e%3cpath%20d='M398.554%20818.914C316.315%201001.03%20491.477%201046.74%20620.672%20940.156C658.687%201059.66%20801.052%20970.473%20852.234%20877.795C964.787%20673.567%20919.318%20465.357%20907.64%20422.374C827.637%20129.443%20427.623%20128.946%20358.8%20423.865C342.651%20475.544%20342.402%20534.18%20333.458%20595.051C328.986%20625.86%20325.507%20645.488%20313.83%20677.785C306.873%20696.424%20297.68%20712.819%20282.773%20740.645C259.915%20783.881%20269.604%20867.113%20387.87%20823.883L399.051%20818.914H398.554Z'%20fill='white'/%3e%3cpath%20d='M636.123%20549.353C603.328%20549.353%20598.359%20510.097%20598.359%20486.742C598.359%20465.623%20602.086%20448.977%20609.293%20438.293C615.504%20428.852%20624.697%20424.131%20636.123%20424.131C647.555%20424.131%20657.492%20428.852%20664.447%20438.541C672.398%20449.474%20676.623%20466.12%20676.623%20486.742C676.623%20525.998%20661.471%20549.353%20636.375%20549.353H636.123Z'%20fill='black'/%3e%3cpath%20d='M771.24%20549.353C738.445%20549.353%20733.477%20510.097%20733.477%20486.742C733.477%20465.623%20737.203%20448.977%20744.41%20438.293C750.621%20428.852%20759.814%20424.131%20771.24%20424.131C782.672%20424.131%20792.609%20428.852%20799.564%20438.541C807.516%20449.474%20811.74%20466.12%20811.74%20486.742C811.74%20525.998%20796.588%20549.353%20771.492%20549.353H771.24Z'%20fill='black'/%3e%3c/g%3e%3c/svg%3e",R7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M2%203h3l3%205%203-5h3v10h-2V6.5l-4%206-4-6V13H2V3Z'/%3e%3c/svg%3e",A7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3crect%20fill='none'%20stroke='currentColor'%20stroke-width='1.1'%20x='4.5'%20y='2.5'%20width='7'%20height='10'%20rx='3.5'/%3e%3cline%20stroke='currentColor'%20stroke-width='1'%20x1='3'%20y1='5.5'%20x2='13'%20y2='5.5'/%3e%3ccircle%20fill='none'%20stroke='currentColor'%20stroke-width='1'%20cx='6.5'%20cy='5.5'%20r='1.6'/%3e%3ccircle%20fill='none'%20stroke='currentColor'%20stroke-width='1'%20cx='9.5'%20cy='5.5'%20r='1.6'/%3e%3ccircle%20fill='currentColor'%20cx='6.8'%20cy='5.6'%20r='0.55'/%3e%3ccircle%20fill='currentColor'%20cx='9.8'%20cy='5.6'%20r='0.55'/%3e%3cpath%20fill='none'%20stroke='currentColor'%20stroke-width='0.6'%20stroke-linecap='round'%20d='M7%208.3%20Q8%209%209%208.3'/%3e%3cpath%20fill='none'%20stroke='currentColor'%20stroke-width='0.9'%20stroke-linecap='round'%20d='M4.5%208%20L3%209.5'/%3e%3cpath%20fill='none'%20stroke='currentColor'%20stroke-width='0.9'%20stroke-linecap='round'%20d='M11.5%208%20L13%209.5'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.7'%20x1='5'%20y1='9.5'%20x2='11'%20y2='9.5'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.9'%20x1='6.5'%20y1='12.5'%20x2='6.5'%20y2='14'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.9'%20x1='9.5'%20y1='12.5'%20x2='9.5'%20y2='14'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.9'%20stroke-linecap='round'%20x1='6.5'%20y1='14'%20x2='5.5'%20y2='14'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.9'%20stroke-linecap='round'%20x1='9.5'%20y1='14'%20x2='10.5'%20y2='14'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.7'%20stroke-linecap='round'%20x1='8'%20y1='2.5'%20x2='7.3'%20y2='0.8'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.7'%20stroke-linecap='round'%20x1='8'%20y1='2.5'%20x2='8'%20y2='0.5'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.7'%20stroke-linecap='round'%20x1='8'%20y1='2.5'%20x2='8.7'%20y2='0.8'/%3e%3c/svg%3e",N7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.8147%205.35803H5.35791V8.46914H8.8147V5.35803Z'%20fill='currentColor'/%3e%3cpath%20d='M22.6419%205.35803H19.1851V8.46914H22.6419V5.35803Z'%20fill='currentColor'/%3e%3cpath%20d='M15.7283%2015.7284H12.2715V18.8395H15.7283V15.7284Z'%20fill='currentColor'/%3e%3cpath%20d='M8.8147%2015.7284H5.35791V18.8395H8.8147V15.7284Z'%20fill='currentColor'/%3e%3cpath%20d='M22.6419%2015.7284H19.1851V18.8395H22.6419V15.7284Z'%20fill='currentColor'/%3e%3cpath%20d='M12.2715%208.81482H5.35791V11.9259H12.2715V8.81482Z'%20fill='currentColor'/%3e%3cpath%20d='M12.2718%2019.1852H1.90137V22.2963H12.2718V19.1852Z'%20fill='currentColor'/%3e%3cpath%20d='M26.0989%2019.1852H15.7285V22.2963H26.0989V19.1852Z'%20fill='currentColor'/%3e%3cpath%20d='M22.6419%2012.2716H5.35791V15.3827H22.6419V12.2716Z'%20fill='currentColor'/%3e%3cpath%20d='M22.6421%208.81482H15.7285V11.9259H22.6421V8.81482Z'%20fill='currentColor'/%3e%3c/svg%3e",L7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3ccircle%20cx='8'%20cy='8'%20r='6'%20fill='none'%20stroke='currentColor'%20stroke-width='1'/%3e%3ccircle%20cx='8'%20cy='8'%20r='4.5'%20fill='none'%20stroke='currentColor'%20stroke-width='0.3'%20opacity='0.5'/%3e%3cline%20x1='8'%20y1='8'%20x2='13.5'%20y2='13.5'%20stroke='currentColor'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cpolygon%20points='14.5,14.5%2012.3,13.5%2013.5,12.3'%20fill='currentColor'/%3e%3cline%20x1='8'%20y1='8'%20x2='2.5'%20y2='2.5'%20stroke='currentColor'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cpolygon%20points='1.5,1.5%203.7,2.5%202.5,3.7'%20fill='currentColor'/%3e%3ccircle%20cx='8'%20cy='8'%20r='1.3'%20fill='currentColor'/%3e%3ccircle%20cx='8'%20cy='8'%20r='0.6'%20fill='none'%20stroke='currentColor'%20stroke-width='0.5'%20opacity='0.7'/%3e%3c/svg%3e",B7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13%2014H3V2H13V14ZM10.5%204.4H5.5V11.6H10.5V4.4Z'%20fill='currentColor'/%3e%3c/svg%3e",O7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M1%201H11.7692V7.9999H8.17942V11.4999H4.58982V15H1V1ZM4.58982%204.50005V7.9999H8.17942V4.50005H4.58982Z'%20fill='currentColor'/%3e%3cpath%20d='M11.7692%207.46154H15V15H11.7692V7.46154Z'%20fill='currentColor'/%3e%3c/svg%3e",z7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.63653%205.50522L2.18735%205.28559C2.09852%205.46726%202.12787%205.68456%202.26172%205.83616C2.39558%205.98775%202.60757%206.04379%202.79884%205.97814L2.63653%205.50522ZM5.83578%206.94285L5.3732%207.13265L5.5645%207.59886L6.02919%207.40392L5.83578%206.94285ZM10.7441%209.44034L10.2614%209.57083L10.393%2010.0573L10.8784%209.92198L10.7441%209.44034ZM2.5%208.24963C2.4998%207.97349%202.27577%207.74979%201.99963%207.75C1.72349%207.75021%201.4998%207.97423%201.5%208.25037L2.5%208.24963ZM13.4143%2010.7751C12.0197%2013.6273%208.57701%2014.8089%205.72485%2013.4143L5.28559%2014.3126C8.63389%2015.9498%2012.6754%2014.5627%2014.3126%2011.2144L13.4143%2010.7751ZM3.08571%205.72485C4.48031%202.87269%207.92299%201.69111%2010.7751%203.08571L11.2144%202.18735C7.86611%200.550151%203.82455%201.93728%202.18735%205.28559L3.08571%205.72485ZM10.7751%203.08571C13.6273%204.48031%2014.8089%207.92299%2013.4143%2010.7751L14.3126%2011.2144C15.9498%207.86611%2014.5627%203.82455%2011.2144%202.18735L10.7751%203.08571ZM2.79884%205.97814C3.02201%205.90155%203.54835%205.84926%204.09141%206.00587C4.61256%206.15616%205.10736%206.48476%205.3732%207.13265L6.29835%206.75304C5.89213%205.76303%205.11508%205.26032%204.3685%205.04503C3.64385%204.83605%202.9066%204.8839%202.47422%205.0323L2.79884%205.97814ZM6.02919%207.40392C6.25314%207.30998%206.55771%207.25841%206.85281%207.36034C7.13062%207.45631%207.49214%207.72014%207.78743%208.4398L8.71257%208.0602C8.3358%207.14195%207.79046%206.62626%207.17931%206.41515C6.58544%206.21001%206.01893%206.32381%205.64236%206.48177L6.02919%207.40392ZM6.26827%207.19375C6.80493%206.26869%208.18817%204.18684%2011.1653%203.10654L10.8242%202.16652C7.53166%203.36127%205.99463%205.67263%205.40329%206.69195L6.26827%207.19375ZM14.3364%2010.8325C14.1845%2010.39%2013.7564%209.79897%2013.14%209.37995C12.504%208.94759%2011.6302%208.67426%2010.6099%208.9587L10.8784%209.92198C11.5634%209.73102%2012.1368%209.90713%2012.5779%2010.207C13.0385%2010.5201%2013.3174%2010.9441%2013.3905%2011.1571L14.3364%2010.8325ZM11.2268%209.30984C11.1236%208.92833%2010.8783%208.39265%2010.3638%208.02453C9.82769%207.6409%209.08331%207.49864%208.11574%207.76836L8.38426%208.73164C9.1221%208.52595%209.53979%208.66454%209.78189%208.83777C10.0457%209.02651%2010.1946%209.32371%2010.2614%209.57083L11.2268%209.30984ZM11.216%209.60556C11.6225%208.44463%2012.4244%205.47936%2011.4712%202.48487L10.5183%202.78819C11.3726%205.47172%2010.6545%208.18331%2010.2722%209.27512L11.216%209.60556ZM7.80082%208.03037L5.05604%2013.6438L5.9544%2014.0831L8.69918%208.46963L7.80082%208.03037ZM5.72485%2013.4143C3.68742%2012.4181%202.50158%2010.3763%202.5%208.24963L1.5%208.25037C1.50185%2010.7441%202.89229%2013.1424%205.28559%2014.3126L5.72485%2013.4143Z'%20fill='currentColor'/%3e%3c/svg%3e",H7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M8%201C4.134%201%201%204.134%201%208s3.134%207%207%207c1.5%200%202.9-.47%204.05-1.28l1.12%201.12a.75.75%200%201%200%201.06-1.06l-1.12-1.12A6.97%206.97%200%200%200%2015%208c0-3.866-3.134-7-7-7Zm0%202c2.761%200%205%202.239%205%205s-2.239%205-5%205-5-2.239-5-5%202.239-5%205-5Z'/%3e%3c/svg%3e",I7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20data-name='图层%202'%20viewBox='0%200%20141.38%20140'%20width='16'%20height='16'%3e%3cpath%20fill='currentColor'%20d='m140.93%2085-16.35-28.33-1.93-3.34%208.66-15a3.323%203.323%200%200%200%200-3.34l-9.62-16.67c-.3-.51-.72-.93-1.22-1.22s-1.07-.45-1.67-.45H82.23l-8.66-15a3.33%203.33%200%200%200-2.89-1.67H51.43c-.59%200-1.17.16-1.66.45-.5.29-.92.71-1.22%201.22L32.19%2029.98l-1.92%203.33H12.96c-.59%200-1.17.16-1.66.45-.5.29-.93.71-1.22%201.22L.45%2051.66a3.323%203.323%200%200%200%200%203.34l18.28%2031.67-8.66%2015a3.32%203.32%200%200%200%200%203.34l9.62%2016.67c.3.51.72.93%201.22%201.22s1.07.45%201.67.45h36.56l8.66%2015a3.35%203.35%200%200%200%202.89%201.67h19.25a3.34%203.34%200%200%200%202.89-1.67l18.28-31.67h17.32c.6%200%201.17-.16%201.67-.45s.92-.71%201.22-1.22l9.62-16.67a3.323%203.323%200%200%200%200-3.34ZM51.44%203.33%2061.07%2020l-9.63%2016.66h76.98l-9.62%2016.66H45.67l-11.54-20zM57.21%20120H22.58l9.63-16.67h19.25l-38.5-66.67h19.25l9.62%2016.67L68.78%20100l-11.55%2020Zm61.59-33.34-9.62-16.67-38.49%2066.67-9.63-16.67%209.63-16.66%2026.94-46.67h23.1l17.32%2030z'%20data-name='图层%201'/%3e%3c/svg%3e",U7="/demo/desktop/assets/sigit-DPmZBS3L.svg",P7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M6.53%204.412h5.883v3.587H9.471v3.588H3.588V7.999H6.53Z'/%3e%3c/svg%3e",q7="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNMC41IDUuNUwyLjUgOCAwLjUgMTAuNSIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KICA8dGV4dCB4PSIzLjIiIHk9IjExLjUiIGZvbnQtZmFtaWx5PSInU0YgTW9ubycsICdGaXJhIENvZGUnLCAnQ29uc29sYXMnLCBtb25vc3BhY2UiIGZvbnQtc2l6ZT0iMTAiIGZvbnQtd2VpZ2h0PSI2MDAiIGxldHRlci1zcGFjaW5nPSItMC41IiBmaWxsPSJjdXJyZW50Q29sb3IiPlZUPC90ZXh0Pgo8L3N2Zz4=",V7=Object.assign({"../assets/agents/agoragentic-acp.svg":t7,"../assets/agents/amp-acp.svg":i7,"../assets/agents/antigravity-acp.svg":s7,"../assets/agents/auggie.svg":n7,"../assets/agents/autohand.svg":r7,"../assets/agents/claude-acp.svg":a7,"../assets/agents/cline.svg":l7,"../assets/agents/codebuddy-code.svg":o7,"../assets/agents/codex-acp.svg":c7,"../assets/agents/cortex-code.svg":h7,"../assets/agents/corust-agent.svg":u7,"../assets/agents/crow-cli.svg":d7,"../assets/agents/cursor.svg":f7,"../assets/agents/deepagents.svg":p7,"../assets/agents/devin.svg":g7,"../assets/agents/dimcode.svg":m7,"../assets/agents/dirac.svg":v7,"../assets/agents/factory-droid.svg":_7,"../assets/agents/fast-agent.svg":y7,"../assets/agents/gemini.svg":S7,"../assets/agents/github-copilot-cli.svg":x7,"../assets/agents/glm-acp-agent.svg":w7,"../assets/agents/goose.svg":b7,"../assets/agents/grok-build.svg":C7,"../assets/agents/harn.svg":k7,"../assets/agents/junie.svg":E7,"../assets/agents/kilo.svg":M7,"../assets/agents/kimchi.svg":j7,"../assets/agents/kimi.svg":T7,"../assets/agents/kiro.svg":D7,"../assets/agents/minimax-code.svg":R7,"../assets/agents/minion-code.svg":A7,"../assets/agents/mistral-vibe.svg":N7,"../assets/agents/nova.svg":L7,"../assets/agents/opencode.svg":B7,"../assets/agents/pi-acp.svg":O7,"../assets/agents/poolside.svg":z7,"../assets/agents/qoder.svg":H7,"../assets/agents/qwen-code.svg":I7,"../assets/agents/sigit.svg":U7,"../assets/agents/stakpak.svg":P7,"../assets/agents/vtcode.svg":q7}),$7=new Map(Object.entries(V7).map(([e,t])=>[e.split("/").pop().replace(".svg",""),t]));function l1(e){return e?$7.get(e)??null:null}function wS({registry:e,size:t,color:n="currentColor"}){const r=l1(e);return r?c.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:t,height:t,flex:"none",backgroundColor:n,WebkitMaskImage:`url("${r}")`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):c.jsx(ae,{name:"terminal",size:t*.8,scaled:!1,color:n})}const W_=e=>e[Math.floor(Math.random()*e.length)];function W7(){return{name:"",description:"",avatarColor:W_(Ah).id,avatarShape:W_(q3),backend:"claude",cwd:"",permission:"auto"}}const e2=e=>!e.id||e.name.trim()!=="",bS=e=>e.backend==="custom"?e:{...e,command:null};function t2(e,t,n){const r={...t},l=e.hello?.backends??[],h=l.find(d=>d.available);return l.find(d=>d.id===r.backend)?.available!==!0&&h&&(r.backend=h.id),r.connectors===void 0&&n.length&&(r.connectors=n.map(d=>d.id)),r}async function CS(e){const t=e.client;if(!t)return{connectors:[],skills:[]};const[n,r]=await Promise.allSettled([t.call("connectors"),t.call("skills")]);return{connectors:n.status==="fulfilled"?n.value.items:[],skills:r.status==="fulfilled"?r.value.items:[]}}function kS(e){const[t,n]=x.useState(null),r=e.connection.kind==="online";return x.useEffect(()=>{let l=!0;return CS(e).then(h=>l&&n(h)),()=>{l=!1}},[e,r]),t}async function F7(e){const{connectors:t}=await CS(e),n=await e.save(t2(e,W7(),t));return e.setSelection(n.id),n}const o1=e=>e.split("/").filter(Boolean).pop()??e,Ar=e=>e instanceof Error?e.message:String(e);function K7({backend:e,selection:t,onChange:n}){const r=Ne(),l=r.connection.kind==="online",[h,d]=x.useState(null),p=x.useRef(null),[g,m]=x.useState(!1),[v,_]=x.useState(null),[S,w]=x.useState(0),b=e==="custom",k=x.useRef(e);x.useEffect(()=>{k.current!==e&&(k.current=e,n(null))},[e,n]),x.useEffect(()=>{const I=`${r.computer.id}/${e}`;if(p.current!==I&&(d(null),p.current=I),_(null),m(!1),b)return;const q=r.client;if(!l||!q){_("Connect to this computer to load its models. You can still enter a model ID.");return}let U=!1;return m(!0),q.call("agentModels",{backend:e},3e5).then(Y=>!U&&d(Y)).catch(Y=>!U&&_(`Couldn't load models: ${Ar(Y)}`)).finally(()=>!U&&m(!1)),()=>{U=!0}},[r.computer.id,r.client,e,l,S,b]);const E=h?.models.find(I=>I.name.toLowerCase().startsWith("default")),j=(h?.models??[]).filter(I=>I.id!==E?.id),V=j.find(I=>I.id===h?.currentModelId)?.name,A=[{id:"",label:E?.name??(V?`Default · ${V}`:"Default")},...j.map(I=>({id:I.id,label:I.name}))];t&&t!==E?.id&&!j.some(I=>I.id===t)&&A.push({id:t,label:t});const z=t===E?.id?"":t??"",F=I=>n(I||null),R=h?.models.length===0;return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx("span",{style:{color:"var(--text)",whiteSpace:"nowrap"},children:"Model"}),c.jsx("span",{style:{flex:1}}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[b?null:c.jsxs("div",{style:{width:28,height:28,display:"grid",placeItems:"center",flex:"none"},children:[c.jsx("div",{style:{gridArea:"1 / 1",opacity:g?0:1,transition:"opacity var(--fade)",pointerEvents:g?"none":void 0},children:c.jsx(ke,{title:v?"Retry model list":"Refresh model list",icon:"arrow.clockwise",disabled:g,onClick:()=>w(I=>I+1)})}),g?c.jsx("div",{className:"fade-in",style:{gridArea:"1 / 1",display:"flex"},"aria-label":"Loading available models",children:c.jsx(et,{size:12})}):null]}),b||!g&&(!h||R)?c.jsx(K3,{outlined:!0,style:{minWidth:0,maxWidth:160},children:c.jsx("input",{value:z,placeholder:"Default",spellCheck:!1,onChange:I=>F(I.target.value),style:{textAlign:"right",width:142,maxWidth:"100%",minWidth:0,color:"var(--text)",userSelect:"text"}})}):c.jsx("div",{style:{display:"flex",minWidth:0},children:c.jsx(Ci,{selection:z,options:A,onChange:F})})]})]}),!b&&!g&&v?c.jsx("span",{style:{...B("caption"),color:"var(--warning)"},children:v}):!b&&!g&&R?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:"This agent doesn't advertise a model list. Leave Default or enter a model ID."}):null,c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:"Changing the model starts a new agent session. Chat history is kept."})]})}function Y7({botId:e}){const n=Ne().client,[r,l]=x.useState([]),[h,d]=x.useState(!1),[p,g]=x.useState(!1),m=x.useCallback(async()=>{if(n){try{l((await n.call("memory",{botId:e})).facts)}catch{l([])}d(!0)}},[n,e]);x.useEffect(()=>{m()},[m]);const v=S=>{l(w=>w.filter(b=>b.id!==S.id)),n?.call("forgetMemory",{botId:e,id:S.id}).catch(()=>{}).then(m)},_=()=>{l([]),n?.call("clearMemory",{botId:e}).catch(()=>{}).then(m)};return c.jsxs(c.Fragment,{children:[c.jsxs(Ee,{title:"Memory",accessory:r.length?c.jsx("button",{className:"press",style:{display:"flex",color:"var(--secondary)"},title:"Forget everything","aria-label":"Forget everything",onClick:()=>g(!0),children:c.jsx(ae,{name:"trash",size:12})}):null,children:[r.length?null:c.jsx("span",{style:{color:"var(--secondary)"},children:h?"Nothing yet. The bot remembers who you are and what you work on as you chat.":"Loading…"}),r.map(S=>c.jsxs("div",{className:"fade-in",style:{display:"flex",alignItems:"baseline",gap:10},children:[c.jsx("span",{style:{display:"flex"},title:S.kind==="profile"?"About you":"History",children:c.jsx(ae,{name:S.kind==="profile"?"person":"clock",size:10,color:"var(--tertiary)"})}),c.jsx("span",{className:"selectable",style:{flex:1,minWidth:0,color:"var(--text)"},children:S.content}),c.jsx("button",{className:"press",style:{display:"flex",color:"var(--tertiary)"},title:"Forget","aria-label":"Forget",onClick:()=>v(S),children:c.jsx(ae,{name:"xmark",size:10})})]},S.id))]}),c.jsx(ts,{open:p,title:"Forget everything this bot remembers?",actions:[{title:"Forget everything",destructive:!0,action:_}],onClose:()=>g(!1)})]})}function po({label:e,detail:t,children:n}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[c.jsx("span",{style:{color:"var(--text)"},children:e}),t?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",lineHeight:1.35},children:t}):null]}),n]})}function i2({title:e,detail:t,on:n,onChange:r}){return c.jsx(rn,{on:n,onChange:r,children:c.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:3},children:[c.jsx("span",{style:{color:"var(--text)"},children:e}),t?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",lineHeight:1.35},children:t}):null]})})}function c1({value:e,onChange:t,placeholder:n,minRows:r,maxRows:l,className:h,onKeyDown:d}){const p=x.useRef(null);return x.useLayoutEffect(()=>{const g=p.current;if(!g)return;const m=getComputedStyle(g),v=parseFloat(m.lineHeight)||15,_=parseFloat(m.paddingTop)+parseFloat(m.paddingBottom);g.style.height="0px",g.style.height=`${Math.min(Math.max(g.scrollHeight,v*r+_),v*l+_)}px`},[e,r,l]),c.jsx("textarea",{ref:p,rows:r,className:h,value:e,placeholder:n,onChange:g=>t(g.target.value),onKeyDown:d})}function ES({bot:e,onRemove:t}){return c.jsxs("span",{className:"bot-chip",children:[c.jsx(Ui,{bot:e,size:20,animated:!1}),c.jsx("span",{style:{...B("body"),color:"var(--text)",maxWidth:220,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.name}),c.jsx("button",{style:{width:18,height:18,display:"grid",placeItems:"center"},"aria-label":`Remove ${e.name}`,title:`Remove ${e.name}`,onClick:t,children:c.jsx(ae,{name:"xmark",size:10,weight:"semibold",color:"var(--secondary)"})})]})}function G7({open:e,onClose:t,anchor:n,children:r}){const{mounted:l,shown:h}=er(e,120),[d,p]=x.useState(null);if(x.useLayoutEffect(()=>{e&&n.current&&p(n.current.getBoundingClientRect())},[e,n]),x.useEffect(()=>{if(!e)return;const w=b=>{b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),t())};return window.addEventListener("keydown",w,!0),()=>window.removeEventListener("keydown",w,!0)},[e,t]),!l||!d)return null;const g=window.innerWidth,m=window.innerHeight,v=m-d.bottom>=d.top,_=d.left+d.width/2<g*.6,S=Math.max(8,g-Math.min(320,g-16)-8);return Kh.createPortal(c.jsx("div",{className:`anchored ${h?"shown":""}`,onMouseDown:w=>w.target===w.currentTarget&&t(),children:c.jsx("div",{className:"anchored-panel",style:{position:"absolute",[v?"top":"bottom"]:v?d.bottom+6:m-d.top+6,..._?{left:Math.min(Math.max(8,d.left),S)}:{right:Math.min(Math.max(8,g-d.right),S)},transformOrigin:`${v?"top":"bottom"} ${_?"left":"right"}`},children:r})}),document.body)}function Z7({draft:e}){const t=Ne(),n=ss(),r=kS(t),l=!e.id,[h,d]=x.useState(()=>l?t2(t,e,[]):e),[p,g]=x.useState(!1),[m,v]=x.useState(null),_=t.connection.kind==="online";x.useEffect(()=>{l&&r&&d(w=>t2(t,w,r.connectors))},[l,r,t]);const S=()=>{!e2(h)||p||!_||(g(!0),v(null),t.save(bS(h)).then(w=>{n(),l&&t.setSelection(w.id)}).catch(w=>v(Ar(w))).finally(()=>g(!1)))};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:l?"New bot":"Settings",trailing:p?c.jsx(et,{}):c.jsx(ke,{title:l?"Create":"Save",icon:"checkmark",disabled:!e2(h)||p||!_,onClick:S})}),c.jsx("div",{style:{flex:1,minHeight:0},children:c.jsx(MS,{draft:h,onChange:d,error:m,plugins:r})})]})}function X7({botId:e}){const t=Ne(),n=kS(t),[r,l]=x.useState(null),[h,d]=x.useState(null),p=x.useCallback(g=>l(m=>m&&g(m)),[]);return x.useEffect(()=>{const g=t.bots.get(e);l(g?yo(g):null)},[e]),x.useEffect(()=>{const g=t.bots.get(e);if(!r||!g||JSON.stringify(r)===JSON.stringify(yo(g))||!e2(r))return;const m=setTimeout(()=>{t.save(bS(r)).then(()=>d(null)).catch(v=>d(Ar(v)))},600);return()=>clearTimeout(m)},[r]),r?c.jsx(MS,{draft:r,onChange:p,error:h,plugins:n}):null}function MS({draft:e,onChange:t,error:n,plugins:r}){const l=Ne(),[h,d]=x.useState(!1),[p,g]=x.useState(!1),m=x.useRef(null),v=(E,j)=>t(V=>({...V,[E]:j})),_=x.useCallback(E=>t(j=>({...j,model:E})),[t]),S=l.hello?.backends??[],w=S.find(E=>E.id===e.backend),b=r?.connectors??[],k=r?.skills??[];return c.jsxs("div",{className:"bot-form",children:[c.jsxs("div",{className:"bot-form-content",children:[c.jsxs("div",{style:{display:"flex",justifyContent:"center"},children:[c.jsx("button",{ref:m,className:"avatar-button",title:"Edit Bot avatar","aria-label":"Edit Bot avatar",onClick:()=>d(E=>!E),children:c.jsx(nn,{shape:e.avatarShape,color:e.avatarColor,size:56})}),c.jsx(G7,{open:h,onClose:()=>d(!1),anchor:m,children:c.jsx("div",{style:{padding:14,width:300},children:c.jsx(Q7,{shape:e.avatarShape,color:e.avatarColor,onShape:E=>v("avatarShape",E),onColor:E=>v("avatarColor",E)})})})]}),c.jsxs(Ee,{title:"Profile",children:[e.id?c.jsx(po,{label:"Name",children:c.jsx("input",{className:"field-box",value:e.name,placeholder:"Name",onChange:E=>v("name",E.target.value)})}):null,c.jsx(po,{label:"Standing instructions",detail:"Rules that always apply. Put task-specific requests in the chat instead.",children:c.jsx(c1,{className:"field-box",value:e.description,placeholder:"e.g. Reviews PRs. Never pushes without asking.",minRows:3,maxRows:8,onChange:E=>v("description",E)})})]}),c.jsxs(Ee,{title:"Agent",children:[c.jsx(Jt,{label:"Computer",children:c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.hostName})}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsx(Jt,{label:"Agent",children:c.jsx(Ci,{selection:e.backend,options:[...S.map(E=>({id:E.id,label:E.available?E.name:`${E.name} (not installed)`})),{id:"custom",label:"Custom command"}],onChange:E=>v("backend",E)})}),w&&!w.available?c.jsx("span",{style:{...B("caption"),color:"var(--warning)"},children:w.installHint}):null,e.backend==="custom"?c.jsx("input",{className:"field-box fade-in",style:B("callout",void 0,"monospaced"),value:e.command??"",placeholder:"ACP command, e.g. my-agent --acp",spellCheck:!1,onChange:E=>v("command",E.target.value||null)}):null]}),c.jsx(K7,{backend:e.backend,selection:e.model,onChange:_}),c.jsx(Jt,{label:"Workspace",detail:e.cwd?"This project is the default starting folder. The bot can work elsewhere when you ask.":"This bot has its own space for files. It can work in other folders when you ask.",children:c.jsx(Yh,{title:e.cwd||"A persistent workspace allocated for this bot",items:()=>[{title:"Personal workspace",selected:!e.cwd,action:()=>v("cwd","")},{title:"Choose project folder…",selected:!!e.cwd,action:()=>g(!0)}],children:c.jsxs(K3,{outlined:!0,style:{gap:6,color:"var(--text)"},children:[c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:160},children:e.cwd?o1(e.cwd):"Personal"}),c.jsx(ae,{name:"chevron.down",size:10,weight:"semibold",color:"var(--secondary)"})]})})}),c.jsx(Jt,{label:"Permissions",detail:e.permission==="auto"?"Tool requests are approved automatically. Your agent's own settings (like Claude Code's permission rules) still apply.":"You'll get an approval card and a notification whenever the agent asks.",children:c.jsx(Ci,{selection:e.permission,options:[{id:"ask",label:"Ask me"},{id:"auto",label:"Approve automatically"}],onChange:E=>v("permission",E)})})]}),c.jsxs(Ee,{title:"Activity",children:[c.jsx(i2,{title:"Notifications",detail:"Get notified when this bot finishes or needs you",on:e.notify??!0,onChange:E=>v("notify",E)}),l.screen?c.jsx(i2,{title:"Use the computer",detail:l.screen.enabled?"Let this bot see the screen and use the mouse and keyboard. You can watch and take over from your phone.":"Let this bot see the screen and use the mouse and keyboard. Turn on Remote screen in Codync's menu on the computer first.",on:e.computer??!1,onChange:E=>v("computer",E)}):null]}),c.jsx(F_,{title:"Connectors",empty:"No connectors yet. Add GitHub, Linear, Notion and more from Plugins.",items:b.map(E=>({id:E.id,name:E.name,detail:E.command??E.url??""})),selection:e.connectors??[],onChange:E=>v("connectors",E)}),c.jsx(F_,{title:"Skills",empty:"No skills yet. Get some from Plugins, or write your own.",items:k.map(E=>({id:E.id,name:E.name,detail:E.description})),selection:e.skills??[],onChange:E=>v("skills",E)}),e.id?c.jsx(Y7,{botId:e.id}):null,n?c.jsx("span",{className:"fade-in",style:{...B("footnote"),color:"var(--danger)"},children:n}):null]}),c.jsx($t,{open:p,onClose:()=>g(!1),width:460,height:520,children:c.jsx(J7,{start:e.cwd||l.hello?.home||null,onPick:E=>{v("cwd",E),g(!1)}})})]})}function F_({title:e,empty:t,items:n,selection:r,onChange:l}){return c.jsxs(Ee,{title:e,children:[n.length?null:c.jsx("span",{style:{color:"var(--secondary)"},children:t}),n.map(h=>c.jsx(i2,{title:h.name,detail:h.detail||null,on:r.includes(h.id),onChange:d=>l([...r.filter(p=>p!==h.id),...d?[h.id]:[]])},h.id))]})}function Q7({shape:e,color:t,onShape:n,onColor:r}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[c.jsx("div",{className:"swatch-row",children:q3.map(l=>c.jsx("button",{className:`swatch ${l===e?"on":""}`,"aria-label":`${l} shape`,"aria-pressed":l===e,onClick:()=>n(l),children:c.jsx(nn,{shape:l,color:t,size:36})},l))}),c.jsx("div",{className:"swatch-row",children:Ah.map(l=>c.jsx("button",{className:`swatch ${l.id===t?"on":""}`,"aria-label":l.label,"aria-pressed":l.id===t,onClick:()=>r(l.id),children:c.jsx("span",{style:{width:26,height:26,borderRadius:"50%",background:l.hex,display:"block"}})},l.id))})]})}function J7({start:e,onPick:t}){const[n,r]=x.useState([e]),[l,h]=x.useState(!0),d=n[n.length-1]??null;return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[n.length>1?c.jsx("div",{className:"fade-in",style:{paddingLeft:10,display:"flex"},children:c.jsx(ke,{title:"Back",icon:"chevron.left",onClick:()=>{h(!1),r(p=>p.slice(0,-1))}})}):null,c.jsx("div",{style:{flex:1,minWidth:0},children:c.jsx(Lt,{title:d?o1(d):"Folders"})})]}),c.jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden"},children:c.jsx(e9,{path:d,forward:l,onPick:t,onOpen:p=>{h(!0),r(g=>[...g,p])}},n.length)})]})}function e9({path:e,forward:t,onPick:n,onOpen:r}){const l=Ne(),[h,d]=x.useState(null),[p,g]=x.useState(null),[m,v]=x.useState("");x.useEffect(()=>{let S=!0;return l.listDirs(e).then(w=>S&&d(w)).catch(w=>S&&g(Ar(w))),()=>{S=!1}},[l,e]);const _=h?.dirs.filter(S=>!m||S.name.toLowerCase().includes(m.toLowerCase()))??[];return c.jsx("div",{className:`bot-form level-slide ${t?"from-trailing":"from-leading"}`,children:c.jsxs("div",{className:"bot-form-content",style:{gap:14},children:[c.jsx(WC,{value:m,onChange:v}),h?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{footer:h.path,children:c.jsxs("button",{className:"press",style:{display:"flex",alignItems:"center",gap:8,...B("headline"),color:"var(--accent)"},onClick:()=>n(h.path),children:[c.jsx(ae,{name:"checkmark.circle.fill",size:13}),c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:`Use “${o1(h.path)}”`})]})}),_.length?c.jsx(Ee,{children:_.map(S=>c.jsxs("button",{className:"press",style:{display:"flex",alignItems:"center",gap:10},onClick:()=>r(S.path),children:[c.jsx("span",{style:{width:20,display:"flex",justifyContent:"center"},children:c.jsx(ae,{name:S.isGit?"arrow.triangle.branch":"folder",size:12,color:S.isGit?"var(--accent)":"var(--secondary)"})}),c.jsx("span",{style:{flex:1,minWidth:0,color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:S.name}),c.jsx(ae,{name:"chevron.right",size:10,weight:"semibold",color:"var(--tertiary)"})]},S.path))}):null]}):p?c.jsx("span",{style:{color:"var(--danger)"},children:p}):c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:c.jsx(et,{size:20})})]})})}const t9="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%23000'%20fill-rule='evenodd'%20d='M12%201.8C9%201.8%207.6%204.2%207.6%207c0%201.6-.6%202.8-1.6%204.2C4.8%2012.9%204%2014.8%204%2016.8c0%201.2.4%202.2%201%203l-1%201.7c-.2.5.2.9.7.8l3.8-.7c1.1.4%202.3.6%203.5.6s2.4-.2%203.5-.6l3.8.7c.5.1.9-.3.7-.8l-1-1.7c.6-.8%201-1.8%201-3%200-2-.8-3.9-2-5.6-1-1.4-1.6-2.6-1.6-4.2%200-2.8-1.4-5.2-4.4-5.2ZM12%2010.6c-2.4%200-4%202.7-4%205.6%200%202.4%201.7%203.8%204%203.8s4-1.4%204-3.8c0-2.9-1.6-5.6-4-5.6ZM10.4%205.3a.9.9%200%201%200%200%201.8.9.9%200%200%200%200-1.8Zm3.2%200a.9.9%200%201%200%200%201.8.9.9%200%200%200%200-1.8ZM10.9%208.1h2.2L12%209.5Z'/%3e%3c/svg%3e",i9=e=>({laptop:"laptopcomputer",macmini:"macmini",macstudio:"macstudio",imac:"desktopcomputer",macpro:"macpro.gen3"})[e??""]??"desktopcomputer";function Va({computer:e,size:t=36}){const n=e?.color?ko(e.color):"var(--text)";return c.jsx("span",{"aria-hidden":!0,style:{width:t,height:t,display:"grid",placeItems:"center",flex:"none",color:n},children:e?.device==="linux"?c.jsx("span",{style:{width:t*.55,height:t*.55,backgroundColor:n,WebkitMaskImage:`url("${t9}")`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):c.jsx(ae,{name:i9(e?.device),size:t*.5,weight:"medium"})})}const s9=e=>["pending","starting","running","recovering"].includes(e.status),n9=()=>({kind:"cron",amount:"1",unit:3600,calendarStyle:"daily",weekday:1,selectedDays:[],monthDay:1,minuteStep:15,hour:9,minute:0,at:0,expression:"",zone:"",original:[]}),K_=(e,t)=>!!e&&!!t&&JSON.stringify(e)===JSON.stringify(t),Kn=e=>e instanceof Error?e.message:String(e);function Wn({label:e,detail:t,children:n}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[c.jsx("span",{style:{color:"var(--text)"},children:e}),t?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",lineHeight:1.4},children:t}):null]}),n]})}function r9({botId:e,routineId:t}){const n=Ne(),[r,l]=x.useState(null),[h,d]=x.useState(null),[p,g]=x.useState(!1),[m,v]=x.useState(null),[_,S]=x.useState(!1),[w,b]=x.useState(!1),k=async V=>{b(V);try{const A=await(await n.ready()).call("routineWebhook",{botId:e,id:t,rotate:V});l(A),V&&(v(null),g(!0)),d(null)}catch(A){d(Kn(A))}finally{b(!1)}};x.useEffect(()=>{k(!1)},[t]);const E=(V,A,z)=>c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 6px 8px 12px",background:"var(--bubble-user)",borderRadius:12},children:[c.jsx("span",{style:{...B("callout",void 0,"monospaced"),flex:1,minWidth:0,userSelect:"text",wordBreak:"break-all",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:V}),z,c.jsx(ke,{title:m===A?"Copied":"Copy",icon:m===A?"checkmark":"doc.on.doc",onClick:()=>{r&&(window.codync.app.copy(A==="key"?r.key:r.url??r.localUrl),v(A))}})]}),j={...B("caption"),paddingLeft:4,lineHeight:1.4};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[r?c.jsxs(c.Fragment,{children:[c.jsx(Wn,{label:r.url?"URL":"Local URL",children:E(r.url??r.localUrl,"url")}),c.jsx(Wn,{label:"Key",children:E(p?r.key:"•".repeat(16),"key",c.jsxs(c.Fragment,{children:[c.jsx(ke,{title:p?"Hide key":"Show key",icon:p?"eye.slash":"eye",onClick:()=>g(V=>!V)}),c.jsx(ke,{title:"Replace key",icon:"arrow.triangle.2.circlepath",disabled:w||n.isOffline,onClick:()=>S(!0)})]}))}),c.jsx("span",{style:{...j,color:"var(--secondary)"},children:r.url?"POST with Authorization: Bearer <key>. For GitHub, use content type application/json and the key as the secret. Deliveries wait up to 72 hours while this computer is off. They pass through the Codync cloud, which can read them.":"The Codync cloud is off, so only this computer can send to it."})]}):h?c.jsx("span",{style:{...j,color:"var(--danger)"},children:h}):c.jsx("span",{style:{...j,color:"var(--secondary)"},children:"Loading webhook…"}),c.jsx(ts,{open:_,title:"Replace the key?",message:"Senders using the current key stop working until they get the new one.",actions:[{title:"Replace key",destructive:!0,action:()=>{k(!0)}}],onClose:()=>S(!1)})]})}const F0={...B("caption"),paddingLeft:4,lineHeight:1.4};function a9({botId:e,routine:t,saved:n}){const r=Ne(),[l,h]=x.useState(t?.name??""),[d,p]=x.useState(t?.instruction??""),[g,m]=x.useState(n9),[v,_]=x.useState(String(t?.timeoutSeconds??3600)),[S,w]=x.useState(!1),[b,k]=x.useState(null),[E,j]=x.useState(!1),[V,A]=x.useState(!1),[z,F]=x.useState(null),[R,I]=x.useState(null),[q,U]=x.useState(null),[Y,$]=x.useState(!1),[M,N]=x.useState(!1),L=x.useRef(g);L.current=g;const O=t?t.triggers.length===1?!["cron","webhook"].includes(t.triggers[0].type):t.triggers.length>0:!1,P=[...t&&O?[{id:"keep",label:t.triggerDescriptions.join(" · ")}]:[],{id:"cron",label:"Schedule"},{id:"webhook",label:"Webhook"}],te=!!l.trim()&&!!d.trim()&&!r.isOffline&&!S&&V&&K_(q,g)&&R===null,Q=async()=>{try{const le=await(await r.ready()).call("routineSchedule",{triggers:t?.triggers??[],timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone}),he={...le.draft,calendarStyle:"custom"};["cron","webhook"].includes(he.kind)||(he.kind="keep"),m(he),F(le),U(le.draft),A(!0),k(null)}catch(J){k(Kn(J))}},ce=async()=>{const J=L.current;F(null),I(null),U(null);try{const le=await(await r.ready()).call("routineSchedule",{draft:J});if(L.current!==J)return;F(le),U(J)}catch(le){if(L.current!==J)return;I(Kn(le))}};x.useEffect(()=>{Q()},[]),x.useEffect(()=>{if(!V)return;const J=setTimeout(()=>{ce()},300);return()=>clearTimeout(J)},[g]);const re=async()=>{if(te){document.activeElement?.blur(),w(!0),k(null);try{const le=await(await r.ready()).call("saveRoutine",{botId:e,id:t?.id??null,name:l,instruction:d,schedule:g,timeoutSeconds:v});n(le.routine)}catch(J){k(Kn(J))}finally{w(!1)}}},de=x.useRef(re);de.current=re,x.useEffect(()=>{const J=le=>{(le.metaKey||le.ctrlKey)&&le.key==="s"&&(le.preventDefault(),de.current())};return window.addEventListener("keydown",J),()=>window.removeEventListener("keydown",J)},[]);const Ce=J=>m(le=>({...le,...J})),je=K_(q,g)?z:null,D=()=>{switch(g.kind){case"cron":return c.jsxs("div",{className:"routine-cron",style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{className:"routine-cron-fields",children:[c.jsx(Wn,{label:"Cron",children:c.jsx("input",{className:"routine-input",style:B("body",void 0,"monospaced"),value:g.expression,placeholder:"0 9 * * 1-5",spellCheck:!1,autoCorrect:"off",onChange:J=>Ce({expression:J.target.value})})}),c.jsx(Wn,{label:"Time zone",children:c.jsx("input",{className:"routine-input",value:g.zone,placeholder:"Asia/Taipei",spellCheck:!1,autoCorrect:"off",onChange:J=>Ce({zone:J.target.value})})})]}),c.jsx("div",{style:{paddingLeft:4},children:R?c.jsx("span",{style:{...B("caption"),color:"var(--danger)",lineHeight:1.4},children:R}):je?c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[c.jsx("span",{style:B("caption","medium"),children:je.summary}),je.nextRunAt?c.jsxs("span",{style:{...B("caption"),color:"var(--secondary)"},children:["Next ",new Date(je.nextRunAt).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})]}):null,je.warning?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:je.warning}):null]}):c.jsx("span",{style:{...B("caption",void 0,"monospaced"),color:"var(--tertiary)",whiteSpace:"pre"},children:"minute hour day month weekday"})})]});case"webhook":return t&&t.triggers.some(J=>J.type==="webhook"||J.type==="event")?c.jsx(r9,{botId:e,routineId:t.id}):c.jsx("span",{style:{...F0,color:"var(--secondary)"},children:"Runs each time something is posted to its URL. Save to get the URL and key."});default:return c.jsx("span",{style:{...F0,color:"var(--secondary)"},children:"Set up by the bot. Pick Schedule or Webhook to replace it."})}};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",maxHeight:700,minHeight:0,background:"var(--background)",color:"var(--text)",...B(13)},children:[c.jsx(Lt,{title:t?"Edit routine":"Set up a routine"}),c.jsx("fieldset",{className:"routine-form",disabled:S||!V,style:{flex:"1 1 auto",minHeight:0,overflowY:"auto"},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24,padding:20},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[c.jsx(Wn,{label:"Name",children:c.jsx("input",{className:"routine-input",value:l,placeholder:"e.g. Morning summary",onChange:J=>h(J.target.value)})}),c.jsx(Wn,{label:"Instruction",children:c.jsx("textarea",{className:"routine-input",value:d,placeholder:"Describe what this bot should do each time it runs.",onChange:J=>p(J.target.value)})})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[c.jsx(Wn,{label:"When to run",children:c.jsx(Ci,{selection:g.kind,options:P,onChange:J=>Ce({kind:J}),fits:!0})}),V?D():c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--secondary)"},children:[c.jsx(ae,{name:"clock",size:12}),"Loading schedule…"]})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[c.jsxs("button",{className:"press","aria-expanded":E,onClick:()=>j(J=>!J),style:{display:"flex",alignItems:"center",gap:6,paddingLeft:4,...B("compactSecondary"),color:"var(--secondary)",width:"100%"},children:["Run settings",c.jsx("span",{style:{display:"flex",transform:`rotate(${E?180:0}deg)`,transition:"transform var(--layout)"},children:c.jsx(ae,{name:"chevron.down",size:10,weight:"semibold"})}),c.jsx("span",{style:{flex:1}}),E?null:c.jsxs("span",{style:{color:"var(--tertiary)"},children:["Timeout ",v,"s"]})]}),E?c.jsxs("div",{className:"routine-fade",style:{display:"flex",flexDirection:"column",gap:12},children:[c.jsx(Wn,{label:"Timeout (seconds)",children:c.jsx("input",{className:"routine-input",value:v,placeholder:"3600",onChange:J=>_(J.target.value)})}),c.jsx("span",{style:{...F0,color:"var(--secondary)"},children:"A run is stopped after this long. 1 second to 24 hours."})]}):null]})]})}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:20,flex:"none"},children:[R!==null?c.jsx("button",{className:"press",style:{alignSelf:"flex-start"},disabled:r.isOffline,onClick:()=>{ce()},children:"Check schedule again"}):null,!V&&b!==null?c.jsx("button",{className:"press",style:{alignSelf:"flex-start"},onClick:()=>{Q()},children:"Retry loading schedule"}):null,g.kind!=="cron"&&R?c.jsx("span",{style:{...B("caption"),color:"var(--danger)"},children:R}):null,b?c.jsxs("span",{style:{display:"flex",gap:6,alignItems:"flex-start",...B("callout"),color:"var(--danger)",userSelect:"text"},children:[c.jsx(ae,{name:"exclamationmark.circle",size:12,style:{marginTop:1}}),b]}):null,r.isOffline?c.jsxs("span",{style:{display:"flex",gap:6,alignItems:"center",...B("caption"),color:"var(--danger)"},children:[c.jsx(ae,{name:"wifi.slash",size:10}),"Connect to this computer to save your routine."]}):null,c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[t?c.jsxs(c.Fragment,{children:[c.jsx(ke,{title:"Delete routine",icon:"trash",onClick:()=>$(!0)}),c.jsx(ke,{title:M?"Started":"Test run",icon:M?"checkmark":"play.circle",disabled:M||r.isOffline,onClick:async()=>{try{await(await r.ready()).call("runRoutine",{botId:e,id:t.id}),N(!0)}catch(J){k(Kn(J))}}})]}):null,c.jsx("span",{style:{flex:1}}),c.jsxs(Fe,{disabled:!te,onClick:()=>{re()},title:"Save (⌘S)",children:[S?c.jsx(et,{size:12}):null,S?"Saving…":t?"Save changes":"Create routine"]})]})]}),c.jsx(ts,{open:Y,title:"Delete routine?",message:"This deletes the routine and stops its future runs. This can't be undone.",actions:[{title:"Delete routine",destructive:!0,action:async()=>{if(t)try{await(await r.ready()).call("deleteRoutine",{botId:e,id:t.id}),n(null)}catch(J){k(Kn(J))}}}],onClose:()=>$(!1)})]})}function Y_(e){switch(e.status){case"pending":return"Queued";case"starting":return"Starting";case"running":return"Running";case"recovering":return"Resuming after restart";case"failed":return"Failed";case"interrupted":return"Interrupted";default:return e.status.charAt(0).toUpperCase()+e.status.slice(1)}}function l9({botId:e,initialId:t,onClose:n}){const r=Ne(),[l,h]=x.useState([]),[d,p]=x.useState([]),[g,m]=x.useState(null),[v,_]=x.useState(!1),[S,w]=x.useState(!1),[b,k]=x.useState(null),[E,j]=x.useState(null),V=x.useRef(e);V.current=e;const A=Y=>m({id:crypto.randomUUID(),routineId:Y}),z=async()=>{const Y=e;try{const $=await(await r.ready()).call("routines",{botId:Y});if(V.current!==Y)return;h($.routines),p($.runs),_(!0),j(null)}catch($){V.current===Y&&j(Kn($))}};x.useEffect(()=>{t&&A(t)},[t]),x.useEffect(()=>{h([]),p([]),_(!1);let Y=!1,$;const M=async()=>{await z(),Y||($=setTimeout(M,3e3))};return M(),()=>{Y=!0,clearTimeout($)}},[e]);const F=async(Y,$,M)=>{if(!S){w(!0);try{await(await r.ready()).call(Y,{botId:e,id:$.id,enabled:M??null}),k(null),await z()}catch(N){k(Kn(N))}finally{w(!1)}}},R=Y=>{const $=d.find(N=>N.routineId===Y.id&&s9(N));if($)return Y_($);if(Y.lastError)return"Schedule needs attention";const M=d.find(N=>N.routineId===Y.id);return M&&["failed","interrupted"].includes(M.status)?`Last run ${Y_(M).toLowerCase()}`:Y.triggerDescriptions.join(" · ")},I=(Y,$)=>{$&&h(M=>M.some(N=>N.id===$.id)?M.map(N=>N.id===$.id?$:N):[...M,$]),Y.routineId===null&&$&&$.triggers.some(M=>M.type==="webhook")?m({id:Y.id,routineId:$.id}):m(null),z()},q=l.find(Y=>Y.id===g?.routineId)??null,U={background:"var(--surface)",borderRadius:16};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:n?16:10,color:"var(--text)",...B(13)},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c.jsx("span",{style:{...B(13,"semibold"),paddingLeft:2},children:"Routines"}),c.jsx("span",{style:{flex:1}}),c.jsx(ke,{title:"Ask the bot for a routine",icon:"text.bubble",disabled:r.isOffline,onClick:()=>{r.setRoutineDraft(e,"I want a routine that "),n?.()}}),c.jsx(ke,{title:"Set up a routine",icon:"plus",disabled:r.isOffline,onClick:()=>A(null)}),n?c.jsx(ke,{title:"Close routines",icon:"xmark",onClick:n}):null]}),E?c.jsx("span",{style:{...B("caption"),color:"var(--danger)"},children:E}):null,b?c.jsx("span",{style:{...B("caption"),color:"var(--danger)",userSelect:"text"},children:b}):null,l.length===0?c.jsx("div",{style:{...U,...B(12),lineHeight:1.45,color:"var(--secondary)",padding:14},children:v?"No routines yet. Ask the bot for one, or set it up yourself with +.":"Loading routines…"}):c.jsx("div",{style:{...U,padding:"0 14px"},children:l.map((Y,$)=>c.jsxs(x.Fragment,{children:[$>0?c.jsx($C,{}):null,c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[c.jsxs("button",{className:"routine-row",onClick:()=>A(Y.id),children:[c.jsx("span",{style:{color:"var(--text)"},children:Y.name}),c.jsx("span",{style:{...B("caption"),color:Y.lastError?"var(--danger)":"var(--secondary)"},children:R(Y)})]}),c.jsx("span",{"aria-label":Y.name,style:{display:"flex"},children:c.jsx(rn,{on:Y.enabled,disabled:S||r.isOffline,onChange:M=>{F("setRoutineEnabled",Y,M)}})})]})]},Y.id))}),c.jsx($t,{open:g!==null&&(g.routineId===null||q!==null),onClose:()=>m(null),width:540,children:g?c.jsx(a9,{botId:e,routine:q,saved:Y=>I(g,Y)},g.id):null})]})}function h1({title:e,icon:t,onClick:n,direction:r=[0,0],size:l=32,className:h}){return c.jsx("button",{className:`mac-chat-button ${h??""}`,title:e,"aria-label":e,onClick:n,style:{width:l,height:l,"--dx":r[0],"--dy":r[1]},children:c.jsx(ae,{name:t,size:l/2,weight:"medium"})})}const G_=window.codync.platform==="darwin";function o9({botId:e,routineId:t,editing:n,setEditing:r,editGroup:l,share:h,close:d}){const g=Ne().bots.get(e)??null,[m,v]=x.useState(!1);let _;return n?_=c.jsxs(c.Fragment,{children:[c.jsx(Gl,{label:"Back to details",symbol:"chevron.left",action:()=>{v(!0),r(!1)}}),c.jsx(K0,{children:"Settings"}),c.jsx("span",{style:{flex:1}})]}):g&&At(g)?_=c.jsxs(c.Fragment,{children:[c.jsx(K0,{children:"Members"}),c.jsx("span",{style:{flex:1}}),c.jsx(Gl,{label:"Edit group",symbol:"gearshape",action:l})]}):_=c.jsxs(c.Fragment,{children:[c.jsx(K0,{children:"Details"}),c.jsx("span",{style:{flex:1}}),c.jsx(Gl,{label:"Create template",symbol:"square.and.arrow.up",action:h}),c.jsx(Gl,{label:"Bot settings",symbol:"gearshape",action:()=>r(!0)})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,height:54,padding:"0 12px",flex:"none"},children:[_,c.jsx(Gl,{label:"Close details",symbol:"chevron.right.2",action:d})]}),c.jsx("div",{style:{flex:1,minHeight:0,position:"relative",overflow:"hidden"},children:g&&At(g)?c.jsx(c9,{group:g}):n?c.jsx("div",{className:"panel-slide from-trailing",style:{height:"100%"},children:c.jsx(X7,{botId:e})}):c.jsx("div",{className:m?"panel-slide from-leading":void 0,style:{height:"100%",overflowY:"auto"},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:28,padding:"4px 16px 24px"},children:[c.jsx(h9,{botId:e}),c.jsx(l9,{botId:e,initialId:t}),g?c.jsx(u9,{bot:g}):null]})})})]})}function K0({children:e}){return c.jsx("span",{style:{...B(15,"semibold"),color:"var(--text)",paddingLeft:4},children:e})}function Gl({label:e,symbol:t,action:n}){return c.jsx(h1,{title:e,icon:t,direction:t==="chevron.right.2"?[1,0]:[0,0],onClick:n})}function c9({group:e}){const t=Ne();return c.jsxs("div",{style:{height:"100%",overflowY:"auto",padding:"0 16px"},children:[c.jsxs("div",{style:{...B(13,"semibold"),paddingBottom:6},children:[e.members.length," bots"]}),t.members(e).map(n=>c.jsxs("button",{className:"press",title:`Open ${n.name}'s own chat`,onClick:()=>t.setSelection(n.id),style:{display:"flex",alignItems:"center",gap:10,padding:"6px 0",width:"100%"},children:[c.jsx(Ui,{bot:n,size:26}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:1,minWidth:0,flex:1},children:[c.jsx("span",{style:{...B(13),color:"var(--text)"},children:n.name}),c.jsx("span",{style:{...B(11),color:"var(--tertiary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Jn(n)?n.activity||"Working…":bo(n)})]})]},n.id))]})}function h9({botId:e}){const t=Ne(),n=t.screen,r=!t.isOffline&&!!n?.enabled&&n.connected&&n.capture,l=n?.enabled?n.connected?n.capture?n.agentBot===e?"cursorarrow.motionlines":"checkmark.circle":"exclamationmark.circle":"arrow.triangle.2.circlepath":"power",h=n?.enabled?n.connected?n.capture?n.agentBot===e?`This bot is using your ${G_?"Mac":"computer"}`:"Ready to connect":"Screen recording permission needed":"Connecting to computer…":"Remote screen is off";return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:16,background:"var(--surface)",borderRadius:16},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[c.jsx(Va,{computer:t.computer,size:32}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,minWidth:0},children:[c.jsx("span",{style:{...B(15,"medium"),color:"var(--text)",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:t.hostName}),c.jsx("span",{style:{...B(13),color:"var(--secondary)"},children:"Remote screen"})]})]}),t.isOffline?null:c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,...B(13),color:"var(--text)"},children:[c.jsx(ae,{name:l,size:13}),h]}),r?c.jsxs("div",{style:{...B(12),color:"var(--secondary)",marginTop:-8},children:["View and control this ",G_?"Mac":"computer"," from your iPhone."]}):null]})}function Y0({label:e,children:t,title:n}){return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,...B(13)},children:[c.jsx("span",{style:{color:"var(--secondary)"},children:e}),c.jsx("span",{style:{flex:1,minWidth:8}}),c.jsx("span",{title:n,style:{color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"flex",alignItems:"center",gap:6,minWidth:0},children:t})]})}function u9({bot:e}){const t=Ne();return c.jsxs(Ee,{title:"Agent",footer:e.description||null,children:[c.jsxs(Y0,{label:"Runtime",children:[c.jsx(wS,{registry:t.hello?.backends.find(n=>n.id===e.backend)?.registry,size:14}),c.jsx("span",{children:t.backendName(e.backend)})]}),c.jsx(Y0,{label:e.managedWorkspace?"Workspace":"Folder",title:e.managedWorkspace?"Personal workspace, managed by Codync":e.cwd,children:e.managedWorkspace?"Personal":bo(e)}),e.model?c.jsx(Y0,{label:"Model",children:e.model}):null]})}function jS({botId:e,thread:t=null}){const n=Ne(),r=new Map;for(const d of n.allEntries(e))(d.threadId??null)===t&&r.set(d.turn,[...r.get(d.turn)??[],d]);const l=[...r.entries()].sort((d,p)=>d[0]-p[0]),h=x.useRef(null);return x.useLayoutEffect(()=>{const d=h.current;d&&(d.scrollTop=d.scrollHeight)},[]),c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:"Full conversation"}),c.jsx("div",{ref:h,style:{flex:1,overflowY:"auto"},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14,padding:14,fontSize:"calc(12px * var(--scale))"},children:[l.length===0?c.jsx("span",{style:{color:"var(--tertiary)"},children:"Nothing yet."}):null,l.map(([d,p])=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsx("div",{style:{...B("compactSecondary","semibold"),color:"var(--text)",paddingLeft:4,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.find(g=>g.kind==="user")?.data.text??`Turn ${d}`}),c.jsx(Ee,{children:p.map(g=>c.jsx(d9,{entry:g},g.id))})]},d))]})})]})}function hh({icon:e,children:t,style:n}){return c.jsxs("span",{style:{display:"flex",alignItems:"flex-start",gap:6,...n},children:[c.jsx("span",{style:{display:"flex",alignItems:"center",minHeight:"1.25em"},children:e}),c.jsx("span",{style:{minWidth:0},children:t})]})}function d9({entry:e}){const[t,n]=x.useState(!1),r=e.data;switch(e.kind){case"user":return c.jsx(hh,{icon:c.jsx(ae,{name:"person.fill",size:11,color:"var(--secondary)"}),style:B("subheadline"),children:c.jsx("span",{style:{color:"var(--text)"},children:r.text??""})});case"agent":return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[c.jsx("span",{style:{...B("caption2","semibold"),color:"var(--tertiary)"},children:r.final?"Reply":"Said"}),c.jsx(lS,{text:r.text??""})]});case"thought":return c.jsx(G2,{expanded:t,onToggle:()=>n(l=>!l),label:c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,...B("subheadline"),color:"var(--secondary)"},children:[c.jsx(on,{size:16,color:"var(--secondary)",animated:!1}),"Thinking"]}),children:c.jsx("div",{className:"selectable",style:{...B("footnote"),color:"var(--secondary)",whiteSpace:"pre-wrap"},children:r.text??""})});case"tool":return c.jsx(p9,{data:r});case"plan":return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[c.jsx(hh,{icon:c.jsx(ae,{name:"checklist",size:11,weight:"bold"}),style:B("subheadline","bold"),children:"Plan"}),(r.entries??[]).map((l,h)=>c.jsx(hh,{style:B("footnote"),icon:c.jsx(ae,{name:l.status==="completed"?"checkmark.circle.fill":l.status==="in_progress"?"circle.dotted":"circle",size:10,color:l.status==="completed"?"var(--accent)":"var(--tertiary)"}),children:c.jsx("span",{style:{color:"var(--text)",textDecoration:l.status==="completed"?"line-through":void 0},children:l.content})},h))]});case"permission":return c.jsx(hh,{icon:c.jsx(ae,{name:"hand.raised",size:11}),style:{...B("subheadline"),color:"var(--secondary)"},children:r.title??"Approval"});default:return c.jsx("span",{style:{...B("footnote"),color:"var(--tertiary)"},children:r.text??""})}}const f9=e=>({read:"doc.text",edit:"pencil",delete:"trash",move:"arrow.right.doc.on.clipboard",search:"magnifyingglass",execute:"terminal",think:"brain",fetch:"globe"})[e??""]??"wrench.and.screwdriver";function p9({data:e}){const[t,n]=x.useState(!1),r=!!e.output||!!e.diffs?.length,l=c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8,...B("caption"),flex:1,minWidth:0},children:[c.jsx("span",{style:{width:18,display:"flex",justifyContent:"center",color:"var(--secondary)"},children:c.jsx(ae,{name:f9(e.toolKind),size:10})}),c.jsx("span",{style:{...B("subheadline"),color:"var(--text)",flex:1,minWidth:0,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:e.title??"Tool"}),e.status==="completed"?c.jsx(ae,{name:"checkmark",size:10,color:"var(--accent)"}):e.status==="failed"?c.jsx(ae,{name:"xmark",size:10,color:"var(--danger)"}):c.jsx(on,{state:e.toolKind==="search"?"searching":e.toolKind==="fetch"?"connecting":"working",size:16,color:"var(--secondary)"})]});return r?c.jsx(G2,{expanded:t,onToggle:()=>n(h=>!h),label:l,children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(e.diffs??[]).map((h,d)=>c.jsx(oS,{diff:h},d)),e.output?c.jsx(Wf,{text:e.output}):null]})}):l}function TS(e,t,n){const r=x.useId(),l=e.connection.kind;x.useEffect(()=>{const h=()=>e.setReading(r,t,n,document.visibilityState==="visible"&&document.hasFocus());return h(),window.addEventListener("focus",h),window.addEventListener("blur",h),document.addEventListener("visibilitychange",h),()=>{window.removeEventListener("focus",h),window.removeEventListener("blur",h),document.removeEventListener("visibilitychange",h),e.setReading(r,t,n,!1)}},[e,r,t,n,l])}function Z_({botId:e,rootId:t,close:n}){const r=Ne(),l=r.bots.get(e)??null,h=r.allEntries(e).find(b=>b.id===t),d=r.replies(e,t),p=!!l&&$2(l,e,t)&&!r.isOffline,g=Vf(d),m=sS([...g.map(b=>b.id),...p?["working"]:[]],!0),[v,_]=x.useState(!1),S=x.useRef(null);TS(r,e,t),x.useEffect(()=>{r.loadThread(e,t)},[r,e,t]),x.useLayoutEffect(()=>{const b=S.current;b&&(b.scrollTop=b.scrollHeight)},[d.length,d[d.length-1]?.data.text,p]);const w=()=>_(!0);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,height:48,padding:"0 10px 0 16px",flex:"none"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[c.jsx("span",{style:{...B("compactBody","semibold"),color:"var(--text)"},children:"Thread"}),c.jsx("span",{style:{...B("caption"),color:"var(--tertiary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l?.name??""})]}),c.jsx(ke,{title:"Close thread",icon:"xmark",onClick:n})]}),c.jsx("div",{style:{height:.5,background:"var(--border)",flex:"none"}}),c.jsx("div",{ref:S,style:{flex:1,overflowY:"auto"},children:c.jsxs("div",{style:{padding:"8px 16px 0"},children:[h?c.jsxs(c.Fragment,{children:[c.jsx(Jf,{entry:h,groupStart:!0,chat:l,openTrace:w}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"12px 0"},children:[c.jsx("span",{style:{...B("caption"),color:"var(--tertiary)",whiteSpace:"nowrap"},children:d.length===0?"No replies yet":d.length===1?"1 reply":`${d.length} replies`}),c.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}})]})]}):null,g.map(b=>b.kind==="entry"?c.jsx("div",{className:m.has(b.id)?nS(b):void 0,children:c.jsx(Jf,{entry:b.entry,groupStart:b.groupStart,chat:l,openTrace:w})},b.id):null),l&&p?c.jsx("div",{className:m.has("working")?"row-in":void 0,style:{paddingTop:6},children:c.jsx(yS,{bot:l,thinking:r.currentThinking(e,t)})}):null,c.jsx("div",{style:{height:8}})]})}),c.jsx("div",{style:{flex:"none"},children:r.mismatch?c.jsx("div",{style:{padding:"0 16px 8px"},children:c.jsx(J2,{})}):c.jsx(xS,{botId:e,thread:t})}),c.jsx($t,{open:v,onClose:()=>_(!1),width:620,height:560,children:c.jsx(jS,{botId:e,thread:t})})]})}function g9({group:e,members:t=[]}){const n=Ne(),r=ss(),l=e?.id??null,[h,d]=x.useState(e?.name??""),[p,g]=x.useState(e?.description??""),[m,v]=x.useState(e?.members??t),[_,S]=x.useState(""),[w,b]=x.useState(!1),[k,E]=x.useState(null),[j,V]=x.useState(null),A=m.map(M=>n.bots.get(M)).filter(M=>!!M),z=_.trim().toLowerCase(),F=n.roster.filter(M=>!At(M)&&!m.includes(M.id)&&(!z||M.name.toLowerCase().includes(z))),R=l===null,I=m.length>0&&!w,q=A.length?A.map(M=>M.name).join(", "):"Name",U=l?n.bots.get(l):void 0,Y=M=>{v(N=>N.includes(M)?N.filter(L=>L!==M):[...N,M]),S("")},$=()=>{b(!0),E(null);const N=h.trim()||q,L=p.trim(),O=l?n.updateGroup({id:l,kind:"group",name:N,description:L,members:m,pinned:n.bots.get(l)?.pinned}):n.createGroup(N,L,m);Promise.resolve(O).then(()=>r()).catch(P=>E(Ar(P))).finally(()=>b(!1))};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:R?"New group chat":"Group chat",trailing:w?c.jsx(et,{}):c.jsx(ke,{title:R?"Create":"Save",icon:"checkmark",disabled:!I,onClick:$})}),c.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto"},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16,...B("body")},children:[c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:c.jsx(Eo,{members:A,size:72})}),c.jsxs(po,{label:`Bots · ${m.length}`,children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[A.length?c.jsx("div",{className:"chip-row",children:A.map(M=>c.jsx(ES,{bot:M,onRemove:()=>Y(M.id)},M.id))}):null,c.jsx("input",{className:"field-box",value:_,placeholder:A.length?"Add another bot":"Search bots",onChange:M=>S(M.target.value),onKeyDown:M=>{M.key==="Enter"&&!M.nativeEvent.isComposing&&F[0]&&Y(F[0].id)}}),c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:F.map(M=>c.jsxs("button",{className:"press pick-row fade-in","aria-label":`Add ${M.name}`,onClick:()=>Y(M.id),children:[c.jsx(Ui,{bot:M,size:26,animated:!1}),c.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[c.jsx("span",{style:{color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:M.name}),c.jsx("span",{style:{...B("caption"),color:"var(--tertiary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:bo(M)})]}),c.jsx(ae,{name:"plus.circle",size:20,color:"var(--tertiary)"})]},M.id))})]}),c.jsx("span",{style:{...B("caption"),color:"var(--tertiary)"},children:"Everyone answers in turn unless you @mention someone. Each bot works in its own folder with its own tools."})]}),c.jsx(po,{label:"Name",children:c.jsx("input",{className:"field-box",value:h,placeholder:q,onChange:M=>d(M.target.value)})}),c.jsx(po,{label:"About",children:c.jsx(c1,{className:"field-box",value:p,placeholder:"What this group works on (optional)",minRows:2,maxRows:5,onChange:g})}),k?c.jsx("span",{className:"fade-in",style:{...B("footnote"),color:"var(--danger)"},children:k}):null,U?c.jsx("div",{style:{paddingTop:8},children:c.jsx(Fe,{kind:"secondary",onClick:()=>V(U),children:"Delete group chat"})}):null]})}),c.jsx(m9,{bot:j,onClose:()=>V(null),onDeleted:r})]})}function m9({bot:e,onClose:t,onDeleted:n}){const r=Ne();return c.jsx(ts,{open:e!==null,title:`Delete ${e?.name??"bot"}?`,message:e&&At(e)?"Its bots and their own chats stay.":"Files it changed on your computer stay as they are.",actions:[{title:"Delete bot and its conversation",destructive:!0,action:()=>{e&&r.delete(e),n()}}],onClose:t})}function v9(e){const{id:t,pinned:n,hidden:r,...l}=e,h=Object.fromEntries(Object.entries(l).filter(([,d])=>d!=null).sort(([d],[p])=>d<p?-1:d>p?1:0));return JSON.stringify(h,null,2).replace(/^(\s*"(?:[^"\\]|\\.)*"): /gm,"$1 : ")}function _9({draft:e}){const t=x.useMemo(()=>v9(e),[e]),[n,r]=x.useState(!1),l=()=>{navigator.clipboard.writeText(t).then(()=>r(!0))};return x.useEffect(()=>{const h=d=>{d.key==="Enter"&&!d.isComposing&&(d.preventDefault(),l())};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)}),c.jsxs("div",{style:{width:560,height:540,display:"flex",flexDirection:"column",background:"var(--background)"},children:[c.jsx(Lt,{title:"Create template"}),c.jsxs("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",gap:20,padding:"0 24px 24px"},children:[c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)"},children:e.name}),c.jsx("span",{style:{...B("callout"),color:"var(--secondary)"},children:"Copy this bot’s settings to reuse as a template. Conversation history and conversation ID are excluded."}),c.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto",background:"var(--surface)",borderRadius:12},children:c.jsx("pre",{className:"selectable",style:{...B(12,"regular","monospaced"),margin:0,padding:16,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:t})}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",flex:1},children:"Includes workspace preferences and agent configuration."}),c.jsxs("button",{className:"press",style:{...B(13,"semibold"),display:"flex",alignItems:"center",gap:6,padding:"9px 14px",color:"var(--on-accent)",background:"var(--accent-fill)",borderRadius:9},onClick:l,children:[c.jsx(ae,{name:n?"checkmark":"square.on.square",size:13,weight:"semibold",className:"fade-in"},n?"checkmark":"square.on.square"),n?"Copied":"Copy template"]})]})]})]})}const y9=["openai","gemini"],Xn={openai:{name:"OpenAI",keyPage:"https://platform.openai.com/api-keys",keyPrompt:"sk-…",defaults:{realtime:"gpt-realtime-2.1",transcribe:"gpt-transcribe",speech:"gpt-4o-mini-tts"},voices:["marin","cedar","alloy","ash","ballad","coral","echo","sage","shimmer","verse"]},gemini:{name:"Gemini",keyPage:"https://aistudio.google.com/apikey",keyPrompt:"AIza…",defaults:{realtime:"gemini-3.8-live",transcribe:"gemini-3.8-flash",speech:"gemini-3.8-flash-tts"},voices:["Kore","Puck","Charon","Fenrir","Aoede","Leda","Orus","Zephyr"]}},DS=e=>e==="openai"||e==="gemini",G0=(e,t)=>e.providers.some(n=>n.provider===t&&n.configured),RS=bi("callEngine","device"),AS=.5,NS=bi("callRate",AS),s2=bi("callPause",1.5),LS=bi("callLanguage","");function S9(e){const t=new Intl.DisplayNames([navigator.language],{type:"language"}),n=r=>{try{return t.of(r.replace("_","-"))??r}catch{return r}};return[{id:"",label:"System"},...e.map(r=>({id:r,label:n(r)})).sort((r,l)=>r.label.localeCompare(l.label))]}const Z0=new Map;function an(e,t){return Z0.has(e)||Z0.set(e,bi(e,t)),Z0.get(e)}const u1=e=>an(`callMode.${e}`,"realtime"),BS=e=>an(`callVoice.${e}`,null),OS=e=>an(`callDefaults.${e}`,null),X_=e=>an(`callModels.${e}`,null),zS={realtime:e=>an(`callModel.${e}`,null),transcribe:e=>an(`callSpeechToText.${e}`,null),speech:e=>an(`callSpeechModel.${e}`,null)},HS=e=>OS(e).get()??Xn[e].defaults;function IS(e,t){t&&OS(e).set(t)}function US(e){for(const t of e.providers)IS(t.provider,t.defaults)}const Js=(e,t)=>zS[t](e).get()??HS(e)[t];function x9(e,t,n){zS[t](e).set(!n||n===HS(e)[t]?null:n)}function PS(e){const t=BS(e).get();return t&&Xn[e].voices.includes(t)?t:Xn[e].voices[0]}const w9=(e,t)=>BS(e).set(t),qS=(e,t)=>`callUsage.${e}.${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}`;function b9(e,t,n=new Date){if(e<=0)return;const r=an(qS(t,n),0);r.set(r.get()+e)}const C9=(e,t=new Date)=>Math.floor((an(qS(e,t),0).get()+59)/60),k9=e=>e.call("voiceStatus"),Q_=(e,t,n)=>e.call("setVoiceKey",{provider:t,key:n},3e4),E9=async(e,t,n,r)=>(await e.call("voiceSession",{provider:t,model:n,voice:r},3e4)).credential,M9=(e,t)=>e.call("voiceModels",{provider:t},3e4),j9=(e,t,n,r,l)=>e.call("voiceSpeak",{provider:t,model:n,voice:r,text:l},9e4),uh=e=>Xn[e].name,T9={openai:600,gemini:150},J_=()=>window.codync.speech.available,Oh=()=>window.codync.platform==="darwin"?"On-device speech isn't available in this build.":"On-device speech isn't available on Linux.",Qi={provider:()=>{const e=RS.get();return DS(e)?e:null},model:e=>Js(e,"realtime"),transcribeModel:e=>Js(e,"transcribe"),speechModel:e=>Js(e,"speech"),voice:PS,isSpeechMode:e=>u1(e).get()==="speech",remember:US,pause:()=>s2.get()>0?s2.get():1.5,rate:()=>NS.get(),language:()=>LS.get()},D9=(e,t)=>b9(Math.floor(e),t);class Gh extends Br{phase="starting";failure=null;level=0;onActivityChanged=null;ended=!1;mutedValue=!1;get isActive(){return this.phase==="listening"||this.phase==="speaking"}get muted(){return this.mutedValue}set muted(t){t!==this.mutedValue&&(this.mutedValue=t,this.mutedChanged(t),this.changed())}mutedChanged(t){}setPhase(t){this.phase=t,this.changed(),this.onActivityChanged?.(!this.ended&&this.isActive)}fail(t){this.end(),this.failure=t,this.setPhase("failed")}}const Yn=e=>e instanceof Error?e.message:String(e),R9="Allow the microphone for Codync in Settings to talk to your bots.";async function VS(){try{return await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1}})}catch(e){throw e instanceof DOMException&&(e.name==="NotAllowedError"||e.name==="SecurityError")?new Error(R9):new Error(`Couldn't use the microphone: ${Yn(e)}`)}}async function $S(e){const t=await VS(),n=new AudioContext({sampleRate:16e3}),r=n.createMediaStreamSource(t),l=n.createScriptProcessor(2048,1,1);return l.onaudioprocess=h=>{const d=h.inputBuffer.getChannelData(0),p=new Int16Array(d.length);let g=0;for(let m=0;m<d.length;m++){const v=Math.max(-1,Math.min(1,d[m]));p[m]=v<0?v*32768:v*32767,g+=v*v}e(p,A9(g,d.length))},r.connect(l),l.connect(n.destination),n.state==="suspended"&&await n.resume(),()=>{l.onaudioprocess=null,r.disconnect(),l.disconnect();for(const h of t.getTracks())h.stop();n.close()}}function A9(e,t){const n=10*Math.log10(Math.max(e/Math.max(t,1),1e-10));return Math.min(1,Math.max(0,(n+50)/50))}function N9(e){const t=e.reduce((d,p)=>d+p.length,0),n=new Uint8Array(44+t*2),r=new DataView(n.buffer),l=(d,p)=>[...p].forEach((g,m)=>r.setUint8(d+m,g.charCodeAt(0)));l(0,"RIFF"),r.setUint32(4,36+t*2,!0),l(8,"WAVEfmt "),r.setUint32(16,16,!0),r.setUint16(20,1,!0),r.setUint16(22,1,!0),r.setUint32(24,16e3,!0),r.setUint32(28,32e3,!0),r.setUint16(32,2,!0),r.setUint16(34,16,!0),l(36,"data"),r.setUint32(40,t*2,!0);let h=44;for(const d of e)for(let p=0;p<d.length;p++,h+=2)r.setInt16(h,d[p],!0);return n}function WS(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function FS(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function zh(e){const t=[[/```[\s\S]*?```/g,""],[/!?\[([^\]]*)\]\([^)]*\)/g,"$1"],[/`([^`]*)`/g,"$1"],[/^\s{0,3}(#{1,6}|>|[-*+]|\d+\.)\s+/gm,""],[/(\*\*|\*|~~)(\S[^\n]*?)\1/g,"$2"],[/^[ \t]*\|?[ \t:|-]{3,}\|?[ \t]*$/gm,""],[/^[ \t]*\|[ \t]*|[ \t]*\|[ \t]*$/gm,""],[/[ \t]*\|[ \t]*/g,", "],[/\n{2,}/g,`+`]];let n=e;for(const[r,l]of t)n=n.replace(r,l);return n.trim()}const KS=window.codync.platform==="darwin",go=KS?"this Mac":"this computer";function $a({show:e,children:t,style:n}){const{mounted:r,shown:l}=er(e);return r?c.jsx("div",{className:`settings-reveal ${l?"shown":""}`,style:n,children:c.jsx("div",{children:t})}):null}function ey({title:e,children:t}){return c.jsxs("div",{className:"settings-section-header",children:[c.jsx("span",{role:"heading","aria-level":3,style:{...B(13,"semibold"),color:"var(--text)"},children:e}),c.jsx("span",{style:{flex:1}}),t]})}const Wa=e=>e instanceof Error?e.message:typeof e=="object"&&e&&"message"in e?String(e.message):String(e);function YS(e,t=new Date){const n=l=>new Date(l.getFullYear(),l.getMonth(),l.getDate()).getTime(),r=Math.round((n(t)-n(e))/864e5);return r===0?e.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):r===1?"Yesterday":t.getTime()-e.getTime()<6*864e5?e.toLocaleDateString(void 0,{weekday:"long"}):e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function n2(e){const t=e.connection;switch(t.kind){case"online":return e.mismatch?"Needs update":"Online";case"connecting":return"Connecting…";case"computerOffline":return t.lastSeen?`Offline · seen ${YS(new Date(t.lastSeen))}`:"Offline";case"offline":return"Can't reach";case"unauthorized":return t.message;case"unpaired":return"Not paired"}}const Hh=e=>e.connection.kind==="online"?e.client:null,L9=e=>e.length===6?`${e.slice(0,3)} ${e.slice(3)}`:e;function d1({showsHeader:e=!0}){const[t,n]=ni(RS),[r,l]=ni(NS),[h,d]=ni(LS),p=x.useMemo(()=>S9(window.codync.speech.locales()),[]),g=DS(t)?t:null,[m,v]=ni(u1(g??"openai")),_=g?`Your own ${Xn[g].name} key, billed by ${Xn[g].name}. Applies from the next call.`:window.codync.speech.available?"On-device speech, on this computer. Applies from the next call.":Oh();return c.jsxs("div",{style:{display:"flex",flexDirection:"column",background:"var(--background)",width:e?440:void 0,height:e?600:"100%"},children:[e?c.jsx(Lt,{title:"Voice chat"}):null,c.jsx("div",{style:{flex:1,minHeight:0},children:c.jsxs(hi,{children:[c.jsx(Ee,{title:"Voice",footer:_,children:[c.jsx(Jt,{label:"Engine",children:c.jsx(Ci,{selection:t,options:[...window.codync.speech.available||t==="device"?[{id:"device",label:"On device"}]:[],...y9.map(S=>({id:S,label:Xn[S].name}))],onChange:n})},"engine"),...g?[c.jsx(Jt,{label:"Mode",detail:m==="speech"?"Sent when you pause, replies read aloud.":"A live conversation. Talk over replies.",children:c.jsx(Ci,{selection:m,options:[{id:"realtime",label:"Realtime"},{id:"speech",label:"Speech"}],onChange:v})},"mode"),...m==="speech"?[c.jsx(ty,{},"pause")]:[]]:[c.jsx(Jt,{label:"Language",detail:"The language you speak in calls.",children:c.jsx(Ci,{selection:h,options:p,onChange:d})},"language"),c.jsx(Jt,{label:"Reading speed",children:c.jsx(Ci,{selection:r,options:[{id:.42,label:"Slower"},{id:AS,label:"Normal"},{id:.56,label:"Faster"}],onChange:l})},"rate"),c.jsx(ty,{},"pause")]]}),g?c.jsx(B9,{provider:g},g):null]})})]})}function ty(){const[e,t]=ni(s2);return c.jsx("div",{className:"settings-appear",children:c.jsx(Jt,{label:"Send after a pause of",detail:"Longer leaves time to think mid-sentence.",children:c.jsx(Ci,{selection:e,options:[{id:1,label:"1 s"},{id:1.5,label:"1.5 s"},{id:2.5,label:"2.5 s"}],onChange:t})})})}function B9({provider:e}){const t=Ne(),n=Xn[e],[r]=ni(u1(e)),[l,h]=x.useState(null),[d,p]=x.useState(!1),[g,m]=x.useState(""),[v,_]=x.useState(!1),[S,w]=x.useState(null),[b,k]=x.useState(()=>PS(e)),[E,j]=x.useState(()=>Js(e,"realtime")),[V,A]=x.useState(()=>Js(e,"transcribe")),[z,F]=x.useState(()=>Js(e,"speech")),[R,I]=x.useState(()=>X_(e).get()??{models:[],transcribe:[],speech:[]}),q=x.useRef(!1),U=r==="speech",Y=l===!0,$={ok:!1,text:`Not connected to ${t.hostName}.`},M=async re=>{let de;try{de=await M9(re,e)}catch{return}I(de),IS(e,de.defaults),j(Js(e,"realtime")),A(Js(e,"transcribe")),F(Js(e,"speech")),X_(e).set(de)};x.useEffect(()=>{let re=!1;return(async()=>{const de=Hh(t);if(!de)return h(!1),w($);let Ce;try{const je=await k9(de);US(je),Ce=G0(je,e)}catch(je){return re?void 0:(h(!1),w({ok:!1,text:Wa(je)}))}re||(h(Ce),Ce&&await M(de))})(),()=>{re=!0}},[e]);const N=(re,de)=>Ce=>{de(Ce),x9(e,re,Ce)},L=re=>{if(q.current)return;const de=Hh(t);if(!de)return w($);q.current=!0,_(!0),w(null),re(de).catch(Ce=>w({ok:!1,text:Wa(Ce)})).finally(()=>{q.current=!1,_(!1)})},O=()=>{const re=g.trim();!re&&!Y||L(async de=>{!re||!d&&Y?(U?await j9(de,e,z,b,"OK"):await E9(de,e,E,b),w({ok:!0,text:"Key works"})):(h(G0(await Q_(de,e,re),e)),m(""),p(!1),w({ok:!0,text:`Key works and is saved on ${t.hostName}`})),await M(de)})},P=()=>L(async re=>{h(G0(await Q_(re,e,""),e)),w(null)}),te=(re,de,Ce)=>{const je=de.includes(re)?de:[re,...de];return c.jsx(Ci,{selection:re,options:je.map(D=>({id:D,label:D})),onChange:Ce})},Q={opacity:Y?1:.55,pointerEvents:Y?void 0:"none",transition:"opacity var(--layout)"},ce=c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[Y&&!d?c.jsxs("div",{className:"settings-row",children:[c.jsx(ae,{name:"key.fill",size:13,color:"var(--secondary)"}),c.jsxs("div",{className:"settings-stack",style:{flex:1},children:[c.jsx("span",{style:{color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Key saved"}),c.jsxs("span",{style:{...B("caption"),color:"var(--tertiary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:["Stays on ",t.hostName]})]}),v?c.jsx(et,{}):c.jsxs(c.Fragment,{children:[c.jsx(ke,{title:"Test key",icon:"checkmark.seal",onClick:O}),c.jsx(ke,{title:"Replace key",icon:"pencil",onClick:()=>{p(!0),w(null)}}),c.jsx(ke,{title:"Remove key",icon:"trash",onClick:P})]})]}):c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[c.jsxs("div",{className:"settings-row",style:{gap:8},children:[c.jsx("input",{type:"password","aria-label":"API key",placeholder:n.keyPrompt,value:g,spellCheck:!1,autoComplete:"off",style:{flex:1,minWidth:0},onChange:re=>m(re.target.value),onKeyDown:re=>re.key==="Enter"&&O()}),v?c.jsx(et,{}):c.jsx(Fe,{onClick:O,disabled:!g.trim(),children:"Save"})]}),c.jsxs("div",{className:"settings-row",style:B("footnote"),children:[c.jsxs("button",{style:{color:"var(--text)",textDecoration:"underline"},onClick:()=>window.codync.app.openExternal(n.keyPage),children:["Get a key from ",n.name]}),c.jsx("span",{style:{flex:1}}),d?c.jsx("button",{style:{color:"var(--secondary)"},onClick:()=>{p(!1),m(""),w(null)},children:"Cancel"}):null]})]}),c.jsx($a,{show:S!==null,children:S?c.jsxs("span",{style:{...B("footnote"),display:"flex",alignItems:"center",gap:5,color:S.ok?"var(--secondary)":"var(--danger)"},children:[c.jsx(ae,{name:S.ok?"checkmark.circle.fill":"exclamationmark.circle.fill",size:10}),S.text]}):null})]},"key");return c.jsx(Ee,{title:n.name,footer:Y?null:`Add a key to choose from ${n.name}'s models.`,children:[ce,...U?[c.jsx("div",{style:Q,children:c.jsx(Jt,{label:"Speech to text",children:te(V,R.transcribe,N("transcribe",A))})},"stt"),c.jsx("div",{style:Q,children:c.jsx(Jt,{label:"Text to speech",children:te(z,R.speech,N("speech",F))})},"tts")]:[c.jsx("div",{style:Q,children:c.jsx(Jt,{label:"Model",children:te(E,R.models,N("realtime",j))})},"model")],c.jsx("div",{style:Q,children:c.jsx(Jt,{label:"Voice",children:c.jsx(Ci,{selection:b,options:n.voices.map(re=>({id:re,label:re})),onChange:re=>{k(re),w9(e,re)}})})},"voice"),c.jsx("div",{style:Q,children:c.jsxs(Jt,{label:"This month",children:["≈ ",C9(e)," min"]})},"minutes")]})}const GS=[{name:"send_to_bot",description:"Send a message to the bot on the computer, exactly as if the user typed it. Its reply arrives later.",parameters:{type:"object",properties:{text:{type:"string",description:"The message"}},required:["text"]}},{name:"bot_status",description:"Whether the bot is idle or working, what it is doing, and any approval it is waiting for.",parameters:{type:"object",properties:{}}},{name:"recent_messages",description:"The latest messages in the chat with the bot, oldest first.",parameters:{type:"object",properties:{count:{type:"integer",description:"How many, 1–20"}}}},{name:"answer_approval",description:"Answer the bot's pending approval request with one of its options.",parameters:{type:"object",properties:{option:{type:"string",description:"The option's name"}},required:["option"]}}];class O9{constructor(t,n){this.store=t,this.botId=n}store;botId;get instructions(){const t=this.store.bots.get(this.botId),n=t?.name??"the bot",r=t?.description?` (${t.description})`:"";return[`You are the voice on a phone call between the user and ${n}${r}, a coding agent running on the user's computer. ${n} does all the actual work; you relay.`,"- When the user asks for something to be done, changed, checked or answered about their code or computer, call send_to_bot with their request in their own words (keep details, names and code terms exactly). Don't do the work or invent results yourself.",'- Use bot_status and recent_messages for "what are you doing?" or "what did it say?".',"- Call answer_approval only after the user has clearly said which option to pick.",`- Messages starting with [${n} replied] or [Notice] come from the computer: tell the user what they say, shortened for speech (no code blocks, no long lists, no URLs).`,"- Reply in the user's language. Keep spoken answers short and natural."].join(``)}call(t,n){let r;switch(t){case"send_to_bot":r=this.send(typeof n.text=="string"?n.text:"");break;case"bot_status":r=this.status();break;case"recent_messages":r=this.recent(typeof n.count=="number"?Math.trunc(n.count):6);break;case"answer_approval":r=this.answer(typeof n.option=="string"?n.option:"");break;default:r={error:`Unknown tool ${t}.`}}return JSON.stringify(r)}reply(t){return`[${this.store.bots.get(this.botId)?.name??"Bot"} replied] ${zh(t)}`}notice(t){return`[Notice] ${t}`}send(t){const n=t.trim();return n?(this.store.send(n,this.botId),{sent:!0,note:"The bot's reply will arrive as a separate message."}):{error:"Nothing to send."}}status(){const t=this.store.bots.get(this.botId);if(!t)return{error:"The bot isn't available."};const n={status:t.status,activity:t.activity},r=this.pendingApproval;return r&&(n.approval={request:r.data.title??r.data.command??"",options:(r.data.options??[]).map(l=>l.name)}),n}recent(t){const n=this.store.bots.get(this.botId)?.name??"bot",r=Math.min(Math.max(t,1),20);return{messages:this.store.chat(this.botId).filter(_o).slice(-r).map(h=>({from:h.kind==="user"?"user":h.kind==="agent"?n:h.kind==="permission"?"approval request":"notice",text:zh(h.data.text??h.data.title??"")}))}}answer(t){const n=this.pendingApproval;if(!n)return{error:"Nothing is waiting for approval."};const r=n.data.options??[],l=t.toLowerCase(),h=r.find(d=>d.name.toLowerCase()===l||d.optionId===t)??r.find(d=>d.name.toLowerCase().includes(l)||l.includes(d.name.toLowerCase()));return h?(this.store.respond(n,h.optionId),{answered:h.name}):{error:"No such option.",options:r.map(d=>d.name)}}get pendingApproval(){return this.store.chat(this.botId).findLast(t=>t.kind==="permission"&&t.data.status==="pending")}}const z9=.3,H9=16e3*3/10,I9=16e3*20,U9=16e3*4/10;function P9(e,t){const n=[];let r="",l="";const h=()=>{const p=r.trim();p&&n.push(p),r=""},d=p=>{[...r].length+[...p].length>t&&h();let g=[...p];for(;g.length>t;)n.push(g.slice(0,t).join("")),g=g.slice(t);r+=g.join("")};for(const p of e)l+=p,`.!?。!?`.includes(p)&&(d(l),l="");return d(l),h(),n}class q9 extends Gh{constructor(t,n){super(),this.provider=t,this.speech=n,this.chunk=T9[t]}provider;speech;stopMic=null;chunk;preroll=[];prerollSamples=0;utterance=[];utteranceSamples=0;speaking=!1;quietSince=null;voiced=0;deafUntil=0;transcribing=Promise.resolve();queue=[];player=null;next=null;speakGeneration=0;async start(){try{const t=await $S((n,r)=>this.heard(n,r));if(this.ended)return t();this.stopMic=t}catch(t){return this.fail(Yn(t))}this.setPhase("listening")}end(){this.ended=!0,this.onActivityChanged?.(!1),this.stopSpeaking(),this.stopMic?.(),this.stopMic=null}mutedChanged(t){t&&this.dropUtterance()}interrupt(){this.phase==="speaking"&&(this.stopSpeaking(),this.setPhase("listening"))}speak(t){this.say(zh(t))}announce(t){this.say(t)}heard(t,n){if(!(this.ended||this.muted||this.phase!=="listening"||Date.now()<this.deafUntil))if(this.level=n,n>z9?(this.speaking=!0,this.quietSince=null,this.voiced+=t.length):this.speaking&&this.quietSince===null&&(this.quietSince=Date.now()),this.speaking)this.utterance.push(t),this.utteranceSamples+=t.length,(this.quietSince!==null&&Date.now()-this.quietSince>=Qi.pause()*1e3||this.utteranceSamples>=I9)&&this.submit();else for(this.preroll.push(t),this.prerollSamples+=t.length;this.preroll.length>1&&this.prerollSamples-this.preroll[0].length>=H9;)this.prerollSamples-=this.preroll.shift().length}submit(){const t=N9([...this.preroll,...this.utterance]),n=this.voiced>=U9;this.dropUtterance(),n&&(this.transcribing=this.transcribing.then(async()=>{try{const r=(await this.speech.transcribe(t)).trim();!this.ended&&r&&this.speech.send(r)}catch(r){console.error("transcribe:",Yn(r)),this.ended||this.fail(Yn(r))}}))}dropUtterance(){this.preroll=[],this.prerollSamples=0,this.utterance=[],this.utteranceSamples=0,this.speaking=!1,this.quietSince=null,this.voiced=0,this.level=0}say(t){this.ended||this.phase==="failed"||this.phase==="starting"||!t||(this.queue.push(...P9(t,this.chunk)),!this.player&&!this.next&&this.playNext())}playNext(){if(this.ended)return;const t=this.speakGeneration,n=this.next??this.fetch(this.queue.shift()??null);this.next=null,n.then(r=>{if(!(t!==this.speakGeneration||this.ended)){if(!r)return this.finishedSpeaking();this.play(r),this.queue.length&&(this.next=this.fetch(this.queue.shift()))}})}async fetch(t){if(t===null)return null;try{return await this.speech.speak(t)}catch(n){return console.error("speak:",Yn(n)),null}}play(t){const n=t.format==="aac"?"audio/aac":t.format==="wav"?"audio/wav":`audio/${t.format}`,r=URL.createObjectURL(new Blob([t.audio],{type:n})),l=new Audio(r),h=this.speakGeneration;let d=!1;const p=()=>{d||(d=!0,URL.revokeObjectURL(r),this.played(h))};l.onended=p,l.onerror=()=>{console.error("play: unreadable clip"),p()},this.player=l,this.dropUtterance(),this.setPhase("speaking"),l.play().catch(()=>l.onerror?.(new Event("error")))}played(t){t===this.speakGeneration&&(this.player=null,!this.queue.length&&!this.next?this.finishedSpeaking():this.playNext())}finishedSpeaking(){this.player=null,this.deafUntil=Date.now()+400,this.phase==="speaking"&&this.setPhase("listening")}stopSpeaking(){this.speakGeneration++,this.queue=[],this.next=null,this.player&&(this.player.onended=null,this.player.onerror=null,this.player.pause(),URL.revokeObjectURL(this.player.src)),this.player=null}}const V9="wss://generativelanguage.googleapis.com/ws/google.ai.generativelanguage.v1alpha.GenerativeService.BidiGenerateContentConstrained";function ZS(e){const t={};for(const[n,r]of Object.entries(e))n==="type"&&typeof r=="string"?t[n]=r.toUpperCase():n==="properties"&&r&&typeof r=="object"?t[n]=Object.fromEntries(Object.entries(r).map(([l,h])=>[l,ZS(h)])):t[n]=r;return t}class $9 extends Gh{constructor(t,n,r,l){super(),this.model=t,this.voice=n,this.credential=r,this.op=l}model;voice;credential;op;provider="gemini";socket=null;ready=!1;resumeHandle=null;reconnects=0;stopMic=null;output=null;sources=new Set;nextStart=0;queued=0;playGeneration=0;turnDone=!0;dropping=!1;pending=[];async start(){await this.connect()}async connect(){try{const t=await this.credential();if(this.ended)return;const n=new WebSocket(`${V9}?access_token=${encodeURIComponent(t)}`);n.binaryType="arraybuffer",this.socket=n,this.ready=!1,n.onopen=()=>this.sendSetup(n),n.onmessage=r=>{this.socket===n&&this.received(typeof r.data=="string"?r.data:new TextDecoder().decode(r.data))},n.onclose=r=>this.closed(n,r.reason)}catch(t){this.ended||this.fail(Yn(t))}}sendSetup(t){const n=GS.map(l=>({name:l.name,description:l.description,...Object.keys(l.parameters.properties).length?{parameters:ZS(l.parameters)}:{}})),r={model:`models/${this.model}`,generationConfig:{responseModalities:["AUDIO"],speechConfig:{voiceConfig:{prebuiltVoiceConfig:{voiceName:this.voice}}}},systemInstruction:{parts:[{text:this.op.instructions}]},tools:[{functionDeclarations:n}],contextWindowCompression:{slidingWindow:{}},sessionResumption:this.resumeHandle?{handle:this.resumeHandle}:{}};this.send({setup:r},t)}end(){this.ended=!0,this.onActivityChanged?.(!1);const t=this.socket;this.socket=null,t?.close(1e3),this.stopPlayback(),this.stopMic?.(),this.stopMic=null,this.output?.close(),this.output=null}mutedChanged(t){this.level=0,t&&this.send({realtimeInput:{audioStreamEnd:!0}})}interrupt(){this.phase==="speaking"&&(this.stopPlayback(),this.dropping=!this.turnDone,this.setPhase("listening"))}speak(t){this.ended||this.phase==="failed"||(this.pending.push(this.op.reply(t)),this.flush())}announce(t){this.ended||this.phase==="failed"||(this.pending.push(this.op.notice(t)),this.flush())}closed(t,n){this.ended||this.socket!==t||(this.socket=null,this.ready=!1,this.resumeHandle&&this.reconnects<3?(this.reconnects++,this.connect()):this.fail(n||"Lost the connection to Gemini."))}received(t){if(this.ended)return;let n;try{n=JSON.parse(t)}catch{return}n.setupComplete!==void 0&&(this.ready=!0,this.reconnects=0,this.stopMic||this.startAudio(),this.phase==="starting"&&this.setPhase("listening"),this.flush());const r=n.serverContent;if(r){r.interrupted===!0&&(this.stopPlayback(),this.dropping=!1,this.phase==="speaking"&&this.setPhase("listening"));const d=r.modelTurn?.parts;if(Array.isArray(d)){this.turnDone=!1;for(const p of d){const g=p?.inlineData?.data;typeof g=="string"&&!this.dropping&&this.play(g)}}r.turnComplete===!0&&(this.turnDone=!0,this.dropping=!1,this.queued===0&&this.phase==="speaking"&&this.setPhase("listening"),this.flush())}const l=n.toolCall?.functionCalls;if(Array.isArray(l)){const d=l.filter(p=>typeof p?.id=="string"&&typeof p?.name=="string").map(p=>{const g=this.op.call(p.name,p.args??{});return{id:p.id,name:p.name,response:{result:JSON.parse(g)}}});this.send({toolResponse:{functionResponses:d}})}const h=n.sessionResumptionUpdate;h?.resumable===!0&&typeof h.newHandle=="string"&&(this.resumeHandle=h.newHandle),n.goAway!==void 0&&this.socket?.close(1e3)}send(t,n){const r=n??(this.ready?this.socket:null);r?.readyState===WebSocket.OPEN&&r.send(JSON.stringify(t))}flush(){if(!this.ready||!this.turnDone||this.queued!==0||!this.pending.length)return;const t=this.pending.join(`-`);this.pending=[],this.turnDone=!1,this.send({clientContent:{turns:[{role:"user",parts:[{text:t}]}],turnComplete:!0}})}async startAudio(){try{this.output=new AudioContext({sampleRate:24e3});const t=await $S((n,r)=>this.captured(n,r));if(this.ended)return t();this.stopMic=t}catch(t){this.ended||this.fail(Yn(t))}}captured(t,n){this.ended||this.muted||!this.isActive||(this.level=this.phase==="speaking"?0:n,this.send({realtimeInput:{audio:{data:WS(new Uint8Array(t.buffer)),mimeType:"audio/pcm;rate=16000"}}}))}play(t){const n=this.output;if(!n)return;const r=FS(t),l=r.length>>1;if(!l)return;const h=new DataView(r.buffer),d=n.createBuffer(1,l,24e3),p=d.getChannelData(0);for(let v=0;v<l;v++)p[v]=h.getInt16(v*2,!0)/32768;const g=n.createBufferSource();g.buffer=d,g.connect(n.destination),this.nextStart=Math.max(this.nextStart,n.currentTime),g.start(this.nextStart),this.nextStart+=d.duration,this.sources.add(g),this.queued++,this.level=0,this.phase!=="speaking"&&this.setPhase("speaking");const m=this.playGeneration;g.onended=()=>{this.sources.delete(g),this.played(m)}}played(t){t!==this.playGeneration||this.ended||(this.queued=Math.max(0,this.queued-1),!(this.queued!==0||!this.turnDone)&&(this.phase==="speaking"&&this.setPhase("listening"),this.flush()))}stopPlayback(){this.playGeneration++,this.queued=0,this.nextStart=0;for(const t of this.sources){t.onended=null;try{t.stop()}catch{}}this.sources.clear()}}function W9(e){const t=l=>e.match(l)?.length??0,n=t(/[A-Za-z]/g),r=navigator.language;if(t(/[-ヿ]/g)>0)return"ja";if(t(/[가-]/g)>n/3)return"ko";if(t(new RegExp("\\p{Script=Han}","gu"))>n/3){const l=navigator.languages.find(h=>h.startsWith("zh"));return l?/Hant|TW|HK|MO/.test(l)?/HK/.test(l)?"zh-HK":"zh-TW":"zh-CN":"zh-TW"}return/^(zh|ja|ko)/.test(r)?"en":r.split("-")[0]}function F9(e){const t=W9(e),n=speechSynthesis.getVoices().filter(l=>l.lang.replace("_","-").startsWith(t)),r=l=>(l.lang.replace("_","-")===navigator.language?4:0)+(/premium|enhanced/i.test(l.name)?2:0)+(l.localService?1:0);return n.sort((l,h)=>r(h)-r(l))[0]??null}class K9 extends Gh{constructor(t){super(),this.send=t}send;provider=null;heard="";recognizing=!1;started=!1;everStarted=!1;lastRestart=0;silence=null;offEvents=null;speakGeneration=0;async start(){if(!window.codync.speech.available)return this.fail(Oh());speechSynthesis.getVoices(),this.offEvents=window.codync.speech.onEvent(t=>this.event(t)),this.listen()}end(){this.ended=!0,this.onActivityChanged?.(!1),this.stopListening(),this.offEvents?.(),this.offEvents=null,this.speakGeneration++,speechSynthesis.cancel()}mutedChanged(t){this.phase==="listening"&&(t?this.stopListening():this.listen())}speak(t){const n=zh(t);if(this.ended||!n||this.phase==="starting"||this.phase==="failed")return;this.stopListening(),this.setPhase("speaking");const r=++this.speakGeneration;speechSynthesis.cancel();const l=new SpeechSynthesisUtterance(n),h=F9(n);h&&(l.voice=h,l.lang=h.lang);const d=Qi.rate();l.rate=d>0?Math.min(10,Math.max(.1,d/.5)):1,l.onend=()=>r===this.speakGeneration&&this.finishedSpeaking(),l.onerror=()=>r===this.speakGeneration&&this.finishedSpeaking(),speechSynthesis.speak(l)}announce(t){this.speak(t)}interrupt(){this.phase==="speaking"&&(this.speakGeneration++,speechSynthesis.cancel(),this.listen())}listen(){this.heard="",this.phase!=="listening"&&this.everStarted&&this.setPhase("listening"),!(this.muted||this.ended)&&(this.recognizing=!0,this.started=!1,window.codync.speech.start(Qi.language()||null))}stopListening(){this.silence&&clearTimeout(this.silence),this.silence=null,this.recognizing&&window.codync.speech.stop(),this.recognizing=!1,this.started=!1,this.level=0}event(t){if(!(this.ended||!this.recognizing))switch(t.type){case"started":this.started=!0,this.everStarted||(this.everStarted=!0,this.setPhase("listening"));break;case"level":this.phase==="listening"&&(this.level=t.value);break;case"partial":case"final":this.recognized(t.text,t.type==="final");break;case"error":if(!this.started)return this.fail(t.message);this.restart(t.message);break;case"stopped":if(!this.started)return this.fail("Speech recognition stopped.");this.restart("Speech recognition stopped.");break}}restart(t){if(Date.now()-this.lastRestart<1e3)return this.fail(t);this.lastRestart=Date.now(),this.submit()}recognized(t,n){if(this.phase==="listening"){if(this.heard=t,this.silence&&clearTimeout(this.silence),n)return this.submit();this.silence=setTimeout(()=>this.submit(),Qi.pause()*1e3)}}submit(){const t=this.heard.trim();this.stopListening(),t&&this.send(t),this.listen()}finishedSpeaking(){this.phase==="speaking"&&this.listen()}fail(t){this.stopListening(),this.failure=t,this.setPhase("failed")}}class Y9 extends Gh{constructor(t,n){super(),this.credential=t,this.op=n}credential;op;provider="openai";pc=null;events=null;stream=null;audio=null;responding=!1;pending=[];dropTimer=null;async start(){try{if(this.stream=await VS(),this.ended)return this.release();const t=await this.credential();if(this.ended)return;await this.connect(t)}catch(t){this.ended||this.fail(Yn(t))}}async connect(t){const n=new RTCPeerConnection({bundlePolicy:"max-bundle"});this.pc=n;const r=this.stream.getAudioTracks()[0];if(!r)throw new Error("Couldn't start the call audio.");r.enabled=!this.muted,n.addTrack(r,this.stream);const l=new Audio;l.autoplay=!0,this.audio=l,n.ontrack=m=>{l.srcObject=m.streams[0]??new MediaStream([m.track])},n.oniceconnectionstatechange=()=>this.iceChanged(n.iceConnectionState);const h=n.createDataChannel("oai-events");h.onopen=()=>this.opened(),h.onmessage=m=>typeof m.data=="string"&&this.received(m.data),this.events=h;const d=await n.createOffer();await n.setLocalDescription(d);const p=await fetch("https://api.openai.com/v1/realtime/calls",{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/sdp"},body:d.sdp,signal:AbortSignal.timeout(15e3)}),g=await p.text();if(!this.ended){if(!p.ok){let m;try{m=JSON.parse(g).error?.message}catch{}throw new Error(m??`OpenAI answered ${p.status}.`)}await n.setRemoteDescription({type:"answer",sdp:g}),this.dropTimer=setTimeout(()=>{!this.ended&&this.phase==="starting"&&this.fail("Couldn't reach OpenAI.")},15e3)}}release(){for(const t of this.stream?.getTracks()??[])t.stop();this.stream=null}end(){this.ended=!0,this.onActivityChanged?.(!1),this.dropTimer&&clearTimeout(this.dropTimer),this.events?.close(),this.pc?.close(),this.events=null,this.pc=null,this.release(),this.audio&&(this.audio.srcObject=null,this.audio=null)}mutedChanged(t){for(const n of this.stream?.getAudioTracks()??[])n.enabled=!t;t&&(this.level=0)}interrupt(){this.phase==="speaking"&&(this.send({type:"response.cancel"}),this.send({type:"output_audio_buffer.clear"}),this.setPhase("listening"))}speak(t){this.ended||this.phase==="failed"||(this.pending.push(this.op.reply(t)),this.flush())}announce(t){this.ended||this.phase==="failed"||(this.pending.push(this.op.notice(t)),this.flush())}opened(){this.ended||(this.dropTimer&&clearTimeout(this.dropTimer),this.send({type:"session.update",session:{type:"realtime",instructions:this.op.instructions,tools:GS.map(t=>({type:"function",name:t.name,description:t.description,parameters:t.parameters})),audio:{input:{turn_detection:{type:"semantic_vad"}}}}}),this.setPhase("listening"),this.flush())}received(t){if(this.ended)return;let n;try{n=JSON.parse(t)}catch{return}switch(n.type){case"input_audio_buffer.speech_started":this.level=this.muted?0:.7;break;case"input_audio_buffer.speech_stopped":this.level=0;break;case"output_audio_buffer.started":this.setPhase("speaking");break;case"output_audio_buffer.stopped":case"output_audio_buffer.cleared":this.phase==="speaking"&&this.setPhase("listening");break;case"response.created":this.responding=!0;break;case"response.done":this.responding=!1,this.flush();break;case"response.function_call_arguments.done":{if(typeof n.call_id!="string"||typeof n.name!="string")return;let r={};try{typeof n.arguments=="string"&&(r=JSON.parse(n.arguments))}catch{}const l=this.op.call(n.name,r);this.send({type:"conversation.item.create",item:{type:"function_call_output",call_id:n.call_id,output:l}}),this.pending.push("");break}case"error":console.error("realtime:",n.error?.message??"?");break}}iceChanged(t){if(!this.ended)switch(t){case"connected":case"completed":this.dropTimer&&clearTimeout(this.dropTimer);break;case"disconnected":this.dropTimer&&clearTimeout(this.dropTimer),this.dropTimer=setTimeout(()=>!this.ended&&this.fail("Lost the connection to OpenAI."),5e3);break;case"failed":this.fail("Lost the connection to OpenAI.");break}}flush(){if(!(this.responding||!this.isActive||this.events?.readyState!=="open"||!this.pending.length)){for(const t of this.pending)t&&this.send({type:"conversation.item.create",item:{type:"message",role:"user",content:[{type:"input_text",text:t}]}});this.pending=[],this.responding=!0,this.send({type:"response.create"})}}send(t){this.events?.readyState==="open"&&this.events.send(JSON.stringify(t))}}function G9(e,t,n){let r=0;for(const d of e.bots.values())r=Math.max(r,d.rev);for(const d of e.entries.values())for(const p of d)r=Math.max(r,p.rev);const l=new Set(e.allEntries(t).filter(d=>d.data.final).map(d=>d.id));let h=(()=>{const d=e.bots.get(t);return d?ln(d):!1})();return e.subscribe(()=>{for(const g of e.allEntries(t))!g.data.final||l.has(g.id)||(l.add(g.id),g.kind==="agent"&&!g.threadId&&g.rev>r&&g.data.text&&n.speak(g.data.text));const d=e.bots.get(t),p=d?ln(d):!1;d&&p&&!h&&n.announce(`${d.name} needs your approval in the chat.`),h=p})}const XS=x.createContext(null);function Z9({botId:e,onSpeaking:t,interrupt:n,onEnd:r}){const l=Ne(),[h,d]=x.useState(null);cn(h);const[p,g]=x.useState(null),[m,v]=x.useState(null),[_,S]=x.useState(!1),w=x.useContext(XS),b=x.useRef(null),k=x.useRef(null),E=x.useRef(!1),j=l.bots.get(e),V=j?ko(j.avatarColor):null,A=()=>{const L=b.current?.provider;!L||k.current===null||(R9((Date.now()-k.current)/1e3,L),k.current=null)},z=(L,O,P)=>async()=>(await(await l.ready()).call("voiceSession",{provider:L,model:O,voice:P},3e4)).credential,F=L=>{if(E.current)return;if(!L&&!J_())return void I();const O=new O9(l,e),P=ce=>l.send(ce,e);let te;if(L&&Qi.isSpeechMode(L)){const ce=Qi.transcribeModel(L),re=Qi.speechModel(L),de=Qi.voice(L);te=new q9(L,{transcribe:async Ce=>(await(await l.ready()).call("voiceTranscribe",{provider:L,model:ce,audio:WS(Ce)},6e4)).text,speak:async Ce=>{const je=await(await l.ready()).call("voiceSpeak",{provider:L,model:re,voice:de,text:Ce},9e4);return{audio:FS(je.audio),format:je.format}},send:P}),k.current=Date.now()}else if(L){const ce=Qi.model(L),re=Qi.voice(L);te=L==="openai"?new Y9(z(L,ce,re),O):new $9(ce,re,z(L,ce,re),O),k.current=Date.now()}else te=new K9(P);L&&D();let Q=null;te.onActivityChanged=ce=>{ce&&!Q?Q=G9(l,e,{speak:re=>te.speak(re),announce:re=>te.announce(re)}):!ce&&Q&&(Q(),Q=null)},b.current=te,d(te),te.start()},D=async()=>{try{const L=await(await l.ready()).call("voiceStatus");return Qi.remember(L),L}catch{return null}},I=async()=>{const L=(await D())?.providers.find(O=>O.configured)?.provider;E.current||(L?(g(`${Oh()} Using ${uh(L)}.`),F(L)):v(`${Oh()} Add an OpenAI or Gemini key in call settings.`))};x.useEffect(()=>{const L=Date.now();return F(Qi.provider()),()=>{E.current=!0,b.current?.end(),A(),t(!1),n.current=null,l.logCall(e,Math.floor((Date.now()-L)/1e3))}},[]);const q=h?.phase??null;x.useEffect(()=>{h&&(t(q==="speaking"),n.current=q==="speaking"?()=>h.interrupt():null,q==="failed"&&h.provider&&J_()&&(A(),g(`${uh(h.provider)} isn't available (${h.failure}). Using on-device voice.`),F(null)))},[h,q]);const U=q==="speaking",Y=h?.muted===!0,$=j?Jn(j):!1,M=q===null||q==="starting"?"Connecting":q==="speaking"?"Speaking":q==="failed"?"Can't listen":Y?"Muted":$?"Working, listening":"Listening",N=m??(q==="failed"?h?.failure:null);return c.jsxs("div",{className:"call",children:[c.jsxs("div",{className:"call-bar",children:[c.jsx("button",{className:`call-avatar ${U?"speaking":""}`,disabled:!U,"aria-label":U?"Interrupt":j?.name??"",title:U?"Interrupt":void 0,onClick:()=>h?.interrupt(),children:j?c.jsx(Ui,{bot:j,size:34}):c.jsx("span",{style:{width:34,height:34}})}),c.jsx(X9,{engine:h,working:$,color:V,label:M}),h?.provider?c.jsx("span",{style:{...B("caption2","semibold"),color:"var(--secondary)"},"aria-label":`Voice by ${uh(h.provider)}`,children:uh(h.provider)}):null,c.jsx("button",{className:"call-round",title:"Call settings","aria-label":"Call settings",onClick:()=>w?w():S(!0),children:c.jsx(ae,{name:"gearshape",size:16,weight:"medium",scaled:!1})}),c.jsx("button",{className:`call-round ${Y?"on":""}`,title:Y?"Unmute":"Mute","aria-label":Y?"Unmute":"Mute",onClick:()=>h&&(h.muted=!h.muted),children:c.jsx(ae,{name:Y?"mic.slash":"mic",size:16,weight:"medium",scaled:!1})}),c.jsx("button",{className:"call-round end",title:"End call","aria-label":"End call",onClick:r,children:c.jsx(ae,{name:"xmark",size:16,weight:"semibold",scaled:!1})})]}),N?c.jsx("div",{className:"call-line",style:{color:"var(--danger)"},children:N},"failure"):p?c.jsx("div",{className:"call-line",style:{color:"var(--secondary)"},children:p},p):null,c.jsx($t,{open:_,onClose:()=>S(!1),children:c.jsx(d1,{})})]})}const dh=120,Zl=16;function X9({engine:e,working:t,color:n,label:r}){const l=x.useRef(null),h=F2(),d=Ka(),p=x.useRef({engine:e,working:t,color:n,dark:h,reduceMotion:d});return p.current={engine:e,working:t,color:n,dark:h,reduceMotion:d},x.useEffect(()=>{const g=l.current,m=g?.getContext("2d");if(!g||!m)return;const v=window.devicePixelRatio||1;g.width=dh*v,g.height=Zl*v;let _=0;const S=w=>{const{engine:b,working:k,color:E,dark:j,reduceMotion:V}=p.current,A=V?0:w/1e3,z=b?.phase==="speaking",F=b?.level??0,D=j?"#ffffff":"#000000",I=z?D:E??D;m.setTransform(v,0,0,v,0,0),m.clearRect(0,0,dh,Zl);const q=8,U=Math.max(1,Math.floor(dh/q));for(let Y=0;Y<U;Y++){const $=Y*q+q/2,M=(Math.sin(Y*.55-A*6)+1)/2,N=z?.5+.5*M:F>.05?Math.max(.2,F)*(.45+.55*M):k?.25*((Math.sin(A*2.4)+1)/2):.08,L=4+N*(Zl-4);m.fillStyle=Eb(I,.5+.5*N),m.beginPath(),m.roundRect($-1.25,(Zl-L)/2,2.5,L,1.25),m.fill()}_=requestAnimationFrame(S)};return _=requestAnimationFrame(S),()=>cancelAnimationFrame(_)},[]),c.jsx("canvas",{ref:l,role:"img","aria-label":r,style:{width:dh,height:Zl,flex:"none"}})}const Q9=680;function J9({botId:e}){const t=Ne(),n=t.bots.get(e)??null,[r,l]=x.useState(!1),[h,d]=x.useState(null),[p,g]=x.useState(!1),[m,v]=x.useState(null),[_,S]=x.useState(!0),[w,b]=x.useState(!1),[k,E]=x.useState(!1),[j,V]=x.useState(!1),[A,z]=x.useState(!1),F=x.useRef(null),[D,I]=x.useState(null),[q,U]=x.useState(0),Y=x.useRef(null),$=x.useRef(null),[M,N]=x.useState(800);TS(t,e,null),x.useLayoutEffect(()=>{const de=Y.current;if(!de)return;const Ce=new ResizeObserver(([R])=>N(R.contentRect.width));Ce.observe(de);const je=new ResizeObserver(([R])=>de.style.setProperty("--composer-height",`${Math.ceil(R.borderBoxSize[0].blockSize)}px`));return $.current&&je.observe($.current),()=>{Ce.disconnect(),je.disconnect()}},[]);const L=M>=Q9;x.useEffect(()=>{L&&E(!1)},[L]);const O=x.useCallback(()=>{L?h?(d(null),S(!0)):S(de=>!de):(d(null),E(de=>!de))},[L,h]);x.useEffect(()=>window.codync.app.onCommand(de=>{de.kind==="toggleDetails"&&O()}),[O]);const P=x.useCallback(()=>l(!0),[]),te=x.useCallback(de=>d(de.id),[]),Q=x.useCallback(()=>d(null),[]),ce=de=>{I(de),U(Ce=>Ce+1),b(!1),d(null),S(!0),L||E(!0)},re=c.jsx(o9,{botId:e,routineId:D,editing:w,setEditing:b,editGroup:()=>g(!0),share:()=>{E(!1),n&&v(yo(n))},close:()=>{S(!1),E(!1)}},q);return c.jsxs("div",{className:"thread-view",ref:Y,children:[c.jsxs("div",{className:"conversation",children:[c.jsxs("div",{className:"top-chrome",children:[c.jsx(ek,{}),c.jsxs("div",{className:"top-chrome-row",children:[c.jsx("span",{style:{flex:1}}),(!_||h||!L)&&!k?c.jsx(h1,{title:"Conversation details",icon:"chevron.left.2",direction:[-1,0],onClick:O}):null]}),c.jsxs("button",{className:`title-pill ${j?"hidden-by-call":""}`,inert:j,onClick:O,"aria-label":"View conversation details",title:"View conversation details",children:[c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:7},children:[n?At(n)?c.jsx(Eo,{members:t.members(n),size:22}):c.jsx(Ui,{bot:n,size:22}):null,c.jsx("span",{style:{...B(14,"semibold"),color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n?.name??""})]}),t.shownConnection.kind!=="online"||t.mismatch?c.jsx(tk,{}):null]})]}),c.jsx(ik,{botId:e,openTrace:P,openThread:te,openRoutine:ce}),c.jsxs("div",{className:"composer-dock",ref:$,children:[c.jsx("div",{className:"composer-fade"}),t.mismatch?c.jsx("div",{style:{padding:"0 16px 8px"},children:c.jsx(J2,{})}):c.jsx(xS,{botId:e,onCall:!j&&n&&!At(n)?()=>V(!0):null,onInterrupt:A?()=>F.current?.():null})]}),j?c.jsx("div",{className:"call-overlay",children:c.jsx(Z9,{botId:e,onSpeaking:z,interrupt:F,onEnd:()=>V(!1)})}):null]}),c.jsx(e7,{open:L&&(!!h||_),width:h?Math.min(420,M*.45):292,children:h?c.jsx(Z_,{botId:e,rootId:h,close:Q},h):re}),c.jsx($t,{open:k,onClose:()=>E(!1),width:340,height:600,children:re}),c.jsx($t,{open:h!==null&&!L,onClose:Q,width:440,height:600,children:h?c.jsx(Z_,{botId:e,rootId:h,close:Q}):null}),c.jsx($t,{open:r,onClose:()=>l(!1),width:620,height:560,children:c.jsx(jS,{botId:e})}),c.jsx($t,{open:m!==null,onClose:()=>v(null),children:m?c.jsx(_9,{draft:m}):null}),c.jsx($t,{open:p,onClose:()=>g(!1),width:420,height:560,children:c.jsx(g9,{group:n})})]})}function ek(){return c.jsx("div",{className:"top-fade"})}function tk(){const e=Ne(),t=e.shownConnection.kind==="connecting",n=e.connection.kind!=="online"?"wifi.slash":e.hostRoute==="relay"?"cloud":e.hostRoute==="direct"?"wifi":e.hostRoute==="loopback"?"desktopcomputer":"network",r=(()=>{switch(e.shownConnection.kind){case"connecting":return"Connecting";case"computerOffline":case"offline":return"Offline";case"unauthorized":return"No access";case"unpaired":return"Not paired"}return e.mismatch?"Needs update":e.hostRoute==="relay"?"Connected through Cloudflare":e.hostRoute==="direct"?"Connected over Wi-Fi or Tailscale":e.hostRoute==="loopback"?"Connected locally":"Connected"})();return c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,...B(10,"medium"),color:"var(--secondary)"},title:`${e.hostName} · ${r}`,"aria-label":`${e.hostName}, ${r}`,children:[c.jsx("span",{style:{width:12,display:"flex",justifyContent:"center"},children:t?c.jsx(et,{size:8}):c.jsx(ae,{name:n,size:8,weight:"medium"})}),c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.connectionLabel})]})}const iy=40;function ik({botId:e,openTrace:t,openThread:n,openRoutine:r}){const l=Ne(),h=l.bots.get(e)??null,d=l.chat(e),p=!!h&&$2(h,e,null)&&!l.isOffline,g=Vf(d),[m,v]=x.useState(null),[_,S]=x.useState(!1),w=m?g.findIndex(M=>M.id===m):-1,b=w>=0?w:Math.max(0,g.length-iy),k=g.slice(b),E=b>0||!l.historyComplete.has(e)&&d.length>=50,[j,V]=x.useState(!0),A=x.useRef(!0);A.current=j;const z=x.useRef(null),F=x.useRef(0),D=x.useRef(null),I=k[k.length-1],q=sS([...k.map(M=>M.id),...p?["working"]:[]],j),U=(M=!1)=>{const N=z.current;N&&N.scrollTo({top:N.scrollHeight,behavior:M?"smooth":"auto"})};x.useEffect(()=>{!m&&k[0]&&v(k[0].id)},[m,k]);const Y=async()=>{if(_)return;S(!0);const M=z.current;D.current=M?M.scrollHeight-M.scrollTop:null;let N=g,L=b;if(L===0){const O=N[0]?.id;await l.loadOlder(e),N=Vf(l.chat(e)),L=O?Math.max(0,N.findIndex(P=>P.id===O)):0}L>0&&v(N[Math.max(0,L-iy)].id),S(!1)};x.useLayoutEffect(()=>{const M=z.current;M&&(D.current!==null&&!A.current?(M.scrollTop=M.scrollHeight-D.current,D.current=null):A.current&&U())});const $=I?.kind==="entry"&&I.entry.kind==="user";return x.useEffect(()=>{$&&V(!0)},[I?.id,$]),x.useEffect(()=>{const M=z.current;if(!M)return;const N=new ResizeObserver(()=>{A.current&&U()});return N.observe(M.firstElementChild),N.observe(M),()=>N.disconnect()},[]),c.jsxs("div",{className:"transcript-frame",children:[c.jsx("div",{className:"transcript",ref:z,onScroll:M=>{const N=M.currentTarget,L=N.scrollHeight-N.scrollTop-N.clientHeight<8;N.scrollTop<F.current-1&&!L?V(!1):L&&V(!0),F.current=N.scrollTop,E&&N.scrollTop<200&&!_&&Y()},children:c.jsxs("div",{className:"transcript-content",children:[E?c.jsx("button",{className:"load-earlier",disabled:_,onClick:()=>{Y()},children:_?c.jsx(et,{size:14}):"Load earlier messages"}):null,k.length===0&&h?c.jsx("div",{style:{paddingTop:40},children:At(h)?c.jsx(nk,{group:h}):c.jsx(rk,{bot:h})}):null,k.map(M=>c.jsx("div",{className:q.has(M.id)?nS(M):void 0,children:c.jsx(sk,{item:M,chat:h,openTrace:t,openThread:n,openRoutine:r})},M.id)),h&&p?c.jsx("div",{className:q.has("working")?"row-in":void 0,style:{paddingTop:6},children:c.jsx(yS,{bot:h,thinking:l.currentThinking(e,null)})}):null,c.jsx("div",{style:{height:8}})]})}),!j&&k.length?c.jsx("div",{className:"jump-to-latest",style:{bottom:"calc(var(--composer-height, 70px) + 10px)"},children:c.jsx(h1,{title:"Jump to latest",icon:"arrow.down",direction:[0,1],onClick:()=>{V(!0),U(!0)}})}):null]})}function sk({item:e,chat:t,openTrace:n,openThread:r,openRoutine:l}){if(e.kind==="separator")return c.jsx("div",{style:{...B("footnote"),color:"var(--tertiary)",textAlign:"center",padding:"18px 0 6px"},children:e1.separator(e.date)});const h=e.entry;return h.kind==="notice"&&h.data.routineId?c.jsxs("button",{onClick:()=>l(h.data.routineId),style:{display:"flex",alignItems:"center",gap:6,...B("footnote"),color:"var(--secondary)",padding:"10px 0",margin:"0 auto"},children:[c.jsx(ae,{name:"clock.arrow.circlepath",size:10}),h.data.text??"Routine"]}):c.jsx(Jf,{entry:h,groupStart:e.groupStart,chat:t,openTrace:n,openThread:r})}function nk({group:e}){const n=Ne().members(e);return c.jsxs("div",{className:"intro-card",children:[c.jsx(Eo,{members:n,size:72}),c.jsx("div",{style:{...B("title2","semibold"),color:"var(--text)"},children:e.name}),c.jsx("div",{style:{...B("subheadline"),color:"var(--secondary)"},children:n.map(r=>r.name).join(" · ")}),e.description?c.jsx("div",{style:{...B("subheadline"),color:"var(--secondary)"},children:e.description}):null,c.jsx("div",{style:{...B("footnote"),color:"var(--tertiary)",paddingTop:4},children:"Everyone answers in turn. @mention a bot to ask just that one. Each bot works in its own folder."})]})}function rk({bot:e}){const t=Ne();return c.jsxs("div",{className:"intro-card",children:[c.jsx(Ui,{bot:e,size:72}),c.jsx("div",{style:{...B("title2","semibold"),color:"var(--text)"},children:e.name}),c.jsx("div",{style:{...B("footnote",void 0,"monospaced"),color:"var(--tertiary)"},children:e.managedWorkspace?`${t.backendName(e.backend)} · Personal workspace`:`${t.backendName(e.backend)} in ${e.cwd}`}),e.description?c.jsx("div",{style:{...B("subheadline"),color:"var(--secondary)"},children:e.description}):null,c.jsx("div",{style:{...B("footnote"),color:"var(--tertiary)",paddingTop:4},children:"Tell it what you need. You'll get a notification when it's done or needs you."})]})}function ak({group:e,onClose:t}){const n=Ne(),[r,l]=x.useState(""),[h,d]=x.useState(""),[p,g]=x.useState([]),[m,v]=x.useState(!1),_=x.useRef(null),S=x.useRef(null),w=r.trim().toLowerCase(),b=n.roster.filter(U=>!p.includes(U.id)&&!(At(U)&&(e||p.length>0))&&(!w||U.name.toLowerCase().includes(w))),k=p.map(U=>n.bots.get(U)).filter(U=>!!U),E=e?p.length<2?"Add bots to the group":"Add another bot":p.length?"Add another bot":"Search or create bots",j=e?k.length<2?"Pick at least two bots":"Message the group":k.length===0?"Message Bot":`Message ${k.map(U=>U.name).join(", ")}`;x.useEffect(()=>{_.current?.focus()},[]),x.useLayoutEffect(()=>{const U=S.current;U&&U.scrollTo({left:U.scrollWidth,behavior:"smooth"})},[p]);const V=U=>{const Y=h.trim();n.setSelection(U),Y&&n.send(Y,U),t()},A=U=>{if(At(U))return V(U.id);g(Y=>[...Y,U.id]),l(""),_.current?.focus()},z=U=>g(Y=>Y.filter($=>$!==U)),F=()=>{if(p.length!==0){if(p.length===1){e||V(p[0]);return}n.createGroup(k.map(U=>U.name).join(", "),"",p).then(U=>V(U.id)).catch(U=>n.setError(Ar(U)))}},D=()=>{if(m)return;v(!0);const U=r.trim(),Y=p.length===0&&!e;(async()=>{try{let $=await F7(n);U&&($=await n.save({...yo($),name:U})),Y?V($.id):(n.setSelection(null),A($))}catch($){n.setError(Ar($))}v(!1)})()},I=()=>{w?b[0]?A(b[0]):D():F()},q=x.useRef({create:D,choose:A,matches:b,onClose:t});return q.current={create:D,choose:A,matches:b,onClose:t},x.useEffect(()=>{const U=Y=>{if(Y.key==="Escape"){Y.preventDefault(),q.current.onClose();return}if(!Y.metaKey||Y.shiftKey||Y.altKey||Y.ctrlKey)return;const $=Number(Y.key);if(!(!Number.isInteger($)||$<1||$>9))if(Y.preventDefault(),$===1)q.current.create();else{const M=q.current.matches[$-2];M&&q.current.choose(M)}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[]),c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"12px 22px",...B("title3")},children:[c.jsx("span",{style:{color:"var(--secondary)",flex:"none"},children:"To:"}),c.jsxs("div",{ref:S,className:"chip-row",style:{flex:1},children:[k.map(U=>c.jsx(ES,{bot:U,onRemove:()=>z(U.id)},U.id)),c.jsx("input",{ref:_,value:r,placeholder:E,style:{minWidth:200,flex:1,color:"var(--text)",userSelect:"text"},onChange:U=>l(U.target.value),onKeyDown:U=>{U.nativeEvent.isComposing||U.keyCode===229||(U.key==="Enter"?(U.preventDefault(),I()):U.key==="Backspace"&&!r&&p.length&&(U.preventDefault(),z(p[p.length-1])))}})]}),c.jsx(ke,{title:"Close",icon:"xmark",onClick:t})]}),c.jsx("div",{className:"hairline"}),c.jsxs("div",{className:"compose-list",children:[c.jsx(sy,{shortcut:1,onClick:D,icon:c.jsx("span",{style:{width:26,height:26,borderRadius:"50%",background:"var(--bubble-agent)",display:"grid",placeItems:"center"},children:c.jsx(ae,{name:m?"hourglass":"plus",size:13,weight:"medium",className:"fade-in"},m?"hourglass":"plus")}),children:r?`Create “${r}”`:"Create new Bot"}),b.map((U,Y)=>c.jsx(sy,{shortcut:Y+2<=9?Y+2:null,onClick:()=>A(U),icon:At(U)?c.jsx(Eo,{members:n.members(U),size:26,animated:!1}):c.jsx(Ui,{bot:U,size:26,animated:!1}),children:U.name},U.id))]}),c.jsx("div",{style:{flex:1}}),c.jsx("div",{className:"compose-box",children:c.jsx(c1,{value:h,onChange:d,placeholder:j,minRows:1,maxRows:6,onKeyDown:U=>{U.key==="Enter"&&!U.shiftKey&&!U.nativeEvent.isComposing&&U.keyCode!==229&&(U.preventDefault(),F())}})})]})}function sy({shortcut:e,onClick:t,icon:n,children:r}){return c.jsxs("button",{className:"press pick-row hover fade-in",onClick:t,children:[n,c.jsx("span",{style:{flex:1,minWidth:0,color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r}),e!==null?c.jsxs("span",{style:{display:"flex",gap:3},children:[c.jsx("span",{className:"key-cap",children:"⌘"}),c.jsx("span",{className:"key-cap",children:e})]}):null]})}var lk=2,ok=1,ck=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")),l=Math.max(0,parseInt(n.getPropertyValue("width"))),h=window.getComputedStyle(this._terminal.element),d={top:parseInt(h.getPropertyValue("padding-top")),bottom:parseInt(h.getPropertyValue("padding-bottom")),right:parseInt(h.getPropertyValue("padding-right")),left:parseInt(h.getPropertyValue("padding-left"))},p=d.top+d.bottom,g=d.right+d.left,m=r-p,v=l-g-t;return{cols:Math.max(lk,Math.floor(v/e.css.cell.width)),rows:Math.max(ok,Math.floor(m/e.css.cell.height))}}};var hk=class{constructor(t,n,r,l={}){this._terminal=t,this._regex=n,this._handler=r,this._options=l}provideLinks(t,n){let r=dk.computeLink(t,this._regex,this._terminal,this._handler);n(this._addCallbacks(r))}_addCallbacks(t){return t.map(n=>(n.leave=this._options.leave,n.hover=(r,l)=>{if(this._options.hover){let{range:h}=n;this._options.hover(r,l,h)}},n))}};function uk(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 dk=class bh{static computeLink(t,n,r,l){let h=new RegExp(n.source,(n.flags||"")+"g"),[d,p]=bh._getWindowedLineStrings(t-1,r),g=d.join(""),m,v=[];for(;m=h.exec(g);){let _=m[0];if(!uk(_))continue;let[S,w]=bh._mapStrIdx(r,p,0,m.index),[b,k]=bh._mapStrIdx(r,S,w,_.length);if(S===-1||w===-1||b===-1||k===-1)continue;let E={start:{x:w+1,y:S+1},end:{x:k,y:b+1}};v.push({range:E,text:_,activate:l})}return v}static _getWindowedLineStrings(t,n){let r,l=t,h=t,d=0,p="",g=[];if(r=n.buffer.active.getLine(t)){let m=r.translateToString(!0);if(r.isWrapped&&m[0]!==" "){for(d=0;(r=n.buffer.active.getLine(--l))&&d<2048&&(p=r.translateToString(!0),d+=p.length,g.push(p),!(!r.isWrapped||p.indexOf(" ")!==-1)););g.reverse()}for(g.push(m),d=0;(r=n.buffer.active.getLine(++h))&&r.isWrapped&&d<2048&&(p=r.translateToString(!0),d+=p.length,g.push(p),p.indexOf(" ")===-1););}return[g,l]}static _mapStrIdx(t,n,r,l){let h=t.buffer.active,d=h.getNullCell(),p=r;for(;l;){let g=h.getLine(n);if(!g)return[-1,-1];for(let m=p;m<g.length;++m){g.getCell(m,d);let v=d.getChars();if(d.getWidth()&&(l-=v.length||1,m===g.length-1&&v==="")){let _=h.getLine(n+1);_&&_.isWrapped&&(_.getCell(0,d),d.getWidth()===2&&(l+=1))}if(l<0)return[n,m]}n++,p=0}return[n,p]}},fk=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function pk(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 gk=class{constructor(t=pk,n={}){this._handler=t,this._options=n}activate(t){this._terminal=t;let n=this._options,r=n.urlRegex||fk;this._linkProvider=this._terminal.registerLinkProvider(new hk(this._terminal,r,this._handler,n))}dispose(){this._linkProvider?.dispose()}};var QS=Object.defineProperty,mk=Object.getOwnPropertyDescriptor,vk=(e,t)=>{for(var n in t)QS(e,n,{get:t[n],enumerable:!0})},_t=(e,t,n,r)=>{for(var l=r>1?void 0:r?mk(t,n):t,h=e.length-1,d;h>=0;h--)(d=e[h])&&(l=(r?d(t,n,l):d(l))||l);return r&&l&&QS(t,n,l),l},me=(e,t)=>(n,r)=>t(n,r,e),ny="Terminal input",r2={get:()=>ny,set:e=>ny=e},ry="Too much output to announce, navigate to rows manually to read",a2={get:()=>ry,set:e=>ry=e};function _k(e){return e.replace(/\r?\n/g,"\r")}function yk(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function Sk(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function xk(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let l=e.clipboardData.getData("text/plain");JS(l,t,n,r)}}function JS(e,t,n,r){e=_k(e),e=yk(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function ex(e,t,n){let r=n.getBoundingClientRect(),l=e.clientX-r.left-10,h=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${l}px`,t.style.top=`${h}px`,t.style.zIndex="1000",t.focus()}function ay(e,t,n,r,l){ex(e,t,n),l&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Fn(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Zh(e,t=0,n=e.length){let r="";for(let l=t;l<n;++l){let h=e[l];h>65535?(h-=65536,r+=String.fromCharCode((h>>10)+55296)+String.fromCharCode(h%1024+56320)):r+=String.fromCharCode(h)}return r}var wk=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,l=0;if(this._interim){let h=e.charCodeAt(l++);56320<=h&&h<=57343?t[r++]=(this._interim-55296)*1024+h-56320+65536:(t[r++]=this._interim,t[r++]=h),this._interim=0}for(let h=l;h<n;++h){let d=e.charCodeAt(h);if(55296<=d&&d<=56319){if(++h>=n)return this._interim=d,r;let p=e.charCodeAt(h);56320<=p&&p<=57343?t[r++]=(d-55296)*1024+p-56320+65536:(t[r++]=d,t[r++]=p);continue}d!==65279&&(t[r++]=d)}return r}},bk=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,l,h,d,p,g=0,m=0;if(this.interim[0]){let S=!1,w=this.interim[0];w&=(w&224)===192?31:(w&240)===224?15:7;let b=0,k;for(;(k=this.interim[++b]&63)&&b<4;)w<<=6,w|=k;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,j=E-b;for(;m<j;){if(m>=n)return 0;if(k=e[m++],(k&192)!==128){m--,S=!0;break}else this.interim[b++]=k,w<<=6,w|=k&63}S||(E===2?w<128?m--:t[r++]=w:E===3?w<2048||w>=55296&&w<=57343||w===65279||(t[r++]=w):w<65536||w>1114111||(t[r++]=w)),this.interim.fill(0)}let v=n-4,_=m;for(;_<n;){for(;_<v&&!((l=e[_])&128)&&!((h=e[_+1])&128)&&!((d=e[_+2])&128)&&!((p=e[_+3])&128);)t[r++]=l,t[r++]=h,t[r++]=d,t[r++]=p,_+=4;if(l=e[_++],l<128)t[r++]=l;else if((l&224)===192){if(_>=n)return this.interim[0]=l,r;if(h=e[_++],(h&192)!==128){_--;continue}if(g=(l&31)<<6|h&63,g<128){_--;continue}t[r++]=g}else if((l&240)===224){if(_>=n)return this.interim[0]=l,r;if(h=e[_++],(h&192)!==128){_--;continue}if(_>=n)return this.interim[0]=l,this.interim[1]=h,r;if(d=e[_++],(d&192)!==128){_--;continue}if(g=(l&15)<<12|(h&63)<<6|d&63,g<2048||g>=55296&&g<=57343||g===65279)continue;t[r++]=g}else if((l&248)===240){if(_>=n)return this.interim[0]=l,r;if(h=e[_++],(h&192)!==128){_--;continue}if(_>=n)return this.interim[0]=l,this.interim[1]=h,r;if(d=e[_++],(d&192)!==128){_--;continue}if(_>=n)return this.interim[0]=l,this.interim[1]=h,this.interim[2]=d,r;if(p=e[_++],(p&192)!==128){_--;continue}if(g=(l&7)<<18|(h&63)<<12|(d&63)<<6|p&63,g<65536||g>1114111)continue;t[r++]=g}}return r}},tx="",Gn=" ",Mo=class ix{constructor(){this.fg=0,this.bg=0,this.extended=new Ih}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new ix;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)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Ih=class sx{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new sx(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},is=class nx extends Mo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ih,this.combinedData=""}static fromCharData(t){let n=new nx;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?Fn(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let l=t[1].charCodeAt(1);56320<=l&&l<=57343?this.content=(r-55296)*1024+l-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ly="di$target",l2="di$dependencies",X0=new Map;function Ck(e){return e[l2]||[]}function Wt(e){if(X0.has(e))return X0.get(e);let t=function(n,r,l){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");kk(t,n,l)};return t._id=e,X0.set(e,t),t}function kk(e,t,n){t[ly]===t?t[l2].push({id:e,index:n}):(t[l2]=[{id:e,index:n}],t[ly]=t)}var ui=Wt("BufferService"),rx=Wt("CoreMouseService"),zr=Wt("CoreService"),Ek=Wt("CharsetService"),f1=Wt("InstantiationService"),ax=Wt("LogService"),di=Wt("OptionsService"),lx=Wt("OscLinkService"),Mk=Wt("UnicodeService"),jo=Wt("DecorationService"),o2=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=[],l=this._optionsService.rawOptions.linkHandler,h=new is,d=n.getTrimmedLength(),p=-1,g=-1,m=!1;for(let v=0;v<d;v++)if(!(g===-1&&!n.hasContent(v))){if(n.loadCell(v,h),h.hasExtendedAttrs()&&h.extended.urlId)if(g===-1){g=v,p=h.extended.urlId;continue}else m=h.extended.urlId!==p;else g!==-1&&(m=!0);if(m||g!==-1&&v===d-1){let _=this._oscLinkService.getLinkData(p)?.uri;if(_){let S={start:{x:g+1,y:e},end:{x:v+(!m&&v===d-1?1:0),y:e}},w=!1;if(!l?.allowNonHttpProtocols)try{let b=new URL(_);["http:","https:"].includes(b.protocol)||(w=!0)}catch{w=!0}w||r.push({text:_,range:S,activate:(b,k)=>l?l.activate(b,k,S):jk(b,k),hover:(b,k)=>l?.hover?.(b,k,S),leave:(b,k)=>l?.leave?.(b,k,S)})}m=!1,h.hasExtendedAttrs()&&h.extended.urlId?(g=v,p=h.extended.urlId):(g=-1,p=-1)}}t(r)}};o2=_t([me(0,ui),me(1,di),me(2,lx)],o2);function jk(e,t){if(confirm(`Do you want to navigate to ${t}?+`);this.pending=[],this.turnDone=!1,this.send({clientContent:{turns:[{role:"user",parts:[{text:t}]}],turnComplete:!0}})}async startAudio(){try{this.output=new AudioContext({sampleRate:24e3});const t=await $S((n,r)=>this.captured(n,r));if(this.ended)return t();this.stopMic=t}catch(t){this.ended||this.fail(Yn(t))}}captured(t,n){this.ended||this.muted||!this.isActive||(this.level=this.phase==="speaking"?0:n,this.send({realtimeInput:{audio:{data:WS(new Uint8Array(t.buffer)),mimeType:"audio/pcm;rate=16000"}}}))}play(t){const n=this.output;if(!n)return;const r=FS(t),l=r.length>>1;if(!l)return;const h=new DataView(r.buffer),d=n.createBuffer(1,l,24e3),p=d.getChannelData(0);for(let v=0;v<l;v++)p[v]=h.getInt16(v*2,!0)/32768;const g=n.createBufferSource();g.buffer=d,g.connect(n.destination),this.nextStart=Math.max(this.nextStart,n.currentTime),g.start(this.nextStart),this.nextStart+=d.duration,this.sources.add(g),this.queued++,this.level=0,this.phase!=="speaking"&&this.setPhase("speaking");const m=this.playGeneration;g.onended=()=>{this.sources.delete(g),this.played(m)}}played(t){t!==this.playGeneration||this.ended||(this.queued=Math.max(0,this.queued-1),!(this.queued!==0||!this.turnDone)&&(this.phase==="speaking"&&this.setPhase("listening"),this.flush()))}stopPlayback(){this.playGeneration++,this.queued=0,this.nextStart=0;for(const t of this.sources){t.onended=null;try{t.stop()}catch{}}this.sources.clear()}}function W9(e){const t=l=>e.match(l)?.length??0,n=t(/[A-Za-z]/g),r=navigator.language;if(t(/[-ヿ]/g)>0)return"ja";if(t(/[가-]/g)>n/3)return"ko";if(t(new RegExp("\\p{Script=Han}","gu"))>n/3){const l=navigator.languages.find(h=>h.startsWith("zh"));return l?/Hant|TW|HK|MO/.test(l)?/HK/.test(l)?"zh-HK":"zh-TW":"zh-CN":"zh-TW"}return/^(zh|ja|ko)/.test(r)?"en":r.split("-")[0]}function F9(e){const t=W9(e),n=speechSynthesis.getVoices().filter(l=>l.lang.replace("_","-").startsWith(t)),r=l=>(l.lang.replace("_","-")===navigator.language?4:0)+(/premium|enhanced/i.test(l.name)?2:0)+(l.localService?1:0);return n.sort((l,h)=>r(h)-r(l))[0]??null}class K9 extends Gh{constructor(t){super(),this.send=t}send;provider=null;heard="";recognizing=!1;started=!1;everStarted=!1;lastRestart=0;silence=null;offEvents=null;speakGeneration=0;async start(){if(!window.codync.speech.available)return this.fail(Oh());speechSynthesis.getVoices(),this.offEvents=window.codync.speech.onEvent(t=>this.event(t)),this.listen()}end(){this.ended=!0,this.onActivityChanged?.(!1),this.stopListening(),this.offEvents?.(),this.offEvents=null,this.speakGeneration++,speechSynthesis.cancel()}mutedChanged(t){this.phase==="listening"&&(t?this.stopListening():this.listen())}speak(t){const n=zh(t);if(this.ended||!n||this.phase==="starting"||this.phase==="failed")return;this.stopListening(),this.setPhase("speaking");const r=++this.speakGeneration;speechSynthesis.cancel();const l=new SpeechSynthesisUtterance(n),h=F9(n);h&&(l.voice=h,l.lang=h.lang);const d=Qi.rate();l.rate=d>0?Math.min(10,Math.max(.1,d/.5)):1,l.onend=()=>r===this.speakGeneration&&this.finishedSpeaking(),l.onerror=()=>r===this.speakGeneration&&this.finishedSpeaking(),speechSynthesis.speak(l)}announce(t){this.speak(t)}interrupt(){this.phase==="speaking"&&(this.speakGeneration++,speechSynthesis.cancel(),this.listen())}listen(){this.heard="",this.phase!=="listening"&&this.everStarted&&this.setPhase("listening"),!(this.muted||this.ended)&&(this.recognizing=!0,this.started=!1,window.codync.speech.start(Qi.language()||null))}stopListening(){this.silence&&clearTimeout(this.silence),this.silence=null,this.recognizing&&window.codync.speech.stop(),this.recognizing=!1,this.started=!1,this.level=0}event(t){if(!(this.ended||!this.recognizing))switch(t.type){case"started":this.started=!0,this.everStarted||(this.everStarted=!0,this.setPhase("listening"));break;case"level":this.phase==="listening"&&(this.level=t.value);break;case"partial":case"final":this.recognized(t.text,t.type==="final");break;case"error":if(!this.started)return this.fail(t.message);this.restart(t.message);break;case"stopped":if(!this.started)return this.fail("Speech recognition stopped.");this.restart("Speech recognition stopped.");break}}restart(t){if(Date.now()-this.lastRestart<1e3)return this.fail(t);this.lastRestart=Date.now(),this.submit()}recognized(t,n){if(this.phase==="listening"){if(this.heard=t,this.silence&&clearTimeout(this.silence),n)return this.submit();this.silence=setTimeout(()=>this.submit(),Qi.pause()*1e3)}}submit(){const t=this.heard.trim();this.stopListening(),t&&this.send(t),this.listen()}finishedSpeaking(){this.phase==="speaking"&&this.listen()}fail(t){this.stopListening(),this.failure=t,this.setPhase("failed")}}class Y9 extends Gh{constructor(t,n){super(),this.credential=t,this.op=n}credential;op;provider="openai";pc=null;events=null;stream=null;audio=null;responding=!1;pending=[];dropTimer=null;async start(){try{if(this.stream=await VS(),this.ended)return this.release();const t=await this.credential();if(this.ended)return;await this.connect(t)}catch(t){this.ended||this.fail(Yn(t))}}async connect(t){const n=new RTCPeerConnection({bundlePolicy:"max-bundle"});this.pc=n;const r=this.stream.getAudioTracks()[0];if(!r)throw new Error("Couldn't start the call audio.");r.enabled=!this.muted,n.addTrack(r,this.stream);const l=new Audio;l.autoplay=!0,this.audio=l,n.ontrack=m=>{l.srcObject=m.streams[0]??new MediaStream([m.track])},n.oniceconnectionstatechange=()=>this.iceChanged(n.iceConnectionState);const h=n.createDataChannel("oai-events");h.onopen=()=>this.opened(),h.onmessage=m=>typeof m.data=="string"&&this.received(m.data),this.events=h;const d=await n.createOffer();await n.setLocalDescription(d);const p=await fetch("https://api.openai.com/v1/realtime/calls",{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/sdp"},body:d.sdp,signal:AbortSignal.timeout(15e3)}),g=await p.text();if(!this.ended){if(!p.ok){let m;try{m=JSON.parse(g).error?.message}catch{}throw new Error(m??`OpenAI answered ${p.status}.`)}await n.setRemoteDescription({type:"answer",sdp:g}),this.dropTimer=setTimeout(()=>{!this.ended&&this.phase==="starting"&&this.fail("Couldn't reach OpenAI.")},15e3)}}release(){for(const t of this.stream?.getTracks()??[])t.stop();this.stream=null}end(){this.ended=!0,this.onActivityChanged?.(!1),this.dropTimer&&clearTimeout(this.dropTimer),this.events?.close(),this.pc?.close(),this.events=null,this.pc=null,this.release(),this.audio&&(this.audio.srcObject=null,this.audio=null)}mutedChanged(t){for(const n of this.stream?.getAudioTracks()??[])n.enabled=!t;t&&(this.level=0)}interrupt(){this.phase==="speaking"&&(this.send({type:"response.cancel"}),this.send({type:"output_audio_buffer.clear"}),this.setPhase("listening"))}speak(t){this.ended||this.phase==="failed"||(this.pending.push(this.op.reply(t)),this.flush())}announce(t){this.ended||this.phase==="failed"||(this.pending.push(this.op.notice(t)),this.flush())}opened(){this.ended||(this.dropTimer&&clearTimeout(this.dropTimer),this.send({type:"session.update",session:{type:"realtime",instructions:this.op.instructions,tools:GS.map(t=>({type:"function",name:t.name,description:t.description,parameters:t.parameters})),audio:{input:{turn_detection:{type:"semantic_vad"}}}}}),this.setPhase("listening"),this.flush())}received(t){if(this.ended)return;let n;try{n=JSON.parse(t)}catch{return}switch(n.type){case"input_audio_buffer.speech_started":this.level=this.muted?0:.7;break;case"input_audio_buffer.speech_stopped":this.level=0;break;case"output_audio_buffer.started":this.setPhase("speaking");break;case"output_audio_buffer.stopped":case"output_audio_buffer.cleared":this.phase==="speaking"&&this.setPhase("listening");break;case"response.created":this.responding=!0;break;case"response.done":this.responding=!1,this.flush();break;case"response.function_call_arguments.done":{if(typeof n.call_id!="string"||typeof n.name!="string")return;let r={};try{typeof n.arguments=="string"&&(r=JSON.parse(n.arguments))}catch{}const l=this.op.call(n.name,r);this.send({type:"conversation.item.create",item:{type:"function_call_output",call_id:n.call_id,output:l}}),this.pending.push("");break}case"error":console.error("realtime:",n.error?.message??"?");break}}iceChanged(t){if(!this.ended)switch(t){case"connected":case"completed":this.dropTimer&&clearTimeout(this.dropTimer);break;case"disconnected":this.dropTimer&&clearTimeout(this.dropTimer),this.dropTimer=setTimeout(()=>!this.ended&&this.fail("Lost the connection to OpenAI."),5e3);break;case"failed":this.fail("Lost the connection to OpenAI.");break}}flush(){if(!(this.responding||!this.isActive||this.events?.readyState!=="open"||!this.pending.length)){for(const t of this.pending)t&&this.send({type:"conversation.item.create",item:{type:"message",role:"user",content:[{type:"input_text",text:t}]}});this.pending=[],this.responding=!0,this.send({type:"response.create"})}}send(t){this.events?.readyState==="open"&&this.events.send(JSON.stringify(t))}}function G9(e,t,n){let r=0;for(const d of e.bots.values())r=Math.max(r,d.rev);for(const d of e.entries.values())for(const p of d)r=Math.max(r,p.rev);const l=new Set(e.allEntries(t).filter(d=>d.data.final).map(d=>d.id));let h=(()=>{const d=e.bots.get(t);return d?ln(d):!1})();return e.subscribe(()=>{for(const g of e.allEntries(t))!g.data.final||l.has(g.id)||(l.add(g.id),g.kind==="agent"&&!g.threadId&&g.rev>r&&g.data.text&&n.speak(g.data.text));const d=e.bots.get(t),p=d?ln(d):!1;d&&p&&!h&&n.announce(`${d.name} needs your approval in the chat.`),h=p})}const XS=x.createContext(null);function Z9({botId:e,onSpeaking:t,interrupt:n,onEnd:r}){const l=Ne(),[h,d]=x.useState(null);cn(h);const[p,g]=x.useState(null),[m,v]=x.useState(null),[_,S]=x.useState(!1),w=x.useContext(XS),b=x.useRef(null),k=x.useRef(null),E=x.useRef(!1),j=l.bots.get(e),V=j?ko(j.avatarColor):null,A=()=>{const L=b.current?.provider;!L||k.current===null||(D9((Date.now()-k.current)/1e3,L),k.current=null)},z=(L,O,P)=>async()=>(await(await l.ready()).call("voiceSession",{provider:L,model:O,voice:P},3e4)).credential,F=L=>{if(E.current)return;if(!L&&!J_())return void I();const O=new O9(l,e),P=ce=>l.send(ce,e);let te;if(L&&Qi.isSpeechMode(L)){const ce=Qi.transcribeModel(L),re=Qi.speechModel(L),de=Qi.voice(L);te=new q9(L,{transcribe:async Ce=>(await(await l.ready()).call("voiceTranscribe",{provider:L,model:ce,audio:WS(Ce)},6e4)).text,speak:async Ce=>{const je=await(await l.ready()).call("voiceSpeak",{provider:L,model:re,voice:de,text:Ce},9e4);return{audio:FS(je.audio),format:je.format}},send:P}),k.current=Date.now()}else if(L){const ce=Qi.model(L),re=Qi.voice(L);te=L==="openai"?new Y9(z(L,ce,re),O):new $9(ce,re,z(L,ce,re),O),k.current=Date.now()}else te=new K9(P);L&&R();let Q=null;te.onActivityChanged=ce=>{ce&&!Q?Q=G9(l,e,{speak:re=>te.speak(re),announce:re=>te.announce(re)}):!ce&&Q&&(Q(),Q=null)},b.current=te,d(te),te.start()},R=async()=>{try{const L=await(await l.ready()).call("voiceStatus");return Qi.remember(L),L}catch{return null}},I=async()=>{const L=(await R())?.providers.find(O=>O.configured)?.provider;E.current||(L?(g(`${Oh()} Using ${uh(L)}.`),F(L)):v(`${Oh()} Add an OpenAI or Gemini key in call settings.`))};x.useEffect(()=>{const L=Date.now();return F(Qi.provider()),()=>{E.current=!0,b.current?.end(),A(),t(!1),n.current=null,l.logCall(e,Math.floor((Date.now()-L)/1e3))}},[]);const q=h?.phase??null;x.useEffect(()=>{h&&(t(q==="speaking"),n.current=q==="speaking"?()=>h.interrupt():null,q==="failed"&&h.provider&&J_()&&(A(),g(`${uh(h.provider)} isn't available (${h.failure}). Using on-device voice.`),F(null)))},[h,q]);const U=q==="speaking",Y=h?.muted===!0,$=j?Jn(j):!1,M=q===null||q==="starting"?"Connecting":q==="speaking"?"Speaking":q==="failed"?"Can't listen":Y?"Muted":$?"Working, listening":"Listening",N=m??(q==="failed"?h?.failure:null);return c.jsxs("div",{className:"call",children:[c.jsxs("div",{className:"call-bar",children:[c.jsx("button",{className:`call-avatar ${U?"speaking":""}`,disabled:!U,"aria-label":U?"Interrupt":j?.name??"",title:U?"Interrupt":void 0,onClick:()=>h?.interrupt(),children:j?c.jsx(Ui,{bot:j,size:34}):c.jsx("span",{style:{width:34,height:34}})}),c.jsx(X9,{engine:h,working:$,color:V,label:M}),h?.provider?c.jsx("span",{style:{...B("caption2","semibold"),color:"var(--secondary)"},"aria-label":`Voice by ${uh(h.provider)}`,children:uh(h.provider)}):null,c.jsx("button",{className:"call-round",title:"Call settings","aria-label":"Call settings",onClick:()=>w?w():S(!0),children:c.jsx(ae,{name:"gearshape",size:16,weight:"medium",scaled:!1})}),c.jsx("button",{className:`call-round ${Y?"on":""}`,title:Y?"Unmute":"Mute","aria-label":Y?"Unmute":"Mute",onClick:()=>h&&(h.muted=!h.muted),children:c.jsx(ae,{name:Y?"mic.slash":"mic",size:16,weight:"medium",scaled:!1})}),c.jsx("button",{className:"call-round end",title:"End call","aria-label":"End call",onClick:r,children:c.jsx(ae,{name:"xmark",size:16,weight:"semibold",scaled:!1})})]}),N?c.jsx("div",{className:"call-line",style:{color:"var(--danger)"},children:N},"failure"):p?c.jsx("div",{className:"call-line",style:{color:"var(--secondary)"},children:p},p):null,c.jsx($t,{open:_,onClose:()=>S(!1),children:c.jsx(d1,{})})]})}const dh=120,Zl=16;function X9({engine:e,working:t,color:n,label:r}){const l=x.useRef(null),h=F2(),d=Ka(),p=x.useRef({engine:e,working:t,color:n,dark:h,reduceMotion:d});return p.current={engine:e,working:t,color:n,dark:h,reduceMotion:d},x.useEffect(()=>{const g=l.current,m=g?.getContext("2d");if(!g||!m)return;const v=window.devicePixelRatio||1;g.width=dh*v,g.height=Zl*v;let _=0;const S=w=>{const{engine:b,working:k,color:E,dark:j,reduceMotion:V}=p.current,A=V?0:w/1e3,z=b?.phase==="speaking",F=b?.level??0,R=j?"#ffffff":"#000000",I=z?R:E??R;m.setTransform(v,0,0,v,0,0),m.clearRect(0,0,dh,Zl);const q=8,U=Math.max(1,Math.floor(dh/q));for(let Y=0;Y<U;Y++){const $=Y*q+q/2,M=(Math.sin(Y*.55-A*6)+1)/2,N=z?.5+.5*M:F>.05?Math.max(.2,F)*(.45+.55*M):k?.25*((Math.sin(A*2.4)+1)/2):.08,L=4+N*(Zl-4);m.fillStyle=Eb(I,.5+.5*N),m.beginPath(),m.roundRect($-1.25,(Zl-L)/2,2.5,L,1.25),m.fill()}_=requestAnimationFrame(S)};return _=requestAnimationFrame(S),()=>cancelAnimationFrame(_)},[]),c.jsx("canvas",{ref:l,role:"img","aria-label":r,style:{width:dh,height:Zl,flex:"none"}})}const Q9=680;function J9({botId:e}){const t=Ne(),n=t.bots.get(e)??null,[r,l]=x.useState(!1),[h,d]=x.useState(null),[p,g]=x.useState(!1),[m,v]=x.useState(null),[_,S]=x.useState(!0),[w,b]=x.useState(!1),[k,E]=x.useState(!1),[j,V]=x.useState(!1),[A,z]=x.useState(!1),F=x.useRef(null),[R,I]=x.useState(null),[q,U]=x.useState(0),Y=x.useRef(null),$=x.useRef(null),[M,N]=x.useState(800);TS(t,e,null),x.useLayoutEffect(()=>{const de=Y.current;if(!de)return;const Ce=new ResizeObserver(([D])=>N(D.contentRect.width));Ce.observe(de);const je=new ResizeObserver(([D])=>de.style.setProperty("--composer-height",`${Math.ceil(D.borderBoxSize[0].blockSize)}px`));return $.current&&je.observe($.current),()=>{Ce.disconnect(),je.disconnect()}},[]);const L=M>=Q9;x.useEffect(()=>{L&&E(!1)},[L]);const O=x.useCallback(()=>{L?h?(d(null),S(!0)):S(de=>!de):(d(null),E(de=>!de))},[L,h]);x.useEffect(()=>window.codync.app.onCommand(de=>{de.kind==="toggleDetails"&&O()}),[O]);const P=x.useCallback(()=>l(!0),[]),te=x.useCallback(de=>d(de.id),[]),Q=x.useCallback(()=>d(null),[]),ce=de=>{I(de),U(Ce=>Ce+1),b(!1),d(null),S(!0),L||E(!0)},re=c.jsx(o9,{botId:e,routineId:R,editing:w,setEditing:b,editGroup:()=>g(!0),share:()=>{E(!1),n&&v(yo(n))},close:()=>{S(!1),E(!1)}},q);return c.jsxs("div",{className:"thread-view",ref:Y,children:[c.jsxs("div",{className:"conversation",children:[c.jsxs("div",{className:"top-chrome",children:[c.jsx(ek,{}),c.jsxs("div",{className:"top-chrome-row",children:[c.jsx("span",{style:{flex:1}}),(!_||h||!L)&&!k?c.jsx(h1,{title:"Conversation details",icon:"chevron.left.2",direction:[-1,0],onClick:O}):null]}),c.jsxs("button",{className:`title-pill ${j?"hidden-by-call":""}`,inert:j,onClick:O,"aria-label":"View conversation details",title:"View conversation details",children:[c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:7},children:[n?At(n)?c.jsx(Eo,{members:t.members(n),size:22}):c.jsx(Ui,{bot:n,size:22}):null,c.jsx("span",{style:{...B(14,"semibold"),color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n?.name??""})]}),t.shownConnection.kind!=="online"||t.mismatch?c.jsx(tk,{}):null]})]}),c.jsx(ik,{botId:e,openTrace:P,openThread:te,openRoutine:ce}),c.jsxs("div",{className:"composer-dock",ref:$,children:[c.jsx("div",{className:"composer-fade"}),t.mismatch?c.jsx("div",{style:{padding:"0 16px 8px"},children:c.jsx(J2,{})}):c.jsx(xS,{botId:e,onCall:!j&&n&&!At(n)?()=>V(!0):null,onInterrupt:A?()=>F.current?.():null})]}),j?c.jsx("div",{className:"call-overlay",children:c.jsx(Z9,{botId:e,onSpeaking:z,interrupt:F,onEnd:()=>V(!1)})}):null]}),c.jsx(e7,{open:L&&(!!h||_),width:h?Math.min(420,M*.45):292,children:h?c.jsx(Z_,{botId:e,rootId:h,close:Q},h):re}),c.jsx($t,{open:k,onClose:()=>E(!1),width:340,height:600,children:re}),c.jsx($t,{open:h!==null&&!L,onClose:Q,width:440,height:600,children:h?c.jsx(Z_,{botId:e,rootId:h,close:Q}):null}),c.jsx($t,{open:r,onClose:()=>l(!1),width:620,height:560,children:c.jsx(jS,{botId:e})}),c.jsx($t,{open:m!==null,onClose:()=>v(null),children:m?c.jsx(_9,{draft:m}):null}),c.jsx($t,{open:p,onClose:()=>g(!1),width:420,height:560,children:c.jsx(g9,{group:n})})]})}function ek(){return c.jsx("div",{className:"top-fade"})}function tk(){const e=Ne(),t=e.shownConnection.kind==="connecting",n=e.connection.kind!=="online"?"wifi.slash":e.hostRoute==="relay"?"cloud":e.hostRoute==="direct"?"wifi":e.hostRoute==="loopback"?"desktopcomputer":"network",r=(()=>{switch(e.shownConnection.kind){case"connecting":return"Connecting";case"computerOffline":case"offline":return"Offline";case"unauthorized":return"No access";case"unpaired":return"Not paired"}return e.mismatch?"Needs update":e.hostRoute==="relay"?"Connected through Cloudflare":e.hostRoute==="direct"?"Connected over Wi-Fi or Tailscale":e.hostRoute==="loopback"?"Connected locally":"Connected"})();return c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,...B(10,"medium"),color:"var(--secondary)"},title:`${e.hostName} · ${r}`,"aria-label":`${e.hostName}, ${r}`,children:[c.jsx("span",{style:{width:12,display:"flex",justifyContent:"center"},children:t?c.jsx(et,{size:8}):c.jsx(ae,{name:n,size:8,weight:"medium"})}),c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.connectionLabel})]})}const iy=40;function ik({botId:e,openTrace:t,openThread:n,openRoutine:r}){const l=Ne(),h=l.bots.get(e)??null,d=l.chat(e),p=!!h&&$2(h,e,null)&&!l.isOffline,g=Vf(d),[m,v]=x.useState(null),[_,S]=x.useState(!1),w=m?g.findIndex(M=>M.id===m):-1,b=w>=0?w:Math.max(0,g.length-iy),k=g.slice(b),E=b>0||!l.historyComplete.has(e)&&d.length>=50,[j,V]=x.useState(!0),A=x.useRef(!0);A.current=j;const z=x.useRef(null),F=x.useRef(0),R=x.useRef(null),I=k[k.length-1],q=sS([...k.map(M=>M.id),...p?["working"]:[]],j),U=(M=!1)=>{const N=z.current;N&&N.scrollTo({top:N.scrollHeight,behavior:M?"smooth":"auto"})};x.useEffect(()=>{!m&&k[0]&&v(k[0].id)},[m,k]);const Y=async()=>{if(_)return;S(!0);const M=z.current;R.current=M?M.scrollHeight-M.scrollTop:null;let N=g,L=b;if(L===0){const O=N[0]?.id;await l.loadOlder(e),N=Vf(l.chat(e)),L=O?Math.max(0,N.findIndex(P=>P.id===O)):0}L>0&&v(N[Math.max(0,L-iy)].id),S(!1)};x.useLayoutEffect(()=>{const M=z.current;M&&(R.current!==null&&!A.current?(M.scrollTop=M.scrollHeight-R.current,R.current=null):A.current&&U())});const $=I?.kind==="entry"&&I.entry.kind==="user";return x.useEffect(()=>{$&&V(!0)},[I?.id,$]),x.useEffect(()=>{const M=z.current;if(!M)return;const N=new ResizeObserver(()=>{A.current&&U()});return N.observe(M.firstElementChild),N.observe(M),()=>N.disconnect()},[]),c.jsxs("div",{className:"transcript-frame",children:[c.jsx("div",{className:"transcript",ref:z,onScroll:M=>{const N=M.currentTarget,L=N.scrollHeight-N.scrollTop-N.clientHeight<8;N.scrollTop<F.current-1&&!L?V(!1):L&&V(!0),F.current=N.scrollTop,E&&N.scrollTop<200&&!_&&Y()},children:c.jsxs("div",{className:"transcript-content",children:[E?c.jsx("button",{className:"load-earlier",disabled:_,onClick:()=>{Y()},children:_?c.jsx(et,{size:14}):"Load earlier messages"}):null,k.length===0&&h?c.jsx("div",{style:{paddingTop:40},children:At(h)?c.jsx(nk,{group:h}):c.jsx(rk,{bot:h})}):null,k.map(M=>c.jsx("div",{className:q.has(M.id)?nS(M):void 0,children:c.jsx(sk,{item:M,chat:h,openTrace:t,openThread:n,openRoutine:r})},M.id)),h&&p?c.jsx("div",{className:q.has("working")?"row-in":void 0,style:{paddingTop:6},children:c.jsx(yS,{bot:h,thinking:l.currentThinking(e,null)})}):null,c.jsx("div",{style:{height:8}})]})}),!j&&k.length?c.jsx("div",{className:"jump-to-latest",style:{bottom:"calc(var(--composer-height, 70px) + 10px)"},children:c.jsx(h1,{title:"Jump to latest",icon:"arrow.down",direction:[0,1],onClick:()=>{V(!0),U(!0)}})}):null]})}function sk({item:e,chat:t,openTrace:n,openThread:r,openRoutine:l}){if(e.kind==="separator")return c.jsx("div",{style:{...B("footnote"),color:"var(--tertiary)",textAlign:"center",padding:"18px 0 6px"},children:e1.separator(e.date)});const h=e.entry;return h.kind==="notice"&&h.data.routineId?c.jsxs("button",{onClick:()=>l(h.data.routineId),style:{display:"flex",alignItems:"center",gap:6,...B("footnote"),color:"var(--secondary)",padding:"10px 0",margin:"0 auto"},children:[c.jsx(ae,{name:"clock.arrow.circlepath",size:10}),h.data.text??"Routine"]}):c.jsx(Jf,{entry:h,groupStart:e.groupStart,chat:t,openTrace:n,openThread:r})}function nk({group:e}){const n=Ne().members(e);return c.jsxs("div",{className:"intro-card",children:[c.jsx(Eo,{members:n,size:72}),c.jsx("div",{style:{...B("title2","semibold"),color:"var(--text)"},children:e.name}),c.jsx("div",{style:{...B("subheadline"),color:"var(--secondary)"},children:n.map(r=>r.name).join(" · ")}),e.description?c.jsx("div",{style:{...B("subheadline"),color:"var(--secondary)"},children:e.description}):null,c.jsx("div",{style:{...B("footnote"),color:"var(--tertiary)",paddingTop:4},children:"Everyone answers in turn. @mention a bot to ask just that one. Each bot works in its own folder."})]})}function rk({bot:e}){const t=Ne();return c.jsxs("div",{className:"intro-card",children:[c.jsx(Ui,{bot:e,size:72}),c.jsx("div",{style:{...B("title2","semibold"),color:"var(--text)"},children:e.name}),c.jsx("div",{style:{...B("footnote",void 0,"monospaced"),color:"var(--tertiary)"},children:e.managedWorkspace?`${t.backendName(e.backend)} · Personal workspace`:`${t.backendName(e.backend)} in ${e.cwd}`}),e.description?c.jsx("div",{style:{...B("subheadline"),color:"var(--secondary)"},children:e.description}):null,c.jsx("div",{style:{...B("footnote"),color:"var(--tertiary)",paddingTop:4},children:"Tell it what you need. You'll get a notification when it's done or needs you."})]})}function ak({group:e,onClose:t}){const n=Ne(),[r,l]=x.useState(""),[h,d]=x.useState(""),[p,g]=x.useState([]),[m,v]=x.useState(!1),_=x.useRef(null),S=x.useRef(null),w=r.trim().toLowerCase(),b=n.roster.filter(U=>!p.includes(U.id)&&!(At(U)&&(e||p.length>0))&&(!w||U.name.toLowerCase().includes(w))),k=p.map(U=>n.bots.get(U)).filter(U=>!!U),E=e?p.length<2?"Add bots to the group":"Add another bot":p.length?"Add another bot":"Search or create bots",j=e?k.length<2?"Pick at least two bots":"Message the group":k.length===0?"Message Bot":`Message ${k.map(U=>U.name).join(", ")}`;x.useEffect(()=>{_.current?.focus()},[]),x.useLayoutEffect(()=>{const U=S.current;U&&U.scrollTo({left:U.scrollWidth,behavior:"smooth"})},[p]);const V=U=>{const Y=h.trim();n.setSelection(U),Y&&n.send(Y,U),t()},A=U=>{if(At(U))return V(U.id);g(Y=>[...Y,U.id]),l(""),_.current?.focus()},z=U=>g(Y=>Y.filter($=>$!==U)),F=()=>{if(p.length!==0){if(p.length===1){e||V(p[0]);return}n.createGroup(k.map(U=>U.name).join(", "),"",p).then(U=>V(U.id)).catch(U=>n.setError(Ar(U)))}},R=()=>{if(m)return;v(!0);const U=r.trim(),Y=p.length===0&&!e;(async()=>{try{let $=await F7(n);U&&($=await n.save({...yo($),name:U})),Y?V($.id):(n.setSelection(null),A($))}catch($){n.setError(Ar($))}v(!1)})()},I=()=>{w?b[0]?A(b[0]):R():F()},q=x.useRef({create:R,choose:A,matches:b,onClose:t});return q.current={create:R,choose:A,matches:b,onClose:t},x.useEffect(()=>{const U=Y=>{if(Y.key==="Escape"){Y.preventDefault(),q.current.onClose();return}if(!Y.metaKey||Y.shiftKey||Y.altKey||Y.ctrlKey)return;const $=Number(Y.key);if(!(!Number.isInteger($)||$<1||$>9))if(Y.preventDefault(),$===1)q.current.create();else{const M=q.current.matches[$-2];M&&q.current.choose(M)}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[]),c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"12px 22px",...B("title3")},children:[c.jsx("span",{style:{color:"var(--secondary)",flex:"none"},children:"To:"}),c.jsxs("div",{ref:S,className:"chip-row",style:{flex:1},children:[k.map(U=>c.jsx(ES,{bot:U,onRemove:()=>z(U.id)},U.id)),c.jsx("input",{ref:_,value:r,placeholder:E,style:{minWidth:200,flex:1,color:"var(--text)",userSelect:"text"},onChange:U=>l(U.target.value),onKeyDown:U=>{U.nativeEvent.isComposing||U.keyCode===229||(U.key==="Enter"?(U.preventDefault(),I()):U.key==="Backspace"&&!r&&p.length&&(U.preventDefault(),z(p[p.length-1])))}})]}),c.jsx(ke,{title:"Close",icon:"xmark",onClick:t})]}),c.jsx("div",{className:"hairline"}),c.jsxs("div",{className:"compose-list",children:[c.jsx(sy,{shortcut:1,onClick:R,icon:c.jsx("span",{style:{width:26,height:26,borderRadius:"50%",background:"var(--bubble-agent)",display:"grid",placeItems:"center"},children:c.jsx(ae,{name:m?"hourglass":"plus",size:13,weight:"medium",className:"fade-in"},m?"hourglass":"plus")}),children:r?`Create “${r}”`:"Create new Bot"}),b.map((U,Y)=>c.jsx(sy,{shortcut:Y+2<=9?Y+2:null,onClick:()=>A(U),icon:At(U)?c.jsx(Eo,{members:n.members(U),size:26,animated:!1}):c.jsx(Ui,{bot:U,size:26,animated:!1}),children:U.name},U.id))]}),c.jsx("div",{style:{flex:1}}),c.jsx("div",{className:"compose-box",children:c.jsx(c1,{value:h,onChange:d,placeholder:j,minRows:1,maxRows:6,onKeyDown:U=>{U.key==="Enter"&&!U.shiftKey&&!U.nativeEvent.isComposing&&U.keyCode!==229&&(U.preventDefault(),F())}})})]})}function sy({shortcut:e,onClick:t,icon:n,children:r}){return c.jsxs("button",{className:"press pick-row hover fade-in",onClick:t,children:[n,c.jsx("span",{style:{flex:1,minWidth:0,color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r}),e!==null?c.jsxs("span",{style:{display:"flex",gap:3},children:[c.jsx("span",{className:"key-cap",children:"⌘"}),c.jsx("span",{className:"key-cap",children:e})]}):null]})}var lk=2,ok=1,ck=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")),l=Math.max(0,parseInt(n.getPropertyValue("width"))),h=window.getComputedStyle(this._terminal.element),d={top:parseInt(h.getPropertyValue("padding-top")),bottom:parseInt(h.getPropertyValue("padding-bottom")),right:parseInt(h.getPropertyValue("padding-right")),left:parseInt(h.getPropertyValue("padding-left"))},p=d.top+d.bottom,g=d.right+d.left,m=r-p,v=l-g-t;return{cols:Math.max(lk,Math.floor(v/e.css.cell.width)),rows:Math.max(ok,Math.floor(m/e.css.cell.height))}}};var hk=class{constructor(t,n,r,l={}){this._terminal=t,this._regex=n,this._handler=r,this._options=l}provideLinks(t,n){let r=dk.computeLink(t,this._regex,this._terminal,this._handler);n(this._addCallbacks(r))}_addCallbacks(t){return t.map(n=>(n.leave=this._options.leave,n.hover=(r,l)=>{if(this._options.hover){let{range:h}=n;this._options.hover(r,l,h)}},n))}};function uk(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 dk=class bh{static computeLink(t,n,r,l){let h=new RegExp(n.source,(n.flags||"")+"g"),[d,p]=bh._getWindowedLineStrings(t-1,r),g=d.join(""),m,v=[];for(;m=h.exec(g);){let _=m[0];if(!uk(_))continue;let[S,w]=bh._mapStrIdx(r,p,0,m.index),[b,k]=bh._mapStrIdx(r,S,w,_.length);if(S===-1||w===-1||b===-1||k===-1)continue;let E={start:{x:w+1,y:S+1},end:{x:k,y:b+1}};v.push({range:E,text:_,activate:l})}return v}static _getWindowedLineStrings(t,n){let r,l=t,h=t,d=0,p="",g=[];if(r=n.buffer.active.getLine(t)){let m=r.translateToString(!0);if(r.isWrapped&&m[0]!==" "){for(d=0;(r=n.buffer.active.getLine(--l))&&d<2048&&(p=r.translateToString(!0),d+=p.length,g.push(p),!(!r.isWrapped||p.indexOf(" ")!==-1)););g.reverse()}for(g.push(m),d=0;(r=n.buffer.active.getLine(++h))&&r.isWrapped&&d<2048&&(p=r.translateToString(!0),d+=p.length,g.push(p),p.indexOf(" ")===-1););}return[g,l]}static _mapStrIdx(t,n,r,l){let h=t.buffer.active,d=h.getNullCell(),p=r;for(;l;){let g=h.getLine(n);if(!g)return[-1,-1];for(let m=p;m<g.length;++m){g.getCell(m,d);let v=d.getChars();if(d.getWidth()&&(l-=v.length||1,m===g.length-1&&v==="")){let _=h.getLine(n+1);_&&_.isWrapped&&(_.getCell(0,d),d.getWidth()===2&&(l+=1))}if(l<0)return[n,m]}n++,p=0}return[n,p]}},fk=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function pk(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 gk=class{constructor(t=pk,n={}){this._handler=t,this._options=n}activate(t){this._terminal=t;let n=this._options,r=n.urlRegex||fk;this._linkProvider=this._terminal.registerLinkProvider(new hk(this._terminal,r,this._handler,n))}dispose(){this._linkProvider?.dispose()}};var QS=Object.defineProperty,mk=Object.getOwnPropertyDescriptor,vk=(e,t)=>{for(var n in t)QS(e,n,{get:t[n],enumerable:!0})},_t=(e,t,n,r)=>{for(var l=r>1?void 0:r?mk(t,n):t,h=e.length-1,d;h>=0;h--)(d=e[h])&&(l=(r?d(t,n,l):d(l))||l);return r&&l&&QS(t,n,l),l},me=(e,t)=>(n,r)=>t(n,r,e),ny="Terminal input",r2={get:()=>ny,set:e=>ny=e},ry="Too much output to announce, navigate to rows manually to read",a2={get:()=>ry,set:e=>ry=e};function _k(e){return e.replace(/\r?\n/g,"\r")}function yk(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function Sk(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function xk(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let l=e.clipboardData.getData("text/plain");JS(l,t,n,r)}}function JS(e,t,n,r){e=_k(e),e=yk(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function ex(e,t,n){let r=n.getBoundingClientRect(),l=e.clientX-r.left-10,h=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${l}px`,t.style.top=`${h}px`,t.style.zIndex="1000",t.focus()}function ay(e,t,n,r,l){ex(e,t,n),l&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Fn(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Zh(e,t=0,n=e.length){let r="";for(let l=t;l<n;++l){let h=e[l];h>65535?(h-=65536,r+=String.fromCharCode((h>>10)+55296)+String.fromCharCode(h%1024+56320)):r+=String.fromCharCode(h)}return r}var wk=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,l=0;if(this._interim){let h=e.charCodeAt(l++);56320<=h&&h<=57343?t[r++]=(this._interim-55296)*1024+h-56320+65536:(t[r++]=this._interim,t[r++]=h),this._interim=0}for(let h=l;h<n;++h){let d=e.charCodeAt(h);if(55296<=d&&d<=56319){if(++h>=n)return this._interim=d,r;let p=e.charCodeAt(h);56320<=p&&p<=57343?t[r++]=(d-55296)*1024+p-56320+65536:(t[r++]=d,t[r++]=p);continue}d!==65279&&(t[r++]=d)}return r}},bk=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,l,h,d,p,g=0,m=0;if(this.interim[0]){let S=!1,w=this.interim[0];w&=(w&224)===192?31:(w&240)===224?15:7;let b=0,k;for(;(k=this.interim[++b]&63)&&b<4;)w<<=6,w|=k;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,j=E-b;for(;m<j;){if(m>=n)return 0;if(k=e[m++],(k&192)!==128){m--,S=!0;break}else this.interim[b++]=k,w<<=6,w|=k&63}S||(E===2?w<128?m--:t[r++]=w:E===3?w<2048||w>=55296&&w<=57343||w===65279||(t[r++]=w):w<65536||w>1114111||(t[r++]=w)),this.interim.fill(0)}let v=n-4,_=m;for(;_<n;){for(;_<v&&!((l=e[_])&128)&&!((h=e[_+1])&128)&&!((d=e[_+2])&128)&&!((p=e[_+3])&128);)t[r++]=l,t[r++]=h,t[r++]=d,t[r++]=p,_+=4;if(l=e[_++],l<128)t[r++]=l;else if((l&224)===192){if(_>=n)return this.interim[0]=l,r;if(h=e[_++],(h&192)!==128){_--;continue}if(g=(l&31)<<6|h&63,g<128){_--;continue}t[r++]=g}else if((l&240)===224){if(_>=n)return this.interim[0]=l,r;if(h=e[_++],(h&192)!==128){_--;continue}if(_>=n)return this.interim[0]=l,this.interim[1]=h,r;if(d=e[_++],(d&192)!==128){_--;continue}if(g=(l&15)<<12|(h&63)<<6|d&63,g<2048||g>=55296&&g<=57343||g===65279)continue;t[r++]=g}else if((l&248)===240){if(_>=n)return this.interim[0]=l,r;if(h=e[_++],(h&192)!==128){_--;continue}if(_>=n)return this.interim[0]=l,this.interim[1]=h,r;if(d=e[_++],(d&192)!==128){_--;continue}if(_>=n)return this.interim[0]=l,this.interim[1]=h,this.interim[2]=d,r;if(p=e[_++],(p&192)!==128){_--;continue}if(g=(l&7)<<18|(h&63)<<12|(d&63)<<6|p&63,g<65536||g>1114111)continue;t[r++]=g}}return r}},tx="",Gn=" ",Mo=class ix{constructor(){this.fg=0,this.bg=0,this.extended=new Ih}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new ix;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)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Ih=class sx{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new sx(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},is=class nx extends Mo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ih,this.combinedData=""}static fromCharData(t){let n=new nx;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?Fn(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let l=t[1].charCodeAt(1);56320<=l&&l<=57343?this.content=(r-55296)*1024+l-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ly="di$target",l2="di$dependencies",X0=new Map;function Ck(e){return e[l2]||[]}function Wt(e){if(X0.has(e))return X0.get(e);let t=function(n,r,l){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");kk(t,n,l)};return t._id=e,X0.set(e,t),t}function kk(e,t,n){t[ly]===t?t[l2].push({id:e,index:n}):(t[l2]=[{id:e,index:n}],t[ly]=t)}var ui=Wt("BufferService"),rx=Wt("CoreMouseService"),zr=Wt("CoreService"),Ek=Wt("CharsetService"),f1=Wt("InstantiationService"),ax=Wt("LogService"),di=Wt("OptionsService"),lx=Wt("OscLinkService"),Mk=Wt("UnicodeService"),jo=Wt("DecorationService"),o2=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=[],l=this._optionsService.rawOptions.linkHandler,h=new is,d=n.getTrimmedLength(),p=-1,g=-1,m=!1;for(let v=0;v<d;v++)if(!(g===-1&&!n.hasContent(v))){if(n.loadCell(v,h),h.hasExtendedAttrs()&&h.extended.urlId)if(g===-1){g=v,p=h.extended.urlId;continue}else m=h.extended.urlId!==p;else g!==-1&&(m=!0);if(m||g!==-1&&v===d-1){let _=this._oscLinkService.getLinkData(p)?.uri;if(_){let S={start:{x:g+1,y:e},end:{x:v+(!m&&v===d-1?1:0),y:e}},w=!1;if(!l?.allowNonHttpProtocols)try{let b=new URL(_);["http:","https:"].includes(b.protocol)||(w=!0)}catch{w=!0}w||r.push({text:_,range:S,activate:(b,k)=>l?l.activate(b,k,S):jk(b,k),hover:(b,k)=>l?.hover?.(b,k,S),leave:(b,k)=>l?.leave?.(b,k,S)})}m=!1,h.hasExtendedAttrs()&&h.extended.urlId?(g=v,p=h.extended.urlId):(g=-1,p=-1)}}t(r)}};o2=_t([me(0,ui),me(1,di),me(2,lx)],o2);function jk(e,t){if(confirm(`Do you want to navigate to ${t}?-WARNING: This link could potentially be dangerous`)){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 Xh=Wt("CharSizeService"),un=Wt("CoreBrowserService"),p1=Wt("MouseService"),dn=Wt("RenderService"),Tk=Wt("SelectionService"),ox=Wt("CharacterJoinerService"),Za=Wt("ThemeService"),cx=Wt("LinkProviderService"),Rk=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?oy.isErrorNoTelemetry(e)?new oy(e.message+`+WARNING: This link could potentially be dangerous`)){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 Xh=Wt("CharSizeService"),un=Wt("CoreBrowserService"),p1=Wt("MouseService"),dn=Wt("RenderService"),Tk=Wt("SelectionService"),ox=Wt("CharacterJoinerService"),Za=Wt("ThemeService"),cx=Wt("LinkProviderService"),Dk=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?oy.isErrorNoTelemetry(e)?new oy(e.message+``+e.stack):new Error(e.message+`-`+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)}},Dk=new Rk;function Ch(e){Ak(e)||Dk.onUnexpectedError(e)}var c2="Canceled";function Ak(e){return e instanceof Nk?!0:e instanceof Error&&e.name===c2&&e.message===c2}var Nk=class extends Error{constructor(){super(c2),this.name=this.message}};function Lk(e){return new Error(`Illegal argument: ${e}`)}var oy=class h2 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof h2)return t;let n=new h2;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},u2=class hx extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,hx.prototype)}};function zi(e,t=0){return e[e.length-(1+t)]}var Bk;(e=>{function t(h){return h<0}e.isLessThan=t;function n(h){return h<=0}e.isLessThanOrEqual=n;function r(h){return h>0}e.isGreaterThan=r;function l(h){return h===0}e.isNeitherLessOrGreaterThan=l,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Bk||={});function Ok(e,t){let n=this,r=!1,l;return function(){return r||(r=!0,t||(l=e.apply(n,arguments))),l}}var ux;(e=>{function t(z){return z&&typeof z=="object"&&typeof z[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*l(z){yield z}e.single=l;function h(z){return t(z)?z:l(z)}e.wrap=h;function d(z){return z||n}e.from=d;function*p(z){for(let F=z.length-1;F>=0;F--)yield z[F]}e.reverse=p;function g(z){return!z||z[Symbol.iterator]().next().done===!0}e.isEmpty=g;function m(z){return z[Symbol.iterator]().next().value}e.first=m;function v(z,F){let D=0;for(let I of z)if(F(I,D++))return!0;return!1}e.some=v;function _(z,F){for(let D of z)if(F(D))return D}e.find=_;function*S(z,F){for(let D of z)F(D)&&(yield D)}e.filter=S;function*w(z,F){let D=0;for(let I of z)yield F(I,D++)}e.map=w;function*b(z,F){let D=0;for(let I of z)yield*F(I,D++)}e.flatMap=b;function*k(...z){for(let F of z)yield*F}e.concat=k;function E(z,F,D){let I=D;for(let q of z)I=F(I,q);return I}e.reduce=E;function*j(z,F,D=z.length){for(F<0&&(F+=z.length),D<0?D+=z.length:D>z.length&&(D=z.length);F<D;F++)yield z[F]}e.slice=j;function V(z,F=Number.POSITIVE_INFINITY){let D=[];if(F===0)return[D,z];let I=z[Symbol.iterator]();for(let q=0;q<F;q++){let U=I.next();if(U.done)return[D,e.empty()];D.push(U.value)}return[D,{[Symbol.iterator](){return I}}]}e.consume=V;async function A(z){let F=[];for await(let D of z)F.push(D);return Promise.resolve(F)}e.asyncToArray=A})(ux||={});function Nr(e){if(ux.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function zk(...e){return ht(()=>Nr(e))}function ht(e){return{dispose:Ok(()=>{e()})}}var dx=class fx{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Nr(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?fx.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};dx.DISABLE_DISPOSED_WARNING=!1;var Qn=dx,He=class{constructor(){this._store=new Qn,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};He.None=Object.freeze({dispose(){}});var Fa=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},sn=typeof window=="object"?window:globalThis,d2=class f2{constructor(t){this.element=t,this.next=f2.Undefined,this.prev=f2.Undefined}};d2.Undefined=new d2(void 0);var dt=d2,cy=class{constructor(){this._first=dt.Undefined,this._last=dt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===dt.Undefined}clear(){let e=this._first;for(;e!==dt.Undefined;){let t=e.next;e.prev=dt.Undefined,e.next=dt.Undefined,e=t}this._first=dt.Undefined,this._last=dt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new dt(e);if(this._first===dt.Undefined)this._first=n,this._last=n;else if(t){let l=this._last;this._last=n,n.prev=l,l.next=n}else{let l=this._first;this._first=n,n.next=l,l.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==dt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==dt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==dt.Undefined&&e.next!==dt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===dt.Undefined&&e.next===dt.Undefined?(this._first=dt.Undefined,this._last=dt.Undefined):e.next===dt.Undefined?(this._last=this._last.prev,this._last.next=dt.Undefined):e.prev===dt.Undefined&&(this._first=this._first.next,this._first.prev=dt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==dt.Undefined;)yield e.element,e=e.next}},Hk=globalThis.performance&&typeof globalThis.performance.now=="function",Ik=class px{static create(t){return new px(t)}constructor(t){this._now=Hk&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},ei;(e=>{e.None=()=>He.None;function t(M,N){return _(M,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function n(M){return(N,L=null,O)=>{let P=!1,te;return te=M(Q=>{if(!P)return te?te.dispose():P=!0,N.call(L,Q)},null,O),P&&te.dispose(),te}}e.once=n;function r(M,N,L){return m((O,P=null,te)=>M(Q=>O.call(P,N(Q)),null,te),L)}e.map=r;function l(M,N,L){return m((O,P=null,te)=>M(Q=>{N(Q),O.call(P,Q)},null,te),L)}e.forEach=l;function h(M,N,L){return m((O,P=null,te)=>M(Q=>N(Q)&&O.call(P,Q),null,te),L)}e.filter=h;function d(M){return M}e.signal=d;function p(...M){return(N,L=null,O)=>{let P=zk(...M.map(te=>te(Q=>N.call(L,Q))));return v(P,O)}}e.any=p;function g(M,N,L,O){let P=L;return r(M,te=>(P=N(P,te),P),O)}e.reduce=g;function m(M,N){let L,O={onWillAddFirstListener(){L=M(P.fire,P)},onDidRemoveLastListener(){L?.dispose()}},P=new ue(O);return N?.add(P),P.event}function v(M,N){return N instanceof Array?N.push(M):N&&N.add(M),M}function _(M,N,L=100,O=!1,P=!1,te,Q){let ce,re,de,Ce=0,je,R={leakWarningThreshold:te,onWillAddFirstListener(){ce=M(le=>{Ce++,re=N(re,le),O&&!de&&(J.fire(re),re=void 0),je=()=>{let he=re;re=void 0,de=void 0,(!O||Ce>1)&&J.fire(he),Ce=0},typeof L=="number"?(clearTimeout(de),de=setTimeout(je,L)):de===void 0&&(de=0,queueMicrotask(je))})},onWillRemoveListener(){P&&Ce>0&&je?.()},onDidRemoveLastListener(){je=void 0,ce.dispose()}},J=new ue(R);return Q?.add(J),J.event}e.debounce=_;function S(M,N=0,L){return e.debounce(M,(O,P)=>O?(O.push(P),O):[P],N,void 0,!0,void 0,L)}e.accumulate=S;function w(M,N=(O,P)=>O===P,L){let O=!0,P;return h(M,te=>{let Q=O||!N(te,P);return O=!1,P=te,Q},L)}e.latch=w;function b(M,N,L){return[e.filter(M,N,L),e.filter(M,O=>!N(O),L)]}e.split=b;function k(M,N=!1,L=[],O){let P=L.slice(),te=M(re=>{P?P.push(re):ce.fire(re)});O&&O.add(te);let Q=()=>{P?.forEach(re=>ce.fire(re)),P=null},ce=new ue({onWillAddFirstListener(){te||(te=M(re=>ce.fire(re)),O&&O.add(te))},onDidAddFirstListener(){P&&(N?setTimeout(Q):Q())},onDidRemoveLastListener(){te&&te.dispose(),te=null}});return O&&O.add(ce),ce.event}e.buffer=k;function E(M,N){return(L,O,P)=>{let te=N(new V);return M(function(Q){let ce=te.evaluate(Q);ce!==j&&L.call(O,ce)},void 0,P)}}e.chain=E;let j=Symbol("HaltChainable");class V{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(L=>(N(L),L)),this}filter(N){return this.steps.push(L=>N(L)?L:j),this}reduce(N,L){let O=L;return this.steps.push(P=>(O=N(O,P),O)),this}latch(N=(L,O)=>L===O){let L=!0,O;return this.steps.push(P=>{let te=L||!N(P,O);return L=!1,O=P,te?P:j}),this}evaluate(N){for(let L of this.steps)if(N=L(N),N===j)break;return N}}function A(M,N,L=O=>O){let O=(...ce)=>Q.fire(L(...ce)),P=()=>M.on(N,O),te=()=>M.removeListener(N,O),Q=new ue({onWillAddFirstListener:P,onDidRemoveLastListener:te});return Q.event}e.fromNodeEventEmitter=A;function z(M,N,L=O=>O){let O=(...ce)=>Q.fire(L(...ce)),P=()=>M.addEventListener(N,O),te=()=>M.removeEventListener(N,O),Q=new ue({onWillAddFirstListener:P,onDidRemoveLastListener:te});return Q.event}e.fromDOMEventEmitter=z;function F(M){return new Promise(N=>n(M)(N))}e.toPromise=F;function D(M){let N=new ue;return M.then(L=>{N.fire(L)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=D;function I(M,N){return M(L=>N.fire(L))}e.forward=I;function q(M,N,L){return N(L),M(O=>N(O))}e.runAndSubscribe=q;class U{constructor(N,L){this._observable=N,this._counter=0,this._hasChanged=!1;let O={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new ue(O),L&&L.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,L){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Y(M,N){return new U(M,N).emitter.event}e.fromObservable=Y;function $(M){return(N,L,O)=>{let P=0,te=!1,Q={beginUpdate(){P++},endUpdate(){P--,P===0&&(M.reportChanges(),te&&(te=!1,N.call(L)))},handlePossibleChange(){},handleChange(){te=!0}};M.addObserver(Q),M.reportChanges();let ce={dispose(){M.removeObserver(Q)}};return O instanceof Qn?O.add(ce):Array.isArray(O)&&O.push(ce),ce}}e.fromObservableLight=$})(ei||={});var p2=class g2{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${g2._idPool++}`,g2.all.add(this)}start(t){this._stopWatch=new Ik,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};p2.all=new Set,p2._idPool=0;var Uk=p2,Pk=-1,gx=class mx{constructor(t,n,r=(mx._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)return;this._stacks||(this._stacks=new Map);let l=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,l+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[h,d]=this.getMostFrequentStack(),p=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${d}):`;console.warn(p),console.warn(h);let g=new $k(p,h);this._errorHandler(g)}return()=>{let h=this._stacks.get(t.value)||0;this._stacks.set(t.value,h-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,l]of this._stacks)(!t||n<l)&&(t=[r,l],n=l);return t}};gx._idPool=1;var qk=gx,Vk=class vx{constructor(t){this.value=t}static create(){let t=new Error;return new vx(t.stack??"")}print(){console.warn(this.value.split(`+`+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)}},Rk=new Dk;function Ch(e){Ak(e)||Rk.onUnexpectedError(e)}var c2="Canceled";function Ak(e){return e instanceof Nk?!0:e instanceof Error&&e.name===c2&&e.message===c2}var Nk=class extends Error{constructor(){super(c2),this.name=this.message}};function Lk(e){return new Error(`Illegal argument: ${e}`)}var oy=class h2 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof h2)return t;let n=new h2;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},u2=class hx extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,hx.prototype)}};function zi(e,t=0){return e[e.length-(1+t)]}var Bk;(e=>{function t(h){return h<0}e.isLessThan=t;function n(h){return h<=0}e.isLessThanOrEqual=n;function r(h){return h>0}e.isGreaterThan=r;function l(h){return h===0}e.isNeitherLessOrGreaterThan=l,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Bk||={});function Ok(e,t){let n=this,r=!1,l;return function(){return r||(r=!0,t||(l=e.apply(n,arguments))),l}}var ux;(e=>{function t(z){return z&&typeof z=="object"&&typeof z[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*l(z){yield z}e.single=l;function h(z){return t(z)?z:l(z)}e.wrap=h;function d(z){return z||n}e.from=d;function*p(z){for(let F=z.length-1;F>=0;F--)yield z[F]}e.reverse=p;function g(z){return!z||z[Symbol.iterator]().next().done===!0}e.isEmpty=g;function m(z){return z[Symbol.iterator]().next().value}e.first=m;function v(z,F){let R=0;for(let I of z)if(F(I,R++))return!0;return!1}e.some=v;function _(z,F){for(let R of z)if(F(R))return R}e.find=_;function*S(z,F){for(let R of z)F(R)&&(yield R)}e.filter=S;function*w(z,F){let R=0;for(let I of z)yield F(I,R++)}e.map=w;function*b(z,F){let R=0;for(let I of z)yield*F(I,R++)}e.flatMap=b;function*k(...z){for(let F of z)yield*F}e.concat=k;function E(z,F,R){let I=R;for(let q of z)I=F(I,q);return I}e.reduce=E;function*j(z,F,R=z.length){for(F<0&&(F+=z.length),R<0?R+=z.length:R>z.length&&(R=z.length);F<R;F++)yield z[F]}e.slice=j;function V(z,F=Number.POSITIVE_INFINITY){let R=[];if(F===0)return[R,z];let I=z[Symbol.iterator]();for(let q=0;q<F;q++){let U=I.next();if(U.done)return[R,e.empty()];R.push(U.value)}return[R,{[Symbol.iterator](){return I}}]}e.consume=V;async function A(z){let F=[];for await(let R of z)F.push(R);return Promise.resolve(F)}e.asyncToArray=A})(ux||={});function Nr(e){if(ux.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function zk(...e){return ht(()=>Nr(e))}function ht(e){return{dispose:Ok(()=>{e()})}}var dx=class fx{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Nr(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?fx.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};dx.DISABLE_DISPOSED_WARNING=!1;var Qn=dx,He=class{constructor(){this._store=new Qn,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};He.None=Object.freeze({dispose(){}});var Fa=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},sn=typeof window=="object"?window:globalThis,d2=class f2{constructor(t){this.element=t,this.next=f2.Undefined,this.prev=f2.Undefined}};d2.Undefined=new d2(void 0);var dt=d2,cy=class{constructor(){this._first=dt.Undefined,this._last=dt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===dt.Undefined}clear(){let e=this._first;for(;e!==dt.Undefined;){let t=e.next;e.prev=dt.Undefined,e.next=dt.Undefined,e=t}this._first=dt.Undefined,this._last=dt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new dt(e);if(this._first===dt.Undefined)this._first=n,this._last=n;else if(t){let l=this._last;this._last=n,n.prev=l,l.next=n}else{let l=this._first;this._first=n,n.next=l,l.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==dt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==dt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==dt.Undefined&&e.next!==dt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===dt.Undefined&&e.next===dt.Undefined?(this._first=dt.Undefined,this._last=dt.Undefined):e.next===dt.Undefined?(this._last=this._last.prev,this._last.next=dt.Undefined):e.prev===dt.Undefined&&(this._first=this._first.next,this._first.prev=dt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==dt.Undefined;)yield e.element,e=e.next}},Hk=globalThis.performance&&typeof globalThis.performance.now=="function",Ik=class px{static create(t){return new px(t)}constructor(t){this._now=Hk&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},ei;(e=>{e.None=()=>He.None;function t(M,N){return _(M,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function n(M){return(N,L=null,O)=>{let P=!1,te;return te=M(Q=>{if(!P)return te?te.dispose():P=!0,N.call(L,Q)},null,O),P&&te.dispose(),te}}e.once=n;function r(M,N,L){return m((O,P=null,te)=>M(Q=>O.call(P,N(Q)),null,te),L)}e.map=r;function l(M,N,L){return m((O,P=null,te)=>M(Q=>{N(Q),O.call(P,Q)},null,te),L)}e.forEach=l;function h(M,N,L){return m((O,P=null,te)=>M(Q=>N(Q)&&O.call(P,Q),null,te),L)}e.filter=h;function d(M){return M}e.signal=d;function p(...M){return(N,L=null,O)=>{let P=zk(...M.map(te=>te(Q=>N.call(L,Q))));return v(P,O)}}e.any=p;function g(M,N,L,O){let P=L;return r(M,te=>(P=N(P,te),P),O)}e.reduce=g;function m(M,N){let L,O={onWillAddFirstListener(){L=M(P.fire,P)},onDidRemoveLastListener(){L?.dispose()}},P=new ue(O);return N?.add(P),P.event}function v(M,N){return N instanceof Array?N.push(M):N&&N.add(M),M}function _(M,N,L=100,O=!1,P=!1,te,Q){let ce,re,de,Ce=0,je,D={leakWarningThreshold:te,onWillAddFirstListener(){ce=M(le=>{Ce++,re=N(re,le),O&&!de&&(J.fire(re),re=void 0),je=()=>{let he=re;re=void 0,de=void 0,(!O||Ce>1)&&J.fire(he),Ce=0},typeof L=="number"?(clearTimeout(de),de=setTimeout(je,L)):de===void 0&&(de=0,queueMicrotask(je))})},onWillRemoveListener(){P&&Ce>0&&je?.()},onDidRemoveLastListener(){je=void 0,ce.dispose()}},J=new ue(D);return Q?.add(J),J.event}e.debounce=_;function S(M,N=0,L){return e.debounce(M,(O,P)=>O?(O.push(P),O):[P],N,void 0,!0,void 0,L)}e.accumulate=S;function w(M,N=(O,P)=>O===P,L){let O=!0,P;return h(M,te=>{let Q=O||!N(te,P);return O=!1,P=te,Q},L)}e.latch=w;function b(M,N,L){return[e.filter(M,N,L),e.filter(M,O=>!N(O),L)]}e.split=b;function k(M,N=!1,L=[],O){let P=L.slice(),te=M(re=>{P?P.push(re):ce.fire(re)});O&&O.add(te);let Q=()=>{P?.forEach(re=>ce.fire(re)),P=null},ce=new ue({onWillAddFirstListener(){te||(te=M(re=>ce.fire(re)),O&&O.add(te))},onDidAddFirstListener(){P&&(N?setTimeout(Q):Q())},onDidRemoveLastListener(){te&&te.dispose(),te=null}});return O&&O.add(ce),ce.event}e.buffer=k;function E(M,N){return(L,O,P)=>{let te=N(new V);return M(function(Q){let ce=te.evaluate(Q);ce!==j&&L.call(O,ce)},void 0,P)}}e.chain=E;let j=Symbol("HaltChainable");class V{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(L=>(N(L),L)),this}filter(N){return this.steps.push(L=>N(L)?L:j),this}reduce(N,L){let O=L;return this.steps.push(P=>(O=N(O,P),O)),this}latch(N=(L,O)=>L===O){let L=!0,O;return this.steps.push(P=>{let te=L||!N(P,O);return L=!1,O=P,te?P:j}),this}evaluate(N){for(let L of this.steps)if(N=L(N),N===j)break;return N}}function A(M,N,L=O=>O){let O=(...ce)=>Q.fire(L(...ce)),P=()=>M.on(N,O),te=()=>M.removeListener(N,O),Q=new ue({onWillAddFirstListener:P,onDidRemoveLastListener:te});return Q.event}e.fromNodeEventEmitter=A;function z(M,N,L=O=>O){let O=(...ce)=>Q.fire(L(...ce)),P=()=>M.addEventListener(N,O),te=()=>M.removeEventListener(N,O),Q=new ue({onWillAddFirstListener:P,onDidRemoveLastListener:te});return Q.event}e.fromDOMEventEmitter=z;function F(M){return new Promise(N=>n(M)(N))}e.toPromise=F;function R(M){let N=new ue;return M.then(L=>{N.fire(L)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=R;function I(M,N){return M(L=>N.fire(L))}e.forward=I;function q(M,N,L){return N(L),M(O=>N(O))}e.runAndSubscribe=q;class U{constructor(N,L){this._observable=N,this._counter=0,this._hasChanged=!1;let O={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new ue(O),L&&L.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,L){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Y(M,N){return new U(M,N).emitter.event}e.fromObservable=Y;function $(M){return(N,L,O)=>{let P=0,te=!1,Q={beginUpdate(){P++},endUpdate(){P--,P===0&&(M.reportChanges(),te&&(te=!1,N.call(L)))},handlePossibleChange(){},handleChange(){te=!0}};M.addObserver(Q),M.reportChanges();let ce={dispose(){M.removeObserver(Q)}};return O instanceof Qn?O.add(ce):Array.isArray(O)&&O.push(ce),ce}}e.fromObservableLight=$})(ei||={});var p2=class g2{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${g2._idPool++}`,g2.all.add(this)}start(t){this._stopWatch=new Ik,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};p2.all=new Set,p2._idPool=0;var Uk=p2,Pk=-1,gx=class mx{constructor(t,n,r=(mx._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)return;this._stacks||(this._stacks=new Map);let l=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,l+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[h,d]=this.getMostFrequentStack(),p=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${d}):`;console.warn(p),console.warn(h);let g=new $k(p,h);this._errorHandler(g)}return()=>{let h=this._stacks.get(t.value)||0;this._stacks.set(t.value,h-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,l]of this._stacks)(!t||n<l)&&(t=[r,l],n=l);return t}};gx._idPool=1;var qk=gx,Vk=class vx{constructor(t){this.value=t}static create(){let t=new Error;return new vx(t.stack??"")}print(){console.warn(this.value.split(``).slice(2).join(`-`))}},$k=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Wk=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Fk=0,Q0=class{constructor(e){this.value=e,this.id=Fk++}},Kk=2,Yk,ue=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new qk(e?.onListenerError??Ch,this._options?.leakWarningThreshold??Pk):void 0,this._perfMon=this._options?._profName?new Uk(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 d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],g=new Wk(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||Ch)(g),He.None}if(this._disposed)return He.None;t&&(e=e.bind(t));let r=new Q0(e),l;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Vk.create(),l=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Q0?(this._deliveryQueue??=new Gk,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let h=ht(()=>{l?.(),this._removeListener(r)});return n instanceof Qn?n.add(h):Array.isArray(n)&&n.push(h),h},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)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Kk<=t.length){let l=0;for(let h=0;h<t.length;h++)t[h]?t[l++]=t[h]:r&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=l}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Ch;if(!n){e.value(t);return}try{e.value(t)}catch(r){n(r)}}_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 Q0)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}},Gk=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}},m2=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ue,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ue,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};m2.INSTANCE=new m2;var g1=m2;function Zk(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}g1.INSTANCE.onDidChangeZoomLevel;function Xk(e){return g1.INSTANCE.getZoomFactor(e)}g1.INSTANCE.onDidChangeFullscreen;var Xa=typeof navigator=="object"?navigator.userAgent:"",v2=Xa.indexOf("Firefox")>=0,Qk=Xa.indexOf("AppleWebKit")>=0,m1=Xa.indexOf("Chrome")>=0,Jk=!m1&&Xa.indexOf("Safari")>=0;Xa.indexOf("Electron/")>=0;Xa.indexOf("Android")>=0;var J0=!1;if(typeof sn.matchMedia=="function"){let e=sn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=sn.matchMedia("(display-mode: fullscreen)");J0=e.matches,Zk(sn,e,({matches:n})=>{J0&&t.matches||(J0=n)})}var Ia="en",_2=!1,y2=!1,kh=!1,_x=!1,fh,Eh=Ia,hy=Ia,eE,Qs,Dr=globalThis,Ii;typeof Dr.vscode<"u"&&typeof Dr.vscode.process<"u"?Ii=Dr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Ii=process);var tE=typeof Ii?.versions?.electron=="string",iE=tE&&Ii?.type==="renderer";if(typeof Ii=="object"){_2=Ii.platform==="win32",y2=Ii.platform==="darwin",kh=Ii.platform==="linux",kh&&Ii.env.SNAP&&Ii.env.SNAP_REVISION,Ii.env.CI||Ii.env.BUILD_ARTIFACTSTAGINGDIRECTORY,fh=Ia,Eh=Ia;let e=Ii.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);fh=t.userLocale,hy=t.osLocale,Eh=t.resolvedLanguage||Ia,eE=t.languagePack?.translationsConfigFile}catch{}_x=!0}else typeof navigator=="object"&&!iE?(Qs=navigator.userAgent,_2=Qs.indexOf("Windows")>=0,y2=Qs.indexOf("Macintosh")>=0,(Qs.indexOf("Macintosh")>=0||Qs.indexOf("iPad")>=0||Qs.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,kh=Qs.indexOf("Linux")>=0,Qs?.indexOf("Mobi")>=0,Eh=globalThis._VSCODE_NLS_LANGUAGE||Ia,fh=navigator.language.toLowerCase(),hy=fh):console.error("Unable to resolve platform.");var yx=_2,Ns=y2,sE=kh,uy=_x,Ls=Qs,Pn=Eh,nE;(e=>{function t(){return Pn}e.value=t;function n(){return Pn.length===2?Pn==="en":Pn.length>=3?Pn[0]==="e"&&Pn[1]==="n"&&Pn[2]==="-":!1}e.isDefaultVariant=n;function r(){return Pn==="en"}e.isDefault=r})(nE||={});var rE=typeof Dr.postMessage=="function"&&!Dr.importScripts;(()=>{if(rE){let e=[];Dr.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,l=e.length;r<l;r++){let h=e[r];if(h.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),h.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Dr.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var aE=!!(Ls&&Ls.indexOf("Chrome")>=0);Ls&&Ls.indexOf("Firefox")>=0;!aE&&Ls&&Ls.indexOf("Safari")>=0;Ls&&Ls.indexOf("Edg/")>=0;Ls&&Ls.indexOf("Android")>=0;var La=typeof navigator=="object"?navigator:{};uy||document.queryCommandSupported&&document.queryCommandSupported("copy")||La&&La.clipboard&&La.clipboard.writeText,uy||La&&La.clipboard&&La.clipboard.readText;var v1=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}},ef=new v1,dy=new v1,fy=new v1,lE=new Array(230),Sx;(e=>{function t(p){return ef.keyCodeToStr(p)}e.toString=t;function n(p){return ef.strToKeyCode(p)}e.fromString=n;function r(p){return dy.keyCodeToStr(p)}e.toUserSettingsUS=r;function l(p){return fy.keyCodeToStr(p)}e.toUserSettingsGeneral=l;function h(p){return dy.strToKeyCode(p)||fy.strToKeyCode(p)}e.fromUserSettings=h;function d(p){if(p>=98&&p<=113)return null;switch(p){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return ef.keyCodeToStr(p)}e.toElectronAccelerator=d})(Sx||={});var oE=class xx{constructor(t,n,r,l,h){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=l,this.keyCode=h}equals(t){return t instanceof xx&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",l=this.metaKey?"1":"0";return`K${t}${n}${r}${l}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new cE([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},cE=class{constructor(e){if(e.length===0)throw Lk("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 hE(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return Sx.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(v2)switch(t){case 59:return 85;case 60:if(sE)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ns)return 57;break}else if(Qk&&(Ns&&t===93||!Ns&&t===92))return 57;return lE[t]||0}var uE=Ns?256:2048,dE=512,fE=1024,pE=Ns?2048:256,py=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=hE(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|=uE),this.altKey&&(t|=dE),this.shiftKey&&(t|=fE),this.metaKey&&(t|=pE),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new oE(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},gy=new WeakMap;function gE(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 mE=class{static getSameOriginWindowChain(e){let t=gy.get(e);if(!t){t=[],gy.set(e,t);let n=e,r;do r=gE(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,l=this.getSameOriginWindowChain(e);for(let h of l){let d=h.window.deref();if(n+=d?.scrollY??0,r+=d?.scrollX??0,d===t||!h.iframeElement)break;let p=h.iframeElement.getBoundingClientRect();n+=p.top,r+=p.left}return{top:n,left:r}}},ph=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=mE.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},my=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(m1){let l=navigator.userAgent.match(/Chrome\/(\d+)/);r=(l?parseInt(l[1]):123)<=122}if(e){let l=e,h=e,d=e.view?.devicePixelRatio||1;if(typeof l.wheelDeltaY<"u")r?this.deltaY=l.wheelDeltaY/(120*d):this.deltaY=l.wheelDeltaY/120;else if(typeof h.VERTICAL_AXIS<"u"&&h.axis===h.VERTICAL_AXIS)this.deltaY=-h.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?v2&&!Ns?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof l.wheelDeltaX<"u")Jk&&yx?this.deltaX=-(l.wheelDeltaX/120):r?this.deltaX=l.wheelDeltaX/(120*d):this.deltaX=l.wheelDeltaX/120;else if(typeof h.HORIZONTAL_AXIS<"u"&&h.axis===h.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?v2&&!Ns?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},wx=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),vE;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof _E?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ei.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:wx})})(vE||={});var _E=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?wx:(this._emitter||(this._emitter=new ue),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},_1=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 u2("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new u2("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},yE=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 u2("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=ht(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},SE;(e=>{async function t(r){let l,h=await Promise.all(r.map(d=>d.then(p=>p,p=>{l||(l=p)})));if(typeof l<"u")throw l;return h}e.settled=t;function n(r){return new Promise(async(l,h)=>{try{await r(l,h)}catch(d){h(d)}})}e.withAsyncBody=n})(SE||={});var vy=class Xi{static fromArray(t){return new Xi(n=>{n.emitMany(t)})}static fromPromise(t){return new Xi(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Xi(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new Xi(async n=>{await Promise.all(t.map(async r=>{for await(let l of r)n.emitOne(l)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new ue,queueMicrotask(async()=>{let r={emitOne:l=>this.emitOne(l),emitMany:l=>this.emitMany(l),reject:l=>this.reject(l)};try{await Promise.resolve(t(r)),this.resolve()}catch(l){this.reject(l)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await ei.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Xi(async r=>{for await(let l of t)r.emitOne(n(l))})}map(t){return Xi.map(this,t)}static filter(t,n){return new Xi(async r=>{for await(let l of t)n(l)&&r.emitOne(l)})}filter(t){return Xi.filter(this,t)}static coalesce(t){return Xi.filter(t,n=>!!n)}coalesce(){return Xi.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return Xi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};vy.EMPTY=vy.fromArray([]);var{getWindow:As,getWindowId:xE,onDidRegisterWindow:wE}=(function(){let e=new Map,t={window:sn,disposables:new Qn};e.set(sn.vscodeWindowId,t);let n=new ue,r=new ue,l=new ue;function h(d,p){return(typeof d=="number"?e.get(d):void 0)??(p?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:l.event,onDidUnregisterWindow:r.event,registerWindow(d){if(e.has(d.vscodeWindowId))return He.None;let p=new Qn,g={window:d,disposables:p.add(new Qn)};return e.set(d.vscodeWindowId,g),p.add(ht(()=>{e.delete(d.vscodeWindowId),r.fire(d)})),p.add(Te(d,Ut.BEFORE_UNLOAD,()=>{l.fire(d)})),n.fire(g),p},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(d){return d.vscodeWindowId},hasWindow(d){return e.has(d)},getWindowById:h,getWindow(d){let p=d;if(p?.ownerDocument?.defaultView)return p.ownerDocument.defaultView.window;let g=d;return g?.view?g.view.window:sn},getDocument(d){return As(d).document}}})(),bE=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,this._handler=null)}};function Te(e,t,n,r){return new bE(e,t,n,r)}var _y=function(e,t,n,r){return Te(e,t,n,r)},y1,CE=class extends yE{constructor(e){super(),this.defaultTarget=e&&As(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},yy=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){Ch(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,l=h=>{n.set(h,!1);let d=e.get(h)??[];for(t.set(h,d),e.set(h,[]),r.set(h,!0);d.length>0;)d.sort(yy.sort),d.shift().execute();r.set(h,!1)};y1=(h,d,p=0)=>{let g=xE(h),m=new yy(d,p),v=e.get(g);return v||(v=[],e.set(g,v)),v.push(m),n.get(g)||(n.set(g,!0),h.requestAnimationFrame(()=>l(g))),m}})();function kE(e){let t=e.getBoundingClientRect(),n=As(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Ut={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},EE=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=wi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=wi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=wi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=wi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=wi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=wi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=wi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=wi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=wi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=wi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=wi(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=wi(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=wi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=wi(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 wi(e){return typeof e=="number"?`${e}px`:e}function mo(e){return new EE(e)}var bx=class{constructor(){this._hooks=new Qn,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,l){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=l;let h=e;try{e.setPointerCapture(t),this._hooks.add(ht(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{h=As(e)}this._hooks.add(Te(h,Ut.POINTER_MOVE,d=>{if(d.buttons!==n){this.stopMonitoring(!0);return}d.preventDefault(),this._pointerMoveCallback(d)})),this._hooks.add(Te(h,Ut.POINTER_UP,d=>this.stopMonitoring(!0)))}};function ME(e,t,n){let r=null,l=null;if(typeof n.value=="function"?(r="value",l=n.value,l.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",l=n.get),!l)throw new Error("not supported");let h=`$memoize$${t}`;n[r]=function(...d){return this.hasOwnProperty(h)||Object.defineProperty(this,h,{configurable:!1,enumerable:!1,writable:!1,value:l.apply(this,d)}),this[h]}}var Rs;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Rs||={});var ao=class si extends He{constructor(){super(),this.dispatched=!1,this.targets=new cy,this.ignoreTargets=new cy,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ei.runAndSubscribe(wE,({window:t,disposables:n})=>{n.add(Te(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(Te(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(Te(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:sn,disposables:this._store}))}static addTarget(t){if(!si.isTouchDevice())return He.None;si.INSTANCE||(si.INSTANCE=new si);let n=si.INSTANCE.targets.push(t);return ht(n)}static ignoreTarget(t){if(!si.isTouchDevice())return He.None;si.INSTANCE||(si.INSTANCE=new si);let n=si.INSTANCE.ignoreTargets.push(t);return ht(n)}static isTouchDevice(){return"ontouchstart"in sn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,l=t.targetTouches.length;r<l;r++){let h=t.targetTouches.item(r);this.activeTouches[h.identifier]={id:h.identifier,initialTarget:h.target,initialTimeStamp:n,initialPageX:h.pageX,initialPageY:h.pageY,rollingTimestamps:[n],rollingPageX:[h.pageX],rollingPageY:[h.pageY]};let d=this.newGestureEvent(Rs.Start,h.target);d.pageX=h.pageX,d.pageY=h.pageY,this.dispatchEvent(d)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),l=Object.keys(this.activeTouches).length;for(let h=0,d=n.changedTouches.length;h<d;h++){let p=n.changedTouches.item(h);if(!this.activeTouches.hasOwnProperty(String(p.identifier))){console.warn("move of an UNKNOWN touch",p);continue}let g=this.activeTouches[p.identifier],m=Date.now()-g.initialTimeStamp;if(m<si.HOLD_DELAY&&Math.abs(g.initialPageX-zi(g.rollingPageX))<30&&Math.abs(g.initialPageY-zi(g.rollingPageY))<30){let v=this.newGestureEvent(Rs.Tap,g.initialTarget);v.pageX=zi(g.rollingPageX),v.pageY=zi(g.rollingPageY),this.dispatchEvent(v)}else if(m>=si.HOLD_DELAY&&Math.abs(g.initialPageX-zi(g.rollingPageX))<30&&Math.abs(g.initialPageY-zi(g.rollingPageY))<30){let v=this.newGestureEvent(Rs.Contextmenu,g.initialTarget);v.pageX=zi(g.rollingPageX),v.pageY=zi(g.rollingPageY),this.dispatchEvent(v)}else if(l===1){let v=zi(g.rollingPageX),_=zi(g.rollingPageY),S=zi(g.rollingTimestamps)-g.rollingTimestamps[0],w=v-g.rollingPageX[0],b=_-g.rollingPageY[0],k=[...this.targets].filter(E=>g.initialTarget instanceof Node&&E.contains(g.initialTarget));this.inertia(t,k,r,Math.abs(w)/S,w>0?1:-1,v,Math.abs(b)/S,b>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(Rs.End,g.initialTarget)),delete this.activeTouches[p.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===Rs.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>si.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===Rs.Change||t.type===Rs.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let l=0,h=t.initialTarget;for(;h&&h!==r;)l++,h=h.parentElement;n.push([l,r])}n.sort((r,l)=>r[0]-l[0]);for(let[r,l]of n)l.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,l,h,d,p,g,m){this.handle=y1(t,()=>{let v=Date.now(),_=v-r,S=0,w=0,b=!0;l+=si.SCROLL_FRICTION*_,p+=si.SCROLL_FRICTION*_,l>0&&(b=!1,S=h*l*_),p>0&&(b=!1,w=g*p*_);let k=this.newGestureEvent(Rs.Change);k.translationX=S,k.translationY=w,n.forEach(E=>E.dispatchEvent(k)),b||this.inertia(t,n,v,l,h,d+S,p,g,m+w)})}onTouchMove(t){let n=Date.now();for(let r=0,l=t.changedTouches.length;r<l;r++){let h=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("end of an UNKNOWN touch",h);continue}let d=this.activeTouches[h.identifier],p=this.newGestureEvent(Rs.Change,d.initialTarget);p.translationX=h.pageX-zi(d.rollingPageX),p.translationY=h.pageY-zi(d.rollingPageY),p.pageX=h.pageX,p.pageY=h.pageY,this.dispatchEvent(p),d.rollingPageX.length>3&&(d.rollingPageX.shift(),d.rollingPageY.shift(),d.rollingTimestamps.shift()),d.rollingPageX.push(h.pageX),d.rollingPageY.push(h.pageY),d.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};ao.SCROLL_FRICTION=-.005,ao.HOLD_DELAY=700,ao.CLEAR_TAP_COUNT_TIME=400,_t([ME],ao,"isTouchDevice",1);var jE=ao,S1=class extends He{onclick(e,t){this._register(Te(e,Ut.CLICK,n=>t(new ph(As(e),n))))}onmousedown(e,t){this._register(Te(e,Ut.MOUSE_DOWN,n=>t(new ph(As(e),n))))}onmouseover(e,t){this._register(Te(e,Ut.MOUSE_OVER,n=>t(new ph(As(e),n))))}onmouseleave(e,t){this._register(Te(e,Ut.MOUSE_LEAVE,n=>t(new ph(As(e),n))))}onkeydown(e,t){this._register(Te(e,Ut.KEY_DOWN,n=>t(new py(n))))}onkeyup(e,t){this._register(Te(e,Ut.KEY_UP,n=>t(new py(n))))}oninput(e,t){this._register(Te(e,Ut.INPUT,t))}onblur(e,t){this._register(Te(e,Ut.BLUR,t))}onfocus(e,t){this._register(Te(e,Ut.FOCUS,t))}onchange(e,t){this._register(Te(e,Ut.CHANGE,t))}ignoreGesture(e){return jE.ignoreTarget(e)}},Sy=11,TE=class extends S1{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=Sy+"px",this.domNode.style.height=Sy+"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 bx),this._register(_y(this.bgDomNode,Ut.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(_y(this.domNode,Ut.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new CE),this._pointerdownScheduleRepeatTimer=this._register(new _1)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,As(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},RE=class S2{constructor(t,n,r,l,h,d,p){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,l=l|0,h=h|0,d=d|0,p=p|0),this.rawScrollLeft=l,this.rawScrollTop=p,n<0&&(n=0),l+n>r&&(l=r-n),l<0&&(l=0),h<0&&(h=0),p+h>d&&(p=d-h),p<0&&(p=0),this.width=n,this.scrollWidth=r,this.scrollLeft=l,this.height=h,this.scrollHeight=d,this.scrollTop=p}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new S2(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 S2(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(t,n){let r=this.width!==t.width,l=this.scrollWidth!==t.scrollWidth,h=this.scrollLeft!==t.scrollLeft,d=this.height!==t.height,p=this.scrollHeight!==t.scrollHeight,g=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:l,scrollLeftChanged:h,heightChanged:d,scrollHeightChanged:p,scrollTopChanged:g}}},DE=class extends He{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new RE(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=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(),this._smoothScrolling=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;t?r=new wy(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=wy.start(this._state,n,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)))}},xy=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function tf(e,t){let n=t-e;return function(r){return e+n*LE(r)}}function AE(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var wy=class x2{constructor(t,n,r,l){this.from=t,this.to=n,this.duration=l,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,r){if(Math.abs(t-n)>2.5*r){let l,h;return t<n?(l=t+.75*r,h=n-.75*r):(l=t-.75*r,h=n+.75*r),AE(tf(t,l),tf(h,n),.33)}return tf(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),l=this.scrollTop(n);return new xy(r,l,!1)}return new xy(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return x2.start(t,n,r)}static start(t,n,r){r=r+10;let l=Date.now()-10;return new x2(t,n,l,r)}};function NE(e){return Math.pow(e,3)}function LE(e){return 1-NE(1-e)}var BE=class extends He{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 _1)}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?!0: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":"")))}},OE=140,Cx=class extends S1{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 BE(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new bx),this._shouldRender=!0,this.domNode=mo(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(Te(this.domNode.domNode,Ut.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new TE(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=mo(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(Te(this.slider.domNode,Ut.POINTER_DOWN,l=>{l.button===0&&(l.preventDefault(),this._sliderPointerDown(l))})),this.onclick(this.slider.domNode,l=>{l.leftButton&&l.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(),l=this._sliderPointerPosition(e);n<=l&&l<=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 l=kE(this.domNode.domNode);t=e.pageX-l.left,n=e.pageY-l.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,l=>{let h=this._sliderOrthogonalPointerPosition(l),d=Math.abs(h-n);if(yx&&d>OE){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let p=this._sliderPointerPosition(l)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(p))},()=>{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()}},kx=class w2{constructor(t,n,r,l,h,d){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=l,this._scrollSize=h,this._scrollPosition=d,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new w2(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,l,h){let d=Math.max(0,r-t),p=Math.max(0,d-2*n),g=l>0&&l>r;if(!g)return{computedAvailableSize:Math.round(d),computedIsNeeded:g,computedSliderSize:Math.round(p),computedSliderRatio:0,computedSliderPosition:0};let m=Math.round(Math.max(20,Math.floor(r*p/l))),v=(p-m)/(l-r),_=h*v;return{computedAvailableSize:Math.round(d),computedIsNeeded:g,computedSliderSize:Math.round(m),computedSliderRatio:v,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=w2._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(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},zE=class extends Cx{constructor(e,t,n){let r=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new kx(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,l.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new 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}},HE=class extends Cx{constructor(e,t,n){let r=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new kx(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,l.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new 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}},IE=500,by=50,UE=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},b2=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,r=1,l=this._rear;do{let h=l===this._front?t:Math.pow(2,-r);if(t-=h,n+=this._memory[l].score*h,l===this._front)break;l=(this._capacity+l-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(m1){let n=As(t.browserEvent),r=Xk(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let l=null,h=new UE(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=h,this._front=0,this._rear=0):(l=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]=h),h.score=this._computeScore(h,l)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let l=Math.abs(t.deltaX),h=Math.abs(t.deltaY),d=Math.abs(n.deltaX),p=Math.abs(n.deltaY),g=Math.max(Math.min(l,d),1),m=Math.max(Math.min(h,p),1),v=Math.max(l,d),_=Math.max(h,p);v%g===0&&_%m===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};b2.INSTANCE=new b2;var PE=b2,qE=class extends S1{constructor(e,t,n){super(),this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ue),this.onWillScroll=this._onWillScroll.event,this._options=$E(t),this._scrollable=n,this._register(this._scrollable.onScroll(l=>{this._onWillScroll.fire(l),this._onDidScroll(l),this._onScroll.fire(l)}));let r={onMouseWheel:l=>this._onMouseWheel(l),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new HE(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new zE(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=mo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=mo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=mo(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,l=>this._onMouseOver(l)),this.onmouseleave(this._listenOnDomNode,l=>this._onMouseLeave(l)),this._hideTimeout=this._register(new _1),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Nr(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,Ns&&(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 my(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Nr(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new my(n))};this._mouseWheelToDispose.push(Te(this._listenOnDomNode,Ut.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=PE.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let l=e.deltaY*this._options.mouseWheelScrollSensitivity,h=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&h+l===0?h=l=0:Math.abs(l)>=Math.abs(h)?h=0:l=0),this._options.flipAxes&&([l,h]=[h,l]);let d=!Ns&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!h&&(h=l,l=0),e.browserEvent&&e.browserEvent.altKey&&(h=h*this._options.fastScrollSensitivity,l=l*this._options.fastScrollSensitivity);let p=this._scrollable.getFutureScrollPosition(),g={};if(l){let m=by*l,v=p.scrollTop-(m<0?Math.floor(m):Math.ceil(m));this._verticalScrollbar.writeScrollPosition(g,v)}if(h){let m=by*h,v=p.scrollLeft-(m<0?Math.floor(m):Math.ceil(m));this._horizontalScrollbar.writeScrollPosition(g,v)}g=this._scrollable.validateScrollPosition(g),(p.scrollLeft!==g.scrollLeft||p.scrollTop!==g.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(g):this._scrollable.setScrollPositionNow(g),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 new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",l=t?" top":"",h=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${l}`),this._topLeftShadowDomNode.setClassName(`shadow${h}${l}${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(),IE)}},VE=class extends qE{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 $E(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,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:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,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:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Ns&&(t.className+=" mac"),t}var C2=class extends He{constructor(e,t,n,r,l,h,d,p){super(),this._bufferService=n,this._optionsService=d,this._renderService=p,this._onRequestScrollLines=this._register(new ue),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let g=this._register(new DE({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:m=>y1(r.window,m)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{g.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new VE(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},g)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(l.onProtocolChange(m=>{this._scrollableElement.updateOptions({handleMouseWheel:!(m&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ei.runAndSubscribe(h.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=h.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ht(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ht(()=>this._styleElement.remove())),this._register(ei.runAndSubscribe(h.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${h.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${h.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${h.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`+`))}},$k=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Wk=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Fk=0,Q0=class{constructor(e){this.value=e,this.id=Fk++}},Kk=2,Yk,ue=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new qk(e?.onListenerError??Ch,this._options?.leakWarningThreshold??Pk):void 0,this._perfMon=this._options?._profName?new Uk(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 d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],g=new Wk(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||Ch)(g),He.None}if(this._disposed)return He.None;t&&(e=e.bind(t));let r=new Q0(e),l;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Vk.create(),l=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Q0?(this._deliveryQueue??=new Gk,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let h=ht(()=>{l?.(),this._removeListener(r)});return n instanceof Qn?n.add(h):Array.isArray(n)&&n.push(h),h},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)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Kk<=t.length){let l=0;for(let h=0;h<t.length;h++)t[h]?t[l++]=t[h]:r&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=l}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Ch;if(!n){e.value(t);return}try{e.value(t)}catch(r){n(r)}}_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 Q0)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}},Gk=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}},m2=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ue,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ue,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};m2.INSTANCE=new m2;var g1=m2;function Zk(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}g1.INSTANCE.onDidChangeZoomLevel;function Xk(e){return g1.INSTANCE.getZoomFactor(e)}g1.INSTANCE.onDidChangeFullscreen;var Xa=typeof navigator=="object"?navigator.userAgent:"",v2=Xa.indexOf("Firefox")>=0,Qk=Xa.indexOf("AppleWebKit")>=0,m1=Xa.indexOf("Chrome")>=0,Jk=!m1&&Xa.indexOf("Safari")>=0;Xa.indexOf("Electron/")>=0;Xa.indexOf("Android")>=0;var J0=!1;if(typeof sn.matchMedia=="function"){let e=sn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=sn.matchMedia("(display-mode: fullscreen)");J0=e.matches,Zk(sn,e,({matches:n})=>{J0&&t.matches||(J0=n)})}var Ia="en",_2=!1,y2=!1,kh=!1,_x=!1,fh,Eh=Ia,hy=Ia,eE,Qs,Rr=globalThis,Ii;typeof Rr.vscode<"u"&&typeof Rr.vscode.process<"u"?Ii=Rr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Ii=process);var tE=typeof Ii?.versions?.electron=="string",iE=tE&&Ii?.type==="renderer";if(typeof Ii=="object"){_2=Ii.platform==="win32",y2=Ii.platform==="darwin",kh=Ii.platform==="linux",kh&&Ii.env.SNAP&&Ii.env.SNAP_REVISION,Ii.env.CI||Ii.env.BUILD_ARTIFACTSTAGINGDIRECTORY,fh=Ia,Eh=Ia;let e=Ii.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);fh=t.userLocale,hy=t.osLocale,Eh=t.resolvedLanguage||Ia,eE=t.languagePack?.translationsConfigFile}catch{}_x=!0}else typeof navigator=="object"&&!iE?(Qs=navigator.userAgent,_2=Qs.indexOf("Windows")>=0,y2=Qs.indexOf("Macintosh")>=0,(Qs.indexOf("Macintosh")>=0||Qs.indexOf("iPad")>=0||Qs.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,kh=Qs.indexOf("Linux")>=0,Qs?.indexOf("Mobi")>=0,Eh=globalThis._VSCODE_NLS_LANGUAGE||Ia,fh=navigator.language.toLowerCase(),hy=fh):console.error("Unable to resolve platform.");var yx=_2,Ns=y2,sE=kh,uy=_x,Ls=Qs,Pn=Eh,nE;(e=>{function t(){return Pn}e.value=t;function n(){return Pn.length===2?Pn==="en":Pn.length>=3?Pn[0]==="e"&&Pn[1]==="n"&&Pn[2]==="-":!1}e.isDefaultVariant=n;function r(){return Pn==="en"}e.isDefault=r})(nE||={});var rE=typeof Rr.postMessage=="function"&&!Rr.importScripts;(()=>{if(rE){let e=[];Rr.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,l=e.length;r<l;r++){let h=e[r];if(h.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),h.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Rr.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var aE=!!(Ls&&Ls.indexOf("Chrome")>=0);Ls&&Ls.indexOf("Firefox")>=0;!aE&&Ls&&Ls.indexOf("Safari")>=0;Ls&&Ls.indexOf("Edg/")>=0;Ls&&Ls.indexOf("Android")>=0;var La=typeof navigator=="object"?navigator:{};uy||document.queryCommandSupported&&document.queryCommandSupported("copy")||La&&La.clipboard&&La.clipboard.writeText,uy||La&&La.clipboard&&La.clipboard.readText;var v1=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}},ef=new v1,dy=new v1,fy=new v1,lE=new Array(230),Sx;(e=>{function t(p){return ef.keyCodeToStr(p)}e.toString=t;function n(p){return ef.strToKeyCode(p)}e.fromString=n;function r(p){return dy.keyCodeToStr(p)}e.toUserSettingsUS=r;function l(p){return fy.keyCodeToStr(p)}e.toUserSettingsGeneral=l;function h(p){return dy.strToKeyCode(p)||fy.strToKeyCode(p)}e.fromUserSettings=h;function d(p){if(p>=98&&p<=113)return null;switch(p){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return ef.keyCodeToStr(p)}e.toElectronAccelerator=d})(Sx||={});var oE=class xx{constructor(t,n,r,l,h){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=l,this.keyCode=h}equals(t){return t instanceof xx&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",l=this.metaKey?"1":"0";return`K${t}${n}${r}${l}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new cE([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},cE=class{constructor(e){if(e.length===0)throw Lk("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 hE(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return Sx.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(v2)switch(t){case 59:return 85;case 60:if(sE)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ns)return 57;break}else if(Qk&&(Ns&&t===93||!Ns&&t===92))return 57;return lE[t]||0}var uE=Ns?256:2048,dE=512,fE=1024,pE=Ns?2048:256,py=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=hE(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|=uE),this.altKey&&(t|=dE),this.shiftKey&&(t|=fE),this.metaKey&&(t|=pE),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new oE(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},gy=new WeakMap;function gE(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 mE=class{static getSameOriginWindowChain(e){let t=gy.get(e);if(!t){t=[],gy.set(e,t);let n=e,r;do r=gE(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,l=this.getSameOriginWindowChain(e);for(let h of l){let d=h.window.deref();if(n+=d?.scrollY??0,r+=d?.scrollX??0,d===t||!h.iframeElement)break;let p=h.iframeElement.getBoundingClientRect();n+=p.top,r+=p.left}return{top:n,left:r}}},ph=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=mE.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},my=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(m1){let l=navigator.userAgent.match(/Chrome\/(\d+)/);r=(l?parseInt(l[1]):123)<=122}if(e){let l=e,h=e,d=e.view?.devicePixelRatio||1;if(typeof l.wheelDeltaY<"u")r?this.deltaY=l.wheelDeltaY/(120*d):this.deltaY=l.wheelDeltaY/120;else if(typeof h.VERTICAL_AXIS<"u"&&h.axis===h.VERTICAL_AXIS)this.deltaY=-h.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?v2&&!Ns?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof l.wheelDeltaX<"u")Jk&&yx?this.deltaX=-(l.wheelDeltaX/120):r?this.deltaX=l.wheelDeltaX/(120*d):this.deltaX=l.wheelDeltaX/120;else if(typeof h.HORIZONTAL_AXIS<"u"&&h.axis===h.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?v2&&!Ns?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},wx=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),vE;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof _E?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ei.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:wx})})(vE||={});var _E=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?wx:(this._emitter||(this._emitter=new ue),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},_1=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 u2("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new u2("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},yE=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 u2("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=ht(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},SE;(e=>{async function t(r){let l,h=await Promise.all(r.map(d=>d.then(p=>p,p=>{l||(l=p)})));if(typeof l<"u")throw l;return h}e.settled=t;function n(r){return new Promise(async(l,h)=>{try{await r(l,h)}catch(d){h(d)}})}e.withAsyncBody=n})(SE||={});var vy=class Xi{static fromArray(t){return new Xi(n=>{n.emitMany(t)})}static fromPromise(t){return new Xi(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Xi(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new Xi(async n=>{await Promise.all(t.map(async r=>{for await(let l of r)n.emitOne(l)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new ue,queueMicrotask(async()=>{let r={emitOne:l=>this.emitOne(l),emitMany:l=>this.emitMany(l),reject:l=>this.reject(l)};try{await Promise.resolve(t(r)),this.resolve()}catch(l){this.reject(l)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await ei.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Xi(async r=>{for await(let l of t)r.emitOne(n(l))})}map(t){return Xi.map(this,t)}static filter(t,n){return new Xi(async r=>{for await(let l of t)n(l)&&r.emitOne(l)})}filter(t){return Xi.filter(this,t)}static coalesce(t){return Xi.filter(t,n=>!!n)}coalesce(){return Xi.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return Xi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};vy.EMPTY=vy.fromArray([]);var{getWindow:As,getWindowId:xE,onDidRegisterWindow:wE}=(function(){let e=new Map,t={window:sn,disposables:new Qn};e.set(sn.vscodeWindowId,t);let n=new ue,r=new ue,l=new ue;function h(d,p){return(typeof d=="number"?e.get(d):void 0)??(p?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:l.event,onDidUnregisterWindow:r.event,registerWindow(d){if(e.has(d.vscodeWindowId))return He.None;let p=new Qn,g={window:d,disposables:p.add(new Qn)};return e.set(d.vscodeWindowId,g),p.add(ht(()=>{e.delete(d.vscodeWindowId),r.fire(d)})),p.add(Te(d,Ut.BEFORE_UNLOAD,()=>{l.fire(d)})),n.fire(g),p},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(d){return d.vscodeWindowId},hasWindow(d){return e.has(d)},getWindowById:h,getWindow(d){let p=d;if(p?.ownerDocument?.defaultView)return p.ownerDocument.defaultView.window;let g=d;return g?.view?g.view.window:sn},getDocument(d){return As(d).document}}})(),bE=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,this._handler=null)}};function Te(e,t,n,r){return new bE(e,t,n,r)}var _y=function(e,t,n,r){return Te(e,t,n,r)},y1,CE=class extends yE{constructor(e){super(),this.defaultTarget=e&&As(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},yy=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){Ch(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,l=h=>{n.set(h,!1);let d=e.get(h)??[];for(t.set(h,d),e.set(h,[]),r.set(h,!0);d.length>0;)d.sort(yy.sort),d.shift().execute();r.set(h,!1)};y1=(h,d,p=0)=>{let g=xE(h),m=new yy(d,p),v=e.get(g);return v||(v=[],e.set(g,v)),v.push(m),n.get(g)||(n.set(g,!0),h.requestAnimationFrame(()=>l(g))),m}})();function kE(e){let t=e.getBoundingClientRect(),n=As(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Ut={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},EE=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=wi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=wi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=wi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=wi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=wi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=wi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=wi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=wi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=wi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=wi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=wi(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=wi(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=wi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=wi(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 wi(e){return typeof e=="number"?`${e}px`:e}function mo(e){return new EE(e)}var bx=class{constructor(){this._hooks=new Qn,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,l){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=l;let h=e;try{e.setPointerCapture(t),this._hooks.add(ht(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{h=As(e)}this._hooks.add(Te(h,Ut.POINTER_MOVE,d=>{if(d.buttons!==n){this.stopMonitoring(!0);return}d.preventDefault(),this._pointerMoveCallback(d)})),this._hooks.add(Te(h,Ut.POINTER_UP,d=>this.stopMonitoring(!0)))}};function ME(e,t,n){let r=null,l=null;if(typeof n.value=="function"?(r="value",l=n.value,l.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",l=n.get),!l)throw new Error("not supported");let h=`$memoize$${t}`;n[r]=function(...d){return this.hasOwnProperty(h)||Object.defineProperty(this,h,{configurable:!1,enumerable:!1,writable:!1,value:l.apply(this,d)}),this[h]}}var Ds;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ds||={});var ao=class si extends He{constructor(){super(),this.dispatched=!1,this.targets=new cy,this.ignoreTargets=new cy,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ei.runAndSubscribe(wE,({window:t,disposables:n})=>{n.add(Te(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(Te(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(Te(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:sn,disposables:this._store}))}static addTarget(t){if(!si.isTouchDevice())return He.None;si.INSTANCE||(si.INSTANCE=new si);let n=si.INSTANCE.targets.push(t);return ht(n)}static ignoreTarget(t){if(!si.isTouchDevice())return He.None;si.INSTANCE||(si.INSTANCE=new si);let n=si.INSTANCE.ignoreTargets.push(t);return ht(n)}static isTouchDevice(){return"ontouchstart"in sn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,l=t.targetTouches.length;r<l;r++){let h=t.targetTouches.item(r);this.activeTouches[h.identifier]={id:h.identifier,initialTarget:h.target,initialTimeStamp:n,initialPageX:h.pageX,initialPageY:h.pageY,rollingTimestamps:[n],rollingPageX:[h.pageX],rollingPageY:[h.pageY]};let d=this.newGestureEvent(Ds.Start,h.target);d.pageX=h.pageX,d.pageY=h.pageY,this.dispatchEvent(d)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),l=Object.keys(this.activeTouches).length;for(let h=0,d=n.changedTouches.length;h<d;h++){let p=n.changedTouches.item(h);if(!this.activeTouches.hasOwnProperty(String(p.identifier))){console.warn("move of an UNKNOWN touch",p);continue}let g=this.activeTouches[p.identifier],m=Date.now()-g.initialTimeStamp;if(m<si.HOLD_DELAY&&Math.abs(g.initialPageX-zi(g.rollingPageX))<30&&Math.abs(g.initialPageY-zi(g.rollingPageY))<30){let v=this.newGestureEvent(Ds.Tap,g.initialTarget);v.pageX=zi(g.rollingPageX),v.pageY=zi(g.rollingPageY),this.dispatchEvent(v)}else if(m>=si.HOLD_DELAY&&Math.abs(g.initialPageX-zi(g.rollingPageX))<30&&Math.abs(g.initialPageY-zi(g.rollingPageY))<30){let v=this.newGestureEvent(Ds.Contextmenu,g.initialTarget);v.pageX=zi(g.rollingPageX),v.pageY=zi(g.rollingPageY),this.dispatchEvent(v)}else if(l===1){let v=zi(g.rollingPageX),_=zi(g.rollingPageY),S=zi(g.rollingTimestamps)-g.rollingTimestamps[0],w=v-g.rollingPageX[0],b=_-g.rollingPageY[0],k=[...this.targets].filter(E=>g.initialTarget instanceof Node&&E.contains(g.initialTarget));this.inertia(t,k,r,Math.abs(w)/S,w>0?1:-1,v,Math.abs(b)/S,b>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(Ds.End,g.initialTarget)),delete this.activeTouches[p.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===Ds.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>si.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===Ds.Change||t.type===Ds.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let l=0,h=t.initialTarget;for(;h&&h!==r;)l++,h=h.parentElement;n.push([l,r])}n.sort((r,l)=>r[0]-l[0]);for(let[r,l]of n)l.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,l,h,d,p,g,m){this.handle=y1(t,()=>{let v=Date.now(),_=v-r,S=0,w=0,b=!0;l+=si.SCROLL_FRICTION*_,p+=si.SCROLL_FRICTION*_,l>0&&(b=!1,S=h*l*_),p>0&&(b=!1,w=g*p*_);let k=this.newGestureEvent(Ds.Change);k.translationX=S,k.translationY=w,n.forEach(E=>E.dispatchEvent(k)),b||this.inertia(t,n,v,l,h,d+S,p,g,m+w)})}onTouchMove(t){let n=Date.now();for(let r=0,l=t.changedTouches.length;r<l;r++){let h=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("end of an UNKNOWN touch",h);continue}let d=this.activeTouches[h.identifier],p=this.newGestureEvent(Ds.Change,d.initialTarget);p.translationX=h.pageX-zi(d.rollingPageX),p.translationY=h.pageY-zi(d.rollingPageY),p.pageX=h.pageX,p.pageY=h.pageY,this.dispatchEvent(p),d.rollingPageX.length>3&&(d.rollingPageX.shift(),d.rollingPageY.shift(),d.rollingTimestamps.shift()),d.rollingPageX.push(h.pageX),d.rollingPageY.push(h.pageY),d.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};ao.SCROLL_FRICTION=-.005,ao.HOLD_DELAY=700,ao.CLEAR_TAP_COUNT_TIME=400,_t([ME],ao,"isTouchDevice",1);var jE=ao,S1=class extends He{onclick(e,t){this._register(Te(e,Ut.CLICK,n=>t(new ph(As(e),n))))}onmousedown(e,t){this._register(Te(e,Ut.MOUSE_DOWN,n=>t(new ph(As(e),n))))}onmouseover(e,t){this._register(Te(e,Ut.MOUSE_OVER,n=>t(new ph(As(e),n))))}onmouseleave(e,t){this._register(Te(e,Ut.MOUSE_LEAVE,n=>t(new ph(As(e),n))))}onkeydown(e,t){this._register(Te(e,Ut.KEY_DOWN,n=>t(new py(n))))}onkeyup(e,t){this._register(Te(e,Ut.KEY_UP,n=>t(new py(n))))}oninput(e,t){this._register(Te(e,Ut.INPUT,t))}onblur(e,t){this._register(Te(e,Ut.BLUR,t))}onfocus(e,t){this._register(Te(e,Ut.FOCUS,t))}onchange(e,t){this._register(Te(e,Ut.CHANGE,t))}ignoreGesture(e){return jE.ignoreTarget(e)}},Sy=11,TE=class extends S1{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=Sy+"px",this.domNode.style.height=Sy+"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 bx),this._register(_y(this.bgDomNode,Ut.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(_y(this.domNode,Ut.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new CE),this._pointerdownScheduleRepeatTimer=this._register(new _1)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,As(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},DE=class S2{constructor(t,n,r,l,h,d,p){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,l=l|0,h=h|0,d=d|0,p=p|0),this.rawScrollLeft=l,this.rawScrollTop=p,n<0&&(n=0),l+n>r&&(l=r-n),l<0&&(l=0),h<0&&(h=0),p+h>d&&(p=d-h),p<0&&(p=0),this.width=n,this.scrollWidth=r,this.scrollLeft=l,this.height=h,this.scrollHeight=d,this.scrollTop=p}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new S2(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 S2(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(t,n){let r=this.width!==t.width,l=this.scrollWidth!==t.scrollWidth,h=this.scrollLeft!==t.scrollLeft,d=this.height!==t.height,p=this.scrollHeight!==t.scrollHeight,g=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:l,scrollLeftChanged:h,heightChanged:d,scrollHeightChanged:p,scrollTopChanged:g}}},RE=class extends He{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new DE(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=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(),this._smoothScrolling=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;t?r=new wy(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=wy.start(this._state,n,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)))}},xy=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function tf(e,t){let n=t-e;return function(r){return e+n*LE(r)}}function AE(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var wy=class x2{constructor(t,n,r,l){this.from=t,this.to=n,this.duration=l,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,r){if(Math.abs(t-n)>2.5*r){let l,h;return t<n?(l=t+.75*r,h=n-.75*r):(l=t-.75*r,h=n+.75*r),AE(tf(t,l),tf(h,n),.33)}return tf(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),l=this.scrollTop(n);return new xy(r,l,!1)}return new xy(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return x2.start(t,n,r)}static start(t,n,r){r=r+10;let l=Date.now()-10;return new x2(t,n,l,r)}};function NE(e){return Math.pow(e,3)}function LE(e){return 1-NE(1-e)}var BE=class extends He{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 _1)}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?!0: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":"")))}},OE=140,Cx=class extends S1{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 BE(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new bx),this._shouldRender=!0,this.domNode=mo(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(Te(this.domNode.domNode,Ut.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new TE(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=mo(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(Te(this.slider.domNode,Ut.POINTER_DOWN,l=>{l.button===0&&(l.preventDefault(),this._sliderPointerDown(l))})),this.onclick(this.slider.domNode,l=>{l.leftButton&&l.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(),l=this._sliderPointerPosition(e);n<=l&&l<=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 l=kE(this.domNode.domNode);t=e.pageX-l.left,n=e.pageY-l.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,l=>{let h=this._sliderOrthogonalPointerPosition(l),d=Math.abs(h-n);if(yx&&d>OE){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let p=this._sliderPointerPosition(l)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(p))},()=>{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()}},kx=class w2{constructor(t,n,r,l,h,d){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=l,this._scrollSize=h,this._scrollPosition=d,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new w2(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,l,h){let d=Math.max(0,r-t),p=Math.max(0,d-2*n),g=l>0&&l>r;if(!g)return{computedAvailableSize:Math.round(d),computedIsNeeded:g,computedSliderSize:Math.round(p),computedSliderRatio:0,computedSliderPosition:0};let m=Math.round(Math.max(20,Math.floor(r*p/l))),v=(p-m)/(l-r),_=h*v;return{computedAvailableSize:Math.round(d),computedIsNeeded:g,computedSliderSize:Math.round(m),computedSliderRatio:v,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=w2._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(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},zE=class extends Cx{constructor(e,t,n){let r=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new kx(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,l.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new 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}},HE=class extends Cx{constructor(e,t,n){let r=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new kx(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,l.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new 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}},IE=500,by=50,UE=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},b2=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,r=1,l=this._rear;do{let h=l===this._front?t:Math.pow(2,-r);if(t-=h,n+=this._memory[l].score*h,l===this._front)break;l=(this._capacity+l-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(m1){let n=As(t.browserEvent),r=Xk(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let l=null,h=new UE(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=h,this._front=0,this._rear=0):(l=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]=h),h.score=this._computeScore(h,l)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let l=Math.abs(t.deltaX),h=Math.abs(t.deltaY),d=Math.abs(n.deltaX),p=Math.abs(n.deltaY),g=Math.max(Math.min(l,d),1),m=Math.max(Math.min(h,p),1),v=Math.max(l,d),_=Math.max(h,p);v%g===0&&_%m===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};b2.INSTANCE=new b2;var PE=b2,qE=class extends S1{constructor(e,t,n){super(),this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ue),this.onWillScroll=this._onWillScroll.event,this._options=$E(t),this._scrollable=n,this._register(this._scrollable.onScroll(l=>{this._onWillScroll.fire(l),this._onDidScroll(l),this._onScroll.fire(l)}));let r={onMouseWheel:l=>this._onMouseWheel(l),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new HE(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new zE(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=mo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=mo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=mo(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,l=>this._onMouseOver(l)),this.onmouseleave(this._listenOnDomNode,l=>this._onMouseLeave(l)),this._hideTimeout=this._register(new _1),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Nr(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,Ns&&(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 my(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Nr(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new my(n))};this._mouseWheelToDispose.push(Te(this._listenOnDomNode,Ut.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=PE.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let l=e.deltaY*this._options.mouseWheelScrollSensitivity,h=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&h+l===0?h=l=0:Math.abs(l)>=Math.abs(h)?h=0:l=0),this._options.flipAxes&&([l,h]=[h,l]);let d=!Ns&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!h&&(h=l,l=0),e.browserEvent&&e.browserEvent.altKey&&(h=h*this._options.fastScrollSensitivity,l=l*this._options.fastScrollSensitivity);let p=this._scrollable.getFutureScrollPosition(),g={};if(l){let m=by*l,v=p.scrollTop-(m<0?Math.floor(m):Math.ceil(m));this._verticalScrollbar.writeScrollPosition(g,v)}if(h){let m=by*h,v=p.scrollLeft-(m<0?Math.floor(m):Math.ceil(m));this._horizontalScrollbar.writeScrollPosition(g,v)}g=this._scrollable.validateScrollPosition(g),(p.scrollLeft!==g.scrollLeft||p.scrollTop!==g.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(g):this._scrollable.setScrollPositionNow(g),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 new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",l=t?" top":"",h=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${l}`),this._topLeftShadowDomNode.setClassName(`shadow${h}${l}${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(),IE)}},VE=class extends qE{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 $E(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,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:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,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:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Ns&&(t.className+=" mac"),t}var C2=class extends He{constructor(e,t,n,r,l,h,d,p){super(),this._bufferService=n,this._optionsService=d,this._renderService=p,this._onRequestScrollLines=this._register(new ue),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let g=this._register(new RE({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:m=>y1(r.window,m)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{g.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new VE(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},g)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(l.onProtocolChange(m=>{this._scrollableElement.updateOptions({handleMouseWheel:!(m&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ei.runAndSubscribe(h.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=h.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ht(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ht(()=>this._styleElement.remove())),this._register(ei.runAndSubscribe(h.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${h.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${h.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${h.colors.scrollbarSliderActiveBackground.css};`,"}"].join(``)})),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(m=>this._handleScroll(m)))}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}};C2=_t([me(2,ui),me(3,un),me(4,rx),me(5,Za),me(6,di),me(7,dn)],C2);var k2=class extends He{constructor(e,t,n,r,l){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=l,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(h=>this._removeDecoration(h))),this._register(ht(()=>{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()}};k2=_t([me(1,ui),me(2,un),me(3,jo),me(4,dn)],k2);var WE=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)}},Ms={full:0,left:0,center:0,right:0},qn={full:0,left:0,center:0,right:0},Xl={full:0,left:0,center:0,right:0},Uh=class extends He{constructor(e,t,n,r,l,h,d,p){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=l,this._optionsService=h,this._themeService=d,this._coreBrowserService=p,this._colorZoneStore=new WE,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(ht(()=>this._canvas?.remove()));let g=this._canvas.getContext("2d");if(g)this._ctx=g;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);qn.full=this._canvas.width,qn.left=e,qn.center=t,qn.right=e,this._refreshDrawHeightConstants(),Xl.full=1,Xl.left=1,Xl.center=1+qn.left,Xl.right=1+qn.left+qn.center}_refreshDrawHeightConstants(){Ms.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);Ms.left=t,Ms.center=t,Ms.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ms.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ms.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ms.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ms.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 t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);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(Xl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ms[e.position||"full"]/2),qn[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ms[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}))}};Uh=_t([me(2,ui),me(3,jo),me(4,dn),me(5,di),me(6,Za),me(7,un)],Uh);var ne;(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=`-`,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=""))(ne||={});var Mh;(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=""))(Mh||={});var Ex;(e=>e.ST=`${ne.ESC}\\`)(Ex||={});var E2=class{constructor(e,t,n,r,l,h){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=l,this._renderService=h,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):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!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(`${ne.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 t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,l=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=l+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let h=this._compositionView.getBoundingClientRect();this._textarea.style.left=l+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(h.width,1)+"px",this._textarea.style.height=Math.max(h.height,1)+"px",this._textarea.style.lineHeight=h.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};E2=_t([me(2,ui),me(3,di),me(4,zr),me(5,dn)],E2);var Pt=0,qt=0,Vt=0,vt=0,Cy={css:"#00000000",rgba:0},Et;(e=>{function t(l,h,d,p){return p!==void 0?`#${Mr(l)}${Mr(h)}${Mr(d)}${Mr(p)}`:`#${Mr(l)}${Mr(h)}${Mr(d)}`}e.toCss=t;function n(l,h,d,p=255){return(l<<24|h<<16|d<<8|p)>>>0}e.toRgba=n;function r(l,h,d,p){return{css:e.toCss(l,h,d,p),rgba:e.toRgba(l,h,d,p)}}e.toColor=r})(Et||={});var ot;(e=>{function t(g,m){if(vt=(m.rgba&255)/255,vt===1)return{css:m.css,rgba:m.rgba};let v=m.rgba>>24&255,_=m.rgba>>16&255,S=m.rgba>>8&255,w=g.rgba>>24&255,b=g.rgba>>16&255,k=g.rgba>>8&255;Pt=w+Math.round((v-w)*vt),qt=b+Math.round((_-b)*vt),Vt=k+Math.round((S-k)*vt);let E=Et.toCss(Pt,qt,Vt),j=Et.toRgba(Pt,qt,Vt);return{css:E,rgba:j}}e.blend=t;function n(g){return(g.rgba&255)===255}e.isOpaque=n;function r(g,m,v){let _=jh.ensureContrastRatio(g.rgba,m.rgba,v);if(_)return Et.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=r;function l(g){let m=(g.rgba|255)>>>0;return[Pt,qt,Vt]=jh.toChannels(m),{css:Et.toCss(Pt,qt,Vt),rgba:m}}e.opaque=l;function h(g,m){return vt=Math.round(m*255),[Pt,qt,Vt]=jh.toChannels(g.rgba),{css:Et.toCss(Pt,qt,Vt,vt),rgba:Et.toRgba(Pt,qt,Vt,vt)}}e.opacity=h;function d(g,m){return vt=g.rgba&255,h(g,vt*m/255)}e.multiplyOpacity=d;function p(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}e.toColorRGB=p})(ot||={});var ft;(e=>{let t,n;try{let l=document.createElement("canvas");l.width=1,l.height=1;let h=l.getContext("2d",{willReadFrequently:!0});h&&(t=h,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(l){if(l.match(/#[\da-f]{3,8}/i))switch(l.length){case 4:return Pt=parseInt(l.slice(1,2).repeat(2),16),qt=parseInt(l.slice(2,3).repeat(2),16),Vt=parseInt(l.slice(3,4).repeat(2),16),Et.toColor(Pt,qt,Vt);case 5:return Pt=parseInt(l.slice(1,2).repeat(2),16),qt=parseInt(l.slice(2,3).repeat(2),16),Vt=parseInt(l.slice(3,4).repeat(2),16),vt=parseInt(l.slice(4,5).repeat(2),16),Et.toColor(Pt,qt,Vt,vt);case 7:return{css:l,rgba:(parseInt(l.slice(1),16)<<8|255)>>>0};case 9:return{css:l,rgba:parseInt(l.slice(1),16)>>>0}}let h=l.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(h)return Pt=parseInt(h[1]),qt=parseInt(h[2]),Vt=parseInt(h[3]),vt=Math.round((h[5]===void 0?1:parseFloat(h[5]))*255),Et.toColor(Pt,qt,Vt,vt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=l,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Pt,qt,Vt,vt]=t.getImageData(0,0,1,1).data,vt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Et.toRgba(Pt,qt,Vt,vt),css:l}}e.toColor=r})(ft||={});var ci;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,l,h){let d=r/255,p=l/255,g=h/255,m=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),v=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4),_=g<=.03928?g/12.92:Math.pow((g+.055)/1.055,2.4);return m*.2126+v*.7152+_*.0722}e.relativeLuminance2=n})(ci||={});var jh;(e=>{function t(d,p){if(vt=(p&255)/255,vt===1)return p;let g=p>>24&255,m=p>>16&255,v=p>>8&255,_=d>>24&255,S=d>>16&255,w=d>>8&255;return Pt=_+Math.round((g-_)*vt),qt=S+Math.round((m-S)*vt),Vt=w+Math.round((v-w)*vt),Et.toRgba(Pt,qt,Vt)}e.blend=t;function n(d,p,g){let m=ci.relativeLuminance(d>>8),v=ci.relativeLuminance(p>>8);if(Xs(m,v)<g){if(v<m){let w=r(d,p,g),b=Xs(m,ci.relativeLuminance(w>>8));if(b<g){let k=l(d,p,g),E=Xs(m,ci.relativeLuminance(k>>8));return b>E?w:k}return w}let _=l(d,p,g),S=Xs(m,ci.relativeLuminance(_>>8));if(S<g){let w=r(d,p,g),b=Xs(m,ci.relativeLuminance(w>>8));return S>b?_:w}return _}}e.ensureContrastRatio=n;function r(d,p,g){let m=d>>24&255,v=d>>16&255,_=d>>8&255,S=p>>24&255,w=p>>16&255,b=p>>8&255,k=Xs(ci.relativeLuminance2(S,w,b),ci.relativeLuminance2(m,v,_));for(;k<g&&(S>0||w>0||b>0);)S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),b-=Math.max(0,Math.ceil(b*.1)),k=Xs(ci.relativeLuminance2(S,w,b),ci.relativeLuminance2(m,v,_));return(S<<24|w<<16|b<<8|255)>>>0}e.reduceLuminance=r;function l(d,p,g){let m=d>>24&255,v=d>>16&255,_=d>>8&255,S=p>>24&255,w=p>>16&255,b=p>>8&255,k=Xs(ci.relativeLuminance2(S,w,b),ci.relativeLuminance2(m,v,_));for(;k<g&&(S<255||w<255||b<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),k=Xs(ci.relativeLuminance2(S,w,b),ci.relativeLuminance2(m,v,_));return(S<<24|w<<16|b<<8|255)>>>0}e.increaseLuminance=l;function h(d){return[d>>24&255,d>>16&255,d>>8&255,d&255]}e.toChannels=h})(jh||={});function Mr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Xs(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var FE=class extends Mo{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 new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ph=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new is}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),l=0,h=0,d=0,p=t.getFg(0),g=t.getBg(0);for(let m=0;m<t.getTrimmedLength();m++)if(t.loadCell(m,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==p||this._workCell.bg!==g){if(m-l>1){let v=this._getJoinedRanges(r,d,h,t,l);for(let _=0;_<v.length;_++)n.push(v[_])}l=m,d=h,p=this._workCell.fg,g=this._workCell.bg}h+=this._workCell.getChars().length||Gn.length}if(this._bufferService.cols-l>1){let m=this._getJoinedRanges(r,d,h,t,l);for(let v=0;v<m.length;v++)n.push(m[v])}return n}_getJoinedRanges(e,t,n,r,l){let h=e.substring(t,n),d=[];try{d=this._characterJoiners[0].handler(h)}catch(p){console.error(p)}for(let p=1;p<this._characterJoiners.length;p++)try{let g=this._characterJoiners[p].handler(h);for(let m=0;m<g.length;m++)Ph._mergeRanges(d,g[m])}catch(g){console.error(g)}return this._stringRangesToCellRanges(d,r,l),d}_stringRangesToCellRanges(e,t,n){let r=0,l=!1,h=0,d=e[r];if(d){for(let p=n;p<this._bufferService.cols;p++){let g=t.getWidth(p),m=t.getString(p).length||Gn.length;if(g!==0){if(!l&&d[0]<=h&&(d[0]=p,l=!0),d[1]<=h){if(d[1]=p,d=e[++r],!d)break;d[0]<=h?(d[0]=p,l=!0):l=!1}h+=m}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let l=e[r];if(n){if(t[1]<=l[0])return e[r-1][1]=t[1],e;if(t[1]<=l[1])return e[r-1][1]=Math.max(t[1],l[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=l[0])return e.splice(r,0,t),e;if(t[1]<=l[1])return l[0]=Math.min(t[0],l[0]),e;t[0]<l[1]&&(l[0]=Math.min(t[0],l[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Ph=_t([me(0,ui)],Ph);function KE(e){return 57508<=e&&e<=57558}function YE(e){return 9472<=e&&e<=9631}function GE(e){return KE(e)||YE(e)}function ZE(){return{css:{canvas:gh(),cell:gh()},device:{canvas:gh(),cell:gh(),char:{width:0,height:0,left:0,top:0}}}}function gh(){return{width:0,height:0}}var M2=class{constructor(e,t,n,r,l,h,d){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=l,this._decorationService=h,this._themeService=d,this._workCell=new is,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,l,h,d,p,g,m,v){let _=[],S=this._characterJoinerService.getJoinedCharacters(t),w=this._themeService.colors,b=e.getNoBgTrimmedLength();n&&b<h+1&&(b=h+1);let k,E=0,j="",V=0,A=0,z=0,F=0,D=!1,I=0,q=!1,U=0,Y=0,$=[],M=m!==-1&&v!==-1;for(let N=0;N<b;N++){e.loadCell(N,this._workCell);let L=this._workCell.getWidth();if(L===0)continue;let O=!1,P=N>=Y,te=N,Q=this._workCell;if(S.length>0&&N===S[0][0]&&P){let De=S.shift(),fi=this._isCellInSelection(De[0],t);for(V=De[0]+1;V<De[1];V++)P&&=fi===this._isCellInSelection(V,t);P&&=!n||h<De[0]||h>=De[1],P?(O=!0,Q=new FE(this._workCell,e.translateToString(!0,De[0],De[1]),De[1]-De[0]),te=De[1]-1,L=Q.getWidth()):Y=De[1]}let ce=this._isCellInSelection(N,t),re=n&&N===h,de=M&&N>=m&&N<=v,Ce=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,De=>{Ce=!0});let je=Q.getChars()||Gn;if(je===" "&&(Q.isUnderline()||Q.isOverline())&&(je=" "),U=L*p-g.get(je,Q.isBold(),Q.isItalic()),!k)k=this._document.createElement("span");else if(E&&(ce&&q||!ce&&!q&&Q.bg===A)&&(ce&&q&&w.selectionForeground||Q.fg===z)&&Q.extended.ext===F&&de===D&&U===I&&!re&&!O&&!Ce&&P){Q.isInvisible()?j+=Gn:j+=je,E++;continue}else E&&(k.textContent=j),k=this._document.createElement("span"),E=0,j="";if(A=Q.bg,z=Q.fg,F=Q.extended.ext,D=de,I=U,q=ce,O&&h>=N&&h<=te&&(h=N),!this._coreService.isCursorHidden&&re&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)d&&$.push("xterm-cursor-blink"),$.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(l)switch(l){case"outline":$.push("xterm-cursor-outline");break;case"block":$.push("xterm-cursor-block");break;case"bar":$.push("xterm-cursor-bar");break;case"underline":$.push("xterm-cursor-underline");break}}if(Q.isBold()&&$.push("xterm-bold"),Q.isItalic()&&$.push("xterm-italic"),Q.isDim()&&$.push("xterm-dim"),Q.isInvisible()?j=Gn:j=Q.getChars()||Gn,Q.isUnderline()&&($.push(`xterm-underline-${Q.extended.underlineStyle}`),j===" "&&(j=" "),!Q.isUnderlineColorDefault()))if(Q.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${Mo.toColorRGB(Q.getUnderlineColor()).join(",")})`;else{let De=Q.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Q.isBold()&&De<8&&(De+=8),k.style.textDecorationColor=w.ansi[De].css}Q.isOverline()&&($.push("xterm-overline"),j===" "&&(j=" ")),Q.isStrikethrough()&&$.push("xterm-strikethrough"),de&&(k.style.textDecoration="underline");let R=Q.getFgColor(),J=Q.getFgColorMode(),le=Q.getBgColor(),he=Q.getBgColorMode(),we=!!Q.isInverse();if(we){let De=R;R=le,le=De;let fi=J;J=he,he=fi}let xe,be,pe=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,De=>{De.options.layer!=="top"&&pe||(De.backgroundColorRGB&&(he=50331648,le=De.backgroundColorRGB.rgba>>8&16777215,xe=De.backgroundColorRGB),De.foregroundColorRGB&&(J=50331648,R=De.foregroundColorRGB.rgba>>8&16777215,be=De.foregroundColorRGB),pe=De.options.layer==="top")}),!pe&&ce&&(xe=this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque,le=xe.rgba>>8&16777215,he=50331648,pe=!0,w.selectionForeground&&(J=50331648,R=w.selectionForeground.rgba>>8&16777215,be=w.selectionForeground)),pe&&$.push("xterm-decoration-top");let _e;switch(he){case 16777216:case 33554432:_e=w.ansi[le],$.push(`xterm-bg-${le}`);break;case 50331648:_e=Et.toColor(le>>16,le>>8&255,le&255),this._addStyle(k,`background-color:#${ky((le>>>0).toString(16),"0",6)}`);break;default:we?(_e=w.foreground,$.push("xterm-bg-257")):_e=w.background}switch(xe||Q.isDim()&&(xe=ot.multiplyOpacity(_e,.5)),J){case 16777216:case 33554432:Q.isBold()&&R<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(R+=8),this._applyMinimumContrast(k,_e,w.ansi[R],Q,xe,void 0)||$.push(`xterm-fg-${R}`);break;case 50331648:let De=Et.toColor(R>>16&255,R>>8&255,R&255);this._applyMinimumContrast(k,_e,De,Q,xe,be)||this._addStyle(k,`color:#${ky(R.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(k,_e,w.foreground,Q,xe,be)||we&&$.push("xterm-fg-257")}$.length&&(k.className=$.join(" "),$.length=0),!re&&!O&&!Ce&&P?E++:k.textContent=j,U!==this.defaultSpacing&&(k.style.letterSpacing=`${U}px`),_.push(k),N=te}return k&&E&&(k.textContent=j),_}_applyMinimumContrast(e,t,n,r,l,h){if(this._optionsService.rawOptions.minimumContrastRatio===1||GE(r.getCode()))return!1;let d=this._getContrastCache(r),p;if(!l&&!h&&(p=d.getColor(t.rgba,n.rgba)),p===void 0){let g=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);p=ot.ensureContrastRatio(l||t,h||n,g),d.setColor((l||t).rgba,(h||n).rgba,p??null)}return p?(this._addStyle(e,`color:${p.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]}};M2=_t([me(1,ox),me(2,di),me(3,un),me(4,zr),me(5,jo),me(6,Za)],M2);function ky(e,t,n){for(;e.length<n;)e=t+e;return e}var XE=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 l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontStyle="italic";let h=e.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold",h.style.fontStyle="italic",this._measureElements=[n,r,l,h],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(l),this._container.appendChild(h),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 d=this._measure(e,0);return d>0&&(this._flat[r]=d),d}let l=e;t&&(l+="B"),n&&(l+="I");let h=this._holey.get(l);if(h===void 0){let d=0;t&&(d|=1),n&&(d|=2),h=this._measure(e,d),h>0&&this._holey.set(l,h)}return h}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},QE=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 l=e.buffers.active.ydisp,h=t[1]-l,d=n[1]-l,p=Math.max(h,0),g=Math.min(d,e.rows-1);if(p>=e.rows||g<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=h,this.viewportEndRow=d,this.viewportCappedStartRow=p,this.viewportCappedEndRow=g,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 JE(){return new QE}var sf="xterm-dom-renderer-owner-",Zi="xterm-rows",mh="xterm-fg-",Ey="xterm-bg-",Ql="xterm-focus",vh="xterm-selection",eM=1,j2=class extends He{constructor(e,t,n,r,l,h,d,p,g,m,v,_,S,w){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=l,this._helperContainer=h,this._linkifier2=d,this._charSizeService=g,this._optionsService=m,this._bufferService=v,this._coreService=_,this._coreBrowserService=S,this._themeService=w,this._terminalClass=eM++,this._rowElements=[],this._selectionRenderModel=JE(),this.onRequestRedraw=this._register(new ue).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Zi),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(vh),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=ZE(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(b=>this._injectCss(b))),this._injectCss(this._themeService.colors),this._rowFactory=p.createInstance(M2,document),this._element.classList.add(sf+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(b=>this._handleLinkHover(b))),this._register(this._linkifier2.onHideLinkUnderline(b=>this._handleLinkLeave(b))),this._register(ht(()=>{this._element.classList.remove(sf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new XE(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 n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Zi} 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} .${Zi} { 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} .${Zi} .xterm-dim { color: ${ot.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}`,l=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${l} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Zi}.${Ql} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Zi}.${Ql} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Zi}.${Ql} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${l} 1s step-end infinite;}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${vh} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${vh} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${vh} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[h,d]of e.ansi.entries())t+=`${this._terminalSelector} .${mh}${h} { color: ${d.css}; }${this._terminalSelector} .${mh}${h}.xterm-dim { color: ${ot.multiplyOpacity(d,.5).css}; }${this._terminalSelector} .${Ey}${h} { background-color: ${d.css}; }`;t+=`${this._terminalSelector} .${mh}257 { color: ${ot.opaque(e.background).css}; }${this._terminalSelector} .${mh}257.xterm-dim { color: ${ot.multiplyOpacity(ot.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ey}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 n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}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(Ql),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ql),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,l=this._selectionRenderModel.viewportEndRow,h=this._selectionRenderModel.viewportCappedStartRow,d=this._selectionRenderModel.viewportCappedEndRow,p=this._document.createDocumentFragment();if(n){let g=e[0]>t[0];p.appendChild(this._createSelectionElement(h,g?t[0]:e[0],g?e[0]:t[0],d-h+1))}else{let g=r===h?e[0]:0,m=h===l?t[0]:this._bufferService.cols;p.appendChild(this._createSelectionElement(h,g,m));let v=d-h-1;if(p.appendChild(this._createSelectionElement(h+1,0,this._bufferService.cols,v)),h!==d){let _=l===d?t[0]:this._bufferService.cols;p.appendChild(this._createSelectionElement(d,0,_))}}this._selectionContainer.appendChild(p)}_createSelectionElement(e,t,n,r=1){let l=this._document.createElement("div"),h=t*this.dimensions.css.cell.width,d=this.dimensions.css.cell.width*(n-t);return h+d>this.dimensions.css.canvas.width&&(d=this.dimensions.css.canvas.width-h),l.style.height=`${r*this.dimensions.css.cell.height}px`,l.style.top=`${e*this.dimensions.css.cell.height}px`,l.style.left=`${h}px`,l.style.width=`${d}px`,l}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,l=Math.min(n.x,this._bufferService.cols-1),h=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,d=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let g=e;g<=t;g++){let m=g+n.ydisp,v=this._rowElements[g],_=n.lines.get(m);if(!v||!_)break;v.replaceChildren(...this._rowFactory.createRow(_,m,m===r,d,p,l,h,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${sf}${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,l,h){n<0&&(e=0),r<0&&(t=0);let d=this._bufferService.rows-1;n=Math.max(Math.min(n,d),0),r=Math.max(Math.min(r,d),0),l=Math.min(l,this._bufferService.cols);let p=this._bufferService.buffer,g=p.ybase+p.y,m=Math.min(p.x,l-1),v=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,S=this._optionsService.rawOptions.cursorInactiveStyle;for(let w=n;w<=r;++w){let b=w+p.ydisp,k=this._rowElements[w],E=p.lines.get(b);if(!k||!E)break;k.replaceChildren(...this._rowFactory.createRow(E,b,b===g,_,S,m,v,this.dimensions.css.cell.width,this._widthCache,h?w===n?e:0:-1,h?(w===r?t:l)-1:-1))}}};j2=_t([me(7,f1),me(8,Xh),me(9,di),me(10,ui),me(11,zr),me(12,un),me(13,Za)],j2);var T2=class extends He{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ue),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new iM(this._optionsService))}catch{this._measureStrategy=this._register(new tM(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())}};T2=_t([me(2,di)],T2);var Mx=class extends He{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)}},tM=class extends Mx{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}},iM=class extends Mx{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 new 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}},sM=class extends He{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 nM(this._window)),this._onDprChange=this._register(new ue),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ue),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(ei.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Te(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Te(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}},nM=class extends He{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Fa),this._onDprChange=this._register(new ue),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ht(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Te(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)}},rM=class extends He{constructor(){super(),this.linkProviders=[],this._register(ht(()=>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 x1(e,t,n){let r=n.getBoundingClientRect(),l=e.getComputedStyle(n),h=parseInt(l.getPropertyValue("padding-left")),d=parseInt(l.getPropertyValue("padding-top"));return[t.clientX-r.left-h,t.clientY-r.top-d]}function aM(e,t,n,r,l,h,d,p,g){if(!h)return;let m=x1(e,t,n);if(m)return m[0]=Math.ceil((m[0]+(g?d/2:0))/d),m[1]=Math.ceil(m[1]/p),m[0]=Math.min(Math.max(m[0],1),r+(g?1:0)),m[1]=Math.min(Math.max(m[1],1),l),m}var R2=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,l){return aM(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(e,t){let n=x1(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])}}};R2=_t([me(0,dn),me(1,Xh)],R2);var lM=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):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=[]}},jx={};vk(jx,{getSafariVersion:()=>cM,isChromeOS:()=>Ax,isFirefox:()=>Tx,isIpad:()=>hM,isIphone:()=>uM,isLegacyEdge:()=>oM,isLinux:()=>w1,isMac:()=>qh,isNode:()=>Qh,isSafari:()=>Rx,isWindows:()=>Dx});var Qh=typeof process<"u"&&"title"in process,To=Qh?"node":navigator.userAgent,Ro=Qh?"node":navigator.platform,Tx=To.includes("Firefox"),oM=To.includes("Edge"),Rx=/^((?!chrome|android).)*safari/i.test(To);function cM(){if(!Rx)return 0;let e=To.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var qh=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ro),hM=Ro==="iPad",uM=Ro==="iPhone",Dx=["Windows","Win16","Win32","WinCE"].includes(Ro),w1=Ro.indexOf("Linux")>=0,Ax=/\bCrOS\b/.test(To),Nx=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),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),l=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),l=e.timeRemaining(),n*1.5>l){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=l}this.clear()}},dM=class extends Nx{_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())}}},fM=class extends Nx{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Vh=!Qh&&"requestIdleCallback"in window?fM:dM,pM=class{constructor(){this._queue=new Vh}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},D2=class extends He{constructor(e,t,n,r,l,h,d,p,g){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=l,this._coreBrowserService=p,this._renderer=this._register(new Fa),this._pausedResizeTask=new pM,this._observerDisposable=this._register(new Fa),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 ue),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ue),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ue),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ue),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new lM((m,v)=>this._renderRows(m,v),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new gM(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ht(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(d.onResize(()=>this._fullRefresh())),this._register(d.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(h.onDecorationRegistered(()=>this._fullRefresh())),this._register(h.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(d.cols,d.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(d.buffer.y,d.buffer.y,!0))),this._register(g.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(m=>this._registerIntersectionObserver(m,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=ht(()=>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),this._needsSelectionRefresh=!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(t=>this.refreshRows(t.start,t.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()}};D2=_t([me(2,di),me(3,Xh),me(4,zr),me(5,jo),me(6,ui),me(7,un),me(8,Za)],D2);var gM=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 mM(e,t,n,r){let l=n.buffer.x,h=n.buffer.y;if(!n.buffer.hasScrollback)return yM(l,h,e,t,n,r)+Jh(h,t,n,r)+SM(l,h,e,t,n,r);let d;if(h===t)return d=l>e?"D":"C",xo(Math.abs(l-e),So(d,r));d=h>t?"D":"C";let p=Math.abs(h-t),g=_M(h>t?e:l,n)+(p-1)*n.cols+1+vM(h>t?l:e);return xo(g,So(d,r))}function vM(e,t){return e-1}function _M(e,t){return t.cols-e}function yM(e,t,n,r,l,h){return Jh(t,r,l,h).length===0?"":xo(Bx(e,t,e,t-Lr(t,l),!1,l).length,So("D",h))}function Jh(e,t,n,r){let l=e-Lr(e,n),h=t-Lr(t,n),d=Math.abs(l-h)-xM(e,t,n);return xo(d,So(Lx(e,t),r))}function SM(e,t,n,r,l,h){let d;Jh(t,r,l,h).length>0?d=r-Lr(r,l):d=t;let p=r,g=wM(e,t,n,r,l,h);return xo(Bx(e,d,n,p,g==="C",l).length,So(g,h))}function xM(e,t,n){let r=0,l=e-Lr(e,n),h=t-Lr(t,n);for(let d=0;d<Math.abs(l-h);d++){let p=Lx(e,t)==="A"?-1:1;n.buffer.lines.get(l+p*d)?.isWrapped&&r++}return r}function Lr(e,t){let n=0,r=t.buffer.lines.get(e),l=r?.isWrapped;for(;l&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),l=r?.isWrapped;return n}function wM(e,t,n,r,l,h){let d;return Jh(n,r,l,h).length>0?d=r-Lr(r,l):d=t,e<n&&d<=r||e>=n&&d<r?"C":"D"}function Lx(e,t){return e>t?"A":"B"}function Bx(e,t,n,r,l,h){let d=e,p=t,g="";for(;(d!==n||p!==r)&&p>=0&&p<h.buffer.lines.length;)d+=l?1:-1,l&&d>h.cols-1?(g+=h.buffer.translateBufferLineToString(p,!1,e,d),d=0,e=0,p++):!l&&d<0&&(g+=h.buffer.translateBufferLineToString(p,!1,0,e+1),d=h.cols-1,e=d,p--);return g+h.buffer.translateBufferLineToString(p,!1,e,d)}function So(e,t){let n=t?"O":"[";return ne.ESC+n+e}function xo(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var bM=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 My(e,t){if(e.start.y>e.end.y)throw new 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 nf=50,CM=15,kM=50,EM=500,MM=" ",jM=new RegExp(MM,"g"),A2=class extends He{constructor(e,t,n,r,l,h,d,p,g){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=l,this._mouseService=h,this._optionsService=d,this._renderService=p,this._coreBrowserService=g,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new is,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ue),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ue),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ue),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ue),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=m=>this._handleMouseMove(m),this._mouseUpListener=m=>this._handleMouseUp(m),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(m=>this._handleTrim(m)),this._register(this._bufferService.buffers.onBufferActivate(m=>this._handleBufferActivate(m))),this.enable(),this._model=new bM(this._bufferService),this._activeSelectionMode=0,this._register(ht(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(m=>{m.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 l=e[0]<t[0]?e[0]:t[0],h=e[0]<t[0]?t[0]:e[0];for(let d=e[1];d<=t[1];d++){let p=n.translateBufferLineToString(d,!0,l,h);r.push(p)}}else{let l=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],l));for(let h=e[1]+1;h<=t[1]-1;h++){let d=n.lines.get(h),p=n.translateBufferLineToString(h,!0);d?.isWrapped?r[r.length-1]+=p:r.push(p)}if(e[1]!==t[1]){let h=n.lines.get(t[1]),d=n.translateBufferLineToString(t[1],!0,0,t[0]);h&&h.isWrapped?r[r.length-1]+=d:r.push(d)}}return r.map(l=>l.replace(jM," ")).join(Dx?`\r+`,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=""))(ne||={});var Mh;(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=""))(Mh||={});var Ex;(e=>e.ST=`${ne.ESC}\\`)(Ex||={});var E2=class{constructor(e,t,n,r,l,h){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=l,this._renderService=h,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):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!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(`${ne.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 t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,l=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=l+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let h=this._compositionView.getBoundingClientRect();this._textarea.style.left=l+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(h.width,1)+"px",this._textarea.style.height=Math.max(h.height,1)+"px",this._textarea.style.lineHeight=h.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};E2=_t([me(2,ui),me(3,di),me(4,zr),me(5,dn)],E2);var Pt=0,qt=0,Vt=0,vt=0,Cy={css:"#00000000",rgba:0},Et;(e=>{function t(l,h,d,p){return p!==void 0?`#${Mr(l)}${Mr(h)}${Mr(d)}${Mr(p)}`:`#${Mr(l)}${Mr(h)}${Mr(d)}`}e.toCss=t;function n(l,h,d,p=255){return(l<<24|h<<16|d<<8|p)>>>0}e.toRgba=n;function r(l,h,d,p){return{css:e.toCss(l,h,d,p),rgba:e.toRgba(l,h,d,p)}}e.toColor=r})(Et||={});var ot;(e=>{function t(g,m){if(vt=(m.rgba&255)/255,vt===1)return{css:m.css,rgba:m.rgba};let v=m.rgba>>24&255,_=m.rgba>>16&255,S=m.rgba>>8&255,w=g.rgba>>24&255,b=g.rgba>>16&255,k=g.rgba>>8&255;Pt=w+Math.round((v-w)*vt),qt=b+Math.round((_-b)*vt),Vt=k+Math.round((S-k)*vt);let E=Et.toCss(Pt,qt,Vt),j=Et.toRgba(Pt,qt,Vt);return{css:E,rgba:j}}e.blend=t;function n(g){return(g.rgba&255)===255}e.isOpaque=n;function r(g,m,v){let _=jh.ensureContrastRatio(g.rgba,m.rgba,v);if(_)return Et.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=r;function l(g){let m=(g.rgba|255)>>>0;return[Pt,qt,Vt]=jh.toChannels(m),{css:Et.toCss(Pt,qt,Vt),rgba:m}}e.opaque=l;function h(g,m){return vt=Math.round(m*255),[Pt,qt,Vt]=jh.toChannels(g.rgba),{css:Et.toCss(Pt,qt,Vt,vt),rgba:Et.toRgba(Pt,qt,Vt,vt)}}e.opacity=h;function d(g,m){return vt=g.rgba&255,h(g,vt*m/255)}e.multiplyOpacity=d;function p(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}e.toColorRGB=p})(ot||={});var ft;(e=>{let t,n;try{let l=document.createElement("canvas");l.width=1,l.height=1;let h=l.getContext("2d",{willReadFrequently:!0});h&&(t=h,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(l){if(l.match(/#[\da-f]{3,8}/i))switch(l.length){case 4:return Pt=parseInt(l.slice(1,2).repeat(2),16),qt=parseInt(l.slice(2,3).repeat(2),16),Vt=parseInt(l.slice(3,4).repeat(2),16),Et.toColor(Pt,qt,Vt);case 5:return Pt=parseInt(l.slice(1,2).repeat(2),16),qt=parseInt(l.slice(2,3).repeat(2),16),Vt=parseInt(l.slice(3,4).repeat(2),16),vt=parseInt(l.slice(4,5).repeat(2),16),Et.toColor(Pt,qt,Vt,vt);case 7:return{css:l,rgba:(parseInt(l.slice(1),16)<<8|255)>>>0};case 9:return{css:l,rgba:parseInt(l.slice(1),16)>>>0}}let h=l.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(h)return Pt=parseInt(h[1]),qt=parseInt(h[2]),Vt=parseInt(h[3]),vt=Math.round((h[5]===void 0?1:parseFloat(h[5]))*255),Et.toColor(Pt,qt,Vt,vt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=l,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Pt,qt,Vt,vt]=t.getImageData(0,0,1,1).data,vt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Et.toRgba(Pt,qt,Vt,vt),css:l}}e.toColor=r})(ft||={});var ci;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,l,h){let d=r/255,p=l/255,g=h/255,m=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),v=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4),_=g<=.03928?g/12.92:Math.pow((g+.055)/1.055,2.4);return m*.2126+v*.7152+_*.0722}e.relativeLuminance2=n})(ci||={});var jh;(e=>{function t(d,p){if(vt=(p&255)/255,vt===1)return p;let g=p>>24&255,m=p>>16&255,v=p>>8&255,_=d>>24&255,S=d>>16&255,w=d>>8&255;return Pt=_+Math.round((g-_)*vt),qt=S+Math.round((m-S)*vt),Vt=w+Math.round((v-w)*vt),Et.toRgba(Pt,qt,Vt)}e.blend=t;function n(d,p,g){let m=ci.relativeLuminance(d>>8),v=ci.relativeLuminance(p>>8);if(Xs(m,v)<g){if(v<m){let w=r(d,p,g),b=Xs(m,ci.relativeLuminance(w>>8));if(b<g){let k=l(d,p,g),E=Xs(m,ci.relativeLuminance(k>>8));return b>E?w:k}return w}let _=l(d,p,g),S=Xs(m,ci.relativeLuminance(_>>8));if(S<g){let w=r(d,p,g),b=Xs(m,ci.relativeLuminance(w>>8));return S>b?_:w}return _}}e.ensureContrastRatio=n;function r(d,p,g){let m=d>>24&255,v=d>>16&255,_=d>>8&255,S=p>>24&255,w=p>>16&255,b=p>>8&255,k=Xs(ci.relativeLuminance2(S,w,b),ci.relativeLuminance2(m,v,_));for(;k<g&&(S>0||w>0||b>0);)S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),b-=Math.max(0,Math.ceil(b*.1)),k=Xs(ci.relativeLuminance2(S,w,b),ci.relativeLuminance2(m,v,_));return(S<<24|w<<16|b<<8|255)>>>0}e.reduceLuminance=r;function l(d,p,g){let m=d>>24&255,v=d>>16&255,_=d>>8&255,S=p>>24&255,w=p>>16&255,b=p>>8&255,k=Xs(ci.relativeLuminance2(S,w,b),ci.relativeLuminance2(m,v,_));for(;k<g&&(S<255||w<255||b<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),k=Xs(ci.relativeLuminance2(S,w,b),ci.relativeLuminance2(m,v,_));return(S<<24|w<<16|b<<8|255)>>>0}e.increaseLuminance=l;function h(d){return[d>>24&255,d>>16&255,d>>8&255,d&255]}e.toChannels=h})(jh||={});function Mr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Xs(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var FE=class extends Mo{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 new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ph=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new is}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),l=0,h=0,d=0,p=t.getFg(0),g=t.getBg(0);for(let m=0;m<t.getTrimmedLength();m++)if(t.loadCell(m,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==p||this._workCell.bg!==g){if(m-l>1){let v=this._getJoinedRanges(r,d,h,t,l);for(let _=0;_<v.length;_++)n.push(v[_])}l=m,d=h,p=this._workCell.fg,g=this._workCell.bg}h+=this._workCell.getChars().length||Gn.length}if(this._bufferService.cols-l>1){let m=this._getJoinedRanges(r,d,h,t,l);for(let v=0;v<m.length;v++)n.push(m[v])}return n}_getJoinedRanges(e,t,n,r,l){let h=e.substring(t,n),d=[];try{d=this._characterJoiners[0].handler(h)}catch(p){console.error(p)}for(let p=1;p<this._characterJoiners.length;p++)try{let g=this._characterJoiners[p].handler(h);for(let m=0;m<g.length;m++)Ph._mergeRanges(d,g[m])}catch(g){console.error(g)}return this._stringRangesToCellRanges(d,r,l),d}_stringRangesToCellRanges(e,t,n){let r=0,l=!1,h=0,d=e[r];if(d){for(let p=n;p<this._bufferService.cols;p++){let g=t.getWidth(p),m=t.getString(p).length||Gn.length;if(g!==0){if(!l&&d[0]<=h&&(d[0]=p,l=!0),d[1]<=h){if(d[1]=p,d=e[++r],!d)break;d[0]<=h?(d[0]=p,l=!0):l=!1}h+=m}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let l=e[r];if(n){if(t[1]<=l[0])return e[r-1][1]=t[1],e;if(t[1]<=l[1])return e[r-1][1]=Math.max(t[1],l[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=l[0])return e.splice(r,0,t),e;if(t[1]<=l[1])return l[0]=Math.min(t[0],l[0]),e;t[0]<l[1]&&(l[0]=Math.min(t[0],l[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Ph=_t([me(0,ui)],Ph);function KE(e){return 57508<=e&&e<=57558}function YE(e){return 9472<=e&&e<=9631}function GE(e){return KE(e)||YE(e)}function ZE(){return{css:{canvas:gh(),cell:gh()},device:{canvas:gh(),cell:gh(),char:{width:0,height:0,left:0,top:0}}}}function gh(){return{width:0,height:0}}var M2=class{constructor(e,t,n,r,l,h,d){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=l,this._decorationService=h,this._themeService=d,this._workCell=new is,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,l,h,d,p,g,m,v){let _=[],S=this._characterJoinerService.getJoinedCharacters(t),w=this._themeService.colors,b=e.getNoBgTrimmedLength();n&&b<h+1&&(b=h+1);let k,E=0,j="",V=0,A=0,z=0,F=0,R=!1,I=0,q=!1,U=0,Y=0,$=[],M=m!==-1&&v!==-1;for(let N=0;N<b;N++){e.loadCell(N,this._workCell);let L=this._workCell.getWidth();if(L===0)continue;let O=!1,P=N>=Y,te=N,Q=this._workCell;if(S.length>0&&N===S[0][0]&&P){let Re=S.shift(),fi=this._isCellInSelection(Re[0],t);for(V=Re[0]+1;V<Re[1];V++)P&&=fi===this._isCellInSelection(V,t);P&&=!n||h<Re[0]||h>=Re[1],P?(O=!0,Q=new FE(this._workCell,e.translateToString(!0,Re[0],Re[1]),Re[1]-Re[0]),te=Re[1]-1,L=Q.getWidth()):Y=Re[1]}let ce=this._isCellInSelection(N,t),re=n&&N===h,de=M&&N>=m&&N<=v,Ce=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,Re=>{Ce=!0});let je=Q.getChars()||Gn;if(je===" "&&(Q.isUnderline()||Q.isOverline())&&(je=" "),U=L*p-g.get(je,Q.isBold(),Q.isItalic()),!k)k=this._document.createElement("span");else if(E&&(ce&&q||!ce&&!q&&Q.bg===A)&&(ce&&q&&w.selectionForeground||Q.fg===z)&&Q.extended.ext===F&&de===R&&U===I&&!re&&!O&&!Ce&&P){Q.isInvisible()?j+=Gn:j+=je,E++;continue}else E&&(k.textContent=j),k=this._document.createElement("span"),E=0,j="";if(A=Q.bg,z=Q.fg,F=Q.extended.ext,R=de,I=U,q=ce,O&&h>=N&&h<=te&&(h=N),!this._coreService.isCursorHidden&&re&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)d&&$.push("xterm-cursor-blink"),$.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(l)switch(l){case"outline":$.push("xterm-cursor-outline");break;case"block":$.push("xterm-cursor-block");break;case"bar":$.push("xterm-cursor-bar");break;case"underline":$.push("xterm-cursor-underline");break}}if(Q.isBold()&&$.push("xterm-bold"),Q.isItalic()&&$.push("xterm-italic"),Q.isDim()&&$.push("xterm-dim"),Q.isInvisible()?j=Gn:j=Q.getChars()||Gn,Q.isUnderline()&&($.push(`xterm-underline-${Q.extended.underlineStyle}`),j===" "&&(j=" "),!Q.isUnderlineColorDefault()))if(Q.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${Mo.toColorRGB(Q.getUnderlineColor()).join(",")})`;else{let Re=Q.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Q.isBold()&&Re<8&&(Re+=8),k.style.textDecorationColor=w.ansi[Re].css}Q.isOverline()&&($.push("xterm-overline"),j===" "&&(j=" ")),Q.isStrikethrough()&&$.push("xterm-strikethrough"),de&&(k.style.textDecoration="underline");let D=Q.getFgColor(),J=Q.getFgColorMode(),le=Q.getBgColor(),he=Q.getBgColorMode(),we=!!Q.isInverse();if(we){let Re=D;D=le,le=Re;let fi=J;J=he,he=fi}let xe,be,pe=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,Re=>{Re.options.layer!=="top"&&pe||(Re.backgroundColorRGB&&(he=50331648,le=Re.backgroundColorRGB.rgba>>8&16777215,xe=Re.backgroundColorRGB),Re.foregroundColorRGB&&(J=50331648,D=Re.foregroundColorRGB.rgba>>8&16777215,be=Re.foregroundColorRGB),pe=Re.options.layer==="top")}),!pe&&ce&&(xe=this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque,le=xe.rgba>>8&16777215,he=50331648,pe=!0,w.selectionForeground&&(J=50331648,D=w.selectionForeground.rgba>>8&16777215,be=w.selectionForeground)),pe&&$.push("xterm-decoration-top");let _e;switch(he){case 16777216:case 33554432:_e=w.ansi[le],$.push(`xterm-bg-${le}`);break;case 50331648:_e=Et.toColor(le>>16,le>>8&255,le&255),this._addStyle(k,`background-color:#${ky((le>>>0).toString(16),"0",6)}`);break;default:we?(_e=w.foreground,$.push("xterm-bg-257")):_e=w.background}switch(xe||Q.isDim()&&(xe=ot.multiplyOpacity(_e,.5)),J){case 16777216:case 33554432:Q.isBold()&&D<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(D+=8),this._applyMinimumContrast(k,_e,w.ansi[D],Q,xe,void 0)||$.push(`xterm-fg-${D}`);break;case 50331648:let Re=Et.toColor(D>>16&255,D>>8&255,D&255);this._applyMinimumContrast(k,_e,Re,Q,xe,be)||this._addStyle(k,`color:#${ky(D.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(k,_e,w.foreground,Q,xe,be)||we&&$.push("xterm-fg-257")}$.length&&(k.className=$.join(" "),$.length=0),!re&&!O&&!Ce&&P?E++:k.textContent=j,U!==this.defaultSpacing&&(k.style.letterSpacing=`${U}px`),_.push(k),N=te}return k&&E&&(k.textContent=j),_}_applyMinimumContrast(e,t,n,r,l,h){if(this._optionsService.rawOptions.minimumContrastRatio===1||GE(r.getCode()))return!1;let d=this._getContrastCache(r),p;if(!l&&!h&&(p=d.getColor(t.rgba,n.rgba)),p===void 0){let g=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);p=ot.ensureContrastRatio(l||t,h||n,g),d.setColor((l||t).rgba,(h||n).rgba,p??null)}return p?(this._addStyle(e,`color:${p.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]}};M2=_t([me(1,ox),me(2,di),me(3,un),me(4,zr),me(5,jo),me(6,Za)],M2);function ky(e,t,n){for(;e.length<n;)e=t+e;return e}var XE=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 l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontStyle="italic";let h=e.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold",h.style.fontStyle="italic",this._measureElements=[n,r,l,h],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(l),this._container.appendChild(h),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 d=this._measure(e,0);return d>0&&(this._flat[r]=d),d}let l=e;t&&(l+="B"),n&&(l+="I");let h=this._holey.get(l);if(h===void 0){let d=0;t&&(d|=1),n&&(d|=2),h=this._measure(e,d),h>0&&this._holey.set(l,h)}return h}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},QE=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 l=e.buffers.active.ydisp,h=t[1]-l,d=n[1]-l,p=Math.max(h,0),g=Math.min(d,e.rows-1);if(p>=e.rows||g<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=h,this.viewportEndRow=d,this.viewportCappedStartRow=p,this.viewportCappedEndRow=g,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 JE(){return new QE}var sf="xterm-dom-renderer-owner-",Zi="xterm-rows",mh="xterm-fg-",Ey="xterm-bg-",Ql="xterm-focus",vh="xterm-selection",eM=1,j2=class extends He{constructor(e,t,n,r,l,h,d,p,g,m,v,_,S,w){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=l,this._helperContainer=h,this._linkifier2=d,this._charSizeService=g,this._optionsService=m,this._bufferService=v,this._coreService=_,this._coreBrowserService=S,this._themeService=w,this._terminalClass=eM++,this._rowElements=[],this._selectionRenderModel=JE(),this.onRequestRedraw=this._register(new ue).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Zi),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(vh),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=ZE(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(b=>this._injectCss(b))),this._injectCss(this._themeService.colors),this._rowFactory=p.createInstance(M2,document),this._element.classList.add(sf+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(b=>this._handleLinkHover(b))),this._register(this._linkifier2.onHideLinkUnderline(b=>this._handleLinkLeave(b))),this._register(ht(()=>{this._element.classList.remove(sf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new XE(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 n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Zi} 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} .${Zi} { 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} .${Zi} .xterm-dim { color: ${ot.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}`,l=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${l} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Zi}.${Ql} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Zi}.${Ql} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Zi}.${Ql} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${l} 1s step-end infinite;}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${vh} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${vh} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${vh} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[h,d]of e.ansi.entries())t+=`${this._terminalSelector} .${mh}${h} { color: ${d.css}; }${this._terminalSelector} .${mh}${h}.xterm-dim { color: ${ot.multiplyOpacity(d,.5).css}; }${this._terminalSelector} .${Ey}${h} { background-color: ${d.css}; }`;t+=`${this._terminalSelector} .${mh}257 { color: ${ot.opaque(e.background).css}; }${this._terminalSelector} .${mh}257.xterm-dim { color: ${ot.multiplyOpacity(ot.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ey}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 n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}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(Ql),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ql),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,l=this._selectionRenderModel.viewportEndRow,h=this._selectionRenderModel.viewportCappedStartRow,d=this._selectionRenderModel.viewportCappedEndRow,p=this._document.createDocumentFragment();if(n){let g=e[0]>t[0];p.appendChild(this._createSelectionElement(h,g?t[0]:e[0],g?e[0]:t[0],d-h+1))}else{let g=r===h?e[0]:0,m=h===l?t[0]:this._bufferService.cols;p.appendChild(this._createSelectionElement(h,g,m));let v=d-h-1;if(p.appendChild(this._createSelectionElement(h+1,0,this._bufferService.cols,v)),h!==d){let _=l===d?t[0]:this._bufferService.cols;p.appendChild(this._createSelectionElement(d,0,_))}}this._selectionContainer.appendChild(p)}_createSelectionElement(e,t,n,r=1){let l=this._document.createElement("div"),h=t*this.dimensions.css.cell.width,d=this.dimensions.css.cell.width*(n-t);return h+d>this.dimensions.css.canvas.width&&(d=this.dimensions.css.canvas.width-h),l.style.height=`${r*this.dimensions.css.cell.height}px`,l.style.top=`${e*this.dimensions.css.cell.height}px`,l.style.left=`${h}px`,l.style.width=`${d}px`,l}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,l=Math.min(n.x,this._bufferService.cols-1),h=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,d=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let g=e;g<=t;g++){let m=g+n.ydisp,v=this._rowElements[g],_=n.lines.get(m);if(!v||!_)break;v.replaceChildren(...this._rowFactory.createRow(_,m,m===r,d,p,l,h,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${sf}${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,l,h){n<0&&(e=0),r<0&&(t=0);let d=this._bufferService.rows-1;n=Math.max(Math.min(n,d),0),r=Math.max(Math.min(r,d),0),l=Math.min(l,this._bufferService.cols);let p=this._bufferService.buffer,g=p.ybase+p.y,m=Math.min(p.x,l-1),v=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,S=this._optionsService.rawOptions.cursorInactiveStyle;for(let w=n;w<=r;++w){let b=w+p.ydisp,k=this._rowElements[w],E=p.lines.get(b);if(!k||!E)break;k.replaceChildren(...this._rowFactory.createRow(E,b,b===g,_,S,m,v,this.dimensions.css.cell.width,this._widthCache,h?w===n?e:0:-1,h?(w===r?t:l)-1:-1))}}};j2=_t([me(7,f1),me(8,Xh),me(9,di),me(10,ui),me(11,zr),me(12,un),me(13,Za)],j2);var T2=class extends He{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ue),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new iM(this._optionsService))}catch{this._measureStrategy=this._register(new tM(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())}};T2=_t([me(2,di)],T2);var Mx=class extends He{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)}},tM=class extends Mx{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}},iM=class extends Mx{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 new 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}},sM=class extends He{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 nM(this._window)),this._onDprChange=this._register(new ue),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ue),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(ei.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Te(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Te(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}},nM=class extends He{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Fa),this._onDprChange=this._register(new ue),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ht(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Te(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)}},rM=class extends He{constructor(){super(),this.linkProviders=[],this._register(ht(()=>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 x1(e,t,n){let r=n.getBoundingClientRect(),l=e.getComputedStyle(n),h=parseInt(l.getPropertyValue("padding-left")),d=parseInt(l.getPropertyValue("padding-top"));return[t.clientX-r.left-h,t.clientY-r.top-d]}function aM(e,t,n,r,l,h,d,p,g){if(!h)return;let m=x1(e,t,n);if(m)return m[0]=Math.ceil((m[0]+(g?d/2:0))/d),m[1]=Math.ceil(m[1]/p),m[0]=Math.min(Math.max(m[0],1),r+(g?1:0)),m[1]=Math.min(Math.max(m[1],1),l),m}var D2=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,l){return aM(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(e,t){let n=x1(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])}}};D2=_t([me(0,dn),me(1,Xh)],D2);var lM=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):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=[]}},jx={};vk(jx,{getSafariVersion:()=>cM,isChromeOS:()=>Ax,isFirefox:()=>Tx,isIpad:()=>hM,isIphone:()=>uM,isLegacyEdge:()=>oM,isLinux:()=>w1,isMac:()=>qh,isNode:()=>Qh,isSafari:()=>Dx,isWindows:()=>Rx});var Qh=typeof process<"u"&&"title"in process,To=Qh?"node":navigator.userAgent,Do=Qh?"node":navigator.platform,Tx=To.includes("Firefox"),oM=To.includes("Edge"),Dx=/^((?!chrome|android).)*safari/i.test(To);function cM(){if(!Dx)return 0;let e=To.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var qh=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Do),hM=Do==="iPad",uM=Do==="iPhone",Rx=["Windows","Win16","Win32","WinCE"].includes(Do),w1=Do.indexOf("Linux")>=0,Ax=/\bCrOS\b/.test(To),Nx=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),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),l=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),l=e.timeRemaining(),n*1.5>l){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=l}this.clear()}},dM=class extends Nx{_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())}}},fM=class extends Nx{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Vh=!Qh&&"requestIdleCallback"in window?fM:dM,pM=class{constructor(){this._queue=new Vh}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},R2=class extends He{constructor(e,t,n,r,l,h,d,p,g){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=l,this._coreBrowserService=p,this._renderer=this._register(new Fa),this._pausedResizeTask=new pM,this._observerDisposable=this._register(new Fa),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 ue),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ue),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ue),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ue),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new lM((m,v)=>this._renderRows(m,v),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new gM(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ht(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(d.onResize(()=>this._fullRefresh())),this._register(d.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(h.onDecorationRegistered(()=>this._fullRefresh())),this._register(h.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(d.cols,d.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(d.buffer.y,d.buffer.y,!0))),this._register(g.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(m=>this._registerIntersectionObserver(m,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=ht(()=>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),this._needsSelectionRefresh=!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(t=>this.refreshRows(t.start,t.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()}};R2=_t([me(2,di),me(3,Xh),me(4,zr),me(5,jo),me(6,ui),me(7,un),me(8,Za)],R2);var gM=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 mM(e,t,n,r){let l=n.buffer.x,h=n.buffer.y;if(!n.buffer.hasScrollback)return yM(l,h,e,t,n,r)+Jh(h,t,n,r)+SM(l,h,e,t,n,r);let d;if(h===t)return d=l>e?"D":"C",xo(Math.abs(l-e),So(d,r));d=h>t?"D":"C";let p=Math.abs(h-t),g=_M(h>t?e:l,n)+(p-1)*n.cols+1+vM(h>t?l:e);return xo(g,So(d,r))}function vM(e,t){return e-1}function _M(e,t){return t.cols-e}function yM(e,t,n,r,l,h){return Jh(t,r,l,h).length===0?"":xo(Bx(e,t,e,t-Lr(t,l),!1,l).length,So("D",h))}function Jh(e,t,n,r){let l=e-Lr(e,n),h=t-Lr(t,n),d=Math.abs(l-h)-xM(e,t,n);return xo(d,So(Lx(e,t),r))}function SM(e,t,n,r,l,h){let d;Jh(t,r,l,h).length>0?d=r-Lr(r,l):d=t;let p=r,g=wM(e,t,n,r,l,h);return xo(Bx(e,d,n,p,g==="C",l).length,So(g,h))}function xM(e,t,n){let r=0,l=e-Lr(e,n),h=t-Lr(t,n);for(let d=0;d<Math.abs(l-h);d++){let p=Lx(e,t)==="A"?-1:1;n.buffer.lines.get(l+p*d)?.isWrapped&&r++}return r}function Lr(e,t){let n=0,r=t.buffer.lines.get(e),l=r?.isWrapped;for(;l&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),l=r?.isWrapped;return n}function wM(e,t,n,r,l,h){let d;return Jh(n,r,l,h).length>0?d=r-Lr(r,l):d=t,e<n&&d<=r||e>=n&&d<r?"C":"D"}function Lx(e,t){return e>t?"A":"B"}function Bx(e,t,n,r,l,h){let d=e,p=t,g="";for(;(d!==n||p!==r)&&p>=0&&p<h.buffer.lines.length;)d+=l?1:-1,l&&d>h.cols-1?(g+=h.buffer.translateBufferLineToString(p,!1,e,d),d=0,e=0,p++):!l&&d<0&&(g+=h.buffer.translateBufferLineToString(p,!1,0,e+1),d=h.cols-1,e=d,p--);return g+h.buffer.translateBufferLineToString(p,!1,e,d)}function So(e,t){let n=t?"O":"[";return ne.ESC+n+e}function xo(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var bM=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 My(e,t){if(e.start.y>e.end.y)throw new 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 nf=50,CM=15,kM=50,EM=500,MM=" ",jM=new RegExp(MM,"g"),A2=class extends He{constructor(e,t,n,r,l,h,d,p,g){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=l,this._mouseService=h,this._optionsService=d,this._renderService=p,this._coreBrowserService=g,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new is,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ue),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ue),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ue),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ue),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=m=>this._handleMouseMove(m),this._mouseUpListener=m=>this._handleMouseUp(m),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(m=>this._handleTrim(m)),this._register(this._bufferService.buffers.onBufferActivate(m=>this._handleBufferActivate(m))),this.enable(),this._model=new bM(this._bufferService),this._activeSelectionMode=0,this._register(ht(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(m=>{m.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 l=e[0]<t[0]?e[0]:t[0],h=e[0]<t[0]?t[0]:e[0];for(let d=e[1];d<=t[1];d++){let p=n.translateBufferLineToString(d,!0,l,h);r.push(p)}}else{let l=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],l));for(let h=e[1]+1;h<=t[1]-1;h++){let d=n.lines.get(h),p=n.translateBufferLineToString(h,!0);d?.isWrapped?r[r.length-1]+=p:r.push(p)}if(e[1]!==t[1]){let h=n.lines.get(t[1]),d=n.translateBufferLineToString(t[1],!0,0,t[0]);h&&h.isWrapped?r[r.length-1]+=d:r.push(d)}}return r.map(l=>l.replace(jM," ")).join(Rx?`\r`:`-`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),w1&&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=My(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=x1(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,-nf),nf),t/=nf,t/Math.abs(t)+Math.round(t*(CM-1)))}shouldForceSelection(e){return qh?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(),kM)}_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&&!(qh&&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 r=n.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!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<EM&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=mM(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!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(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let l=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:l>1&&t!==r&&(n+=l-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 l=this._bufferService.buffer,h=l.lines.get(e[1]);if(!h)return;let d=l.translateBufferLineToString(e[1],!1),p=this._convertViewportColToCharacterIndex(h,e[0]),g=p,m=e[0]-p,v=0,_=0,S=0,w=0;if(d.charAt(p)===" "){for(;p>0&&d.charAt(p-1)===" ";)p--;for(;g<d.length&&d.charAt(g+1)===" ";)g++}else{let E=e[0],j=e[0];h.getWidth(E)===0&&(v++,E--),h.getWidth(j)===2&&(_++,j++);let V=h.getString(j).length;for(V>1&&(w+=V-1,g+=V-1);E>0&&p>0&&!this._isCharWordSeparator(h.loadCell(E-1,this._workCell));){h.loadCell(E-1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===0?(v++,E--):A>1&&(S+=A-1,p-=A-1),p--,E--}for(;j<h.length&&g+1<d.length&&!this._isCharWordSeparator(h.loadCell(j+1,this._workCell));){h.loadCell(j+1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,j++):A>1&&(w+=A-1,g+=A-1),g++,j++}}g++;let b=p+m-v+S,k=Math.min(this._bufferService.cols,g-p+v+_-S-w);if(!(!t&&d.slice(p,g).trim()==="")){if(n&&b===0&&h.getCodePoint(0)!==32){let E=l.lines.get(e[1]-1);if(E&&h.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let j=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(j){let V=this._bufferService.cols-j.start;b-=V,k+=V}}}if(r&&b+k===this._bufferService.cols&&h.getCodePoint(this._bufferService.cols-1)!==32){let E=l.lines.get(e[1]+1);if(E?.isWrapped&&E.getCodePoint(0)!==32){let j=this._getWordAt([0,e[1]+1],!1,!1,!0);j&&(k+=j.length)}}return{start:b,length:k}}}_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?!1: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=My(n,this._bufferService.cols)}};A2=_t([me(3,ui),me(4,zr),me(5,p1),me(6,di),me(7,dn),me(8,un)],A2);var jy=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={}}},Ty=class{constructor(){this._color=new jy,this._css=new jy}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()}},Tt=Object.freeze((()=>{let e=[ft.toColor("#2e3436"),ft.toColor("#cc0000"),ft.toColor("#4e9a06"),ft.toColor("#c4a000"),ft.toColor("#3465a4"),ft.toColor("#75507b"),ft.toColor("#06989a"),ft.toColor("#d3d7cf"),ft.toColor("#555753"),ft.toColor("#ef2929"),ft.toColor("#8ae234"),ft.toColor("#fce94f"),ft.toColor("#729fcf"),ft.toColor("#ad7fa8"),ft.toColor("#34e2e2"),ft.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],l=t[n/6%6|0],h=t[n%6];e.push({css:Et.toCss(r,l,h),rgba:Et.toRgba(r,l,h)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:Et.toCss(r,r,r),rgba:Et.toRgba(r,r,r)})}return e})()),jr=ft.toColor("#ffffff"),lo=ft.toColor("#000000"),Ry=ft.toColor("#ffffff"),Dy=lo,Jl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},TM=jr,N2=class extends He{constructor(e){super(),this._optionsService=e,this._contrastCache=new Ty,this._halfContrastCache=new Ty,this._onChangeColors=this._register(new ue),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:jr,background:lo,cursor:Ry,cursorAccent:Dy,selectionForeground:void 0,selectionBackgroundTransparent:Jl,selectionBackgroundOpaque:ot.blend(lo,Jl),selectionInactiveBackgroundTransparent:Jl,selectionInactiveBackgroundOpaque:ot.blend(lo,Jl),scrollbarSliderBackground:ot.opacity(jr,.2),scrollbarSliderHoverBackground:ot.opacity(jr,.4),scrollbarSliderActiveBackground:ot.opacity(jr,.5),overviewRulerBorder:jr,ansi:Tt.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=it(e.foreground,jr),t.background=it(e.background,lo),t.cursor=ot.blend(t.background,it(e.cursor,Ry)),t.cursorAccent=ot.blend(t.background,it(e.cursorAccent,Dy)),t.selectionBackgroundTransparent=it(e.selectionBackground,Jl),t.selectionBackgroundOpaque=ot.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=it(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ot.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?it(e.selectionForeground,Cy):void 0,t.selectionForeground===Cy&&(t.selectionForeground=void 0),ot.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ot.opacity(t.selectionBackgroundTransparent,.3)),ot.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ot.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=it(e.scrollbarSliderBackground,ot.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=it(e.scrollbarSliderHoverBackground,ot.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=it(e.scrollbarSliderActiveBackground,ot.opacity(t.foreground,.5)),t.overviewRulerBorder=it(e.overviewRulerBorder,TM),t.ansi=Tt.slice(),t.ansi[0]=it(e.black,Tt[0]),t.ansi[1]=it(e.red,Tt[1]),t.ansi[2]=it(e.green,Tt[2]),t.ansi[3]=it(e.yellow,Tt[3]),t.ansi[4]=it(e.blue,Tt[4]),t.ansi[5]=it(e.magenta,Tt[5]),t.ansi[6]=it(e.cyan,Tt[6]),t.ansi[7]=it(e.white,Tt[7]),t.ansi[8]=it(e.brightBlack,Tt[8]),t.ansi[9]=it(e.brightRed,Tt[9]),t.ansi[10]=it(e.brightGreen,Tt[10]),t.ansi[11]=it(e.brightYellow,Tt[11]),t.ansi[12]=it(e.brightBlue,Tt[12]),t.ansi[13]=it(e.brightMagenta,Tt[13]),t.ansi[14]=it(e.brightCyan,Tt[14]),t.ansi[15]=it(e.brightWhite,Tt[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]=it(e.extendedAnsi[r],Tt[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 t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];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()}}};N2=_t([me(0,di)],N2);function it(e,t){if(e!==void 0)try{return ft.toColor(e)}catch{}return t}var RM=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)}},DM=class{constructor(){this._services=new RM,this._services.set(f1,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Ck(e).sort((h,d)=>h.index-d.index),r=[];for(let h of n){let d=this._services.get(h.id);if(!d)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${h.id._id}.`);r.push(d)}let l=n.length>0?n[0].index:t.length;if(t.length!==l)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${l+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},AM={trace:0,debug:1,info:2,warn:3,error:4,off:5},NM="xterm.js: ",L2=class extends He{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=AM[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?"":NM)+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)}};L2=_t([me(0,di)],L2);var Ay=class extends He{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ue),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ue),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ue),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new 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 new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}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 new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let l=t-1;l>=0;l--)this.set(e+l+n,this.get(e+l));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}},ze=3,kt=Object.freeze(new Mo),_h=0,rf=2,oo=class Ox{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*ze);let l=n||is.fromCharData([0,tx,1,0]);for(let h=0;h<t;++h)this.setCell(h,l);this.length=t}get(t){let n=this._data[t*ze+0],r=n&2097151;return[this._data[t*ze+1],n&2097152?this._combined[t]:r?Fn(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*ze+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*ze+0]=t|2097152|n[2]<<22):this._data[t*ze+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*ze+0]>>22}hasWidth(t){return this._data[t*ze+0]&12582912}getFg(t){return this._data[t*ze+1]}getBg(t){return this._data[t*ze+2]}hasContent(t){return this._data[t*ze+0]&4194303}getCodePoint(t){let n=this._data[t*ze+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*ze+0]&2097152}getString(t){let n=this._data[t*ze+0];return n&2097152?this._combined[t]:n&2097151?Fn(n&2097151):""}isProtected(t){return this._data[t*ze+2]&536870912}loadCell(t,n){return _h=t*ze,n.content=this._data[_h+0],n.fg=this._data[_h+1],n.bg=this._data[_h+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*ze+0]=n.content,this._data[t*ze+1]=n.fg,this._data[t*ze+2]=n.bg}setCellFromCodepoint(t,n,r,l){l.bg&268435456&&(this._extendedAttrs[t]=l.extended),this._data[t*ze+0]=n|r<<22,this._data[t*ze+1]=l.fg,this._data[t*ze+2]=l.bg}addCodepointToCell(t,n,r){let l=this._data[t*ze+0];l&2097152?this._combined[t]+=Fn(n):l&2097151?(this._combined[t]=Fn(l&2097151)+Fn(n),l&=-2097152,l|=2097152):l=n|1<<22,r&&(l&=-12582913,l|=r<<22),this._data[t*ze+0]=l}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let l=new is;for(let h=this.length-t-n-1;h>=0;--h)this.setCell(t+n+h,this.loadCell(t+h,l));for(let h=0;h<n;++h)this.setCell(t+h,r)}else for(let l=t;l<this.length;++l)this.setCell(l,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let l=new is;for(let h=0;h<this.length-t-n;++h)this.setCell(t+h,this.loadCell(t+n+h,l));for(let h=this.length-n;h<this.length;++h)this.setCell(h,r)}else for(let l=t;l<this.length;++l)this.setCell(l,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,l=!1){if(l){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*rf<this._data.buffer.byteLength;let r=t*ze;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let l=new Uint32Array(r);l.set(this._data),this._data=l}for(let l=this.length;l<t;++l)this.setCell(l,n)}else{this._data=this._data.subarray(0,r);let l=Object.keys(this._combined);for(let d=0;d<l.length;d++){let p=parseInt(l[d],10);p>=t&&delete this._combined[p]}let h=Object.keys(this._extendedAttrs);for(let d=0;d<h.length;d++){let p=parseInt(h[d],10);p>=t&&delete this._extendedAttrs[p]}}return this.length=t,r*4*rf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*rf<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new Ox(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ze+0]&4194303)return t+(this._data[t*ze+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ze+0]&4194303||this._data[t*ze+2]&50331648)return t+(this._data[t*ze+0]>>22);return 0}copyCellsFrom(t,n,r,l,h){let d=t._data;if(h)for(let g=l-1;g>=0;g--){for(let m=0;m<ze;m++)this._data[(r+g)*ze+m]=d[(n+g)*ze+m];d[(n+g)*ze+2]&268435456&&(this._extendedAttrs[r+g]=t._extendedAttrs[n+g])}else for(let g=0;g<l;g++){for(let m=0;m<ze;m++)this._data[(r+g)*ze+m]=d[(n+g)*ze+m];d[(n+g)*ze+2]&268435456&&(this._extendedAttrs[r+g]=t._extendedAttrs[n+g])}let p=Object.keys(t._combined);for(let g=0;g<p.length;g++){let m=parseInt(p[g],10);m>=n&&(this._combined[m-n+r]=t._combined[m])}}translateToString(t,n,r,l){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),l&&(l.length=0);let h="";for(;n<r;){let d=this._data[n*ze+0],p=d&2097151,g=d&2097152?this._combined[n]:p?Fn(p):Gn;if(h+=g,l)for(let m=0;m<g.length;++m)l.push(n);n+=d>>22||1}return l&&l.push(n),h}};function LM(e,t,n,r,l,h){let d=[];for(let p=0;p<e.length-1;p++){let g=p,m=e.get(++g);if(!m.isWrapped)continue;let v=[e.get(p)];for(;g<e.length&&m.isWrapped;)v.push(m),m=e.get(++g);if(!h&&r>=p&&r<g){p+=v.length-1;continue}let _=0,S=wo(v,_,t),w=1,b=0;for(;w<v.length;){let E=wo(v,w,t),j=E-b,V=n-S,A=Math.min(j,V);v[_].copyCellsFrom(v[w],b,S,A,!1),S+=A,S===n&&(_++,S=0),b+=A,b===E&&(w++,b=0),S===0&&_!==0&&v[_-1].getWidth(n-1)===2&&(v[_].copyCellsFrom(v[_-1],n-1,S++,1,!1),v[_-1].setCell(n-1,l))}v[_].replaceCells(S,n,l);let k=0;for(let E=v.length-1;E>0&&(E>_||v[E].getTrimmedLength()===0);E--)k++;k>0&&(d.push(p+v.length-k),d.push(k)),p+=v.length-1}return d}function BM(e,t){let n=[],r=0,l=t[r],h=0;for(let d=0;d<e.length;d++)if(l===d){let p=t[++r];e.onDeleteEmitter.fire({index:d-h,amount:p}),d+=p-1,h+=p,l=t[++r]}else n.push(d);return{layout:n,countRemoved:h}}function OM(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function zM(e,t,n){let r=[],l=e.map((g,m)=>wo(e,m,t)).reduce((g,m)=>g+m),h=0,d=0,p=0;for(;p<l;){if(l-p<n){r.push(l-p);break}h+=n;let g=wo(e,d,t);h>g&&(h-=g,d++);let m=e[d].getWidth(h-1)===2;m&&h--;let v=m?n-1:n;r.push(v),p+=v}return r}function wo(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,l=e[t+1].getWidth(0)===2;return r&&l?n-1:n}var zx=class Hx{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Hx._nextId++,this._onDispose=this.register(new ue),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Nr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};zx._nextId=1;var HM=zx,Nt={},Tr=Nt.B;Nt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Nt.A={"#":"£"};Nt.B=void 0;Nt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Nt.C=Nt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Nt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Nt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Nt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Nt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Nt.E=Nt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Nt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Nt.H=Nt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Nt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Ny=4294967295,Ly=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=kt.clone(),this.savedCharset=Tr,this.markers=[],this._nullCell=is.fromCharData([0,tx,1,0]),this._whitespaceCell=is.fromCharData([0,Gn,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Vh,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Ay(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 Ih),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 Ih),this._whitespaceCell}getBlankLine(e,t){return new oo(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>Ny?Ny:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=kt);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 Ay(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(kt),r=0,l=this._getCorrectBufferLength(t);if(l>this.lines.maxLength&&(this.lines.maxLength=l),this.lines.length>0){if(this._cols<e)for(let d=0;d<this.lines.length;d++)r+=+this.lines.get(d).resize(e,n);let h=0;if(this._rows<t)for(let d=this._rows;d<t;d++)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 oo(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+h+1?(this.ybase--,h++,this.ydisp>0&&this.ydisp--):this.lines.push(new oo(e,n)));else for(let d=this._rows;d>t;d--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(l<this.lines.maxLength){let d=this.lines.length-l;d>0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=l}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),h&&(this.y+=h),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 h=0;h<this.lines.length;h++)r+=+this.lines.get(h).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=LM(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(kt),n);if(r.length>0){let l=BM(this.lines,r);OM(this.lines,l.layout),this._reflowLargerAdjustViewport(e,t,l.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(kt),l=n;for(;l-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new oo(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(kt),l=[],h=0;for(let d=this.lines.length-1;d>=0;d--){let p=this.lines.get(d);if(!p||!p.isWrapped&&p.getTrimmedLength()<=e)continue;let g=[p];for(;p.isWrapped&&d>0;)p=this.lines.get(--d),g.unshift(p);if(!n){let A=this.ybase+this.y;if(A>=d&&A<d+g.length)continue}let m=g[g.length-1].getTrimmedLength(),v=zM(g,this._cols,e),_=v.length-g.length,S;this.ybase===0&&this.y!==this.lines.length-1?S=Math.max(0,this.y-this.lines.maxLength+_):S=Math.max(0,this.lines.length-this.lines.maxLength+_);let w=[];for(let A=0;A<_;A++){let z=this.getBlankLine(kt,!0);w.push(z)}w.length>0&&(l.push({start:d+g.length+h,newLines:w}),h+=w.length),g.push(...w);let b=v.length-1,k=v[b];k===0&&(b--,k=v[b]);let E=g.length-_-1,j=m;for(;E>=0;){let A=Math.min(j,k);if(g[b]===void 0)break;if(g[b].copyCellsFrom(g[E],j-A,k-A,A,!0),k-=A,k===0&&(b--,k=v[b]),j-=A,j===0){E--;let z=Math.max(E,0);j=wo(g,z,this._cols)}}for(let A=0;A<g.length;A++)v[A]<e&&g[A].setCell(v[A],r);let V=_-S;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+h)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+t-1)}if(l.length>0){let d=[],p=[];for(let k=0;k<this.lines.length;k++)p.push(this.lines.get(k));let g=this.lines.length,m=g-1,v=0,_=l[v];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+h);let S=0;for(let k=Math.min(this.lines.maxLength-1,g+h-1);k>=0;k--)if(_&&_.start>m+S){for(let E=_.newLines.length-1;E>=0;E--)this.lines.set(k--,_.newLines[E]);k++,d.push({index:m+1,amount:_.newLines.length}),S+=_.newLines.length,_=l[++v]}else this.lines.set(k,p[m--]);let w=0;for(let k=d.length-1;k>=0;k--)d[k].index+=w,this.lines.onInsertEmitter.fire(d[k]),w+=d[k].amount;let b=Math.max(0,g+h-this.lines.maxLength);b>0&&this.lines.onTrimEmitter.fire(b)}}translateBufferLineToString(e,t,n=0,r){let l=this.lines.get(e);return l?l.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]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(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 HM(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},IM=class extends He{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ue),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 Ly(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Ly(!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)}},Ix=2,Ux=1,B2=class extends He{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ue),this.onResize=this._onResize.event,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Ix),this.rows=Math.max(e.rawOptions.rows||0,Ux),this.buffers=this._register(new IM(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.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 l=n.ybase+n.scrollTop,h=n.ybase+n.scrollBottom;if(n.scrollTop===0){let d=n.lines.isFull;h===n.lines.length-1?d?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(h+1,0,r.clone()),d?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let d=h-l+1;n.lines.shiftElements(l+1,d-1,-1),n.lines.set(h,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))}};B2=_t([me(0,di)],B2);var Ba={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:qh,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},UM=["normal","bold","100","200","300","400","500","600","700","800","900"],PM=class extends He{constructor(e){super(),this._onOptionChange=this._register(new ue),this.onOptionChange=this._onOptionChange.event;let t={...Ba};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(ht(()=>{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=n=>{if(!(n in Ba))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in Ba))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};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||(t=Ba[e]),!qM(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Ba[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=UM.includes(t)?t:Ba[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new 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 new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function qM(e){return e==="block"||e==="underline"||e==="bar"}function co(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]&&co(e[r],t-1);return n}var By=Object.freeze({insertMode:!1}),Oy=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),O2=class extends He{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 ue),this.onData=this._onData.event,this._onUserInput=this._register(new ue),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ue),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ue),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=co(By),this.decPrivateModes=co(Oy)}reset(){this.modes=co(By),this.decPrivateModes=co(Oy)}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(r=>r.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(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};O2=_t([me(0,ui),me(1,ax),me(2,di)],O2);var zy={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 af(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 lf=String.fromCharCode,Hy={DEFAULT:e=>{let t=[af(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${lf(t[0])}${lf(t[1])}${lf(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${af(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${af(e,!0)};${e.x};${e.y}${t}`}},z2=class extends He{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 ue),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(zy))this.addProtocol(r,zy[r]);for(let r of Object.keys(Hy))this.addEncoding(r,Hy[r]);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 new 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 new 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,l=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=r+0,Math.abs(e.deltaY)<50&&(l*=.3),this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_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)}};z2=_t([me(0,ui),me(1,zr),me(2,di)],z2);var of=[[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]],VM=[[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]],Rt;function $M(e,t){let n=0,r=t.length-1,l;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(l=n+r>>1,e>t[l][1])n=l+1;else if(e<t[l][0])r=l-1;else return!0;return!1}var WM=class{constructor(){if(this.version="6",!Rt){Rt=new Uint8Array(65536),Rt.fill(1),Rt[0]=0,Rt.fill(0,1,32),Rt.fill(0,127,160),Rt.fill(2,4352,4448),Rt[9001]=2,Rt[9002]=2,Rt.fill(2,11904,42192),Rt[12351]=1,Rt.fill(2,44032,55204),Rt.fill(2,63744,64256),Rt.fill(2,65040,65050),Rt.fill(2,65072,65136),Rt.fill(2,65280,65377),Rt.fill(2,65504,65511);for(let e=0;e<of.length;++e)Rt.fill(0,of[e][0],of[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Rt[e]:$M(e,VM)?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 l=Rr.extractWidth(t);l===0?r=!1:l>n&&(n=l)}return Rr.createPropertyValue(0,n,r)}},Rr=class Th{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ue,this.onChange=this._onChange.event;let t=new WM;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,r=0,l=t.length;for(let h=0;h<l;++h){let d=t.charCodeAt(h);if(55296<=d&&d<=56319){if(++h>=l)return n+this.wcwidth(d);let m=t.charCodeAt(h);56320<=m&&m<=57343?d=(d-55296)*1024+m-56320+65536:n+=this.wcwidth(m)}let p=this.charProperties(d,r),g=Th.extractWidth(p);Th.extractShouldJoin(p)&&(g-=Th.extractWidth(r)),n+=g,r=p}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},FM=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 Iy(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 eo=2147483647,KM=256,Px=class H2{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>KM)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new H2;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let l=t[r];if(Array.isArray(l))for(let h=0;h<l.length;++h)n.addSubParam(l[h]);else n.addParam(l)}return n}clone(){let t=new H2(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 t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,l=this._subParamsIdx[n]&255;l-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,l))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>eo?eo:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>eo?eo:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,l=this._subParamsIdx[n]&255;l-r>0&&(t[n]=this._subParams.slice(r,l))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,l=r[n-1];r[n-1]=~l?Math.min(l*10+t,eo):t}},to=[],YM=class{constructor(){this._state=0,this._active=to,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 r=n.indexOf(t);r!==-1&&n.splice(r,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=to}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=to,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||to,!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",Zh(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 r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&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,l=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,l=this._stack.fallThrough,this._stack.paused=!1),!l&&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=to,this._id=-1,this._state=0}}},Hi=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+=Zh(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(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},io=[],GM=class{constructor(){this._handlers=Object.create(null),this._active=io,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=io}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,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=io,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||io,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Zh(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,l=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,l=this._stack.fallThrough,this._stack.paused=!1),!l&&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=io,this._ident=0}},ho=new Px;ho.addParam(0);var Uy=class{constructor(e){this._handler=e,this._data="",this._params=ho,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():ho,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Zh(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(n=>(this._params=ho,this._data="",this._hitLimit=!1,n));return this._params=ho,this._data="",this._hitLimit=!1,t}},ZM=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 l=0;l<e.length;l++)this.table[t<<8|e[l]]=n<<4|r}},es=160,XM=(function(){let e=new ZM(4095),t=Array.apply(null,Array(256)).map((p,g)=>g),n=(p,g)=>t.slice(p,g),r=n(32,127),l=n(0,24);l.push(25),l.push.apply(l,n(28,32));let h=n(0,14),d;e.setDefault(1,0),e.addMany(r,0,2,0);for(d in h)e.addMany([24,26,153,154],d,3,0),e.addMany(n(128,144),d,3,0),e.addMany(n(144,152),d,3,0),e.add(156,d,0,0),e.add(27,d,11,1),e.add(157,d,4,8),e.addMany([152,158,159],d,0,7),e.add(155,d,11,3),e.add(144,d,11,9);return e.addMany(l,0,3,0),e.addMany(l,1,3,1),e.add(127,1,0,1),e.addMany(l,8,0,8),e.addMany(l,3,3,3),e.add(127,3,0,3),e.addMany(l,4,3,4),e.add(127,4,0,4),e.addMany(l,6,3,6),e.addMany(l,5,3,5),e.add(127,5,0,5),e.addMany(l,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(l,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(l,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(l,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(l,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(l,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(l,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(es,0,2,0),e.add(es,8,5,8),e.add(es,6,0,6),e.add(es,11,0,11),e.add(es,13,13,13),e})(),QM=class extends He{constructor(e=XM){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 Px,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(ht(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new YM),this._dcsParser=this._register(new GM),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 new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let l=0;l<e.intermediates.length;++l){let h=e.intermediates.charCodeAt(l);if(32>h||h>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=h}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new 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 l=r.indexOf(t);l!==-1&&r.splice(l,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 l=r.indexOf(t);l!==-1&&r.splice(l,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,l){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=l}parse(e,t,n){let r=0,l=0,h=0,d;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,h=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let p=this._parseStack.handlers,g=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&g>-1){for(;g>=0&&(d=p[g](this._params),d!==!0);g--)if(d instanceof Promise)return this._parseStack.handlerPos=g,d}this._parseStack.handlers=[];break;case 4:if(n===!1&&g>-1){for(;g>=0&&(d=p[g](),d!==!0);g--)if(d instanceof Promise)return this._parseStack.handlerPos=g,d}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],d=this._dcsParser.unhook(r!==24&&r!==26,n),d)return d;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],d=this._oscParser.end(r!==24&&r!==26,n),d)return d;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,h=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let p=h;p<t;++p){switch(r=e[p],l=this._transitions.table[this.currentState<<8|(r<160?r:es)],l>>4){case 2:for(let S=p+1;;++S){if(S>=t||(r=e[S])<32||r>126&&r<es){this._printHandler(e,p,S),p=S-1;break}if(++S>=t||(r=e[S])<32||r>126&&r<es){this._printHandler(e,p,S),p=S-1;break}if(++S>=t||(r=e[S])<32||r>126&&r<es){this._printHandler(e,p,S),p=S-1;break}if(++S>=t||(r=e[S])<32||r>126&&r<es){this._printHandler(e,p,S),p=S-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:p,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let g=this._csiHandlers[this._collect<<8|r],m=g?g.length-1:-1;for(;m>=0&&(d=g[m](this._params),d!==!0);m--)if(d instanceof Promise)return this._preserveStack(3,g,m,l,p),d;m<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(++p<t&&(r=e[p])>47&&r<60);p--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let v=this._escHandlers[this._collect<<8|r],_=v?v.length-1:-1;for(;_>=0&&(d=v[_](),d!==!0);_--)if(d instanceof Promise)return this._preserveStack(4,v,_,l,p),d;_<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 S=p+1;;++S)if(S>=t||(r=e[S])===24||r===26||r===27||r>127&&r<es){this._dcsParser.put(e,p,S),p=S-1;break}break;case 14:if(d=this._dcsParser.unhook(r!==24&&r!==26),d)return this._preserveStack(6,[],0,l,p),d;r===27&&(l|=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 S=p+1;;S++)if(S>=t||(r=e[S])<32||r>127&&r<es){this._oscParser.put(e,p,S),p=S-1;break}break;case 6:if(d=this._oscParser.end(r!==24&&r!==26),d)return this._preserveStack(5,[],0,l,p),d;r===27&&(l|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=l&15}}},JM=/^([\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})$/,ej=/^[\da-f]+$/;function Py(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=JM.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),ej.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let l=0;l<3;++l){let h=parseInt(t.slice(n*l,n*l+n),16);r[l]=n===1?h<<4:n===2?h:n===3?h>>4:h>>8}return r}}function cf(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 tj(e,t=16){let[n,r,l]=e;return`rgb:${cf(n,t)}/${cf(r,t)}/${cf(l,t)}`}var ij={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Vn=131072,qy=10;function Vy(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 $y=5e3,Wy=0,sj=class extends He{constructor(e,t,n,r,l,h,d,p,g=new QM){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=l,this._oscLinkService=h,this._coreMouseService=d,this._unicodeService=p,this._parser=g,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new wk,this._utf8Decoder=new bk,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=kt.clone(),this._eraseAttrDataInternal=kt.clone(),this._onRequestBell=this._register(new ue),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ue),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ue),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ue),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ue),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ue),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ue),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ue),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ue),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ue),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ue),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ue),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 I2(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(m=>this._activeBuffer=m.activeBuffer)),this._parser.setCsiHandlerFallback((m,v)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(m),params:v.toArray()})}),this._parser.setEscHandlerFallback(m=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(m)})}),this._parser.setExecuteHandlerFallback(m=>{this._logService.debug("Unknown EXECUTE code: ",{code:m})}),this._parser.setOscHandlerFallback((m,v,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:m,action:v,data:_})}),this._parser.setDcsHandlerFallback((m,v,_)=>{v==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(m),action:v,payload:_})}),this._parser.setPrintHandler((m,v,_)=>this.print(m,v,_)),this._parser.registerCsiHandler({final:"@"},m=>this.insertChars(m)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},m=>this.scrollLeft(m)),this._parser.registerCsiHandler({final:"A"},m=>this.cursorUp(m)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},m=>this.scrollRight(m)),this._parser.registerCsiHandler({final:"B"},m=>this.cursorDown(m)),this._parser.registerCsiHandler({final:"C"},m=>this.cursorForward(m)),this._parser.registerCsiHandler({final:"D"},m=>this.cursorBackward(m)),this._parser.registerCsiHandler({final:"E"},m=>this.cursorNextLine(m)),this._parser.registerCsiHandler({final:"F"},m=>this.cursorPrecedingLine(m)),this._parser.registerCsiHandler({final:"G"},m=>this.cursorCharAbsolute(m)),this._parser.registerCsiHandler({final:"H"},m=>this.cursorPosition(m)),this._parser.registerCsiHandler({final:"I"},m=>this.cursorForwardTab(m)),this._parser.registerCsiHandler({final:"J"},m=>this.eraseInDisplay(m,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},m=>this.eraseInDisplay(m,!0)),this._parser.registerCsiHandler({final:"K"},m=>this.eraseInLine(m,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},m=>this.eraseInLine(m,!0)),this._parser.registerCsiHandler({final:"L"},m=>this.insertLines(m)),this._parser.registerCsiHandler({final:"M"},m=>this.deleteLines(m)),this._parser.registerCsiHandler({final:"P"},m=>this.deleteChars(m)),this._parser.registerCsiHandler({final:"S"},m=>this.scrollUp(m)),this._parser.registerCsiHandler({final:"T"},m=>this.scrollDown(m)),this._parser.registerCsiHandler({final:"X"},m=>this.eraseChars(m)),this._parser.registerCsiHandler({final:"Z"},m=>this.cursorBackwardTab(m)),this._parser.registerCsiHandler({final:"`"},m=>this.charPosAbsolute(m)),this._parser.registerCsiHandler({final:"a"},m=>this.hPositionRelative(m)),this._parser.registerCsiHandler({final:"b"},m=>this.repeatPrecedingCharacter(m)),this._parser.registerCsiHandler({final:"c"},m=>this.sendDeviceAttributesPrimary(m)),this._parser.registerCsiHandler({prefix:">",final:"c"},m=>this.sendDeviceAttributesSecondary(m)),this._parser.registerCsiHandler({final:"d"},m=>this.linePosAbsolute(m)),this._parser.registerCsiHandler({final:"e"},m=>this.vPositionRelative(m)),this._parser.registerCsiHandler({final:"f"},m=>this.hVPosition(m)),this._parser.registerCsiHandler({final:"g"},m=>this.tabClear(m)),this._parser.registerCsiHandler({final:"h"},m=>this.setMode(m)),this._parser.registerCsiHandler({prefix:"?",final:"h"},m=>this.setModePrivate(m)),this._parser.registerCsiHandler({final:"l"},m=>this.resetMode(m)),this._parser.registerCsiHandler({prefix:"?",final:"l"},m=>this.resetModePrivate(m)),this._parser.registerCsiHandler({final:"m"},m=>this.charAttributes(m)),this._parser.registerCsiHandler({final:"n"},m=>this.deviceStatus(m)),this._parser.registerCsiHandler({prefix:"?",final:"n"},m=>this.deviceStatusPrivate(m)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},m=>this.softReset(m)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},m=>this.setCursorStyle(m)),this._parser.registerCsiHandler({final:"r"},m=>this.setScrollRegion(m)),this._parser.registerCsiHandler({final:"s"},m=>this.saveCursor(m)),this._parser.registerCsiHandler({final:"t"},m=>this.windowOptions(m)),this._parser.registerCsiHandler({final:"u"},m=>this.restoreCursor(m)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},m=>this.insertColumns(m)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},m=>this.deleteColumns(m)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},m=>this.selectProtected(m)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},m=>this.requestMode(m,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},m=>this.requestMode(m,!1)),this._parser.setExecuteHandler(ne.BEL,()=>this.bell()),this._parser.setExecuteHandler(ne.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ne.BS,()=>this.backspace()),this._parser.setExecuteHandler(ne.HT,()=>this.tab()),this._parser.setExecuteHandler(ne.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ne.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Mh.IND,()=>this.index()),this._parser.setExecuteHandler(Mh.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Mh.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Hi(m=>(this.setTitle(m),this.setIconName(m),!0))),this._parser.registerOscHandler(1,new Hi(m=>this.setIconName(m))),this._parser.registerOscHandler(2,new Hi(m=>this.setTitle(m))),this._parser.registerOscHandler(4,new Hi(m=>this.setOrReportIndexedColor(m))),this._parser.registerOscHandler(8,new Hi(m=>this.setHyperlink(m))),this._parser.registerOscHandler(10,new Hi(m=>this.setOrReportFgColor(m))),this._parser.registerOscHandler(11,new Hi(m=>this.setOrReportBgColor(m))),this._parser.registerOscHandler(12,new Hi(m=>this.setOrReportCursorColor(m))),this._parser.registerOscHandler(104,new Hi(m=>this.restoreIndexedColor(m))),this._parser.registerOscHandler(110,new Hi(m=>this.restoreFgColor(m))),this._parser.registerOscHandler(111,new Hi(m=>this.restoreBgColor(m))),this._parser.registerOscHandler(112,new Hi(m=>this.restoreCursorColor(m))),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 m in Nt)this._parser.registerEscHandler({intermediates:"(",final:m},()=>this.selectCharset("("+m)),this._parser.registerEscHandler({intermediates:")",final:m},()=>this.selectCharset(")"+m)),this._parser.registerEscHandler({intermediates:"*",final:m},()=>this.selectCharset("*"+m)),this._parser.registerEscHandler({intermediates:"+",final:m},()=>this.selectCharset("+"+m)),this._parser.registerEscHandler({intermediates:"-",final:m},()=>this.selectCharset("-"+m)),this._parser.registerEscHandler({intermediates:".",final:m},()=>this.selectCharset("."+m)),this._parser.registerEscHandler({intermediates:"/",final:m},()=>this.selectCharset("/"+m));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(m=>(this._logService.error("Parsing error: ",m),m)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Uy((m,v)=>this.requestStatusString(m,v)))}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((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),$y))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${$y} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,l=this._activeBuffer.y,h=0,d=this._parseStack.paused;if(d){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,l=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Vn&&(h=this._parseStack.position+Vn)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,m=>String.fromCharCode(m)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(m=>m.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Vn&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Vn))),d||this._dirtyRowTracker.clearRange(),e.length>Vn)for(let m=h;m<e.length;m+=Vn){let v=m+Vn<e.length?m+Vn:e.length,_=typeof e=="string"?this._stringDecoder.decode(e.substring(m,v),this._parseBuffer):this._utf8Decoder.decode(e.subarray(m,v),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,_))return this._preserveStack(r,l,_,m),this._logSlowResolvingAsync(n),n}else if(!d){let m=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,m))return this._preserveStack(r,l,m,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==l)&&this._onCursorMove.fire();let p=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),g=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);g<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(g,this._bufferService.rows-1),end:Math.min(p,this._bufferService.rows-1)})}print(e,t,n){let r,l,h=this._charsetService.charset,d=this._optionsService.rawOptions.screenReaderMode,p=this._bufferService.cols,g=this._coreService.decPrivateModes.wraparound,m=this._coreService.modes.insertMode,v=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,v);let S=this._parser.precedingJoinState;for(let w=t;w<n;++w){if(r=e[w],r<127&&h){let j=h[String.fromCharCode(r)];j&&(r=j.charCodeAt(0))}let b=this._unicodeService.charProperties(r,S);l=Rr.extractWidth(b);let k=Rr.extractShouldJoin(b),E=k?Rr.extractWidth(S):0;if(S=b,d&&this._onA11yChar.fire(Fn(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+l-E>p){if(g){let j=_,V=this._activeBuffer.x-E;for(this._activeBuffer.x=E,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),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),E>0&&_ instanceof oo&&_.copyCellsFrom(j,V,0,E,!1);V<p;)j.setCellFromCodepoint(V++,0,1,v)}else if(this._activeBuffer.x=p-1,l===2)continue}if(k&&this._activeBuffer.x){let j=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-j,r,l);for(let V=l-E;--V>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,v);continue}if(m&&(_.insertCells(this._activeBuffer.x,l-E,this._activeBuffer.getNullCell(v)),_.getWidth(p-1)===2&&_.setCellFromCodepoint(p-1,0,1,v)),_.setCellFromCodepoint(this._activeBuffer.x++,r,l,v),l>0)for(;--l;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,v)}this._parser.precedingJoinState=S,this._activeBuffer.x<p&&n-t>0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,v),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>Vy(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Uy(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Hi(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,l=!1){let h=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);h.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),l),r&&(h.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 r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(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);break}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,l=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(l-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(kt));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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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=Rr.extractWidth(t),l=this._activeBuffer.x-r,h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(l),d=new Uint32Array(h.length*n),p=0;for(let m=0;m<h.length;){let v=h.codePointAt(m)||0;d[p++]=v,m+=v>65535?2:1}let g=p;for(let m=1;m<n;++m)d.copyWithin(g,0,p),g+=p;return this.print(d,0,g),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ne.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ne.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ne.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ne.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ne.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;break}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,Tr),this._charsetService.setgCharset(1,Tr),this._charsetService.setgCharset(2,Tr),this._charsetService.setgCharset(3,Tr);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(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;break}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);break}return!0}requestMode(e,t){let n;(k=>(k[k.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",k[k.SET=1]="SET",k[k.RESET=2]="RESET",k[k.PERMANENTLY_SET=3]="PERMANENTLY_SET",k[k.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:l,activeEncoding:h}=this._coreMouseService,d=this._coreService,{buffers:p,cols:g}=this._bufferService,{active:m,alt:v}=p,_=this._optionsService.rawOptions,S=(k,E)=>(d.triggerDataEvent(`${ne.ESC}[${t?"":"?"}${k};${E}$y`),!0),w=k=>k?1:2,b=e.params[0];return t?b===2?S(b,4):b===4?S(b,w(d.modes.insertMode)):b===12?S(b,3):b===20?S(b,w(_.convertEol)):S(b,0):b===1?S(b,w(r.applicationCursorKeys)):b===3?S(b,_.windowOptions.setWinLines?g===80?2:g===132?1:0:0):b===6?S(b,w(r.origin)):b===7?S(b,w(r.wraparound)):b===8?S(b,3):b===9?S(b,w(l==="X10")):b===12?S(b,w(_.cursorBlink)):b===25?S(b,w(!d.isCursorHidden)):b===45?S(b,w(r.reverseWraparound)):b===66?S(b,w(r.applicationKeypad)):b===67?S(b,4):b===1e3?S(b,w(l==="VT200")):b===1002?S(b,w(l==="DRAG")):b===1003?S(b,w(l==="ANY")):b===1004?S(b,w(r.sendFocus)):b===1005?S(b,4):b===1006?S(b,w(h==="SGR")):b===1015?S(b,4):b===1016?S(b,w(h==="SGR_PIXELS")):b===1048?S(b,1):b===47||b===1047||b===1049?S(b,w(m===v)):b===2004?S(b,w(r.bracketedPasteMode)):b===2026?S(b,w(r.synchronizedOutput)):S(b,0)}_updateAttrColor(e,t,n,r,l){return t===2?(e|=50331648,e&=-16777216,e|=Mo.fromColorRGB([n,r,l])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],l=0,h=0;do{if(r[h+l]=e.params[t+h],e.hasSubParams(t+h)){let d=e.getSubParams(t+h),p=0;do r[1]===5&&(l=1),r[h+p+1+l]=d[p];while(++p<d.length&&p+h+1+l<r.length);break}if(r[1]===5&&h+l>=2||r[1]===2&&h+l>=5)break;r[1]&&(l=1)}while(++h+t<e.length&&h+l<r.length);for(let d=2;d<r.length;++d)r[d]===-1&&(r[d]=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 h}_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=kt.fg,e.bg=kt.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 l=0;l<t;l++)n=e.params[l],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|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(l)?e.getSubParams(l)[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|=kt.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=kt.bg&16777215):n===38||n===48||n===58?l+=this._extractColor(e,l,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|=kt.fg&16777215,r.bg&=-67108864,r.bg|=kt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ne.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ne.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ne.ESC}[?${t};${n}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=kt.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";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}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(!Vy(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(`${ne.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>qy&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>qy&&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());break}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 r=n.shift(),l=n.shift();if(/^\d+$/.exec(r)){let h=parseInt(r);if(Fy(h))if(l==="?")t.push({type:0,index:h});else{let d=Py(l);d&&t.push({type:1,index:h,color:d})}}}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()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,l=n.findIndex(h=>h.startsWith("id="));return l!==-1&&(r=n[l].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 r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let l=Py(n[r]);l&&this._onColor.fire([{type:1,index:this._specialColors[t],color:l}])}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 r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let l=parseInt(n[r]);Fy(l)&&t.push({type:2,index:l})}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,Tr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(ij[e[0]],Nt[e[1]]||Tr),!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=kt.clone(),this._eraseAttrDataInternal=kt.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 is;e.content=1<<22|69,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=d=>(this._coreService.triggerDataEvent(`${ne.ESC}${d}${ne.ESC}\\`),!0),r=this._bufferService.buffer,l=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"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}[l.cursorStyle]-(l.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},I2=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&&(Wy=e,e=t,t=Wy),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};I2=_t([me(0,ui)],I2);function Fy(e){return 0<=e&&e<256}var nj=5e7,Ky=12,rj=50,aj=class extends He{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 ue),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 r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>nj)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=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 r=this._writeBuffer[this._bufferOffset],l=this._action(r,t);if(l){let d=p=>performance.now()-n>=Ky?setTimeout(()=>this._innerWrite(0,p)):this._innerWrite(n,p);l.catch(p=>(queueMicrotask(()=>{throw p}),Promise.resolve(!1))).then(d);return}let h=this._callbacks[this._bufferOffset];if(h&&h(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=Ky)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>rj&&(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()}},U2=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 p=t.addMarker(t.ybase+t.y),g={data:e,id:this._nextId++,lines:[p]};return p.onDispose(()=>this._removeMarkerFromLink(g,p)),this._dataByLinkId.set(g.id,g),g.id}let n=e,r=this._getEntryIdKey(n),l=this._entriesWithId.get(r);if(l)return this.addLineToLink(l.id,t.ybase+t.y),l.id;let h=t.addMarker(t.ybase+t.y),d={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(d,h)),this._entriesWithId.set(d.key,d),this._dataByLinkId.set(d.id,d),d.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}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)))}};U2=_t([me(0,ui)],U2);var Yy=!1,lj=class extends He{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Fa),this._onBinary=this._register(new ue),this.onBinary=this._onBinary.event,this._onData=this._register(new ue),this.onData=this._onData.event,this._onLineFeed=this._register(new ue),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ue),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ue),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ue),this._instantiationService=new DM,this.optionsService=this._register(new PM(e)),this._instantiationService.setService(di,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(B2)),this._instantiationService.setService(ui,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(L2)),this._instantiationService.setService(ax,this._logService),this.coreService=this._register(this._instantiationService.createInstance(O2)),this._instantiationService.setService(zr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(z2)),this._instantiationService.setService(rx,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Rr)),this._instantiationService.setService(Mk,this.unicodeService),this._charsetService=this._instantiationService.createInstance(FM),this._instantiationService.setService(Ek,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(U2),this._instantiationService.setService(lx,this._oscLinkService),this._inputHandler=this._register(new sj(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ei.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ei.forward(this._bufferService.onResize,this._onResize)),this._register(ei.forward(this.coreService.onData,this._onData)),this._register(ei.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 aj((t,n)=>this._inputHandler.parse(t,n))),this._register(ei.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ue),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&&!Yy&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Yy=!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,Ix),t=Math.max(t,Ux),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(Iy.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Iy(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ht(()=>{for(let t of e)t.dispose()})}}},oj={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 cj(e,t,n,r){let l={type:0,cancel:!1,key:void 0},h=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?l.key=ne.ESC+"OA":l.key=ne.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?l.key=ne.ESC+"OD":l.key=ne.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?l.key=ne.ESC+"OC":l.key=ne.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?l.key=ne.ESC+"OB":l.key=ne.ESC+"[B");break;case 8:l.key=e.ctrlKey?"\b":ne.DEL,e.altKey&&(l.key=ne.ESC+l.key);break;case 9:if(e.shiftKey){l.key=ne.ESC+"[Z";break}l.key=ne.HT,l.cancel=!0;break;case 13:l.key=e.altKey?ne.ESC+ne.CR:ne.CR,l.cancel=!0;break;case 27:l.key=ne.ESC,e.altKey&&(l.key=ne.ESC+ne.ESC),l.cancel=!0;break;case 37:if(e.metaKey)break;h?l.key=ne.ESC+"[1;"+(h+1)+"D":t?l.key=ne.ESC+"OD":l.key=ne.ESC+"[D";break;case 39:if(e.metaKey)break;h?l.key=ne.ESC+"[1;"+(h+1)+"C":t?l.key=ne.ESC+"OC":l.key=ne.ESC+"[C";break;case 38:if(e.metaKey)break;h?l.key=ne.ESC+"[1;"+(h+1)+"A":t?l.key=ne.ESC+"OA":l.key=ne.ESC+"[A";break;case 40:if(e.metaKey)break;h?l.key=ne.ESC+"[1;"+(h+1)+"B":t?l.key=ne.ESC+"OB":l.key=ne.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(l.key=ne.ESC+"[2~");break;case 46:h?l.key=ne.ESC+"[3;"+(h+1)+"~":l.key=ne.ESC+"[3~";break;case 36:h?l.key=ne.ESC+"[1;"+(h+1)+"H":t?l.key=ne.ESC+"OH":l.key=ne.ESC+"[H";break;case 35:h?l.key=ne.ESC+"[1;"+(h+1)+"F":t?l.key=ne.ESC+"OF":l.key=ne.ESC+"[F";break;case 33:e.shiftKey?l.type=2:e.ctrlKey?l.key=ne.ESC+"[5;"+(h+1)+"~":l.key=ne.ESC+"[5~";break;case 34:e.shiftKey?l.type=3:e.ctrlKey?l.key=ne.ESC+"[6;"+(h+1)+"~":l.key=ne.ESC+"[6~";break;case 112:h?l.key=ne.ESC+"[1;"+(h+1)+"P":l.key=ne.ESC+"OP";break;case 113:h?l.key=ne.ESC+"[1;"+(h+1)+"Q":l.key=ne.ESC+"OQ";break;case 114:h?l.key=ne.ESC+"[1;"+(h+1)+"R":l.key=ne.ESC+"OR";break;case 115:h?l.key=ne.ESC+"[1;"+(h+1)+"S":l.key=ne.ESC+"OS";break;case 116:h?l.key=ne.ESC+"[15;"+(h+1)+"~":l.key=ne.ESC+"[15~";break;case 117:h?l.key=ne.ESC+"[17;"+(h+1)+"~":l.key=ne.ESC+"[17~";break;case 118:h?l.key=ne.ESC+"[18;"+(h+1)+"~":l.key=ne.ESC+"[18~";break;case 119:h?l.key=ne.ESC+"[19;"+(h+1)+"~":l.key=ne.ESC+"[19~";break;case 120:h?l.key=ne.ESC+"[20;"+(h+1)+"~":l.key=ne.ESC+"[20~";break;case 121:h?l.key=ne.ESC+"[21;"+(h+1)+"~":l.key=ne.ESC+"[21~";break;case 122:h?l.key=ne.ESC+"[23;"+(h+1)+"~":l.key=ne.ESC+"[23~";break;case 123:h?l.key=ne.ESC+"[24;"+(h+1)+"~":l.key=ne.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?l.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?l.key=ne.NUL:e.keyCode>=51&&e.keyCode<=55?l.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?l.key=ne.DEL:e.keyCode===219?l.key=ne.ESC:e.keyCode===220?l.key=ne.FS:e.keyCode===221&&(l.key=ne.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let d=oj[e.keyCode]?.[e.shiftKey?1:0];if(d)l.key=ne.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let p=e.ctrlKey?e.keyCode-64:e.keyCode+32,g=String.fromCharCode(p);e.shiftKey&&(g=g.toUpperCase()),l.key=ne.ESC+g}else if(e.keyCode===32)l.key=ne.ESC+(e.ctrlKey?ne.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let p=e.code.slice(3,4);e.shiftKey||(p=p.toLowerCase()),l.key=ne.ESC+p,l.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(l.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?l.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(l.key=ne.US),e.key==="@"&&(l.key=ne.NUL));break}return l}var St=0,hj=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Vh,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Vh,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((l,h)=>this._getKey(l)-this._getKey(h)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let l=0;l<r.length;l++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[l]=e[t],t++):r[l]=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||(St=this._search(t),St===-1)||this._getKey(this._array[St])!==t)return!1;do if(this._array[St]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(St),!0;while(++St<this._array.length&&this._getKey(this._array[St])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((l,h)=>l-h),t=0,n=new Array(this._array.length-e.length),r=0;for(let l=0;l<this._array.length;l++)e[t]===l?t++:n[r++]=this._array[l];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&&(St=this._search(e),!(St<0||St>=this._array.length)&&this._getKey(this._array[St])===e))do yield this._array[St];while(++St<this._array.length&&this._getKey(this._array[St])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(St=this._search(e),!(St<0||St>=this._array.length)&&this._getKey(this._array[St])===e))do t(this._array[St]);while(++St<this._array.length&&this._getKey(this._array[St])===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,l=this._getKey(this._array[r]);if(l>e)n=r-1;else if(l<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},hf=0,Gy=0,uj=class extends He{constructor(){super(),this._decorations=new hj(e=>e?.marker.line),this._onDecorationRegistered=this._register(new ue),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ue),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ht(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new dj(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.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,l=0;for(let h of this._decorations.getKeyIterator(t))r=h.options.x??0,l=r+(h.options.width??1),e>=r&&e<l&&(!n||(h.options.layer??"bottom")===n)&&(yield h)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,l=>{hf=l.options.x??0,Gy=hf+(l.options.width??1),e>=hf&&e<Gy&&(!n||(l.options.layer??"bottom")===n)&&r(l)})}},dj=class extends Qn{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ue),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ue),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.options.backgroundColor?this._cachedBg=ft.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ft.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},fj=1e3,pj=class{constructor(e,t=fj){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?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let l=r-this._lastRefreshMs,h=this._debounceThresholdMS-l;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},h)}}_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)}},Zy=20,$h=class extends He{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 l=this._coreBrowserService.mainDocument;this._accessibilityContainer=l.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=l.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let h=0;h<this._terminal.rows;h++)this._rowElements[h]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[h]);if(this._topBoundaryFocusListener=h=>this._handleBoundaryFocus(h,0),this._bottomBoundaryFocusListener=h=>this._handleBoundaryFocus(h,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=l.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new pj(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(h=>this._handleResize(h.rows))),this._register(this._terminal.onRender(h=>this._refreshRows(h.start,h.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(h=>this._handleChar(h))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`+`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),w1&&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=My(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=x1(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,-nf),nf),t/=nf,t/Math.abs(t)+Math.round(t*(CM-1)))}shouldForceSelection(e){return qh?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(),kM)}_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&&!(qh&&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 r=n.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!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<EM&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=mM(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!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(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let l=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:l>1&&t!==r&&(n+=l-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 l=this._bufferService.buffer,h=l.lines.get(e[1]);if(!h)return;let d=l.translateBufferLineToString(e[1],!1),p=this._convertViewportColToCharacterIndex(h,e[0]),g=p,m=e[0]-p,v=0,_=0,S=0,w=0;if(d.charAt(p)===" "){for(;p>0&&d.charAt(p-1)===" ";)p--;for(;g<d.length&&d.charAt(g+1)===" ";)g++}else{let E=e[0],j=e[0];h.getWidth(E)===0&&(v++,E--),h.getWidth(j)===2&&(_++,j++);let V=h.getString(j).length;for(V>1&&(w+=V-1,g+=V-1);E>0&&p>0&&!this._isCharWordSeparator(h.loadCell(E-1,this._workCell));){h.loadCell(E-1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===0?(v++,E--):A>1&&(S+=A-1,p-=A-1),p--,E--}for(;j<h.length&&g+1<d.length&&!this._isCharWordSeparator(h.loadCell(j+1,this._workCell));){h.loadCell(j+1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,j++):A>1&&(w+=A-1,g+=A-1),g++,j++}}g++;let b=p+m-v+S,k=Math.min(this._bufferService.cols,g-p+v+_-S-w);if(!(!t&&d.slice(p,g).trim()==="")){if(n&&b===0&&h.getCodePoint(0)!==32){let E=l.lines.get(e[1]-1);if(E&&h.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let j=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(j){let V=this._bufferService.cols-j.start;b-=V,k+=V}}}if(r&&b+k===this._bufferService.cols&&h.getCodePoint(this._bufferService.cols-1)!==32){let E=l.lines.get(e[1]+1);if(E?.isWrapped&&E.getCodePoint(0)!==32){let j=this._getWordAt([0,e[1]+1],!1,!1,!0);j&&(k+=j.length)}}return{start:b,length:k}}}_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?!1: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=My(n,this._bufferService.cols)}};A2=_t([me(3,ui),me(4,zr),me(5,p1),me(6,di),me(7,dn),me(8,un)],A2);var jy=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={}}},Ty=class{constructor(){this._color=new jy,this._css=new jy}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()}},Tt=Object.freeze((()=>{let e=[ft.toColor("#2e3436"),ft.toColor("#cc0000"),ft.toColor("#4e9a06"),ft.toColor("#c4a000"),ft.toColor("#3465a4"),ft.toColor("#75507b"),ft.toColor("#06989a"),ft.toColor("#d3d7cf"),ft.toColor("#555753"),ft.toColor("#ef2929"),ft.toColor("#8ae234"),ft.toColor("#fce94f"),ft.toColor("#729fcf"),ft.toColor("#ad7fa8"),ft.toColor("#34e2e2"),ft.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],l=t[n/6%6|0],h=t[n%6];e.push({css:Et.toCss(r,l,h),rgba:Et.toRgba(r,l,h)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:Et.toCss(r,r,r),rgba:Et.toRgba(r,r,r)})}return e})()),jr=ft.toColor("#ffffff"),lo=ft.toColor("#000000"),Dy=ft.toColor("#ffffff"),Ry=lo,Jl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},TM=jr,N2=class extends He{constructor(e){super(),this._optionsService=e,this._contrastCache=new Ty,this._halfContrastCache=new Ty,this._onChangeColors=this._register(new ue),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:jr,background:lo,cursor:Dy,cursorAccent:Ry,selectionForeground:void 0,selectionBackgroundTransparent:Jl,selectionBackgroundOpaque:ot.blend(lo,Jl),selectionInactiveBackgroundTransparent:Jl,selectionInactiveBackgroundOpaque:ot.blend(lo,Jl),scrollbarSliderBackground:ot.opacity(jr,.2),scrollbarSliderHoverBackground:ot.opacity(jr,.4),scrollbarSliderActiveBackground:ot.opacity(jr,.5),overviewRulerBorder:jr,ansi:Tt.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=it(e.foreground,jr),t.background=it(e.background,lo),t.cursor=ot.blend(t.background,it(e.cursor,Dy)),t.cursorAccent=ot.blend(t.background,it(e.cursorAccent,Ry)),t.selectionBackgroundTransparent=it(e.selectionBackground,Jl),t.selectionBackgroundOpaque=ot.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=it(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ot.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?it(e.selectionForeground,Cy):void 0,t.selectionForeground===Cy&&(t.selectionForeground=void 0),ot.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ot.opacity(t.selectionBackgroundTransparent,.3)),ot.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ot.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=it(e.scrollbarSliderBackground,ot.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=it(e.scrollbarSliderHoverBackground,ot.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=it(e.scrollbarSliderActiveBackground,ot.opacity(t.foreground,.5)),t.overviewRulerBorder=it(e.overviewRulerBorder,TM),t.ansi=Tt.slice(),t.ansi[0]=it(e.black,Tt[0]),t.ansi[1]=it(e.red,Tt[1]),t.ansi[2]=it(e.green,Tt[2]),t.ansi[3]=it(e.yellow,Tt[3]),t.ansi[4]=it(e.blue,Tt[4]),t.ansi[5]=it(e.magenta,Tt[5]),t.ansi[6]=it(e.cyan,Tt[6]),t.ansi[7]=it(e.white,Tt[7]),t.ansi[8]=it(e.brightBlack,Tt[8]),t.ansi[9]=it(e.brightRed,Tt[9]),t.ansi[10]=it(e.brightGreen,Tt[10]),t.ansi[11]=it(e.brightYellow,Tt[11]),t.ansi[12]=it(e.brightBlue,Tt[12]),t.ansi[13]=it(e.brightMagenta,Tt[13]),t.ansi[14]=it(e.brightCyan,Tt[14]),t.ansi[15]=it(e.brightWhite,Tt[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]=it(e.extendedAnsi[r],Tt[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 t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];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()}}};N2=_t([me(0,di)],N2);function it(e,t){if(e!==void 0)try{return ft.toColor(e)}catch{}return t}var DM=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)}},RM=class{constructor(){this._services=new DM,this._services.set(f1,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Ck(e).sort((h,d)=>h.index-d.index),r=[];for(let h of n){let d=this._services.get(h.id);if(!d)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${h.id._id}.`);r.push(d)}let l=n.length>0?n[0].index:t.length;if(t.length!==l)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${l+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},AM={trace:0,debug:1,info:2,warn:3,error:4,off:5},NM="xterm.js: ",L2=class extends He{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=AM[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?"":NM)+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)}};L2=_t([me(0,di)],L2);var Ay=class extends He{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ue),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ue),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ue),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new 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 new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}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 new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let l=t-1;l>=0;l--)this.set(e+l+n,this.get(e+l));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}},ze=3,kt=Object.freeze(new Mo),_h=0,rf=2,oo=class Ox{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*ze);let l=n||is.fromCharData([0,tx,1,0]);for(let h=0;h<t;++h)this.setCell(h,l);this.length=t}get(t){let n=this._data[t*ze+0],r=n&2097151;return[this._data[t*ze+1],n&2097152?this._combined[t]:r?Fn(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*ze+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*ze+0]=t|2097152|n[2]<<22):this._data[t*ze+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*ze+0]>>22}hasWidth(t){return this._data[t*ze+0]&12582912}getFg(t){return this._data[t*ze+1]}getBg(t){return this._data[t*ze+2]}hasContent(t){return this._data[t*ze+0]&4194303}getCodePoint(t){let n=this._data[t*ze+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*ze+0]&2097152}getString(t){let n=this._data[t*ze+0];return n&2097152?this._combined[t]:n&2097151?Fn(n&2097151):""}isProtected(t){return this._data[t*ze+2]&536870912}loadCell(t,n){return _h=t*ze,n.content=this._data[_h+0],n.fg=this._data[_h+1],n.bg=this._data[_h+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*ze+0]=n.content,this._data[t*ze+1]=n.fg,this._data[t*ze+2]=n.bg}setCellFromCodepoint(t,n,r,l){l.bg&268435456&&(this._extendedAttrs[t]=l.extended),this._data[t*ze+0]=n|r<<22,this._data[t*ze+1]=l.fg,this._data[t*ze+2]=l.bg}addCodepointToCell(t,n,r){let l=this._data[t*ze+0];l&2097152?this._combined[t]+=Fn(n):l&2097151?(this._combined[t]=Fn(l&2097151)+Fn(n),l&=-2097152,l|=2097152):l=n|1<<22,r&&(l&=-12582913,l|=r<<22),this._data[t*ze+0]=l}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let l=new is;for(let h=this.length-t-n-1;h>=0;--h)this.setCell(t+n+h,this.loadCell(t+h,l));for(let h=0;h<n;++h)this.setCell(t+h,r)}else for(let l=t;l<this.length;++l)this.setCell(l,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let l=new is;for(let h=0;h<this.length-t-n;++h)this.setCell(t+h,this.loadCell(t+n+h,l));for(let h=this.length-n;h<this.length;++h)this.setCell(h,r)}else for(let l=t;l<this.length;++l)this.setCell(l,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,l=!1){if(l){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*rf<this._data.buffer.byteLength;let r=t*ze;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let l=new Uint32Array(r);l.set(this._data),this._data=l}for(let l=this.length;l<t;++l)this.setCell(l,n)}else{this._data=this._data.subarray(0,r);let l=Object.keys(this._combined);for(let d=0;d<l.length;d++){let p=parseInt(l[d],10);p>=t&&delete this._combined[p]}let h=Object.keys(this._extendedAttrs);for(let d=0;d<h.length;d++){let p=parseInt(h[d],10);p>=t&&delete this._extendedAttrs[p]}}return this.length=t,r*4*rf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*rf<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new Ox(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ze+0]&4194303)return t+(this._data[t*ze+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ze+0]&4194303||this._data[t*ze+2]&50331648)return t+(this._data[t*ze+0]>>22);return 0}copyCellsFrom(t,n,r,l,h){let d=t._data;if(h)for(let g=l-1;g>=0;g--){for(let m=0;m<ze;m++)this._data[(r+g)*ze+m]=d[(n+g)*ze+m];d[(n+g)*ze+2]&268435456&&(this._extendedAttrs[r+g]=t._extendedAttrs[n+g])}else for(let g=0;g<l;g++){for(let m=0;m<ze;m++)this._data[(r+g)*ze+m]=d[(n+g)*ze+m];d[(n+g)*ze+2]&268435456&&(this._extendedAttrs[r+g]=t._extendedAttrs[n+g])}let p=Object.keys(t._combined);for(let g=0;g<p.length;g++){let m=parseInt(p[g],10);m>=n&&(this._combined[m-n+r]=t._combined[m])}}translateToString(t,n,r,l){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),l&&(l.length=0);let h="";for(;n<r;){let d=this._data[n*ze+0],p=d&2097151,g=d&2097152?this._combined[n]:p?Fn(p):Gn;if(h+=g,l)for(let m=0;m<g.length;++m)l.push(n);n+=d>>22||1}return l&&l.push(n),h}};function LM(e,t,n,r,l,h){let d=[];for(let p=0;p<e.length-1;p++){let g=p,m=e.get(++g);if(!m.isWrapped)continue;let v=[e.get(p)];for(;g<e.length&&m.isWrapped;)v.push(m),m=e.get(++g);if(!h&&r>=p&&r<g){p+=v.length-1;continue}let _=0,S=wo(v,_,t),w=1,b=0;for(;w<v.length;){let E=wo(v,w,t),j=E-b,V=n-S,A=Math.min(j,V);v[_].copyCellsFrom(v[w],b,S,A,!1),S+=A,S===n&&(_++,S=0),b+=A,b===E&&(w++,b=0),S===0&&_!==0&&v[_-1].getWidth(n-1)===2&&(v[_].copyCellsFrom(v[_-1],n-1,S++,1,!1),v[_-1].setCell(n-1,l))}v[_].replaceCells(S,n,l);let k=0;for(let E=v.length-1;E>0&&(E>_||v[E].getTrimmedLength()===0);E--)k++;k>0&&(d.push(p+v.length-k),d.push(k)),p+=v.length-1}return d}function BM(e,t){let n=[],r=0,l=t[r],h=0;for(let d=0;d<e.length;d++)if(l===d){let p=t[++r];e.onDeleteEmitter.fire({index:d-h,amount:p}),d+=p-1,h+=p,l=t[++r]}else n.push(d);return{layout:n,countRemoved:h}}function OM(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function zM(e,t,n){let r=[],l=e.map((g,m)=>wo(e,m,t)).reduce((g,m)=>g+m),h=0,d=0,p=0;for(;p<l;){if(l-p<n){r.push(l-p);break}h+=n;let g=wo(e,d,t);h>g&&(h-=g,d++);let m=e[d].getWidth(h-1)===2;m&&h--;let v=m?n-1:n;r.push(v),p+=v}return r}function wo(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,l=e[t+1].getWidth(0)===2;return r&&l?n-1:n}var zx=class Hx{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Hx._nextId++,this._onDispose=this.register(new ue),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Nr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};zx._nextId=1;var HM=zx,Nt={},Tr=Nt.B;Nt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Nt.A={"#":"£"};Nt.B=void 0;Nt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Nt.C=Nt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Nt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Nt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Nt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Nt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Nt.E=Nt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Nt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Nt.H=Nt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Nt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Ny=4294967295,Ly=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=kt.clone(),this.savedCharset=Tr,this.markers=[],this._nullCell=is.fromCharData([0,tx,1,0]),this._whitespaceCell=is.fromCharData([0,Gn,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Vh,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Ay(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 Ih),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 Ih),this._whitespaceCell}getBlankLine(e,t){return new oo(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>Ny?Ny:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=kt);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 Ay(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(kt),r=0,l=this._getCorrectBufferLength(t);if(l>this.lines.maxLength&&(this.lines.maxLength=l),this.lines.length>0){if(this._cols<e)for(let d=0;d<this.lines.length;d++)r+=+this.lines.get(d).resize(e,n);let h=0;if(this._rows<t)for(let d=this._rows;d<t;d++)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 oo(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+h+1?(this.ybase--,h++,this.ydisp>0&&this.ydisp--):this.lines.push(new oo(e,n)));else for(let d=this._rows;d>t;d--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(l<this.lines.maxLength){let d=this.lines.length-l;d>0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=l}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),h&&(this.y+=h),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 h=0;h<this.lines.length;h++)r+=+this.lines.get(h).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=LM(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(kt),n);if(r.length>0){let l=BM(this.lines,r);OM(this.lines,l.layout),this._reflowLargerAdjustViewport(e,t,l.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(kt),l=n;for(;l-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new oo(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(kt),l=[],h=0;for(let d=this.lines.length-1;d>=0;d--){let p=this.lines.get(d);if(!p||!p.isWrapped&&p.getTrimmedLength()<=e)continue;let g=[p];for(;p.isWrapped&&d>0;)p=this.lines.get(--d),g.unshift(p);if(!n){let A=this.ybase+this.y;if(A>=d&&A<d+g.length)continue}let m=g[g.length-1].getTrimmedLength(),v=zM(g,this._cols,e),_=v.length-g.length,S;this.ybase===0&&this.y!==this.lines.length-1?S=Math.max(0,this.y-this.lines.maxLength+_):S=Math.max(0,this.lines.length-this.lines.maxLength+_);let w=[];for(let A=0;A<_;A++){let z=this.getBlankLine(kt,!0);w.push(z)}w.length>0&&(l.push({start:d+g.length+h,newLines:w}),h+=w.length),g.push(...w);let b=v.length-1,k=v[b];k===0&&(b--,k=v[b]);let E=g.length-_-1,j=m;for(;E>=0;){let A=Math.min(j,k);if(g[b]===void 0)break;if(g[b].copyCellsFrom(g[E],j-A,k-A,A,!0),k-=A,k===0&&(b--,k=v[b]),j-=A,j===0){E--;let z=Math.max(E,0);j=wo(g,z,this._cols)}}for(let A=0;A<g.length;A++)v[A]<e&&g[A].setCell(v[A],r);let V=_-S;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+h)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+t-1)}if(l.length>0){let d=[],p=[];for(let k=0;k<this.lines.length;k++)p.push(this.lines.get(k));let g=this.lines.length,m=g-1,v=0,_=l[v];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+h);let S=0;for(let k=Math.min(this.lines.maxLength-1,g+h-1);k>=0;k--)if(_&&_.start>m+S){for(let E=_.newLines.length-1;E>=0;E--)this.lines.set(k--,_.newLines[E]);k++,d.push({index:m+1,amount:_.newLines.length}),S+=_.newLines.length,_=l[++v]}else this.lines.set(k,p[m--]);let w=0;for(let k=d.length-1;k>=0;k--)d[k].index+=w,this.lines.onInsertEmitter.fire(d[k]),w+=d[k].amount;let b=Math.max(0,g+h-this.lines.maxLength);b>0&&this.lines.onTrimEmitter.fire(b)}}translateBufferLineToString(e,t,n=0,r){let l=this.lines.get(e);return l?l.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]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(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 HM(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},IM=class extends He{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ue),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 Ly(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Ly(!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)}},Ix=2,Ux=1,B2=class extends He{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ue),this.onResize=this._onResize.event,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Ix),this.rows=Math.max(e.rawOptions.rows||0,Ux),this.buffers=this._register(new IM(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.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 l=n.ybase+n.scrollTop,h=n.ybase+n.scrollBottom;if(n.scrollTop===0){let d=n.lines.isFull;h===n.lines.length-1?d?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(h+1,0,r.clone()),d?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let d=h-l+1;n.lines.shiftElements(l+1,d-1,-1),n.lines.set(h,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))}};B2=_t([me(0,di)],B2);var Ba={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:qh,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},UM=["normal","bold","100","200","300","400","500","600","700","800","900"],PM=class extends He{constructor(e){super(),this._onOptionChange=this._register(new ue),this.onOptionChange=this._onOptionChange.event;let t={...Ba};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(ht(()=>{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=n=>{if(!(n in Ba))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in Ba))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};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||(t=Ba[e]),!qM(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Ba[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=UM.includes(t)?t:Ba[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new 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 new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function qM(e){return e==="block"||e==="underline"||e==="bar"}function co(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]&&co(e[r],t-1);return n}var By=Object.freeze({insertMode:!1}),Oy=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),O2=class extends He{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 ue),this.onData=this._onData.event,this._onUserInput=this._register(new ue),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ue),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ue),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=co(By),this.decPrivateModes=co(Oy)}reset(){this.modes=co(By),this.decPrivateModes=co(Oy)}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(r=>r.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(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};O2=_t([me(0,ui),me(1,ax),me(2,di)],O2);var zy={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 af(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 lf=String.fromCharCode,Hy={DEFAULT:e=>{let t=[af(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${lf(t[0])}${lf(t[1])}${lf(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${af(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${af(e,!0)};${e.x};${e.y}${t}`}},z2=class extends He{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 ue),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(zy))this.addProtocol(r,zy[r]);for(let r of Object.keys(Hy))this.addEncoding(r,Hy[r]);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 new 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 new 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,l=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=r+0,Math.abs(e.deltaY)<50&&(l*=.3),this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_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)}};z2=_t([me(0,ui),me(1,zr),me(2,di)],z2);var of=[[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]],VM=[[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]],Dt;function $M(e,t){let n=0,r=t.length-1,l;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(l=n+r>>1,e>t[l][1])n=l+1;else if(e<t[l][0])r=l-1;else return!0;return!1}var WM=class{constructor(){if(this.version="6",!Dt){Dt=new Uint8Array(65536),Dt.fill(1),Dt[0]=0,Dt.fill(0,1,32),Dt.fill(0,127,160),Dt.fill(2,4352,4448),Dt[9001]=2,Dt[9002]=2,Dt.fill(2,11904,42192),Dt[12351]=1,Dt.fill(2,44032,55204),Dt.fill(2,63744,64256),Dt.fill(2,65040,65050),Dt.fill(2,65072,65136),Dt.fill(2,65280,65377),Dt.fill(2,65504,65511);for(let e=0;e<of.length;++e)Dt.fill(0,of[e][0],of[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Dt[e]:$M(e,VM)?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 l=Dr.extractWidth(t);l===0?r=!1:l>n&&(n=l)}return Dr.createPropertyValue(0,n,r)}},Dr=class Th{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ue,this.onChange=this._onChange.event;let t=new WM;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,r=0,l=t.length;for(let h=0;h<l;++h){let d=t.charCodeAt(h);if(55296<=d&&d<=56319){if(++h>=l)return n+this.wcwidth(d);let m=t.charCodeAt(h);56320<=m&&m<=57343?d=(d-55296)*1024+m-56320+65536:n+=this.wcwidth(m)}let p=this.charProperties(d,r),g=Th.extractWidth(p);Th.extractShouldJoin(p)&&(g-=Th.extractWidth(r)),n+=g,r=p}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},FM=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 Iy(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 eo=2147483647,KM=256,Px=class H2{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>KM)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new H2;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let l=t[r];if(Array.isArray(l))for(let h=0;h<l.length;++h)n.addSubParam(l[h]);else n.addParam(l)}return n}clone(){let t=new H2(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 t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,l=this._subParamsIdx[n]&255;l-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,l))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>eo?eo:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>eo?eo:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,l=this._subParamsIdx[n]&255;l-r>0&&(t[n]=this._subParams.slice(r,l))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,l=r[n-1];r[n-1]=~l?Math.min(l*10+t,eo):t}},to=[],YM=class{constructor(){this._state=0,this._active=to,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 r=n.indexOf(t);r!==-1&&n.splice(r,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=to}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=to,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||to,!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",Zh(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 r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&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,l=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,l=this._stack.fallThrough,this._stack.paused=!1),!l&&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=to,this._id=-1,this._state=0}}},Hi=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+=Zh(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(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},io=[],GM=class{constructor(){this._handlers=Object.create(null),this._active=io,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=io}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,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=io,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||io,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Zh(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,l=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,l=this._stack.fallThrough,this._stack.paused=!1),!l&&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=io,this._ident=0}},ho=new Px;ho.addParam(0);var Uy=class{constructor(e){this._handler=e,this._data="",this._params=ho,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():ho,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Zh(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(n=>(this._params=ho,this._data="",this._hitLimit=!1,n));return this._params=ho,this._data="",this._hitLimit=!1,t}},ZM=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 l=0;l<e.length;l++)this.table[t<<8|e[l]]=n<<4|r}},es=160,XM=(function(){let e=new ZM(4095),t=Array.apply(null,Array(256)).map((p,g)=>g),n=(p,g)=>t.slice(p,g),r=n(32,127),l=n(0,24);l.push(25),l.push.apply(l,n(28,32));let h=n(0,14),d;e.setDefault(1,0),e.addMany(r,0,2,0);for(d in h)e.addMany([24,26,153,154],d,3,0),e.addMany(n(128,144),d,3,0),e.addMany(n(144,152),d,3,0),e.add(156,d,0,0),e.add(27,d,11,1),e.add(157,d,4,8),e.addMany([152,158,159],d,0,7),e.add(155,d,11,3),e.add(144,d,11,9);return e.addMany(l,0,3,0),e.addMany(l,1,3,1),e.add(127,1,0,1),e.addMany(l,8,0,8),e.addMany(l,3,3,3),e.add(127,3,0,3),e.addMany(l,4,3,4),e.add(127,4,0,4),e.addMany(l,6,3,6),e.addMany(l,5,3,5),e.add(127,5,0,5),e.addMany(l,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(l,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(l,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(l,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(l,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(l,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(l,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(es,0,2,0),e.add(es,8,5,8),e.add(es,6,0,6),e.add(es,11,0,11),e.add(es,13,13,13),e})(),QM=class extends He{constructor(e=XM){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 Px,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(ht(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new YM),this._dcsParser=this._register(new GM),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 new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let l=0;l<e.intermediates.length;++l){let h=e.intermediates.charCodeAt(l);if(32>h||h>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=h}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new 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 l=r.indexOf(t);l!==-1&&r.splice(l,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 l=r.indexOf(t);l!==-1&&r.splice(l,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,l){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=l}parse(e,t,n){let r=0,l=0,h=0,d;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,h=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let p=this._parseStack.handlers,g=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&g>-1){for(;g>=0&&(d=p[g](this._params),d!==!0);g--)if(d instanceof Promise)return this._parseStack.handlerPos=g,d}this._parseStack.handlers=[];break;case 4:if(n===!1&&g>-1){for(;g>=0&&(d=p[g](),d!==!0);g--)if(d instanceof Promise)return this._parseStack.handlerPos=g,d}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],d=this._dcsParser.unhook(r!==24&&r!==26,n),d)return d;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],d=this._oscParser.end(r!==24&&r!==26,n),d)return d;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,h=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let p=h;p<t;++p){switch(r=e[p],l=this._transitions.table[this.currentState<<8|(r<160?r:es)],l>>4){case 2:for(let S=p+1;;++S){if(S>=t||(r=e[S])<32||r>126&&r<es){this._printHandler(e,p,S),p=S-1;break}if(++S>=t||(r=e[S])<32||r>126&&r<es){this._printHandler(e,p,S),p=S-1;break}if(++S>=t||(r=e[S])<32||r>126&&r<es){this._printHandler(e,p,S),p=S-1;break}if(++S>=t||(r=e[S])<32||r>126&&r<es){this._printHandler(e,p,S),p=S-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:p,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let g=this._csiHandlers[this._collect<<8|r],m=g?g.length-1:-1;for(;m>=0&&(d=g[m](this._params),d!==!0);m--)if(d instanceof Promise)return this._preserveStack(3,g,m,l,p),d;m<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(++p<t&&(r=e[p])>47&&r<60);p--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let v=this._escHandlers[this._collect<<8|r],_=v?v.length-1:-1;for(;_>=0&&(d=v[_](),d!==!0);_--)if(d instanceof Promise)return this._preserveStack(4,v,_,l,p),d;_<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 S=p+1;;++S)if(S>=t||(r=e[S])===24||r===26||r===27||r>127&&r<es){this._dcsParser.put(e,p,S),p=S-1;break}break;case 14:if(d=this._dcsParser.unhook(r!==24&&r!==26),d)return this._preserveStack(6,[],0,l,p),d;r===27&&(l|=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 S=p+1;;S++)if(S>=t||(r=e[S])<32||r>127&&r<es){this._oscParser.put(e,p,S),p=S-1;break}break;case 6:if(d=this._oscParser.end(r!==24&&r!==26),d)return this._preserveStack(5,[],0,l,p),d;r===27&&(l|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=l&15}}},JM=/^([\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})$/,ej=/^[\da-f]+$/;function Py(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=JM.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),ej.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let l=0;l<3;++l){let h=parseInt(t.slice(n*l,n*l+n),16);r[l]=n===1?h<<4:n===2?h:n===3?h>>4:h>>8}return r}}function cf(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 tj(e,t=16){let[n,r,l]=e;return`rgb:${cf(n,t)}/${cf(r,t)}/${cf(l,t)}`}var ij={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Vn=131072,qy=10;function Vy(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 $y=5e3,Wy=0,sj=class extends He{constructor(e,t,n,r,l,h,d,p,g=new QM){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=l,this._oscLinkService=h,this._coreMouseService=d,this._unicodeService=p,this._parser=g,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new wk,this._utf8Decoder=new bk,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=kt.clone(),this._eraseAttrDataInternal=kt.clone(),this._onRequestBell=this._register(new ue),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ue),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ue),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ue),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ue),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ue),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ue),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ue),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ue),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ue),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ue),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ue),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 I2(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(m=>this._activeBuffer=m.activeBuffer)),this._parser.setCsiHandlerFallback((m,v)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(m),params:v.toArray()})}),this._parser.setEscHandlerFallback(m=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(m)})}),this._parser.setExecuteHandlerFallback(m=>{this._logService.debug("Unknown EXECUTE code: ",{code:m})}),this._parser.setOscHandlerFallback((m,v,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:m,action:v,data:_})}),this._parser.setDcsHandlerFallback((m,v,_)=>{v==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(m),action:v,payload:_})}),this._parser.setPrintHandler((m,v,_)=>this.print(m,v,_)),this._parser.registerCsiHandler({final:"@"},m=>this.insertChars(m)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},m=>this.scrollLeft(m)),this._parser.registerCsiHandler({final:"A"},m=>this.cursorUp(m)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},m=>this.scrollRight(m)),this._parser.registerCsiHandler({final:"B"},m=>this.cursorDown(m)),this._parser.registerCsiHandler({final:"C"},m=>this.cursorForward(m)),this._parser.registerCsiHandler({final:"D"},m=>this.cursorBackward(m)),this._parser.registerCsiHandler({final:"E"},m=>this.cursorNextLine(m)),this._parser.registerCsiHandler({final:"F"},m=>this.cursorPrecedingLine(m)),this._parser.registerCsiHandler({final:"G"},m=>this.cursorCharAbsolute(m)),this._parser.registerCsiHandler({final:"H"},m=>this.cursorPosition(m)),this._parser.registerCsiHandler({final:"I"},m=>this.cursorForwardTab(m)),this._parser.registerCsiHandler({final:"J"},m=>this.eraseInDisplay(m,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},m=>this.eraseInDisplay(m,!0)),this._parser.registerCsiHandler({final:"K"},m=>this.eraseInLine(m,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},m=>this.eraseInLine(m,!0)),this._parser.registerCsiHandler({final:"L"},m=>this.insertLines(m)),this._parser.registerCsiHandler({final:"M"},m=>this.deleteLines(m)),this._parser.registerCsiHandler({final:"P"},m=>this.deleteChars(m)),this._parser.registerCsiHandler({final:"S"},m=>this.scrollUp(m)),this._parser.registerCsiHandler({final:"T"},m=>this.scrollDown(m)),this._parser.registerCsiHandler({final:"X"},m=>this.eraseChars(m)),this._parser.registerCsiHandler({final:"Z"},m=>this.cursorBackwardTab(m)),this._parser.registerCsiHandler({final:"`"},m=>this.charPosAbsolute(m)),this._parser.registerCsiHandler({final:"a"},m=>this.hPositionRelative(m)),this._parser.registerCsiHandler({final:"b"},m=>this.repeatPrecedingCharacter(m)),this._parser.registerCsiHandler({final:"c"},m=>this.sendDeviceAttributesPrimary(m)),this._parser.registerCsiHandler({prefix:">",final:"c"},m=>this.sendDeviceAttributesSecondary(m)),this._parser.registerCsiHandler({final:"d"},m=>this.linePosAbsolute(m)),this._parser.registerCsiHandler({final:"e"},m=>this.vPositionRelative(m)),this._parser.registerCsiHandler({final:"f"},m=>this.hVPosition(m)),this._parser.registerCsiHandler({final:"g"},m=>this.tabClear(m)),this._parser.registerCsiHandler({final:"h"},m=>this.setMode(m)),this._parser.registerCsiHandler({prefix:"?",final:"h"},m=>this.setModePrivate(m)),this._parser.registerCsiHandler({final:"l"},m=>this.resetMode(m)),this._parser.registerCsiHandler({prefix:"?",final:"l"},m=>this.resetModePrivate(m)),this._parser.registerCsiHandler({final:"m"},m=>this.charAttributes(m)),this._parser.registerCsiHandler({final:"n"},m=>this.deviceStatus(m)),this._parser.registerCsiHandler({prefix:"?",final:"n"},m=>this.deviceStatusPrivate(m)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},m=>this.softReset(m)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},m=>this.setCursorStyle(m)),this._parser.registerCsiHandler({final:"r"},m=>this.setScrollRegion(m)),this._parser.registerCsiHandler({final:"s"},m=>this.saveCursor(m)),this._parser.registerCsiHandler({final:"t"},m=>this.windowOptions(m)),this._parser.registerCsiHandler({final:"u"},m=>this.restoreCursor(m)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},m=>this.insertColumns(m)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},m=>this.deleteColumns(m)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},m=>this.selectProtected(m)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},m=>this.requestMode(m,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},m=>this.requestMode(m,!1)),this._parser.setExecuteHandler(ne.BEL,()=>this.bell()),this._parser.setExecuteHandler(ne.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ne.BS,()=>this.backspace()),this._parser.setExecuteHandler(ne.HT,()=>this.tab()),this._parser.setExecuteHandler(ne.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ne.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Mh.IND,()=>this.index()),this._parser.setExecuteHandler(Mh.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Mh.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Hi(m=>(this.setTitle(m),this.setIconName(m),!0))),this._parser.registerOscHandler(1,new Hi(m=>this.setIconName(m))),this._parser.registerOscHandler(2,new Hi(m=>this.setTitle(m))),this._parser.registerOscHandler(4,new Hi(m=>this.setOrReportIndexedColor(m))),this._parser.registerOscHandler(8,new Hi(m=>this.setHyperlink(m))),this._parser.registerOscHandler(10,new Hi(m=>this.setOrReportFgColor(m))),this._parser.registerOscHandler(11,new Hi(m=>this.setOrReportBgColor(m))),this._parser.registerOscHandler(12,new Hi(m=>this.setOrReportCursorColor(m))),this._parser.registerOscHandler(104,new Hi(m=>this.restoreIndexedColor(m))),this._parser.registerOscHandler(110,new Hi(m=>this.restoreFgColor(m))),this._parser.registerOscHandler(111,new Hi(m=>this.restoreBgColor(m))),this._parser.registerOscHandler(112,new Hi(m=>this.restoreCursorColor(m))),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 m in Nt)this._parser.registerEscHandler({intermediates:"(",final:m},()=>this.selectCharset("("+m)),this._parser.registerEscHandler({intermediates:")",final:m},()=>this.selectCharset(")"+m)),this._parser.registerEscHandler({intermediates:"*",final:m},()=>this.selectCharset("*"+m)),this._parser.registerEscHandler({intermediates:"+",final:m},()=>this.selectCharset("+"+m)),this._parser.registerEscHandler({intermediates:"-",final:m},()=>this.selectCharset("-"+m)),this._parser.registerEscHandler({intermediates:".",final:m},()=>this.selectCharset("."+m)),this._parser.registerEscHandler({intermediates:"/",final:m},()=>this.selectCharset("/"+m));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(m=>(this._logService.error("Parsing error: ",m),m)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Uy((m,v)=>this.requestStatusString(m,v)))}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((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),$y))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${$y} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,l=this._activeBuffer.y,h=0,d=this._parseStack.paused;if(d){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,l=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Vn&&(h=this._parseStack.position+Vn)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,m=>String.fromCharCode(m)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(m=>m.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Vn&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Vn))),d||this._dirtyRowTracker.clearRange(),e.length>Vn)for(let m=h;m<e.length;m+=Vn){let v=m+Vn<e.length?m+Vn:e.length,_=typeof e=="string"?this._stringDecoder.decode(e.substring(m,v),this._parseBuffer):this._utf8Decoder.decode(e.subarray(m,v),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,_))return this._preserveStack(r,l,_,m),this._logSlowResolvingAsync(n),n}else if(!d){let m=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,m))return this._preserveStack(r,l,m,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==l)&&this._onCursorMove.fire();let p=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),g=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);g<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(g,this._bufferService.rows-1),end:Math.min(p,this._bufferService.rows-1)})}print(e,t,n){let r,l,h=this._charsetService.charset,d=this._optionsService.rawOptions.screenReaderMode,p=this._bufferService.cols,g=this._coreService.decPrivateModes.wraparound,m=this._coreService.modes.insertMode,v=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,v);let S=this._parser.precedingJoinState;for(let w=t;w<n;++w){if(r=e[w],r<127&&h){let j=h[String.fromCharCode(r)];j&&(r=j.charCodeAt(0))}let b=this._unicodeService.charProperties(r,S);l=Dr.extractWidth(b);let k=Dr.extractShouldJoin(b),E=k?Dr.extractWidth(S):0;if(S=b,d&&this._onA11yChar.fire(Fn(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+l-E>p){if(g){let j=_,V=this._activeBuffer.x-E;for(this._activeBuffer.x=E,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),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),E>0&&_ instanceof oo&&_.copyCellsFrom(j,V,0,E,!1);V<p;)j.setCellFromCodepoint(V++,0,1,v)}else if(this._activeBuffer.x=p-1,l===2)continue}if(k&&this._activeBuffer.x){let j=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-j,r,l);for(let V=l-E;--V>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,v);continue}if(m&&(_.insertCells(this._activeBuffer.x,l-E,this._activeBuffer.getNullCell(v)),_.getWidth(p-1)===2&&_.setCellFromCodepoint(p-1,0,1,v)),_.setCellFromCodepoint(this._activeBuffer.x++,r,l,v),l>0)for(;--l;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,v)}this._parser.precedingJoinState=S,this._activeBuffer.x<p&&n-t>0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,v),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>Vy(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Uy(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Hi(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,l=!1){let h=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);h.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),l),r&&(h.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 r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(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);break}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,l=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(l-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(kt));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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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=Dr.extractWidth(t),l=this._activeBuffer.x-r,h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(l),d=new Uint32Array(h.length*n),p=0;for(let m=0;m<h.length;){let v=h.codePointAt(m)||0;d[p++]=v,m+=v>65535?2:1}let g=p;for(let m=1;m<n;++m)d.copyWithin(g,0,p),g+=p;return this.print(d,0,g),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ne.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ne.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ne.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ne.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ne.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;break}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,Tr),this._charsetService.setgCharset(1,Tr),this._charsetService.setgCharset(2,Tr),this._charsetService.setgCharset(3,Tr);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(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;break}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);break}return!0}requestMode(e,t){let n;(k=>(k[k.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",k[k.SET=1]="SET",k[k.RESET=2]="RESET",k[k.PERMANENTLY_SET=3]="PERMANENTLY_SET",k[k.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:l,activeEncoding:h}=this._coreMouseService,d=this._coreService,{buffers:p,cols:g}=this._bufferService,{active:m,alt:v}=p,_=this._optionsService.rawOptions,S=(k,E)=>(d.triggerDataEvent(`${ne.ESC}[${t?"":"?"}${k};${E}$y`),!0),w=k=>k?1:2,b=e.params[0];return t?b===2?S(b,4):b===4?S(b,w(d.modes.insertMode)):b===12?S(b,3):b===20?S(b,w(_.convertEol)):S(b,0):b===1?S(b,w(r.applicationCursorKeys)):b===3?S(b,_.windowOptions.setWinLines?g===80?2:g===132?1:0:0):b===6?S(b,w(r.origin)):b===7?S(b,w(r.wraparound)):b===8?S(b,3):b===9?S(b,w(l==="X10")):b===12?S(b,w(_.cursorBlink)):b===25?S(b,w(!d.isCursorHidden)):b===45?S(b,w(r.reverseWraparound)):b===66?S(b,w(r.applicationKeypad)):b===67?S(b,4):b===1e3?S(b,w(l==="VT200")):b===1002?S(b,w(l==="DRAG")):b===1003?S(b,w(l==="ANY")):b===1004?S(b,w(r.sendFocus)):b===1005?S(b,4):b===1006?S(b,w(h==="SGR")):b===1015?S(b,4):b===1016?S(b,w(h==="SGR_PIXELS")):b===1048?S(b,1):b===47||b===1047||b===1049?S(b,w(m===v)):b===2004?S(b,w(r.bracketedPasteMode)):b===2026?S(b,w(r.synchronizedOutput)):S(b,0)}_updateAttrColor(e,t,n,r,l){return t===2?(e|=50331648,e&=-16777216,e|=Mo.fromColorRGB([n,r,l])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],l=0,h=0;do{if(r[h+l]=e.params[t+h],e.hasSubParams(t+h)){let d=e.getSubParams(t+h),p=0;do r[1]===5&&(l=1),r[h+p+1+l]=d[p];while(++p<d.length&&p+h+1+l<r.length);break}if(r[1]===5&&h+l>=2||r[1]===2&&h+l>=5)break;r[1]&&(l=1)}while(++h+t<e.length&&h+l<r.length);for(let d=2;d<r.length;++d)r[d]===-1&&(r[d]=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 h}_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=kt.fg,e.bg=kt.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 l=0;l<t;l++)n=e.params[l],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|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(l)?e.getSubParams(l)[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|=kt.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=kt.bg&16777215):n===38||n===48||n===58?l+=this._extractColor(e,l,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|=kt.fg&16777215,r.bg&=-67108864,r.bg|=kt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ne.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ne.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ne.ESC}[?${t};${n}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=kt.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";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}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(!Vy(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(`${ne.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>qy&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>qy&&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());break}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 r=n.shift(),l=n.shift();if(/^\d+$/.exec(r)){let h=parseInt(r);if(Fy(h))if(l==="?")t.push({type:0,index:h});else{let d=Py(l);d&&t.push({type:1,index:h,color:d})}}}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()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,l=n.findIndex(h=>h.startsWith("id="));return l!==-1&&(r=n[l].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 r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let l=Py(n[r]);l&&this._onColor.fire([{type:1,index:this._specialColors[t],color:l}])}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 r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let l=parseInt(n[r]);Fy(l)&&t.push({type:2,index:l})}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,Tr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(ij[e[0]],Nt[e[1]]||Tr),!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=kt.clone(),this._eraseAttrDataInternal=kt.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 is;e.content=1<<22|69,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=d=>(this._coreService.triggerDataEvent(`${ne.ESC}${d}${ne.ESC}\\`),!0),r=this._bufferService.buffer,l=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"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}[l.cursorStyle]-(l.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},I2=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&&(Wy=e,e=t,t=Wy),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};I2=_t([me(0,ui)],I2);function Fy(e){return 0<=e&&e<256}var nj=5e7,Ky=12,rj=50,aj=class extends He{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 ue),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 r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>nj)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=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 r=this._writeBuffer[this._bufferOffset],l=this._action(r,t);if(l){let d=p=>performance.now()-n>=Ky?setTimeout(()=>this._innerWrite(0,p)):this._innerWrite(n,p);l.catch(p=>(queueMicrotask(()=>{throw p}),Promise.resolve(!1))).then(d);return}let h=this._callbacks[this._bufferOffset];if(h&&h(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=Ky)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>rj&&(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()}},U2=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 p=t.addMarker(t.ybase+t.y),g={data:e,id:this._nextId++,lines:[p]};return p.onDispose(()=>this._removeMarkerFromLink(g,p)),this._dataByLinkId.set(g.id,g),g.id}let n=e,r=this._getEntryIdKey(n),l=this._entriesWithId.get(r);if(l)return this.addLineToLink(l.id,t.ybase+t.y),l.id;let h=t.addMarker(t.ybase+t.y),d={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(d,h)),this._entriesWithId.set(d.key,d),this._dataByLinkId.set(d.id,d),d.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}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)))}};U2=_t([me(0,ui)],U2);var Yy=!1,lj=class extends He{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Fa),this._onBinary=this._register(new ue),this.onBinary=this._onBinary.event,this._onData=this._register(new ue),this.onData=this._onData.event,this._onLineFeed=this._register(new ue),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ue),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ue),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ue),this._instantiationService=new RM,this.optionsService=this._register(new PM(e)),this._instantiationService.setService(di,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(B2)),this._instantiationService.setService(ui,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(L2)),this._instantiationService.setService(ax,this._logService),this.coreService=this._register(this._instantiationService.createInstance(O2)),this._instantiationService.setService(zr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(z2)),this._instantiationService.setService(rx,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Dr)),this._instantiationService.setService(Mk,this.unicodeService),this._charsetService=this._instantiationService.createInstance(FM),this._instantiationService.setService(Ek,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(U2),this._instantiationService.setService(lx,this._oscLinkService),this._inputHandler=this._register(new sj(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ei.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ei.forward(this._bufferService.onResize,this._onResize)),this._register(ei.forward(this.coreService.onData,this._onData)),this._register(ei.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 aj((t,n)=>this._inputHandler.parse(t,n))),this._register(ei.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ue),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&&!Yy&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Yy=!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,Ix),t=Math.max(t,Ux),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(Iy.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Iy(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ht(()=>{for(let t of e)t.dispose()})}}},oj={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 cj(e,t,n,r){let l={type:0,cancel:!1,key:void 0},h=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?l.key=ne.ESC+"OA":l.key=ne.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?l.key=ne.ESC+"OD":l.key=ne.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?l.key=ne.ESC+"OC":l.key=ne.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?l.key=ne.ESC+"OB":l.key=ne.ESC+"[B");break;case 8:l.key=e.ctrlKey?"\b":ne.DEL,e.altKey&&(l.key=ne.ESC+l.key);break;case 9:if(e.shiftKey){l.key=ne.ESC+"[Z";break}l.key=ne.HT,l.cancel=!0;break;case 13:l.key=e.altKey?ne.ESC+ne.CR:ne.CR,l.cancel=!0;break;case 27:l.key=ne.ESC,e.altKey&&(l.key=ne.ESC+ne.ESC),l.cancel=!0;break;case 37:if(e.metaKey)break;h?l.key=ne.ESC+"[1;"+(h+1)+"D":t?l.key=ne.ESC+"OD":l.key=ne.ESC+"[D";break;case 39:if(e.metaKey)break;h?l.key=ne.ESC+"[1;"+(h+1)+"C":t?l.key=ne.ESC+"OC":l.key=ne.ESC+"[C";break;case 38:if(e.metaKey)break;h?l.key=ne.ESC+"[1;"+(h+1)+"A":t?l.key=ne.ESC+"OA":l.key=ne.ESC+"[A";break;case 40:if(e.metaKey)break;h?l.key=ne.ESC+"[1;"+(h+1)+"B":t?l.key=ne.ESC+"OB":l.key=ne.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(l.key=ne.ESC+"[2~");break;case 46:h?l.key=ne.ESC+"[3;"+(h+1)+"~":l.key=ne.ESC+"[3~";break;case 36:h?l.key=ne.ESC+"[1;"+(h+1)+"H":t?l.key=ne.ESC+"OH":l.key=ne.ESC+"[H";break;case 35:h?l.key=ne.ESC+"[1;"+(h+1)+"F":t?l.key=ne.ESC+"OF":l.key=ne.ESC+"[F";break;case 33:e.shiftKey?l.type=2:e.ctrlKey?l.key=ne.ESC+"[5;"+(h+1)+"~":l.key=ne.ESC+"[5~";break;case 34:e.shiftKey?l.type=3:e.ctrlKey?l.key=ne.ESC+"[6;"+(h+1)+"~":l.key=ne.ESC+"[6~";break;case 112:h?l.key=ne.ESC+"[1;"+(h+1)+"P":l.key=ne.ESC+"OP";break;case 113:h?l.key=ne.ESC+"[1;"+(h+1)+"Q":l.key=ne.ESC+"OQ";break;case 114:h?l.key=ne.ESC+"[1;"+(h+1)+"R":l.key=ne.ESC+"OR";break;case 115:h?l.key=ne.ESC+"[1;"+(h+1)+"S":l.key=ne.ESC+"OS";break;case 116:h?l.key=ne.ESC+"[15;"+(h+1)+"~":l.key=ne.ESC+"[15~";break;case 117:h?l.key=ne.ESC+"[17;"+(h+1)+"~":l.key=ne.ESC+"[17~";break;case 118:h?l.key=ne.ESC+"[18;"+(h+1)+"~":l.key=ne.ESC+"[18~";break;case 119:h?l.key=ne.ESC+"[19;"+(h+1)+"~":l.key=ne.ESC+"[19~";break;case 120:h?l.key=ne.ESC+"[20;"+(h+1)+"~":l.key=ne.ESC+"[20~";break;case 121:h?l.key=ne.ESC+"[21;"+(h+1)+"~":l.key=ne.ESC+"[21~";break;case 122:h?l.key=ne.ESC+"[23;"+(h+1)+"~":l.key=ne.ESC+"[23~";break;case 123:h?l.key=ne.ESC+"[24;"+(h+1)+"~":l.key=ne.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?l.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?l.key=ne.NUL:e.keyCode>=51&&e.keyCode<=55?l.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?l.key=ne.DEL:e.keyCode===219?l.key=ne.ESC:e.keyCode===220?l.key=ne.FS:e.keyCode===221&&(l.key=ne.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let d=oj[e.keyCode]?.[e.shiftKey?1:0];if(d)l.key=ne.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let p=e.ctrlKey?e.keyCode-64:e.keyCode+32,g=String.fromCharCode(p);e.shiftKey&&(g=g.toUpperCase()),l.key=ne.ESC+g}else if(e.keyCode===32)l.key=ne.ESC+(e.ctrlKey?ne.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let p=e.code.slice(3,4);e.shiftKey||(p=p.toLowerCase()),l.key=ne.ESC+p,l.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(l.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?l.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(l.key=ne.US),e.key==="@"&&(l.key=ne.NUL));break}return l}var St=0,hj=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Vh,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Vh,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((l,h)=>this._getKey(l)-this._getKey(h)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let l=0;l<r.length;l++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[l]=e[t],t++):r[l]=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||(St=this._search(t),St===-1)||this._getKey(this._array[St])!==t)return!1;do if(this._array[St]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(St),!0;while(++St<this._array.length&&this._getKey(this._array[St])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((l,h)=>l-h),t=0,n=new Array(this._array.length-e.length),r=0;for(let l=0;l<this._array.length;l++)e[t]===l?t++:n[r++]=this._array[l];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&&(St=this._search(e),!(St<0||St>=this._array.length)&&this._getKey(this._array[St])===e))do yield this._array[St];while(++St<this._array.length&&this._getKey(this._array[St])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(St=this._search(e),!(St<0||St>=this._array.length)&&this._getKey(this._array[St])===e))do t(this._array[St]);while(++St<this._array.length&&this._getKey(this._array[St])===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,l=this._getKey(this._array[r]);if(l>e)n=r-1;else if(l<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},hf=0,Gy=0,uj=class extends He{constructor(){super(),this._decorations=new hj(e=>e?.marker.line),this._onDecorationRegistered=this._register(new ue),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ue),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ht(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new dj(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.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,l=0;for(let h of this._decorations.getKeyIterator(t))r=h.options.x??0,l=r+(h.options.width??1),e>=r&&e<l&&(!n||(h.options.layer??"bottom")===n)&&(yield h)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,l=>{hf=l.options.x??0,Gy=hf+(l.options.width??1),e>=hf&&e<Gy&&(!n||(l.options.layer??"bottom")===n)&&r(l)})}},dj=class extends Qn{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ue),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ue),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.options.backgroundColor?this._cachedBg=ft.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ft.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},fj=1e3,pj=class{constructor(e,t=fj){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?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let l=r-this._lastRefreshMs,h=this._debounceThresholdMS-l;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},h)}}_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)}},Zy=20,$h=class extends He{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 l=this._coreBrowserService.mainDocument;this._accessibilityContainer=l.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=l.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let h=0;h<this._terminal.rows;h++)this._rowElements[h]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[h]);if(this._topBoundaryFocusListener=h=>this._handleBoundaryFocus(h,0),this._bottomBoundaryFocusListener=h=>this._handleBoundaryFocus(h,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=l.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new pj(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(h=>this._handleResize(h.rows))),this._register(this._terminal.onRender(h=>this._refreshRows(h.start,h.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(h=>this._handleChar(h))),this._register(this._terminal.onLineFeed(()=>this._handleChar(``))),this._register(this._terminal.onA11yTab(h=>this._handleTab(h))),this._register(this._terminal.onKey(h=>this._handleKey(h.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Te(l,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ht(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Zy+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`-`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Zy+1&&(this._liveRegion.textContent+=a2.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\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 l=e;l<=t;l++){let h=n.lines.get(n.ydisp+l),d=[],p=h?.translateToString(!0,void 0,void 0,d)||"",g=(n.ydisp+l+1).toString(),m=this._rowElements[l];m&&(p.length===0?(m.textContent=" ",this._rowColumns.set(m,[0,1])):(m.textContent=p,this._rowColumns.set(m,d)),m.setAttribute("aria-posinset",g),m.setAttribute("aria-setsize",r),this._alignRowWidth(m))}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],l=n.getAttribute("aria-posinset"),h=t===0?"1":`${this._terminal.buffer.lines.length}`;if(l===h||e.relatedTarget!==r)return;let d,p;if(t===0?(d=n,p=this._rowElements.pop(),this._rowContainer.removeChild(p)):(d=this._rowElements.shift(),p=n,this._rowContainer.removeChild(d)),d.removeEventListener("focus",this._topBoundaryFocusListener),p.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let g=this._createAccessibilityTreeNode();this._rowElements.unshift(g),this._rowContainer.insertAdjacentElement("afterbegin",g)}else{let g=this._createAccessibilityTreeNode();this._rowElements.push(g),this._rowContainer.appendChild(g)}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 l=({node:p,offset:g})=>{let m=p instanceof Text?p.parentNode:p,v=parseInt(m?.getAttribute("aria-posinset"),10)-1;if(isNaN(v))return console.warn("row is invalid. Race condition?"),null;let _=this._rowColumns.get(m);if(!_)return console.warn("columns is null. Race condition?"),null;let S=g<_.length?_[g]:_.slice(-1)[0]+1;return S>=this._terminal.cols&&(++v,S=0),{row:v,column:S}},h=l(t),d=l(n);if(!(!h||!d)){if(h.row>d.row||h.row===d.row&&h.column>=d.column)throw new Error("invalid range");this._terminal.select(h.column,h.row,(d.row-h.row)*this._terminal.cols-h.column+d.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);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})`}};$h=_t([me(1,f1),me(2,un),me(3,dn)],$h);var P2=class extends He{constructor(e,t,n,r,l){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=l,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ue),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ue),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ht(()=>{Nr(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(Te(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Te(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Te(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Te(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 r=0;r<n.length;r++){let l=n[r];if(l.classList.contains("xterm"))break;if(l.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(r=>{r?.forEach(l=>{l.link.dispose&&l.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,l]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):l.provideLinks(e.y,h=>{if(this._isMouseOut)return;let d=h?.map(p=>({link:p}));this._activeProviderReplies?.set(r,d),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 l=t.get(r);if(l)for(let h=0;h<l.length;h++){let d=l[h],p=d.link.range.start.y<e?0:d.link.range.start.x,g=d.link.range.end.y>e?this._bufferService.cols:d.link.range.end.x;for(let m=p;m<=g;m++){if(n.has(m)){l.splice(h--,1);break}n.add(m)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),l=!1;for(let h=0;h<e;h++)(!this._activeProviderReplies.has(h)||this._activeProviderReplies.get(h))&&(l=!0);if(!l&&r){let h=r.find(d=>this._linkAtPosition(d.link,t));h&&(n=!0,this._handleNewLink(h))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let h=0;h<this._activeProviderReplies.size;h++){let d=this._activeProviderReplies.get(h)?.find(p=>this._linkAtPosition(p.link,t));if(d){n=!0,this._handleNewLink(d);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&&gj(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,Nr(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?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!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:n=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,l=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=l&&(this._clearCurrentLink(r,l),this._lastMouseEvent)){let h=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);h&&this._askForLink(h,!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,l=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(l)}_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,l=t.y*this._bufferService.cols+t.x;return n<=l&&l<=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,l){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:l}}};P2=_t([me(1,p1),me(2,dn),me(3,ui),me(4,cx)],P2);function gj(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 mj=class extends lj{constructor(e={}){super(e),this._linkifier=this._register(new Fa),this.browser=jx,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Fa),this._onCursorMove=this._register(new ue),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ue),this.onKey=this._onKey.event,this._onRender=this._register(new ue),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ue),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ue),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ue),this.onBell=this._onBell.event,this._onFocus=this._register(new ue),this._onBlur=this._register(new ue),this._onA11yCharEmitter=this._register(new ue),this._onA11yTabEmitter=this._register(new ue),this._onWillOpen=this._register(new ue),this._setup(),this._decorationService=this._instantiationService.createInstance(uj),this._instantiationService.setService(jo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(rM),this._instantiationService.setService(cx,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(o2)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(ei.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ei.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ei.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ei.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ht(()=>{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 n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let l=ot.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ne.ESC}]${r};${tj(l)}${Ex.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(h=>h.ansi[t.index]=Et.toColor(...t.color));else{let h=n;this._themeService.modifyColors(d=>d[h]=Et.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_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($h,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ne.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(ne.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,l=t.getWidth(n),h=this._renderService.dimensions.css.cell.width*l,d=this.buffer.y*this._renderService.dimensions.css.cell.height,p=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=p+"px",this.textarea.style.top=d+"px",this.textarea.style.width=h+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Te(this.element,"copy",t=>{this.hasSelection()&&Sk(t,this._selectionService)}));let e=t=>xk(t,this.textarea,this.coreService,this.optionsService);this._register(Te(this.textarea,"paste",e)),this._register(Te(this.element,"paste",e)),Tx?this._register(Te(this.element,"mousedown",t=>{t.button===2&&ay(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Te(this.element,"contextmenu",t=>{ay(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),w1&&this._register(Te(this.element,"auxclick",t=>{t.button===1&&ex(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Te(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Te(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Te(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Te(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Te(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Te(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Te(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new 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(Te(this.screenElement,"mousemove",l=>this.updateCursorStyle(l))),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",r2.get()),Ax||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(sM,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(un,this._coreBrowserService),this._register(Te(this.textarea,"focus",l=>this._handleTextAreaFocus(l))),this._register(Te(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(T2,this._document,this._helperContainer),this._instantiationService.setService(Xh,this._charSizeService),this._themeService=this._instantiationService.createInstance(N2),this._instantiationService.setService(Za,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Ph),this._instantiationService.setService(ox,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(D2,this.rows,this.screenElement)),this._instantiationService.setService(dn,this._renderService),this._register(this._renderService.onRenderedViewportChange(l=>this._onRender.fire(l))),this.onResize(l=>this._renderService.resize(l.cols,l.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(E2,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(R2),this._instantiationService.setService(p1,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(P2,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(C2,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(l=>{super.scrollLines(l,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(A2,this.element,this.screenElement,r)),this._instantiationService.setService(Tk,this._selectionService),this._register(this._selectionService.onRequestScrollLines(l=>this.scrollLines(l.amount,l.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(l=>this._renderService.handleSelectionChanged(l.start,l.end,l.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(l=>{this.textarea.value=l,this.textarea.focus(),this.textarea.select()})),this._register(ei.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(k2,this.screenElement)),this._register(Te(this.element,"mousedown",l=>this._selectionService.handleMouseDown(l))),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($h,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",l=>this._handleScreenReaderModeOptionChange(l))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Uh,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",l=>{!this._overviewRulerRenderer&&l&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Uh,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(j2,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(h){let d=e._mouseService.getMouseReportCoords(h,e.screenElement);if(!d)return!1;let p,g;switch(h.overrideType||h.type){case"mousemove":g=32,h.buttons===void 0?(p=3,h.button!==void 0&&(p=h.button<3?h.button:3)):p=h.buttons&1?0:h.buttons&4?1:h.buttons&2?2:3;break;case"mouseup":g=0,p=h.button<3?h.button:3;break;case"mousedown":g=1,p=h.button<3?h.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(h)===!1)return!1;let m=h.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(h,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;g=m<0?0:1,p=4;break;default:return!1}return g===void 0||p===void 0||p>4?!1:e.coreMouseService.triggerMouseEvent({col:d.col,row:d.row,x:d.x,y:d.y,button:p,action:g,ctrl:h.ctrlKey,alt:h.altKey,shift:h.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},l={mouseup:h=>(n(h),h.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(h)),wheel:h=>(n(h),this.cancel(h,!0)),mousedrag:h=>{h.buttons&&n(h)},mousemove:h=>{h.buttons||n(h)}};this._register(this.coreMouseService.onProtocolChange(h=>{h?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(h)),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()),h&8?r.mousemove||(t.addEventListener("mousemove",l.mousemove),r.mousemove=l.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),h&16?r.wheel||(t.addEventListener("wheel",l.wheel,{passive:!1}),r.wheel=l.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),h&2?r.mouseup||(r.mouseup=l.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),h&4?r.mousedrag||(r.mousedrag=l.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Te(t,"mousedown",h=>{if(h.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(h)))return n(h),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(h)})),this._register(Te(t,"wheel",h=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(h)===!1)return!1;if(!this.buffer.hasScrollback){if(h.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(h,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(h,!0);let d=ne.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(h.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(h,!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){JS(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 new 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 new 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=cj(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),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===ne.ETX||n.key===ne.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)&&(vj(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(kt));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(ne.ESC+"[I"):this.coreService.triggerDataEvent(ne.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ne.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),l=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ne.ESC}[6;${l};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function vj(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var _j=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 new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},yj=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 is)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Xy=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 yj(t)}getNullCell(){return new is}},Sj=class extends He{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ue),this.onBufferChange=this._onBufferChange.event,this._normal=new Xy(this._core.buffers.normal,"normal"),this._alternate=new Xy(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},xj=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.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)}},wj=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}},bj=["cols","rows"],js=0,Cj=class extends He{constructor(e){super(),this._core=this._register(new mj(e)),this._addonManager=this._register(new _j),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,l)=>{this._checkReadonlyOptions(r),this._core.options[r]=l};for(let r in this._core.options){let l={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,l)}}_checkReadonlyOptions(e){if(bj.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new xj(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new wj(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new Sj(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";break}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-`,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 r2.get()},set promptLabel(e){r2.set(e)},get tooMuchOutput(){return a2.get()},set tooMuchOutput(e){a2.set(e)}}}_verifyIntegers(...e){for(js of e)if(js===1/0||isNaN(js)||js%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(js of e)if(js&&(js===1/0||isNaN(js)||js%1!==0||js<0))throw new Error("This API only accepts positive integers")}};const Qy=e=>{/^https?:/i.test(e)&&window.codync.app.openExternal(e)};function Jy({backend:e,step:t,method:n,back:r}){const l=Ne(),h=x.useRef(null),[d,p]=x.useState(null),[g,m]=x.useState(null);x.useEffect(()=>{const _=h.current;if(!_)return;const S=getComputedStyle(document.documentElement),w=parseFloat(S.getPropertyValue("--scale"))||1,b=new Cj({fontFamily:S.getPropertyValue("--mono").trim()||"monospace",fontSize:12*w,cursorBlink:!0,allowTransparency:!0,theme:{background:S.getPropertyValue("--background").trim(),foreground:S.getPropertyValue("--text").trim(),cursor:S.getPropertyValue("--text").trim(),selectionBackground:`rgba(${S.getPropertyValue("--text-rgb").trim()}, 0.2)`},linkHandler:{activate:(L,O)=>Qy(O)}}),k=new ck;b.loadAddon(k),b.loadAddon(new gk((L,O)=>Qy(O))),b.open(_),k.fit(),b.focus();let E=!1,j=null,V=null,A={cols:b.cols,rows:b.rows},z={cols:0,rows:0},F=null,D=Promise.resolve();const I=new TextEncoder,q=()=>{const L=l.client;!L||!V||A.cols===z.cols&&A.rows===z.rows||(z=A,Ae.termResize(L,V,A.cols,A.rows).catch(()=>{}))},U=L=>{const O=l.client;if(j!==null||!O||!V)return;const P=V;D=D.then(()=>Ae.termInput(O,P,X3(L)).then(()=>{},()=>{}))},Y=[b.onData(L=>U(I.encode(L))),b.onBinary(L=>U(Uint8Array.from(L,O=>O.charCodeAt(0)&255))),b.onResize(({cols:L,rows:O})=>{A={cols:L,rows:O},q()})],$=new ResizeObserver(()=>k.fit());$.observe(_);let M=0;const N=(L,O)=>new Promise(P=>{b.reset(),F=L.transport.stream(`/term/${encodeURIComponent(O)}`,te=>{M=0;let Q;try{Q=JSON.parse(te)}catch{return}Q.type==="output"&&Q.data?b.write(Q3(Q.data)):Q.type==="exit"&&(j=Q.code??-1,p(j))},te=>{F=null,te?.status===404?(m(te.message),P("done")):te?(M+=1,M>5?(m(te.message),P("done")):P("retry")):P("retry")})});return(async()=>{try{const L=await l.ready(),O=await Ae.agentSetup(L,e.id,t,n?.id??null,A.cols,A.rows);if(E){Ae.termClose(L,O).catch(()=>{});return}for(V=O,z=A,q();j===null&&!E&&await N(L,O)!=="done";)j===null&&!E&&await new Promise(P=>setTimeout(P,1e3))}catch(L){E||m(L instanceof Ji?L.message:lt(L));return}E||await l.refreshBackends()})(),()=>{E=!0,$.disconnect(),Y.forEach(O=>O.dispose()),F?.();const L=l.client;j===null&&L&&V&&Ae.termClose(L,V).catch(()=>{}),b.dispose()}},[l,e.id,t,n?.id]);const v=t==="install"?`Install ${e.name}`:n?.name??`Sign in to ${e.name}`;return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(s1,{title:v,onBack:r}),c.jsx("div",{className:"setup-terminal",children:c.jsx("div",{ref:h,style:{width:"100%",height:"100%"}})}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 16px",...B("footnote")},children:[g?c.jsx("span",{style:{color:"var(--danger)",...uf},children:g}):d!==null?c.jsxs(c.Fragment,{children:[c.jsx(ae,{name:d===0?"checkmark.circle.fill":"exclamationmark.circle.fill",size:10,color:d===0?"var(--added)":"var(--warning)"}),c.jsx("span",{style:{color:"var(--secondary)",...uf},children:d===0?"Finished.":`Ended with an error (${d}).`})]}):c.jsxs(c.Fragment,{children:[c.jsx(on,{size:14,color:"var(--secondary)"}),c.jsxs("span",{style:{color:"var(--secondary)",...uf},children:["Running on ",l.hostName,". Links open on this device."]})]}),c.jsx("span",{style:{flex:1}}),d!==null?c.jsx(Fe,{className:"fade-in",onClick:r,children:"Done"}):null]})]})}const uf={display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"};function kj(e){switch(e){case"claude-acp":return"rgb(217, 120, 87)";case"gemini":return"linear-gradient(to top right, rgb(71, 150, 227), rgb(145, 120, 199), rgb(201, 102, 115))";case"antigravity-acp":return"rgb(66, 133, 245)";case"mistral-vibe":return"rgb(250, 82, 15)";case"qwen-code":return"rgb(97, 92, 237)";case"amp-acp":return"rgb(242, 79, 64)";case"kiro":return"rgb(143, 69, 255)";case"cortex-code":return"rgb(41, 181, 232)";default:return"var(--text)"}}function qx({registry:e,icon:t,tile:n,radius:r}){return c.jsx("div",{style:{width:n,height:n,flex:"none",borderRadius:r,background:"var(--bubble-agent)",display:"grid",placeItems:"center",color:"var(--text)"},children:c.jsx(Ej,{registry:e,size:t})})}function Ej({registry:e,size:t}){const n=l1(e);return n?c.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:t,height:t,flex:"none",background:kj(e),WebkitMaskImage:`url("${n}")`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):c.jsx(ae,{name:"terminal",size:t*.8,scaled:!1})}function Mj({initial:e}){const t=Ne(),[n,r]=x.useState(null),[l,h]=x.useState(null),[d,p]=x.useState(!1),[g,m]=x.useState(null),[v,_]=x.useState(null),S=x.useRef(!1),w=t.hello?.backends.find($=>$.id===e.id)??e,b=w.installed===!0,k=w.curated===!0,E=l?.signedIn??w.signedIn??null,j=t.hostName,V=async()=>{const $=t.client;if(!(!$||S.current)){S.current=!0,p(!0);try{h(await Ae.agentAuth($,w.id)),_(null)}catch(M){_(lt(M))}S.current=!1,p(!1),await t.refreshBackends()}},A=async $=>{const M=t.client;if(M){m($.id);try{h(await Ae.agentAuthenticate(M,w.id,$.id)),_(null)}catch(N){_(lt(N))}m(null),await t.refreshBackends()}};x.useEffect(()=>{w.signedIn!==!0&&V()},[]);const z=x.useRef(!1);x.useEffect(()=>{n===null&&z.current&&V(),z.current=n!==null},[n]);const F=()=>r(null),D=n===null?null:n.kind==="install"?c.jsx(Jy,{backend:w,step:"install",back:F}):n.kind==="terminal"?c.jsx(Jy,{backend:w,step:"login",method:n.method,back:F}):c.jsx(jj,{backend:w,method:n.method,saved:l?.savedEnv??[],back:F,done:h}),I=d?l===null?`Checking with ${w.name}… The first check can download it.`:"Checking…":E===!0?"Signed in.":E===!1?"Not signed in yet.":`Couldn't tell. Skip this if you've already signed in on ${j}.`,q=($,M,N,L,O,P=!1)=>c.jsxs("button",{className:"option-row",disabled:g!==null,onClick:O,children:[c.jsx("span",{"aria-hidden":!0,style:{width:26,display:"flex",justifyContent:"center",color:"var(--secondary)",flex:"none"},children:c.jsx(ae,{name:L,size:13})}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0},children:[c.jsx("span",{style:{...B("body","medium"),color:"var(--text)"},children:M}),c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)",...Gf(3)},children:N})]}),c.jsx("span",{style:{minWidth:8}}),P?c.jsx(on,{size:16,color:"var(--secondary)"}):c.jsx(ae,{name:"chevron.right",size:10,weight:"semibold",color:"var(--tertiary)"})]},$),U=[];if(E!==!0&&!d){l?.login&&U.push(q("login","Sign in",`In a terminal on ${j}. Links open here.`,"terminal",()=>r({kind:"terminal",method:null})));for(const $ of l?.methods??[])$.kind==="terminal"?U.push(q($.id,$.name,$.description??`In a terminal on ${j}.`,"terminal",()=>r({kind:"terminal",method:$}))):$.kind==="envVar"?U.push(q($.id,$.name,$.description??`Saved on ${j} only.`,"key",()=>r({kind:"keys",method:$}))):U.push(q($.id,$.name,g===$.id?`Finish signing in in the browser on ${j}…`:$.description??`Opens a browser on ${j}.`,"safari",()=>{A($)},g===$.id))}const Y=c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:w.name}),c.jsxs(hi,{children:[c.jsx(Ee,{children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"4px 0"},children:[c.jsx(qx,{registry:w.registry,icon:30,tile:52,radius:14}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0},children:[c.jsx("span",{style:B("title3","semibold"),children:w.name}),w.description?c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)",...Gf(3)},children:w.description}):null]})]})}),k?c.jsx(Ee,{children:c.jsx(e3,{number:1,title:"Install",detail:b?`Installed on ${j}.`:w.canInstall?`Runs the official installer on ${j}.`:w.installHint,done:b,action:b||!w.canInstall?null:{label:"Install",run:()=>r({kind:"install"})}})}):null,c.jsxs(Ee,{footer:E!==!0&&l?.methods.some($=>$.kind==="agent")?`Browser sign-ins open on ${j} itself. Away from it? Use Remote screen to finish there.`:null,children:[c.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c.jsx("div",{style:{flex:1,minWidth:0},children:c.jsx(e3,{number:k?2:1,title:"Sign in",detail:I,done:E===!0,action:null})}),d?c.jsx(on,{state:"connecting",size:16,color:"var(--secondary)"}):c.jsx("button",{title:"Check again","aria-label":"Check again",style:{display:"flex",color:"var(--secondary)"},onClick:()=>{V()},children:c.jsx(ae,{name:"arrow.clockwise",size:13})})]}),E!==!0&&l?.detail?c.jsx("span",{className:"selectable",style:{...B("footnote"),color:"var(--secondary)",whiteSpace:"pre-wrap"},children:l.detail}):null,U]}),v?c.jsx(Ee,{children:c.jsx(hn,{text:v})}):null]})]});return c.jsx(pS,{base:Y,top:D})}function jj({backend:e,method:t,saved:n,back:r,done:l}){const h=Ne(),[d,p]=x.useState({}),[g,m]=x.useState(!1),[v,_]=x.useState(null),S=t.vars??[],w=async k=>{const E=h.client;if(E){m(!0);try{l(await Ae.setAgentEnv(E,e.id,k)),r()}catch(j){_(lt(j))}m(!1)}},b=S.some(k=>!k.optional&&!d[k.name]&&!n.includes(k.name));return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(s1,{title:t.name,onBack:r,trailing:g?c.jsx(et,{}):c.jsx(ke,{title:"Save",icon:"checkmark",disabled:b,onClick:()=>{w(n1(d))}})}),c.jsxs(hi,{children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[c.jsx(Ee,{title:t.name,children:S.map(k=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[c.jsx(Mt,{label:k.label,value:d[k.name]??"",secret:k.secret,placeholder:n.includes(k.name)?"Saved (type to replace)":k.name,onChange:E=>p(j=>({...j,[k.name]:E}))}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:k.label+(k.optional?" (optional)":"")})]},k.name))}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:"0 4px",...B("caption"),color:"var(--tertiary)"},children:[t.description?c.jsx("span",{children:t.description}):null,c.jsxs("span",{children:["Saved on ",h.hostName," only and given to ",e.name," when it starts."]}),t.link&&URL.canParse(t.link)?c.jsx(i1,{title:"Get a key",url:t.link}):null]})]}),n.length?c.jsx(Ee,{children:c.jsx("button",{style:{color:"var(--danger)"},onClick:()=>{w(Object.fromEntries(S.map(k=>[k.name,""])))},children:"Remove saved keys"})}):null,v?c.jsx(Ee,{children:c.jsx(hn,{text:v})}):null]})]})}function e3({number:e,title:t,detail:n,done:r,action:l}){return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"4px 0"},"aria-label":`${t}. ${n}${r?". Done":""}`,children:[c.jsx("span",{"aria-hidden":!0,style:{width:26,height:26,borderRadius:"50%",flex:"none",display:"grid",placeItems:"center",background:r?"var(--accent-fill)":"var(--bubble-agent)",transition:"background-color var(--fade)"},children:r?c.jsx(ae,{name:"checkmark",size:10,weight:"bold",color:"var(--on-accent)"}):c.jsx("span",{style:{...B("caption","semibold"),color:"var(--secondary)"},children:e})}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0},children:[c.jsx("span",{style:{...B("body","medium"),color:"var(--text)"},children:t}),c.jsx("span",{className:"selectable",style:{...B("subheadline"),color:"var(--secondary)"},children:n})]}),c.jsx("span",{style:{minWidth:8}}),l?c.jsx("button",{className:"capsule-action",style:{...B("subheadline","semibold"),padding:"7px 14px"},onClick:l.run,children:l.label}):null]})}const t3=e=>e.name;function Tj({computers:e,computer:t,onComputer:n}){const r=Ne(),l=Ga(r),h=ss(),[d,p]=x.useState(""),[g,m]=x.useState(0),[v,_]=x.useState(Lh),[S,w]=x.useState(null),[b,k]=x.useState(!1),[E,j]=x.useState([]),[V,A]=x.useState(!0),[z,F]=x.useState(!0),[D,I]=x.useState(null),[q,U]=x.useState(null),[Y,$]=x.useState(null),[M,N]=x.useState(!1),[L,O]=x.useState(!1),[P,te]=x.useState(null),[Q,ce]=x.useState(10),[re,de]=x.useState(!1),[Ce,je]=x.useState(!1),R=x.useRef(0),J=x.useRef(""),le=d.trim(),he=ge=>(ge??"").toLowerCase().includes(le.toLowerCase()),we=(r.hello?.backends??[]).filter(ge=>ge.available||ge.installed===!0||ge.curated===!0),xe=le?we.filter(ge=>he(ge.name)):we,be=le?E.filter(ge=>he(ge.name)||he(ge.description)):E,pe=l.installedConnectors.length+l.installedSkills.length,_e=async(ge=le)=>{const Ke=++R.current;J.current=ge,A(!0),k(!1);try{const ki=await Ae.marketConnectors(await r.ready(),ge);if(R.current!==Ke)return;_(hS(ki.items,t3)),w(ki.next),I(null)}catch(ki){if(R.current!==Ke)return;_(Lh()),w(null),I(lt(ki))}finally{R.current===Ke&&A(!1)}},De=async()=>{if(b||V)return;if(Kf(v)){_(Ff);return}if(!S)return;const ge=R.current;k(!0);try{const Ke=await Ae.marketConnectors(await r.ready(),J.current,S);if(R.current!==ge)return;_(ki=>Ff(cS(ki,Ke.items,t3))),w(Ke.next),I(null)}catch(Ke){R.current===ge&&I(lt(Ke))}finally{R.current===ge&&k(!1)}};x.useEffect(()=>(l.refresh(),r.refreshBackends(),_e(""),(async()=>{try{j(await Ae.marketSkills(await r.ready()))}catch(ge){I(lt(ge))}F(!1)})(),()=>{R.current++}),[]);const fi=ge=>{m(Ke=>Ke+1),_e(ge)},pi=async ge=>{$(ge.source);try{await l.installSkill(ge.source)}catch(Ke){I(lt(Ke))}$(null)},Bt=c.jsxs("div",{style:{display:"flex",alignItems:"center",paddingTop:28,gap:8},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[c.jsx(Va,{computer:r.computer,size:32}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0,whiteSpace:"nowrap"},children:[c.jsx("span",{style:{...B("title2","semibold"),color:"var(--text)"},children:"Marketplace"}),e.length>1?c.jsxs(Yh,{title:"Switch computer",style:{display:"flex",alignItems:"center",gap:4,...B("subheadline"),color:"var(--secondary)",minWidth:0},items:()=>e.map(ge=>({title:ge.name,selected:ge.id===t,action:()=>n(ge.id)})),children:[c.jsx("span",{"aria-label":`Computer: ${r.hostName}`,style:{overflow:"hidden",textOverflow:"ellipsis"},children:r.hostName}),c.jsx(ae,{name:"chevron.down",size:10,weight:"semibold"})]}):c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)",overflow:"hidden",textOverflow:"ellipsis"},children:r.hostName})]})]}),c.jsx("span",{style:{flex:1}}),pe>0?c.jsxs("button",{className:"press",style:{display:"flex",alignItems:"center",gap:8,flex:"none"},onClick:()=>de(!0),children:[c.jsx("span",{style:{display:"flex"},children:l.installedConnectors.slice(0,3).map((ge,Ke)=>c.jsx("span",{style:{marginLeft:Ke?-8:0,display:"flex"},children:c.jsx(Xf,{name:ge.name,registryName:ge.registryName,size:26})},ge.id))}),c.jsxs("span",{style:{color:"var(--secondary)",whiteSpace:"nowrap"},children:[pe," installed"]}),c.jsx(ae,{name:"chevron.right",size:10,weight:"semibold",color:"var(--tertiary)"})]}):null]}),pt=c.jsxs("div",{className:"market-search",children:[c.jsx(ae,{name:"magnifyingglass",size:13,color:"var(--secondary)"}),c.jsx("input",{value:d,placeholder:"Search agents, connectors and skills","aria-label":"Search agents, connectors and skills",spellCheck:!1,onChange:ge=>{p(ge.target.value),ce(10)},onKeyDown:ge=>{ge.key==="Enter"&&!ge.nativeEvent.isComposing&&fi(d.trim())}}),d?c.jsx("button",{"aria-label":"Clear search",title:"Clear search",style:{display:"flex",color:"var(--tertiary)"},onClick:()=>{p(""),ce(10),fi("")},children:c.jsx(ae,{name:"xmark.circle.fill",size:13})}):null]}),$e=ge=>c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:ge}),gi=c.jsxs("div",{className:"market-page",children:[c.jsx("div",{className:"market-scroll",children:c.jsxs("div",{className:"market-page-content",children:[Bt,pt,xe.length>0?c.jsxs(ro,{title:le?`Agents matching “${le}”`:"Agents",children:[c.jsx("div",{className:"agent-grid",children:xe.slice(0,Q).map(ge=>c.jsx(Rj,{backend:ge,onClick:()=>te(ge)},ge.id))}),xe.length>Q?$e(c.jsx(Fe,{kind:"secondary",onClick:()=>ce(ge=>ge+10),children:"Load more agents"})):null]}):null,c.jsx(ro,{title:"Connectors",children:V?c.jsx(Zf,{}):v.items.length===0?c.jsx("span",{style:{color:"var(--secondary)"},children:le?`No connectors match “${le}”.`:"Couldn't load connectors."}):c.jsxs(c.Fragment,{children:[c.jsx(uo,{children:uS(v).map(ge=>c.jsx(Ha,{title:ge.title,subtitle:ge.description??ge.name,added:ge.installed,icon:c.jsx(Xf,{website:ge.website,name:ge.title,registryName:ge.name}),onAdd:()=>U(ge)},ge.name))}),Kf(v)||S?$e(c.jsx(Fe,{kind:"secondary",disabled:b,onClick:()=>{De()},children:b?"Loading…":"Load more connectors"})):null]})}),c.jsx(O8,{query:le,searchToken:g}),c.jsx(ro,{title:"Skills",children:z?c.jsx(Zf,{}):c.jsx(uo,{children:be.map(ge=>c.jsx(Ha,{title:ge.name,subtitle:ge.description,added:ge.installed||l.installedSkills.some(Ke=>Ke.id===ge.source.toLowerCase()),busy:Y===ge.source,icon:c.jsx(fS,{}),onAdd:()=>{pi(ge)}},ge.source))})}),c.jsx("div",{children:c.jsxs(Fe,{kind:"secondary",onClick:()=>je(!0),children:[c.jsx(ae,{name:"lock.shield",size:11}),"Credentials"]})}),c.jsx(ro,{title:"Make your own",children:c.jsxs(uo,{children:[c.jsx(Ha,{title:"Custom connector",subtitle:"Any MCP server: a command or a URL",added:!1,addLabel:"New",icon:c.jsx(Qf,{name:"point.3.connected.trianglepath.dotted"}),onAdd:()=>N(!0)}),c.jsx(Ha,{title:"Your own skill",subtitle:"Write instructions a bot can follow",added:!1,addLabel:"New",icon:c.jsx(Qf,{name:"square.and.pencil"}),onAdd:()=>O(!0)})]})}),D?c.jsx("span",{style:{...B("footnote"),color:"var(--danger)"},children:D}):null,c.jsxs("span",{style:{...B("footnote"),color:"var(--tertiary)"},children:["Connectors come from the official MCP Registry, apps through Composio, skills from Anthropic, agents from the ACP registry. Everything installs on ",r.hostName,"."]})]})}),c.jsx("div",{className:"market-close",children:c.jsx(ke,{title:"Close",icon:"xmark",onClick:h})})]});return c.jsxs(c.Fragment,{children:[c.jsx(pS,{base:gi,top:re?c.jsx(Dj,{back:()=>de(!1)}):null}),c.jsx(Ds,{open:q!==null,onClose:()=>U(null),children:q?c.jsx(mS,{item:q,done:()=>{_e(J.current)}},q.name):null}),c.jsx(Ds,{open:Ce,onClose:()=>je(!1),width:560,height:720,children:c.jsx(P8,{})}),c.jsx(Ds,{open:M,onClose:()=>N(!1),children:c.jsx(H8,{})}),c.jsx(Ds,{open:L,onClose:()=>O(!1),children:c.jsx(I8,{})}),c.jsx(Ds,{open:P!==null,onClose:()=>te(null),width:560,height:560,children:P?c.jsx(Mj,{initial:P},P.id):null})]})}function Rj({backend:e,onClick:t}){const n=e.installed===!0?e.signedIn===!1?"Not signed in":"Installed":e.curated===!0?"Not installed":"Sets up on first use";return c.jsxs("button",{className:"agent-card",title:e.name,onClick:t,children:[c.jsx(qx,{registry:e.registry,icon:34,tile:64,radius:18}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:2,maxWidth:"100%"},children:[c.jsx("span",{style:{...B("subheadline","semibold"),color:"var(--text)",...Wh},children:e.name}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",...Wh},children:n})]})]})}const Wh={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"};function Dj({back:e}){const t=Ne(),n=Ga(t),[r,l]=x.useState(null),[h,d]=x.useState(null),p=n.installedConnectors.length===0&&n.installedSkills.length===0,g=async v=>{d(v);try{await n.signIn(v)}catch(_){t.setError(lt(_))}d(null)},m=async v=>{try{v.isSkill?await n.removeSkill(v.id):await n.removeConnector(v.id)}catch(_){t.setError(lt(_))}};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(s1,{title:"Installed",onBack:e}),c.jsx("div",{style:{flex:1,minHeight:0},children:c.jsxs(hi,{children:[p?c.jsx(Aj,{icon:"shippingbox",title:"Nothing installed",detail:"Connectors and skills you add show up here."}):null,n.installedConnectors.length?c.jsx(Ee,{title:"Connectors",children:n.installedConnectors.map(v=>c.jsx(i3,{title:v.name,subtitle:qa(v)?"Sign in so bots can use it":v.command??v.url??v.description,icon:v.kind==="composio"?c.jsx(t1,{url:v.logo,name:v.name,size:32}):c.jsx(Xf,{name:v.name,registryName:v.registryName,size:32}),accessory:h===v.id?c.jsx(et,{}):qa(v)?c.jsx(Fe,{onClick:()=>{g(v.id)},children:"Sign in"}):null,onRemove:()=>l({id:v.id,name:v.name,isSkill:!1})},v.id))}):null,n.installedSkills.length?c.jsx(Ee,{title:"Skills",children:n.installedSkills.map(v=>c.jsx(i3,{title:v.name,subtitle:v.description,icon:c.jsx(fS,{size:32}),onRemove:()=>l({id:v.id,name:v.name,isSkill:!0})},v.id))}):null]})}),c.jsx(ts,{open:r!==null,title:`Remove ${r?.name??""}?`,message:r?r.isSkill?"Bots stop using this skill.":"Bots lose this connector, and the keys saved for it are deleted.":null,actions:r?[{title:"Remove",destructive:!0,action:()=>{m(r)}}]:[],onClose:()=>l(null)})]})}function Aj({icon:e,title:t,detail:n}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"40px 0",textAlign:"center"},children:[c.jsx(ae,{name:e,size:28,color:"var(--tertiary)"}),c.jsx("span",{style:{...B("compactBody","semibold"),color:"var(--text)"},children:t}),c.jsx("span",{style:{...B("compactSecondary"),color:"var(--secondary)"},children:n})]})}function i3({title:e,subtitle:t,icon:n,accessory:r,onRemove:l}){return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},title:t,children:[n,c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0},children:[c.jsx("span",{style:{color:"var(--text)",...Wh},children:e}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",...Wh},children:t})]}),c.jsx("span",{style:{minWidth:12}}),r,c.jsx("button",{title:"Remove","aria-label":`Remove ${e}`,style:{minWidth:44,minHeight:44,display:"grid",placeItems:"center",color:"var(--secondary)",margin:"-8px 0"},onClick:l,children:c.jsx(ae,{name:"trash",size:13})})]})}var Oa={},df,s3;function Nj(){return s3||(s3=1,df=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),df}var ff={},$n={},n3;function Hr(){if(n3)return $n;n3=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return $n.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},$n.getSymbolTotalCodewords=function(r){return t[r]},$n.getBCHDigit=function(n){let r=0;for(;n!==0;)r++,n>>>=1;return r},$n.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');e=r},$n.isKanjiModeEnabled=function(){return typeof e<"u"},$n.toSJIS=function(r){return e(r)},$n}var pf={},r3;function b1(){return r3||(r3=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+n)}}e.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},e.from=function(r,l){if(e.isValid(r))return r;try{return t(r)}catch{return l}}})(pf)),pf}var gf,a3;function Lj(){if(a3)return gf;a3=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const n=Math.floor(t/8);return(this.buffer[n]>>>7-t%8&1)===1},put:function(t,n){for(let r=0;r<n;r++)this.putBit((t>>>n-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},gf=e,gf}var mf,l3;function Bj(){if(l3)return mf;l3=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,n,r,l){const h=t*this.size+n;this.data[h]=r,l&&(this.reservedBit[h]=!0)},e.prototype.get=function(t,n){return this.data[t*this.size+n]},e.prototype.xor=function(t,n,r){this.data[t*this.size+n]^=r},e.prototype.isReserved=function(t,n){return this.reservedBit[t*this.size+n]},mf=e,mf}var vf={},o3;function Oj(){return o3||(o3=1,(function(e){const t=Hr().getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const l=Math.floor(r/7)+2,h=t(r),d=h===145?26:Math.ceil((h-13)/(2*l-2))*2,p=[h-7];for(let g=1;g<l-1;g++)p[g]=p[g-1]-d;return p.push(6),p.reverse()},e.getPositions=function(r){const l=[],h=e.getRowColCoords(r),d=h.length;for(let p=0;p<d;p++)for(let g=0;g<d;g++)p===0&&g===0||p===0&&g===d-1||p===d-1&&g===0||l.push([h[p],h[g]]);return l}})(vf)),vf}var _f={},c3;function zj(){if(c3)return _f;c3=1;const e=Hr().getSymbolSize,t=7;return _f.getPositions=function(r){const l=e(r);return[[0,0],[l-t,0],[0,l-t]]},_f}var yf={},h3;function Hj(){return h3||(h3=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(l){return l!=null&&l!==""&&!isNaN(l)&&l>=0&&l<=7},e.from=function(l){return e.isValid(l)?parseInt(l,10):void 0},e.getPenaltyN1=function(l){const h=l.size;let d=0,p=0,g=0,m=null,v=null;for(let _=0;_<h;_++){p=g=0,m=v=null;for(let S=0;S<h;S++){let w=l.get(_,S);w===m?p++:(p>=5&&(d+=t.N1+(p-5)),m=w,p=1),w=l.get(S,_),w===v?g++:(g>=5&&(d+=t.N1+(g-5)),v=w,g=1)}p>=5&&(d+=t.N1+(p-5)),g>=5&&(d+=t.N1+(g-5))}return d},e.getPenaltyN2=function(l){const h=l.size;let d=0;for(let p=0;p<h-1;p++)for(let g=0;g<h-1;g++){const m=l.get(p,g)+l.get(p,g+1)+l.get(p+1,g)+l.get(p+1,g+1);(m===4||m===0)&&d++}return d*t.N2},e.getPenaltyN3=function(l){const h=l.size;let d=0,p=0,g=0;for(let m=0;m<h;m++){p=g=0;for(let v=0;v<h;v++)p=p<<1&2047|l.get(m,v),v>=10&&(p===1488||p===93)&&d++,g=g<<1&2047|l.get(v,m),v>=10&&(g===1488||g===93)&&d++}return d*t.N3},e.getPenaltyN4=function(l){let h=0;const d=l.data.length;for(let g=0;g<d;g++)h+=l.data[g];return Math.abs(Math.ceil(h*100/d/5)-10)*t.N4};function n(r,l,h){switch(r){case e.Patterns.PATTERN000:return(l+h)%2===0;case e.Patterns.PATTERN001:return l%2===0;case e.Patterns.PATTERN010:return h%3===0;case e.Patterns.PATTERN011:return(l+h)%3===0;case e.Patterns.PATTERN100:return(Math.floor(l/2)+Math.floor(h/3))%2===0;case e.Patterns.PATTERN101:return l*h%2+l*h%3===0;case e.Patterns.PATTERN110:return(l*h%2+l*h%3)%2===0;case e.Patterns.PATTERN111:return(l*h%3+(l+h)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}e.applyMask=function(l,h){const d=h.size;for(let p=0;p<d;p++)for(let g=0;g<d;g++)h.isReserved(g,p)||h.xor(g,p,n(l,g,p))},e.getBestMask=function(l,h){const d=Object.keys(e.Patterns).length;let p=0,g=1/0;for(let m=0;m<d;m++){h(m),e.applyMask(m,l);const v=e.getPenaltyN1(l)+e.getPenaltyN2(l)+e.getPenaltyN3(l)+e.getPenaltyN4(l);e.applyMask(m,l),v<g&&(g=v,p=m)}return p}})(yf)),yf}var yh={},u3;function Vx(){if(u3)return yh;u3=1;const e=b1(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],n=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return yh.getBlocksCount=function(l,h){switch(h){case e.L:return t[(l-1)*4+0];case e.M:return t[(l-1)*4+1];case e.Q:return t[(l-1)*4+2];case e.H:return t[(l-1)*4+3];default:return}},yh.getTotalCodewordsCount=function(l,h){switch(h){case e.L:return n[(l-1)*4+0];case e.M:return n[(l-1)*4+1];case e.Q:return n[(l-1)*4+2];case e.H:return n[(l-1)*4+3];default:return}},yh}var Sf={},so={},d3;function Ij(){if(d3)return so;d3=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let r=1;for(let l=0;l<255;l++)e[l]=r,t[r]=l,r<<=1,r&256&&(r^=285);for(let l=255;l<512;l++)e[l]=e[l-255]})(),so.log=function(r){if(r<1)throw new Error("log("+r+")");return t[r]},so.exp=function(r){return e[r]},so.mul=function(r,l){return r===0||l===0?0:e[t[r]+t[l]]},so}var f3;function Uj(){return f3||(f3=1,(function(e){const t=Ij();e.mul=function(r,l){const h=new Uint8Array(r.length+l.length-1);for(let d=0;d<r.length;d++)for(let p=0;p<l.length;p++)h[d+p]^=t.mul(r[d],l[p]);return h},e.mod=function(r,l){let h=new Uint8Array(r);for(;h.length-l.length>=0;){const d=h[0];for(let g=0;g<l.length;g++)h[g]^=t.mul(l[g],d);let p=0;for(;p<h.length&&h[p]===0;)p++;h=h.slice(p)}return h},e.generateECPolynomial=function(r){let l=new Uint8Array([1]);for(let h=0;h<r;h++)l=e.mul(l,new Uint8Array([1,t.exp(h)]));return l}})(Sf)),Sf}var xf,p3;function Pj(){if(p3)return xf;p3=1;const e=Uj();function t(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(r){this.degree=r,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const l=new Uint8Array(r.length+this.degree);l.set(r);const h=e.mod(l,this.genPoly),d=this.degree-h.length;if(d>0){const p=new Uint8Array(this.degree);return p.set(h,d),p}return h},xf=t,xf}var wf={},bf={},Cf={},g3;function $x(){return g3||(g3=1,Cf.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Cf}var Ts={},m3;function Wx(){if(m3)return Ts;m3=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+`)(?:.|[\r-]))+`;Ts.KANJI=new RegExp(n,"g"),Ts.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Ts.BYTE=new RegExp(r,"g"),Ts.NUMERIC=new RegExp(e,"g"),Ts.ALPHANUMERIC=new RegExp(t,"g");const l=new RegExp("^"+n+"$"),h=new RegExp("^"+e+"$"),d=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Ts.testKanji=function(g){return l.test(g)},Ts.testNumeric=function(g){return h.test(g)},Ts.testAlphanumeric=function(g){return d.test(g)},Ts}var v3;function Ir(){return v3||(v3=1,(function(e){const t=$x(),n=Wx();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(h,d){if(!h.ccBits)throw new Error("Invalid mode: "+h);if(!t.isValid(d))throw new Error("Invalid version: "+d);return d>=1&&d<10?h.ccBits[0]:d<27?h.ccBits[1]:h.ccBits[2]},e.getBestModeForData=function(h){return n.testNumeric(h)?e.NUMERIC:n.testAlphanumeric(h)?e.ALPHANUMERIC:n.testKanji(h)?e.KANJI:e.BYTE},e.toString=function(h){if(h&&h.id)return h.id;throw new Error("Invalid mode")},e.isValid=function(h){return h&&h.bit&&h.ccBits};function r(l){if(typeof l!="string")throw new Error("Param is not a string");switch(l.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+l)}}e.from=function(h,d){if(e.isValid(h))return h;try{return r(h)}catch{return d}}})(bf)),bf}var _3;function qj(){return _3||(_3=1,(function(e){const t=Hr(),n=Vx(),r=b1(),l=Ir(),h=$x(),d=7973,p=t.getBCHDigit(d);function g(S,w,b){for(let k=1;k<=40;k++)if(w<=e.getCapacity(k,b,S))return k}function m(S,w){return l.getCharCountIndicator(S,w)+4}function v(S,w){let b=0;return S.forEach(function(k){const E=m(k.mode,w);b+=E+k.getBitsLength()}),b}function _(S,w){for(let b=1;b<=40;b++)if(v(S,b)<=e.getCapacity(b,w,l.MIXED))return b}e.from=function(w,b){return h.isValid(w)?parseInt(w,10):b},e.getCapacity=function(w,b,k){if(!h.isValid(w))throw new Error("Invalid QR Code version");typeof k>"u"&&(k=l.BYTE);const E=t.getSymbolTotalCodewords(w),j=n.getTotalCodewordsCount(w,b),V=(E-j)*8;if(k===l.MIXED)return V;const A=V-m(k,w);switch(k){case l.NUMERIC:return Math.floor(A/10*3);case l.ALPHANUMERIC:return Math.floor(A/11*2);case l.KANJI:return Math.floor(A/13);case l.BYTE:default:return Math.floor(A/8)}},e.getBestVersionForData=function(w,b){let k;const E=r.from(b,r.M);if(Array.isArray(w)){if(w.length>1)return _(w,E);if(w.length===0)return 1;k=w[0]}else k=w;return g(k.mode,k.getLength(),E)},e.getEncodedBits=function(w){if(!h.isValid(w)||w<7)throw new Error("Invalid QR Code version");let b=w<<12;for(;t.getBCHDigit(b)-p>=0;)b^=d<<t.getBCHDigit(b)-p;return w<<12|b}})(wf)),wf}var kf={},y3;function Vj(){if(y3)return kf;y3=1;const e=Hr(),t=1335,n=21522,r=e.getBCHDigit(t);return kf.getEncodedBits=function(h,d){const p=h.bit<<3|d;let g=p<<10;for(;e.getBCHDigit(g)-r>=0;)g^=t<<e.getBCHDigit(g)-r;return(p<<10|g)^n},kf}var Ef={},Mf,S3;function $j(){if(S3)return Mf;S3=1;const e=Ir();function t(n){this.mode=e.NUMERIC,this.data=n.toString()}return t.getBitsLength=function(r){return 10*Math.floor(r/3)+(r%3?r%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){let l,h,d;for(l=0;l+3<=this.data.length;l+=3)h=this.data.substr(l,3),d=parseInt(h,10),r.put(d,10);const p=this.data.length-l;p>0&&(h=this.data.substr(l),d=parseInt(h,10),r.put(d,p*3+1))},Mf=t,Mf}var jf,x3;function Wj(){if(x3)return jf;x3=1;const e=Ir(),t=["0","1","2","3","4","5","6","7","8","9","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"," ","$","%","*","+","-",".","/",":"];function n(r){this.mode=e.ALPHANUMERIC,this.data=r}return n.getBitsLength=function(l){return 11*Math.floor(l/2)+6*(l%2)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(l){let h;for(h=0;h+2<=this.data.length;h+=2){let d=t.indexOf(this.data[h])*45;d+=t.indexOf(this.data[h+1]),l.put(d,11)}this.data.length%2&&l.put(t.indexOf(this.data[h]),6)},jf=n,jf}var Tf,w3;function Fj(){if(w3)return Tf;w3=1;const e=Ir();function t(n){this.mode=e.BYTE,typeof n=="string"?this.data=new TextEncoder().encode(n):this.data=new Uint8Array(n)}return t.getBitsLength=function(r){return r*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(n){for(let r=0,l=this.data.length;r<l;r++)n.put(this.data[r],8)},Tf=t,Tf}var Rf,b3;function Kj(){if(b3)return Rf;b3=1;const e=Ir(),t=Hr();function n(r){this.mode=e.KANJI,this.data=r}return n.getBitsLength=function(l){return l*13},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(r){let l;for(l=0;l<this.data.length;l++){let h=t.toSJIS(this.data[l]);if(h>=33088&&h<=40956)h-=33088;else if(h>=57408&&h<=60351)h-=49472;else throw new Error("Invalid SJIS character: "+this.data[l]+`-Make sure your charset is UTF-8`);h=(h>>>8&255)*192+(h&255),r.put(h,13)}},Rf=n,Rf}var Df={exports:{}},C3;function Yj(){return C3||(C3=1,(function(e){var t={single_source_shortest_paths:function(n,r,l){var h={},d={};d[r]=0;var p=t.PriorityQueue.make();p.push(r,0);for(var g,m,v,_,S,w,b,k,E;!p.empty();){g=p.pop(),m=g.value,_=g.cost,S=n[m]||{};for(v in S)S.hasOwnProperty(v)&&(w=S[v],b=_+w,k=d[v],E=typeof d[v]>"u",(E||k>b)&&(d[v]=b,p.push(v,b),h[v]=m))}if(typeof l<"u"&&typeof d[l]>"u"){var j=["Could not find a path from ",r," to ",l,"."].join("");throw new Error(j)}return h},extract_shortest_path_from_predecessor_list:function(n,r){for(var l=[],h=r;h;)l.push(h),n[h],h=n[h];return l.reverse(),l},find_path:function(n,r,l){var h=t.single_source_shortest_paths(n,r,l);return t.extract_shortest_path_from_predecessor_list(h,l)},PriorityQueue:{make:function(n){var r=t.PriorityQueue,l={},h;n=n||{};for(h in r)r.hasOwnProperty(h)&&(l[h]=r[h]);return l.queue=[],l.sorter=n.sorter||r.default_sorter,l},default_sorter:function(n,r){return n.cost-r.cost},push:function(n,r){var l={value:n,cost:r};this.queue.push(l),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(Df)),Df.exports}var k3;function Gj(){return k3||(k3=1,(function(e){const t=Ir(),n=$j(),r=Wj(),l=Fj(),h=Kj(),d=Wx(),p=Hr(),g=Yj();function m(j){return unescape(encodeURIComponent(j)).length}function v(j,V,A){const z=[];let F;for(;(F=j.exec(A))!==null;)z.push({data:F[0],index:F.index,mode:V,length:F[0].length});return z}function _(j){const V=v(d.NUMERIC,t.NUMERIC,j),A=v(d.ALPHANUMERIC,t.ALPHANUMERIC,j);let z,F;return p.isKanjiModeEnabled()?(z=v(d.BYTE,t.BYTE,j),F=v(d.KANJI,t.KANJI,j)):(z=v(d.BYTE_KANJI,t.BYTE,j),F=[]),V.concat(A,z,F).sort(function(I,q){return I.index-q.index}).map(function(I){return{data:I.data,mode:I.mode,length:I.length}})}function S(j,V){switch(V){case t.NUMERIC:return n.getBitsLength(j);case t.ALPHANUMERIC:return r.getBitsLength(j);case t.KANJI:return h.getBitsLength(j);case t.BYTE:return l.getBitsLength(j)}}function w(j){return j.reduce(function(V,A){const z=V.length-1>=0?V[V.length-1]:null;return z&&z.mode===A.mode?(V[V.length-1].data+=A.data,V):(V.push(A),V)},[])}function b(j){const V=[];for(let A=0;A<j.length;A++){const z=j[A];switch(z.mode){case t.NUMERIC:V.push([z,{data:z.data,mode:t.ALPHANUMERIC,length:z.length},{data:z.data,mode:t.BYTE,length:z.length}]);break;case t.ALPHANUMERIC:V.push([z,{data:z.data,mode:t.BYTE,length:z.length}]);break;case t.KANJI:V.push([z,{data:z.data,mode:t.BYTE,length:m(z.data)}]);break;case t.BYTE:V.push([{data:z.data,mode:t.BYTE,length:m(z.data)}])}}return V}function k(j,V){const A={},z={start:{}};let F=["start"];for(let D=0;D<j.length;D++){const I=j[D],q=[];for(let U=0;U<I.length;U++){const Y=I[U],$=""+D+U;q.push($),A[$]={node:Y,lastCount:0},z[$]={};for(let M=0;M<F.length;M++){const N=F[M];A[N]&&A[N].node.mode===Y.mode?(z[N][$]=S(A[N].lastCount+Y.length,Y.mode)-S(A[N].lastCount,Y.mode),A[N].lastCount+=Y.length):(A[N]&&(A[N].lastCount=Y.length),z[N][$]=S(Y.length,Y.mode)+4+t.getCharCountIndicator(Y.mode,V))}}F=q}for(let D=0;D<F.length;D++)z[F[D]].end=0;return{map:z,table:A}}function E(j,V){let A;const z=t.getBestModeForData(j);if(A=t.from(V,z),A!==t.BYTE&&A.bit<z.bit)throw new Error('"'+j+'" cannot be encoded with mode '+t.toString(A)+`.- Suggested mode is: `+t.toString(z));switch(A===t.KANJI&&!p.isKanjiModeEnabled()&&(A=t.BYTE),A){case t.NUMERIC:return new n(j);case t.ALPHANUMERIC:return new r(j);case t.KANJI:return new h(j);case t.BYTE:return new l(j)}}e.fromArray=function(V){return V.reduce(function(A,z){return typeof z=="string"?A.push(E(z,null)):z.data&&A.push(E(z.data,z.mode)),A},[])},e.fromString=function(V,A){const z=_(V,p.isKanjiModeEnabled()),F=b(z),D=k(F,A),I=g.find_path(D.map,"start","end"),q=[];for(let U=1;U<I.length-1;U++)q.push(D.table[I[U]].node);return e.fromArray(w(q))},e.rawSplit=function(V){return e.fromArray(_(V,p.isKanjiModeEnabled()))}})(Ef)),Ef}var E3;function Zj(){if(E3)return ff;E3=1;const e=Hr(),t=b1(),n=Lj(),r=Bj(),l=Oj(),h=zj(),d=Hj(),p=Vx(),g=Pj(),m=qj(),v=Vj(),_=Ir(),S=Gj();function w(D,I){const q=D.size,U=h.getPositions(I);for(let Y=0;Y<U.length;Y++){const $=U[Y][0],M=U[Y][1];for(let N=-1;N<=7;N++)if(!($+N<=-1||q<=$+N))for(let L=-1;L<=7;L++)M+L<=-1||q<=M+L||(N>=0&&N<=6&&(L===0||L===6)||L>=0&&L<=6&&(N===0||N===6)||N>=2&&N<=4&&L>=2&&L<=4?D.set($+N,M+L,!0,!0):D.set($+N,M+L,!1,!0))}}function b(D){const I=D.size;for(let q=8;q<I-8;q++){const U=q%2===0;D.set(q,6,U,!0),D.set(6,q,U,!0)}}function k(D,I){const q=l.getPositions(I);for(let U=0;U<q.length;U++){const Y=q[U][0],$=q[U][1];for(let M=-2;M<=2;M++)for(let N=-2;N<=2;N++)M===-2||M===2||N===-2||N===2||M===0&&N===0?D.set(Y+M,$+N,!0,!0):D.set(Y+M,$+N,!1,!0)}}function E(D,I){const q=D.size,U=m.getEncodedBits(I);let Y,$,M;for(let N=0;N<18;N++)Y=Math.floor(N/3),$=N%3+q-8-3,M=(U>>N&1)===1,D.set(Y,$,M,!0),D.set($,Y,M,!0)}function j(D,I,q){const U=D.size,Y=v.getEncodedBits(I,q);let $,M;for($=0;$<15;$++)M=(Y>>$&1)===1,$<6?D.set($,8,M,!0):$<8?D.set($+1,8,M,!0):D.set(U-15+$,8,M,!0),$<8?D.set(8,U-$-1,M,!0):$<9?D.set(8,15-$-1+1,M,!0):D.set(8,15-$-1,M,!0);D.set(U-8,8,1,!0)}function V(D,I){const q=D.size;let U=-1,Y=q-1,$=7,M=0;for(let N=q-1;N>0;N-=2)for(N===6&&N--;;){for(let L=0;L<2;L++)if(!D.isReserved(Y,N-L)){let O=!1;M<I.length&&(O=(I[M]>>>$&1)===1),D.set(Y,N-L,O),$--,$===-1&&(M++,$=7)}if(Y+=U,Y<0||q<=Y){Y-=U,U=-U;break}}}function A(D,I,q){const U=new n;q.forEach(function(L){U.put(L.mode.bit,4),U.put(L.getLength(),_.getCharCountIndicator(L.mode,D)),L.write(U)});const Y=e.getSymbolTotalCodewords(D),$=p.getTotalCodewordsCount(D,I),M=(Y-$)*8;for(U.getLengthInBits()+4<=M&&U.put(0,4);U.getLengthInBits()%8!==0;)U.putBit(0);const N=(M-U.getLengthInBits())/8;for(let L=0;L<N;L++)U.put(L%2?17:236,8);return z(U,D,I)}function z(D,I,q){const U=e.getSymbolTotalCodewords(I),Y=p.getTotalCodewordsCount(I,q),$=U-Y,M=p.getBlocksCount(I,q),N=U%M,L=M-N,O=Math.floor(U/M),P=Math.floor($/M),te=P+1,Q=O-P,ce=new g(Q);let re=0;const de=new Array(M),Ce=new Array(M);let je=0;const R=new Uint8Array(D.buffer);for(let xe=0;xe<M;xe++){const be=xe<L?P:te;de[xe]=R.slice(re,re+be),Ce[xe]=ce.encode(de[xe]),re+=be,je=Math.max(je,be)}const J=new Uint8Array(U);let le=0,he,we;for(he=0;he<je;he++)for(we=0;we<M;we++)he<de[we].length&&(J[le++]=de[we][he]);for(he=0;he<Q;he++)for(we=0;we<M;we++)J[le++]=Ce[we][he];return J}function F(D,I,q,U){let Y;if(Array.isArray(D))Y=S.fromArray(D);else if(typeof D=="string"){let O=I;if(!O){const P=S.rawSplit(D);O=m.getBestVersionForData(P,q)}Y=S.fromString(D,O||40)}else throw new Error("Invalid data");const $=m.getBestVersionForData(Y,q);if(!$)throw new Error("The amount of data is too big to be stored in a QR Code");if(!I)I=$;else if(I<$)throw new Error(`+`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Zy+1&&(this._liveRegion.textContent+=a2.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\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 l=e;l<=t;l++){let h=n.lines.get(n.ydisp+l),d=[],p=h?.translateToString(!0,void 0,void 0,d)||"",g=(n.ydisp+l+1).toString(),m=this._rowElements[l];m&&(p.length===0?(m.textContent=" ",this._rowColumns.set(m,[0,1])):(m.textContent=p,this._rowColumns.set(m,d)),m.setAttribute("aria-posinset",g),m.setAttribute("aria-setsize",r),this._alignRowWidth(m))}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],l=n.getAttribute("aria-posinset"),h=t===0?"1":`${this._terminal.buffer.lines.length}`;if(l===h||e.relatedTarget!==r)return;let d,p;if(t===0?(d=n,p=this._rowElements.pop(),this._rowContainer.removeChild(p)):(d=this._rowElements.shift(),p=n,this._rowContainer.removeChild(d)),d.removeEventListener("focus",this._topBoundaryFocusListener),p.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let g=this._createAccessibilityTreeNode();this._rowElements.unshift(g),this._rowContainer.insertAdjacentElement("afterbegin",g)}else{let g=this._createAccessibilityTreeNode();this._rowElements.push(g),this._rowContainer.appendChild(g)}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 l=({node:p,offset:g})=>{let m=p instanceof Text?p.parentNode:p,v=parseInt(m?.getAttribute("aria-posinset"),10)-1;if(isNaN(v))return console.warn("row is invalid. Race condition?"),null;let _=this._rowColumns.get(m);if(!_)return console.warn("columns is null. Race condition?"),null;let S=g<_.length?_[g]:_.slice(-1)[0]+1;return S>=this._terminal.cols&&(++v,S=0),{row:v,column:S}},h=l(t),d=l(n);if(!(!h||!d)){if(h.row>d.row||h.row===d.row&&h.column>=d.column)throw new Error("invalid range");this._terminal.select(h.column,h.row,(d.row-h.row)*this._terminal.cols-h.column+d.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);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})`}};$h=_t([me(1,f1),me(2,un),me(3,dn)],$h);var P2=class extends He{constructor(e,t,n,r,l){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=l,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ue),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ue),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ht(()=>{Nr(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(Te(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Te(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Te(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Te(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 r=0;r<n.length;r++){let l=n[r];if(l.classList.contains("xterm"))break;if(l.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(r=>{r?.forEach(l=>{l.link.dispose&&l.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,l]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):l.provideLinks(e.y,h=>{if(this._isMouseOut)return;let d=h?.map(p=>({link:p}));this._activeProviderReplies?.set(r,d),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 l=t.get(r);if(l)for(let h=0;h<l.length;h++){let d=l[h],p=d.link.range.start.y<e?0:d.link.range.start.x,g=d.link.range.end.y>e?this._bufferService.cols:d.link.range.end.x;for(let m=p;m<=g;m++){if(n.has(m)){l.splice(h--,1);break}n.add(m)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),l=!1;for(let h=0;h<e;h++)(!this._activeProviderReplies.has(h)||this._activeProviderReplies.get(h))&&(l=!0);if(!l&&r){let h=r.find(d=>this._linkAtPosition(d.link,t));h&&(n=!0,this._handleNewLink(h))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let h=0;h<this._activeProviderReplies.size;h++){let d=this._activeProviderReplies.get(h)?.find(p=>this._linkAtPosition(p.link,t));if(d){n=!0,this._handleNewLink(d);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&&gj(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,Nr(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?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!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:n=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,l=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=l&&(this._clearCurrentLink(r,l),this._lastMouseEvent)){let h=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);h&&this._askForLink(h,!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,l=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(l)}_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,l=t.y*this._bufferService.cols+t.x;return n<=l&&l<=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,l){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:l}}};P2=_t([me(1,p1),me(2,dn),me(3,ui),me(4,cx)],P2);function gj(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 mj=class extends lj{constructor(e={}){super(e),this._linkifier=this._register(new Fa),this.browser=jx,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Fa),this._onCursorMove=this._register(new ue),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ue),this.onKey=this._onKey.event,this._onRender=this._register(new ue),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ue),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ue),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ue),this.onBell=this._onBell.event,this._onFocus=this._register(new ue),this._onBlur=this._register(new ue),this._onA11yCharEmitter=this._register(new ue),this._onA11yTabEmitter=this._register(new ue),this._onWillOpen=this._register(new ue),this._setup(),this._decorationService=this._instantiationService.createInstance(uj),this._instantiationService.setService(jo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(rM),this._instantiationService.setService(cx,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(o2)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(ei.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ei.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ei.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ei.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ht(()=>{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 n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let l=ot.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ne.ESC}]${r};${tj(l)}${Ex.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(h=>h.ansi[t.index]=Et.toColor(...t.color));else{let h=n;this._themeService.modifyColors(d=>d[h]=Et.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_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($h,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ne.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(ne.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,l=t.getWidth(n),h=this._renderService.dimensions.css.cell.width*l,d=this.buffer.y*this._renderService.dimensions.css.cell.height,p=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=p+"px",this.textarea.style.top=d+"px",this.textarea.style.width=h+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Te(this.element,"copy",t=>{this.hasSelection()&&Sk(t,this._selectionService)}));let e=t=>xk(t,this.textarea,this.coreService,this.optionsService);this._register(Te(this.textarea,"paste",e)),this._register(Te(this.element,"paste",e)),Tx?this._register(Te(this.element,"mousedown",t=>{t.button===2&&ay(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Te(this.element,"contextmenu",t=>{ay(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),w1&&this._register(Te(this.element,"auxclick",t=>{t.button===1&&ex(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Te(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Te(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Te(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Te(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Te(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Te(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Te(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new 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(Te(this.screenElement,"mousemove",l=>this.updateCursorStyle(l))),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",r2.get()),Ax||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(sM,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(un,this._coreBrowserService),this._register(Te(this.textarea,"focus",l=>this._handleTextAreaFocus(l))),this._register(Te(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(T2,this._document,this._helperContainer),this._instantiationService.setService(Xh,this._charSizeService),this._themeService=this._instantiationService.createInstance(N2),this._instantiationService.setService(Za,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Ph),this._instantiationService.setService(ox,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(R2,this.rows,this.screenElement)),this._instantiationService.setService(dn,this._renderService),this._register(this._renderService.onRenderedViewportChange(l=>this._onRender.fire(l))),this.onResize(l=>this._renderService.resize(l.cols,l.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(E2,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(D2),this._instantiationService.setService(p1,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(P2,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(C2,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(l=>{super.scrollLines(l,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(A2,this.element,this.screenElement,r)),this._instantiationService.setService(Tk,this._selectionService),this._register(this._selectionService.onRequestScrollLines(l=>this.scrollLines(l.amount,l.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(l=>this._renderService.handleSelectionChanged(l.start,l.end,l.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(l=>{this.textarea.value=l,this.textarea.focus(),this.textarea.select()})),this._register(ei.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(k2,this.screenElement)),this._register(Te(this.element,"mousedown",l=>this._selectionService.handleMouseDown(l))),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($h,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",l=>this._handleScreenReaderModeOptionChange(l))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Uh,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",l=>{!this._overviewRulerRenderer&&l&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Uh,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(j2,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(h){let d=e._mouseService.getMouseReportCoords(h,e.screenElement);if(!d)return!1;let p,g;switch(h.overrideType||h.type){case"mousemove":g=32,h.buttons===void 0?(p=3,h.button!==void 0&&(p=h.button<3?h.button:3)):p=h.buttons&1?0:h.buttons&4?1:h.buttons&2?2:3;break;case"mouseup":g=0,p=h.button<3?h.button:3;break;case"mousedown":g=1,p=h.button<3?h.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(h)===!1)return!1;let m=h.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(h,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;g=m<0?0:1,p=4;break;default:return!1}return g===void 0||p===void 0||p>4?!1:e.coreMouseService.triggerMouseEvent({col:d.col,row:d.row,x:d.x,y:d.y,button:p,action:g,ctrl:h.ctrlKey,alt:h.altKey,shift:h.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},l={mouseup:h=>(n(h),h.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(h)),wheel:h=>(n(h),this.cancel(h,!0)),mousedrag:h=>{h.buttons&&n(h)},mousemove:h=>{h.buttons||n(h)}};this._register(this.coreMouseService.onProtocolChange(h=>{h?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(h)),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()),h&8?r.mousemove||(t.addEventListener("mousemove",l.mousemove),r.mousemove=l.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),h&16?r.wheel||(t.addEventListener("wheel",l.wheel,{passive:!1}),r.wheel=l.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),h&2?r.mouseup||(r.mouseup=l.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),h&4?r.mousedrag||(r.mousedrag=l.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Te(t,"mousedown",h=>{if(h.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(h)))return n(h),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(h)})),this._register(Te(t,"wheel",h=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(h)===!1)return!1;if(!this.buffer.hasScrollback){if(h.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(h,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(h,!0);let d=ne.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(h.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(h,!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){JS(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 new 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 new 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=cj(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),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===ne.ETX||n.key===ne.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)&&(vj(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(kt));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(ne.ESC+"[I"):this.coreService.triggerDataEvent(ne.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ne.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),l=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ne.ESC}[6;${l};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function vj(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var _j=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 new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},yj=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 is)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Xy=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 yj(t)}getNullCell(){return new is}},Sj=class extends He{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ue),this.onBufferChange=this._onBufferChange.event,this._normal=new Xy(this._core.buffers.normal,"normal"),this._alternate=new Xy(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},xj=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.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)}},wj=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}},bj=["cols","rows"],js=0,Cj=class extends He{constructor(e){super(),this._core=this._register(new mj(e)),this._addonManager=this._register(new _j),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,l)=>{this._checkReadonlyOptions(r),this._core.options[r]=l};for(let r in this._core.options){let l={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,l)}}_checkReadonlyOptions(e){if(bj.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new xj(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new wj(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new Sj(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";break}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+`,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 r2.get()},set promptLabel(e){r2.set(e)},get tooMuchOutput(){return a2.get()},set tooMuchOutput(e){a2.set(e)}}}_verifyIntegers(...e){for(js of e)if(js===1/0||isNaN(js)||js%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(js of e)if(js&&(js===1/0||isNaN(js)||js%1!==0||js<0))throw new Error("This API only accepts positive integers")}};const Qy=e=>{/^https?:/i.test(e)&&window.codync.app.openExternal(e)};function Jy({backend:e,step:t,method:n,back:r}){const l=Ne(),h=x.useRef(null),[d,p]=x.useState(null),[g,m]=x.useState(null);x.useEffect(()=>{const _=h.current;if(!_)return;const S=getComputedStyle(document.documentElement),w=parseFloat(S.getPropertyValue("--scale"))||1,b=new Cj({fontFamily:S.getPropertyValue("--mono").trim()||"monospace",fontSize:12*w,cursorBlink:!0,allowTransparency:!0,theme:{background:S.getPropertyValue("--background").trim(),foreground:S.getPropertyValue("--text").trim(),cursor:S.getPropertyValue("--text").trim(),selectionBackground:`rgba(${S.getPropertyValue("--text-rgb").trim()}, 0.2)`},linkHandler:{activate:(L,O)=>Qy(O)}}),k=new ck;b.loadAddon(k),b.loadAddon(new gk((L,O)=>Qy(O))),b.open(_),k.fit(),b.focus();let E=!1,j=null,V=null,A={cols:b.cols,rows:b.rows},z={cols:0,rows:0},F=null,R=Promise.resolve();const I=new TextEncoder,q=()=>{const L=l.client;!L||!V||A.cols===z.cols&&A.rows===z.rows||(z=A,Ae.termResize(L,V,A.cols,A.rows).catch(()=>{}))},U=L=>{const O=l.client;if(j!==null||!O||!V)return;const P=V;R=R.then(()=>Ae.termInput(O,P,X3(L)).then(()=>{},()=>{}))},Y=[b.onData(L=>U(I.encode(L))),b.onBinary(L=>U(Uint8Array.from(L,O=>O.charCodeAt(0)&255))),b.onResize(({cols:L,rows:O})=>{A={cols:L,rows:O},q()})],$=new ResizeObserver(()=>k.fit());$.observe(_);let M=0;const N=(L,O)=>new Promise(P=>{b.reset(),F=L.transport.stream(`/term/${encodeURIComponent(O)}`,te=>{M=0;let Q;try{Q=JSON.parse(te)}catch{return}Q.type==="output"&&Q.data?b.write(Q3(Q.data)):Q.type==="exit"&&(j=Q.code??-1,p(j))},te=>{F=null,te?.status===404?(m(te.message),P("done")):te?(M+=1,M>5?(m(te.message),P("done")):P("retry")):P("retry")})});return(async()=>{try{const L=await l.ready(),O=await Ae.agentSetup(L,e.id,t,n?.id??null,A.cols,A.rows);if(E){Ae.termClose(L,O).catch(()=>{});return}for(V=O,z=A,q();j===null&&!E&&await N(L,O)!=="done";)j===null&&!E&&await new Promise(P=>setTimeout(P,1e3))}catch(L){E||m(L instanceof Ji?L.message:lt(L));return}E||await l.refreshBackends()})(),()=>{E=!0,$.disconnect(),Y.forEach(O=>O.dispose()),F?.();const L=l.client;j===null&&L&&V&&Ae.termClose(L,V).catch(()=>{}),b.dispose()}},[l,e.id,t,n?.id]);const v=t==="install"?`Install ${e.name}`:n?.name??`Sign in to ${e.name}`;return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(s1,{title:v,onBack:r}),c.jsx("div",{className:"setup-terminal",children:c.jsx("div",{ref:h,style:{width:"100%",height:"100%"}})}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 16px",...B("footnote")},children:[g?c.jsx("span",{style:{color:"var(--danger)",...uf},children:g}):d!==null?c.jsxs(c.Fragment,{children:[c.jsx(ae,{name:d===0?"checkmark.circle.fill":"exclamationmark.circle.fill",size:10,color:d===0?"var(--added)":"var(--warning)"}),c.jsx("span",{style:{color:"var(--secondary)",...uf},children:d===0?"Finished.":`Ended with an error (${d}).`})]}):c.jsxs(c.Fragment,{children:[c.jsx(on,{size:14,color:"var(--secondary)"}),c.jsxs("span",{style:{color:"var(--secondary)",...uf},children:["Running on ",l.hostName,". Links open on this device."]})]}),c.jsx("span",{style:{flex:1}}),d!==null?c.jsx(Fe,{className:"fade-in",onClick:r,children:"Done"}):null]})]})}const uf={display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"};function kj(e){switch(e){case"claude-acp":return"rgb(217, 120, 87)";case"gemini":return"linear-gradient(to top right, rgb(71, 150, 227), rgb(145, 120, 199), rgb(201, 102, 115))";case"antigravity-acp":return"rgb(66, 133, 245)";case"mistral-vibe":return"rgb(250, 82, 15)";case"qwen-code":return"rgb(97, 92, 237)";case"amp-acp":return"rgb(242, 79, 64)";case"kiro":return"rgb(143, 69, 255)";case"cortex-code":return"rgb(41, 181, 232)";default:return"var(--text)"}}function qx({registry:e,icon:t,tile:n,radius:r}){return c.jsx("div",{style:{width:n,height:n,flex:"none",borderRadius:r,background:"var(--bubble-agent)",display:"grid",placeItems:"center",color:"var(--text)"},children:c.jsx(Ej,{registry:e,size:t})})}function Ej({registry:e,size:t}){const n=l1(e);return n?c.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:t,height:t,flex:"none",background:kj(e),WebkitMaskImage:`url("${n}")`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):c.jsx(ae,{name:"terminal",size:t*.8,scaled:!1})}function Mj({initial:e}){const t=Ne(),[n,r]=x.useState(null),[l,h]=x.useState(null),[d,p]=x.useState(!1),[g,m]=x.useState(null),[v,_]=x.useState(null),S=x.useRef(!1),w=t.hello?.backends.find($=>$.id===e.id)??e,b=w.installed===!0,k=w.curated===!0,E=l?.signedIn??w.signedIn??null,j=t.hostName,V=async()=>{const $=t.client;if(!(!$||S.current)){S.current=!0,p(!0);try{h(await Ae.agentAuth($,w.id)),_(null)}catch(M){_(lt(M))}S.current=!1,p(!1),await t.refreshBackends()}},A=async $=>{const M=t.client;if(M){m($.id);try{h(await Ae.agentAuthenticate(M,w.id,$.id)),_(null)}catch(N){_(lt(N))}m(null),await t.refreshBackends()}};x.useEffect(()=>{w.signedIn!==!0&&V()},[]);const z=x.useRef(!1);x.useEffect(()=>{n===null&&z.current&&V(),z.current=n!==null},[n]);const F=()=>r(null),R=n===null?null:n.kind==="install"?c.jsx(Jy,{backend:w,step:"install",back:F}):n.kind==="terminal"?c.jsx(Jy,{backend:w,step:"login",method:n.method,back:F}):c.jsx(jj,{backend:w,method:n.method,saved:l?.savedEnv??[],back:F,done:h}),I=d?l===null?`Checking with ${w.name}… The first check can download it.`:"Checking…":E===!0?"Signed in.":E===!1?"Not signed in yet.":`Couldn't tell. Skip this if you've already signed in on ${j}.`,q=($,M,N,L,O,P=!1)=>c.jsxs("button",{className:"option-row",disabled:g!==null,onClick:O,children:[c.jsx("span",{"aria-hidden":!0,style:{width:26,display:"flex",justifyContent:"center",color:"var(--secondary)",flex:"none"},children:c.jsx(ae,{name:L,size:13})}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0},children:[c.jsx("span",{style:{...B("body","medium"),color:"var(--text)"},children:M}),c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)",...Gf(3)},children:N})]}),c.jsx("span",{style:{minWidth:8}}),P?c.jsx(on,{size:16,color:"var(--secondary)"}):c.jsx(ae,{name:"chevron.right",size:10,weight:"semibold",color:"var(--tertiary)"})]},$),U=[];if(E!==!0&&!d){l?.login&&U.push(q("login","Sign in",`In a terminal on ${j}. Links open here.`,"terminal",()=>r({kind:"terminal",method:null})));for(const $ of l?.methods??[])$.kind==="terminal"?U.push(q($.id,$.name,$.description??`In a terminal on ${j}.`,"terminal",()=>r({kind:"terminal",method:$}))):$.kind==="envVar"?U.push(q($.id,$.name,$.description??`Saved on ${j} only.`,"key",()=>r({kind:"keys",method:$}))):U.push(q($.id,$.name,g===$.id?`Finish signing in in the browser on ${j}…`:$.description??`Opens a browser on ${j}.`,"safari",()=>{A($)},g===$.id))}const Y=c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:w.name}),c.jsxs(hi,{children:[c.jsx(Ee,{children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"4px 0"},children:[c.jsx(qx,{registry:w.registry,icon:30,tile:52,radius:14}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0},children:[c.jsx("span",{style:B("title3","semibold"),children:w.name}),w.description?c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)",...Gf(3)},children:w.description}):null]})]})}),k?c.jsx(Ee,{children:c.jsx(e3,{number:1,title:"Install",detail:b?`Installed on ${j}.`:w.canInstall?`Runs the official installer on ${j}.`:w.installHint,done:b,action:b||!w.canInstall?null:{label:"Install",run:()=>r({kind:"install"})}})}):null,c.jsxs(Ee,{footer:E!==!0&&l?.methods.some($=>$.kind==="agent")?`Browser sign-ins open on ${j} itself. Away from it? Use Remote screen to finish there.`:null,children:[c.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c.jsx("div",{style:{flex:1,minWidth:0},children:c.jsx(e3,{number:k?2:1,title:"Sign in",detail:I,done:E===!0,action:null})}),d?c.jsx(on,{state:"connecting",size:16,color:"var(--secondary)"}):c.jsx("button",{title:"Check again","aria-label":"Check again",style:{display:"flex",color:"var(--secondary)"},onClick:()=>{V()},children:c.jsx(ae,{name:"arrow.clockwise",size:13})})]}),E!==!0&&l?.detail?c.jsx("span",{className:"selectable",style:{...B("footnote"),color:"var(--secondary)",whiteSpace:"pre-wrap"},children:l.detail}):null,U]}),v?c.jsx(Ee,{children:c.jsx(hn,{text:v})}):null]})]});return c.jsx(pS,{base:Y,top:R})}function jj({backend:e,method:t,saved:n,back:r,done:l}){const h=Ne(),[d,p]=x.useState({}),[g,m]=x.useState(!1),[v,_]=x.useState(null),S=t.vars??[],w=async k=>{const E=h.client;if(E){m(!0);try{l(await Ae.setAgentEnv(E,e.id,k)),r()}catch(j){_(lt(j))}m(!1)}},b=S.some(k=>!k.optional&&!d[k.name]&&!n.includes(k.name));return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(s1,{title:t.name,onBack:r,trailing:g?c.jsx(et,{}):c.jsx(ke,{title:"Save",icon:"checkmark",disabled:b,onClick:()=>{w(n1(d))}})}),c.jsxs(hi,{children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[c.jsx(Ee,{title:t.name,children:S.map(k=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[c.jsx(Mt,{label:k.label,value:d[k.name]??"",secret:k.secret,placeholder:n.includes(k.name)?"Saved (type to replace)":k.name,onChange:E=>p(j=>({...j,[k.name]:E}))}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:k.label+(k.optional?" (optional)":"")})]},k.name))}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:"0 4px",...B("caption"),color:"var(--tertiary)"},children:[t.description?c.jsx("span",{children:t.description}):null,c.jsxs("span",{children:["Saved on ",h.hostName," only and given to ",e.name," when it starts."]}),t.link&&URL.canParse(t.link)?c.jsx(i1,{title:"Get a key",url:t.link}):null]})]}),n.length?c.jsx(Ee,{children:c.jsx("button",{style:{color:"var(--danger)"},onClick:()=>{w(Object.fromEntries(S.map(k=>[k.name,""])))},children:"Remove saved keys"})}):null,v?c.jsx(Ee,{children:c.jsx(hn,{text:v})}):null]})]})}function e3({number:e,title:t,detail:n,done:r,action:l}){return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"4px 0"},"aria-label":`${t}. ${n}${r?". Done":""}`,children:[c.jsx("span",{"aria-hidden":!0,style:{width:26,height:26,borderRadius:"50%",flex:"none",display:"grid",placeItems:"center",background:r?"var(--accent-fill)":"var(--bubble-agent)",transition:"background-color var(--fade)"},children:r?c.jsx(ae,{name:"checkmark",size:10,weight:"bold",color:"var(--on-accent)"}):c.jsx("span",{style:{...B("caption","semibold"),color:"var(--secondary)"},children:e})}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0},children:[c.jsx("span",{style:{...B("body","medium"),color:"var(--text)"},children:t}),c.jsx("span",{className:"selectable",style:{...B("subheadline"),color:"var(--secondary)"},children:n})]}),c.jsx("span",{style:{minWidth:8}}),l?c.jsx("button",{className:"capsule-action",style:{...B("subheadline","semibold"),padding:"7px 14px"},onClick:l.run,children:l.label}):null]})}const t3=e=>e.name;function Tj({computers:e,computer:t,onComputer:n}){const r=Ne(),l=Ga(r),h=ss(),[d,p]=x.useState(""),[g,m]=x.useState(0),[v,_]=x.useState(Lh),[S,w]=x.useState(null),[b,k]=x.useState(!1),[E,j]=x.useState([]),[V,A]=x.useState(!0),[z,F]=x.useState(!0),[R,I]=x.useState(null),[q,U]=x.useState(null),[Y,$]=x.useState(null),[M,N]=x.useState(!1),[L,O]=x.useState(!1),[P,te]=x.useState(null),[Q,ce]=x.useState(10),[re,de]=x.useState(!1),[Ce,je]=x.useState(!1),D=x.useRef(0),J=x.useRef(""),le=d.trim(),he=ge=>(ge??"").toLowerCase().includes(le.toLowerCase()),we=(r.hello?.backends??[]).filter(ge=>ge.available||ge.installed===!0||ge.curated===!0),xe=le?we.filter(ge=>he(ge.name)):we,be=le?E.filter(ge=>he(ge.name)||he(ge.description)):E,pe=l.installedConnectors.length+l.installedSkills.length,_e=async(ge=le)=>{const Ke=++D.current;J.current=ge,A(!0),k(!1);try{const ki=await Ae.marketConnectors(await r.ready(),ge);if(D.current!==Ke)return;_(hS(ki.items,t3)),w(ki.next),I(null)}catch(ki){if(D.current!==Ke)return;_(Lh()),w(null),I(lt(ki))}finally{D.current===Ke&&A(!1)}},Re=async()=>{if(b||V)return;if(Kf(v)){_(Ff);return}if(!S)return;const ge=D.current;k(!0);try{const Ke=await Ae.marketConnectors(await r.ready(),J.current,S);if(D.current!==ge)return;_(ki=>Ff(cS(ki,Ke.items,t3))),w(Ke.next),I(null)}catch(Ke){D.current===ge&&I(lt(Ke))}finally{D.current===ge&&k(!1)}};x.useEffect(()=>(l.refresh(),r.refreshBackends(),_e(""),(async()=>{try{j(await Ae.marketSkills(await r.ready()))}catch(ge){I(lt(ge))}F(!1)})(),()=>{D.current++}),[]);const fi=ge=>{m(Ke=>Ke+1),_e(ge)},pi=async ge=>{$(ge.source);try{await l.installSkill(ge.source)}catch(Ke){I(lt(Ke))}$(null)},Bt=c.jsxs("div",{style:{display:"flex",alignItems:"center",paddingTop:28,gap:8},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[c.jsx(Va,{computer:r.computer,size:32}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0,whiteSpace:"nowrap"},children:[c.jsx("span",{style:{...B("title2","semibold"),color:"var(--text)"},children:"Marketplace"}),e.length>1?c.jsxs(Yh,{title:"Switch computer",style:{display:"flex",alignItems:"center",gap:4,...B("subheadline"),color:"var(--secondary)",minWidth:0},items:()=>e.map(ge=>({title:ge.name,selected:ge.id===t,action:()=>n(ge.id)})),children:[c.jsx("span",{"aria-label":`Computer: ${r.hostName}`,style:{overflow:"hidden",textOverflow:"ellipsis"},children:r.hostName}),c.jsx(ae,{name:"chevron.down",size:10,weight:"semibold"})]}):c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)",overflow:"hidden",textOverflow:"ellipsis"},children:r.hostName})]})]}),c.jsx("span",{style:{flex:1}}),pe>0?c.jsxs("button",{className:"press",style:{display:"flex",alignItems:"center",gap:8,flex:"none"},onClick:()=>de(!0),children:[c.jsx("span",{style:{display:"flex"},children:l.installedConnectors.slice(0,3).map((ge,Ke)=>c.jsx("span",{style:{marginLeft:Ke?-8:0,display:"flex"},children:c.jsx(Xf,{name:ge.name,registryName:ge.registryName,size:26})},ge.id))}),c.jsxs("span",{style:{color:"var(--secondary)",whiteSpace:"nowrap"},children:[pe," installed"]}),c.jsx(ae,{name:"chevron.right",size:10,weight:"semibold",color:"var(--tertiary)"})]}):null]}),pt=c.jsxs("div",{className:"market-search",children:[c.jsx(ae,{name:"magnifyingglass",size:13,color:"var(--secondary)"}),c.jsx("input",{value:d,placeholder:"Search agents, connectors and skills","aria-label":"Search agents, connectors and skills",spellCheck:!1,onChange:ge=>{p(ge.target.value),ce(10)},onKeyDown:ge=>{ge.key==="Enter"&&!ge.nativeEvent.isComposing&&fi(d.trim())}}),d?c.jsx("button",{"aria-label":"Clear search",title:"Clear search",style:{display:"flex",color:"var(--tertiary)"},onClick:()=>{p(""),ce(10),fi("")},children:c.jsx(ae,{name:"xmark.circle.fill",size:13})}):null]}),$e=ge=>c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:ge}),gi=c.jsxs("div",{className:"market-page",children:[c.jsx("div",{className:"market-scroll",children:c.jsxs("div",{className:"market-page-content",children:[Bt,pt,xe.length>0?c.jsxs(ro,{title:le?`Agents matching “${le}”`:"Agents",children:[c.jsx("div",{className:"agent-grid",children:xe.slice(0,Q).map(ge=>c.jsx(Dj,{backend:ge,onClick:()=>te(ge)},ge.id))}),xe.length>Q?$e(c.jsx(Fe,{kind:"secondary",onClick:()=>ce(ge=>ge+10),children:"Load more agents"})):null]}):null,c.jsx(ro,{title:"Connectors",children:V?c.jsx(Zf,{}):v.items.length===0?c.jsx("span",{style:{color:"var(--secondary)"},children:le?`No connectors match “${le}”.`:"Couldn't load connectors."}):c.jsxs(c.Fragment,{children:[c.jsx(uo,{children:uS(v).map(ge=>c.jsx(Ha,{title:ge.title,subtitle:ge.description??ge.name,added:ge.installed,icon:c.jsx(Xf,{website:ge.website,name:ge.title,registryName:ge.name}),onAdd:()=>U(ge)},ge.name))}),Kf(v)||S?$e(c.jsx(Fe,{kind:"secondary",disabled:b,onClick:()=>{Re()},children:b?"Loading…":"Load more connectors"})):null]})}),c.jsx(O8,{query:le,searchToken:g}),c.jsx(ro,{title:"Skills",children:z?c.jsx(Zf,{}):c.jsx(uo,{children:be.map(ge=>c.jsx(Ha,{title:ge.name,subtitle:ge.description,added:ge.installed||l.installedSkills.some(Ke=>Ke.id===ge.source.toLowerCase()),busy:Y===ge.source,icon:c.jsx(fS,{}),onAdd:()=>{pi(ge)}},ge.source))})}),c.jsx("div",{children:c.jsxs(Fe,{kind:"secondary",onClick:()=>je(!0),children:[c.jsx(ae,{name:"lock.shield",size:11}),"Credentials"]})}),c.jsx(ro,{title:"Make your own",children:c.jsxs(uo,{children:[c.jsx(Ha,{title:"Custom connector",subtitle:"Any MCP server: a command or a URL",added:!1,addLabel:"New",icon:c.jsx(Qf,{name:"point.3.connected.trianglepath.dotted"}),onAdd:()=>N(!0)}),c.jsx(Ha,{title:"Your own skill",subtitle:"Write instructions a bot can follow",added:!1,addLabel:"New",icon:c.jsx(Qf,{name:"square.and.pencil"}),onAdd:()=>O(!0)})]})}),R?c.jsx("span",{style:{...B("footnote"),color:"var(--danger)"},children:R}):null,c.jsxs("span",{style:{...B("footnote"),color:"var(--tertiary)"},children:["Connectors come from the official MCP Registry, apps through Composio, skills from Anthropic, agents from the ACP registry. Everything installs on ",r.hostName,"."]})]})}),c.jsx("div",{className:"market-close",children:c.jsx(ke,{title:"Close",icon:"xmark",onClick:h})})]});return c.jsxs(c.Fragment,{children:[c.jsx(pS,{base:gi,top:re?c.jsx(Rj,{back:()=>de(!1)}):null}),c.jsx(Rs,{open:q!==null,onClose:()=>U(null),children:q?c.jsx(mS,{item:q,done:()=>{_e(J.current)}},q.name):null}),c.jsx(Rs,{open:Ce,onClose:()=>je(!1),width:560,height:720,children:c.jsx(P8,{})}),c.jsx(Rs,{open:M,onClose:()=>N(!1),children:c.jsx(H8,{})}),c.jsx(Rs,{open:L,onClose:()=>O(!1),children:c.jsx(I8,{})}),c.jsx(Rs,{open:P!==null,onClose:()=>te(null),width:560,height:560,children:P?c.jsx(Mj,{initial:P},P.id):null})]})}function Dj({backend:e,onClick:t}){const n=e.installed===!0?e.signedIn===!1?"Not signed in":"Installed":e.curated===!0?"Not installed":"Sets up on first use";return c.jsxs("button",{className:"agent-card",title:e.name,onClick:t,children:[c.jsx(qx,{registry:e.registry,icon:34,tile:64,radius:18}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:2,maxWidth:"100%"},children:[c.jsx("span",{style:{...B("subheadline","semibold"),color:"var(--text)",...Wh},children:e.name}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",...Wh},children:n})]})]})}const Wh={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"};function Rj({back:e}){const t=Ne(),n=Ga(t),[r,l]=x.useState(null),[h,d]=x.useState(null),p=n.installedConnectors.length===0&&n.installedSkills.length===0,g=async v=>{d(v);try{await n.signIn(v)}catch(_){t.setError(lt(_))}d(null)},m=async v=>{try{v.isSkill?await n.removeSkill(v.id):await n.removeConnector(v.id)}catch(_){t.setError(lt(_))}};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(s1,{title:"Installed",onBack:e}),c.jsx("div",{style:{flex:1,minHeight:0},children:c.jsxs(hi,{children:[p?c.jsx(Aj,{icon:"shippingbox",title:"Nothing installed",detail:"Connectors and skills you add show up here."}):null,n.installedConnectors.length?c.jsx(Ee,{title:"Connectors",children:n.installedConnectors.map(v=>c.jsx(i3,{title:v.name,subtitle:qa(v)?"Sign in so bots can use it":v.command??v.url??v.description,icon:v.kind==="composio"?c.jsx(t1,{url:v.logo,name:v.name,size:32}):c.jsx(Xf,{name:v.name,registryName:v.registryName,size:32}),accessory:h===v.id?c.jsx(et,{}):qa(v)?c.jsx(Fe,{onClick:()=>{g(v.id)},children:"Sign in"}):null,onRemove:()=>l({id:v.id,name:v.name,isSkill:!1})},v.id))}):null,n.installedSkills.length?c.jsx(Ee,{title:"Skills",children:n.installedSkills.map(v=>c.jsx(i3,{title:v.name,subtitle:v.description,icon:c.jsx(fS,{size:32}),onRemove:()=>l({id:v.id,name:v.name,isSkill:!0})},v.id))}):null]})}),c.jsx(ts,{open:r!==null,title:`Remove ${r?.name??""}?`,message:r?r.isSkill?"Bots stop using this skill.":"Bots lose this connector, and the keys saved for it are deleted.":null,actions:r?[{title:"Remove",destructive:!0,action:()=>{m(r)}}]:[],onClose:()=>l(null)})]})}function Aj({icon:e,title:t,detail:n}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"40px 0",textAlign:"center"},children:[c.jsx(ae,{name:e,size:28,color:"var(--tertiary)"}),c.jsx("span",{style:{...B("compactBody","semibold"),color:"var(--text)"},children:t}),c.jsx("span",{style:{...B("compactSecondary"),color:"var(--secondary)"},children:n})]})}function i3({title:e,subtitle:t,icon:n,accessory:r,onRemove:l}){return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},title:t,children:[n,c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0},children:[c.jsx("span",{style:{color:"var(--text)",...Wh},children:e}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",...Wh},children:t})]}),c.jsx("span",{style:{minWidth:12}}),r,c.jsx("button",{title:"Remove","aria-label":`Remove ${e}`,style:{minWidth:44,minHeight:44,display:"grid",placeItems:"center",color:"var(--secondary)",margin:"-8px 0"},onClick:l,children:c.jsx(ae,{name:"trash",size:13})})]})}var Oa={},df,s3;function Nj(){return s3||(s3=1,df=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),df}var ff={},$n={},n3;function Hr(){if(n3)return $n;n3=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return $n.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},$n.getSymbolTotalCodewords=function(r){return t[r]},$n.getBCHDigit=function(n){let r=0;for(;n!==0;)r++,n>>>=1;return r},$n.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');e=r},$n.isKanjiModeEnabled=function(){return typeof e<"u"},$n.toSJIS=function(r){return e(r)},$n}var pf={},r3;function b1(){return r3||(r3=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+n)}}e.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},e.from=function(r,l){if(e.isValid(r))return r;try{return t(r)}catch{return l}}})(pf)),pf}var gf,a3;function Lj(){if(a3)return gf;a3=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const n=Math.floor(t/8);return(this.buffer[n]>>>7-t%8&1)===1},put:function(t,n){for(let r=0;r<n;r++)this.putBit((t>>>n-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},gf=e,gf}var mf,l3;function Bj(){if(l3)return mf;l3=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,n,r,l){const h=t*this.size+n;this.data[h]=r,l&&(this.reservedBit[h]=!0)},e.prototype.get=function(t,n){return this.data[t*this.size+n]},e.prototype.xor=function(t,n,r){this.data[t*this.size+n]^=r},e.prototype.isReserved=function(t,n){return this.reservedBit[t*this.size+n]},mf=e,mf}var vf={},o3;function Oj(){return o3||(o3=1,(function(e){const t=Hr().getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const l=Math.floor(r/7)+2,h=t(r),d=h===145?26:Math.ceil((h-13)/(2*l-2))*2,p=[h-7];for(let g=1;g<l-1;g++)p[g]=p[g-1]-d;return p.push(6),p.reverse()},e.getPositions=function(r){const l=[],h=e.getRowColCoords(r),d=h.length;for(let p=0;p<d;p++)for(let g=0;g<d;g++)p===0&&g===0||p===0&&g===d-1||p===d-1&&g===0||l.push([h[p],h[g]]);return l}})(vf)),vf}var _f={},c3;function zj(){if(c3)return _f;c3=1;const e=Hr().getSymbolSize,t=7;return _f.getPositions=function(r){const l=e(r);return[[0,0],[l-t,0],[0,l-t]]},_f}var yf={},h3;function Hj(){return h3||(h3=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(l){return l!=null&&l!==""&&!isNaN(l)&&l>=0&&l<=7},e.from=function(l){return e.isValid(l)?parseInt(l,10):void 0},e.getPenaltyN1=function(l){const h=l.size;let d=0,p=0,g=0,m=null,v=null;for(let _=0;_<h;_++){p=g=0,m=v=null;for(let S=0;S<h;S++){let w=l.get(_,S);w===m?p++:(p>=5&&(d+=t.N1+(p-5)),m=w,p=1),w=l.get(S,_),w===v?g++:(g>=5&&(d+=t.N1+(g-5)),v=w,g=1)}p>=5&&(d+=t.N1+(p-5)),g>=5&&(d+=t.N1+(g-5))}return d},e.getPenaltyN2=function(l){const h=l.size;let d=0;for(let p=0;p<h-1;p++)for(let g=0;g<h-1;g++){const m=l.get(p,g)+l.get(p,g+1)+l.get(p+1,g)+l.get(p+1,g+1);(m===4||m===0)&&d++}return d*t.N2},e.getPenaltyN3=function(l){const h=l.size;let d=0,p=0,g=0;for(let m=0;m<h;m++){p=g=0;for(let v=0;v<h;v++)p=p<<1&2047|l.get(m,v),v>=10&&(p===1488||p===93)&&d++,g=g<<1&2047|l.get(v,m),v>=10&&(g===1488||g===93)&&d++}return d*t.N3},e.getPenaltyN4=function(l){let h=0;const d=l.data.length;for(let g=0;g<d;g++)h+=l.data[g];return Math.abs(Math.ceil(h*100/d/5)-10)*t.N4};function n(r,l,h){switch(r){case e.Patterns.PATTERN000:return(l+h)%2===0;case e.Patterns.PATTERN001:return l%2===0;case e.Patterns.PATTERN010:return h%3===0;case e.Patterns.PATTERN011:return(l+h)%3===0;case e.Patterns.PATTERN100:return(Math.floor(l/2)+Math.floor(h/3))%2===0;case e.Patterns.PATTERN101:return l*h%2+l*h%3===0;case e.Patterns.PATTERN110:return(l*h%2+l*h%3)%2===0;case e.Patterns.PATTERN111:return(l*h%3+(l+h)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}e.applyMask=function(l,h){const d=h.size;for(let p=0;p<d;p++)for(let g=0;g<d;g++)h.isReserved(g,p)||h.xor(g,p,n(l,g,p))},e.getBestMask=function(l,h){const d=Object.keys(e.Patterns).length;let p=0,g=1/0;for(let m=0;m<d;m++){h(m),e.applyMask(m,l);const v=e.getPenaltyN1(l)+e.getPenaltyN2(l)+e.getPenaltyN3(l)+e.getPenaltyN4(l);e.applyMask(m,l),v<g&&(g=v,p=m)}return p}})(yf)),yf}var yh={},u3;function Vx(){if(u3)return yh;u3=1;const e=b1(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],n=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return yh.getBlocksCount=function(l,h){switch(h){case e.L:return t[(l-1)*4+0];case e.M:return t[(l-1)*4+1];case e.Q:return t[(l-1)*4+2];case e.H:return t[(l-1)*4+3];default:return}},yh.getTotalCodewordsCount=function(l,h){switch(h){case e.L:return n[(l-1)*4+0];case e.M:return n[(l-1)*4+1];case e.Q:return n[(l-1)*4+2];case e.H:return n[(l-1)*4+3];default:return}},yh}var Sf={},so={},d3;function Ij(){if(d3)return so;d3=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let r=1;for(let l=0;l<255;l++)e[l]=r,t[r]=l,r<<=1,r&256&&(r^=285);for(let l=255;l<512;l++)e[l]=e[l-255]})(),so.log=function(r){if(r<1)throw new Error("log("+r+")");return t[r]},so.exp=function(r){return e[r]},so.mul=function(r,l){return r===0||l===0?0:e[t[r]+t[l]]},so}var f3;function Uj(){return f3||(f3=1,(function(e){const t=Ij();e.mul=function(r,l){const h=new Uint8Array(r.length+l.length-1);for(let d=0;d<r.length;d++)for(let p=0;p<l.length;p++)h[d+p]^=t.mul(r[d],l[p]);return h},e.mod=function(r,l){let h=new Uint8Array(r);for(;h.length-l.length>=0;){const d=h[0];for(let g=0;g<l.length;g++)h[g]^=t.mul(l[g],d);let p=0;for(;p<h.length&&h[p]===0;)p++;h=h.slice(p)}return h},e.generateECPolynomial=function(r){let l=new Uint8Array([1]);for(let h=0;h<r;h++)l=e.mul(l,new Uint8Array([1,t.exp(h)]));return l}})(Sf)),Sf}var xf,p3;function Pj(){if(p3)return xf;p3=1;const e=Uj();function t(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(r){this.degree=r,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const l=new Uint8Array(r.length+this.degree);l.set(r);const h=e.mod(l,this.genPoly),d=this.degree-h.length;if(d>0){const p=new Uint8Array(this.degree);return p.set(h,d),p}return h},xf=t,xf}var wf={},bf={},Cf={},g3;function $x(){return g3||(g3=1,Cf.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Cf}var Ts={},m3;function Wx(){if(m3)return Ts;m3=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+`)(?:.|[\r+]))+`;Ts.KANJI=new RegExp(n,"g"),Ts.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Ts.BYTE=new RegExp(r,"g"),Ts.NUMERIC=new RegExp(e,"g"),Ts.ALPHANUMERIC=new RegExp(t,"g");const l=new RegExp("^"+n+"$"),h=new RegExp("^"+e+"$"),d=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Ts.testKanji=function(g){return l.test(g)},Ts.testNumeric=function(g){return h.test(g)},Ts.testAlphanumeric=function(g){return d.test(g)},Ts}var v3;function Ir(){return v3||(v3=1,(function(e){const t=$x(),n=Wx();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(h,d){if(!h.ccBits)throw new Error("Invalid mode: "+h);if(!t.isValid(d))throw new Error("Invalid version: "+d);return d>=1&&d<10?h.ccBits[0]:d<27?h.ccBits[1]:h.ccBits[2]},e.getBestModeForData=function(h){return n.testNumeric(h)?e.NUMERIC:n.testAlphanumeric(h)?e.ALPHANUMERIC:n.testKanji(h)?e.KANJI:e.BYTE},e.toString=function(h){if(h&&h.id)return h.id;throw new Error("Invalid mode")},e.isValid=function(h){return h&&h.bit&&h.ccBits};function r(l){if(typeof l!="string")throw new Error("Param is not a string");switch(l.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+l)}}e.from=function(h,d){if(e.isValid(h))return h;try{return r(h)}catch{return d}}})(bf)),bf}var _3;function qj(){return _3||(_3=1,(function(e){const t=Hr(),n=Vx(),r=b1(),l=Ir(),h=$x(),d=7973,p=t.getBCHDigit(d);function g(S,w,b){for(let k=1;k<=40;k++)if(w<=e.getCapacity(k,b,S))return k}function m(S,w){return l.getCharCountIndicator(S,w)+4}function v(S,w){let b=0;return S.forEach(function(k){const E=m(k.mode,w);b+=E+k.getBitsLength()}),b}function _(S,w){for(let b=1;b<=40;b++)if(v(S,b)<=e.getCapacity(b,w,l.MIXED))return b}e.from=function(w,b){return h.isValid(w)?parseInt(w,10):b},e.getCapacity=function(w,b,k){if(!h.isValid(w))throw new Error("Invalid QR Code version");typeof k>"u"&&(k=l.BYTE);const E=t.getSymbolTotalCodewords(w),j=n.getTotalCodewordsCount(w,b),V=(E-j)*8;if(k===l.MIXED)return V;const A=V-m(k,w);switch(k){case l.NUMERIC:return Math.floor(A/10*3);case l.ALPHANUMERIC:return Math.floor(A/11*2);case l.KANJI:return Math.floor(A/13);case l.BYTE:default:return Math.floor(A/8)}},e.getBestVersionForData=function(w,b){let k;const E=r.from(b,r.M);if(Array.isArray(w)){if(w.length>1)return _(w,E);if(w.length===0)return 1;k=w[0]}else k=w;return g(k.mode,k.getLength(),E)},e.getEncodedBits=function(w){if(!h.isValid(w)||w<7)throw new Error("Invalid QR Code version");let b=w<<12;for(;t.getBCHDigit(b)-p>=0;)b^=d<<t.getBCHDigit(b)-p;return w<<12|b}})(wf)),wf}var kf={},y3;function Vj(){if(y3)return kf;y3=1;const e=Hr(),t=1335,n=21522,r=e.getBCHDigit(t);return kf.getEncodedBits=function(h,d){const p=h.bit<<3|d;let g=p<<10;for(;e.getBCHDigit(g)-r>=0;)g^=t<<e.getBCHDigit(g)-r;return(p<<10|g)^n},kf}var Ef={},Mf,S3;function $j(){if(S3)return Mf;S3=1;const e=Ir();function t(n){this.mode=e.NUMERIC,this.data=n.toString()}return t.getBitsLength=function(r){return 10*Math.floor(r/3)+(r%3?r%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){let l,h,d;for(l=0;l+3<=this.data.length;l+=3)h=this.data.substr(l,3),d=parseInt(h,10),r.put(d,10);const p=this.data.length-l;p>0&&(h=this.data.substr(l),d=parseInt(h,10),r.put(d,p*3+1))},Mf=t,Mf}var jf,x3;function Wj(){if(x3)return jf;x3=1;const e=Ir(),t=["0","1","2","3","4","5","6","7","8","9","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"," ","$","%","*","+","-",".","/",":"];function n(r){this.mode=e.ALPHANUMERIC,this.data=r}return n.getBitsLength=function(l){return 11*Math.floor(l/2)+6*(l%2)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(l){let h;for(h=0;h+2<=this.data.length;h+=2){let d=t.indexOf(this.data[h])*45;d+=t.indexOf(this.data[h+1]),l.put(d,11)}this.data.length%2&&l.put(t.indexOf(this.data[h]),6)},jf=n,jf}var Tf,w3;function Fj(){if(w3)return Tf;w3=1;const e=Ir();function t(n){this.mode=e.BYTE,typeof n=="string"?this.data=new TextEncoder().encode(n):this.data=new Uint8Array(n)}return t.getBitsLength=function(r){return r*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(n){for(let r=0,l=this.data.length;r<l;r++)n.put(this.data[r],8)},Tf=t,Tf}var Df,b3;function Kj(){if(b3)return Df;b3=1;const e=Ir(),t=Hr();function n(r){this.mode=e.KANJI,this.data=r}return n.getBitsLength=function(l){return l*13},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(r){let l;for(l=0;l<this.data.length;l++){let h=t.toSJIS(this.data[l]);if(h>=33088&&h<=40956)h-=33088;else if(h>=57408&&h<=60351)h-=49472;else throw new Error("Invalid SJIS character: "+this.data[l]+`+Make sure your charset is UTF-8`);h=(h>>>8&255)*192+(h&255),r.put(h,13)}},Df=n,Df}var Rf={exports:{}},C3;function Yj(){return C3||(C3=1,(function(e){var t={single_source_shortest_paths:function(n,r,l){var h={},d={};d[r]=0;var p=t.PriorityQueue.make();p.push(r,0);for(var g,m,v,_,S,w,b,k,E;!p.empty();){g=p.pop(),m=g.value,_=g.cost,S=n[m]||{};for(v in S)S.hasOwnProperty(v)&&(w=S[v],b=_+w,k=d[v],E=typeof d[v]>"u",(E||k>b)&&(d[v]=b,p.push(v,b),h[v]=m))}if(typeof l<"u"&&typeof d[l]>"u"){var j=["Could not find a path from ",r," to ",l,"."].join("");throw new Error(j)}return h},extract_shortest_path_from_predecessor_list:function(n,r){for(var l=[],h=r;h;)l.push(h),n[h],h=n[h];return l.reverse(),l},find_path:function(n,r,l){var h=t.single_source_shortest_paths(n,r,l);return t.extract_shortest_path_from_predecessor_list(h,l)},PriorityQueue:{make:function(n){var r=t.PriorityQueue,l={},h;n=n||{};for(h in r)r.hasOwnProperty(h)&&(l[h]=r[h]);return l.queue=[],l.sorter=n.sorter||r.default_sorter,l},default_sorter:function(n,r){return n.cost-r.cost},push:function(n,r){var l={value:n,cost:r};this.queue.push(l),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(Rf)),Rf.exports}var k3;function Gj(){return k3||(k3=1,(function(e){const t=Ir(),n=$j(),r=Wj(),l=Fj(),h=Kj(),d=Wx(),p=Hr(),g=Yj();function m(j){return unescape(encodeURIComponent(j)).length}function v(j,V,A){const z=[];let F;for(;(F=j.exec(A))!==null;)z.push({data:F[0],index:F.index,mode:V,length:F[0].length});return z}function _(j){const V=v(d.NUMERIC,t.NUMERIC,j),A=v(d.ALPHANUMERIC,t.ALPHANUMERIC,j);let z,F;return p.isKanjiModeEnabled()?(z=v(d.BYTE,t.BYTE,j),F=v(d.KANJI,t.KANJI,j)):(z=v(d.BYTE_KANJI,t.BYTE,j),F=[]),V.concat(A,z,F).sort(function(I,q){return I.index-q.index}).map(function(I){return{data:I.data,mode:I.mode,length:I.length}})}function S(j,V){switch(V){case t.NUMERIC:return n.getBitsLength(j);case t.ALPHANUMERIC:return r.getBitsLength(j);case t.KANJI:return h.getBitsLength(j);case t.BYTE:return l.getBitsLength(j)}}function w(j){return j.reduce(function(V,A){const z=V.length-1>=0?V[V.length-1]:null;return z&&z.mode===A.mode?(V[V.length-1].data+=A.data,V):(V.push(A),V)},[])}function b(j){const V=[];for(let A=0;A<j.length;A++){const z=j[A];switch(z.mode){case t.NUMERIC:V.push([z,{data:z.data,mode:t.ALPHANUMERIC,length:z.length},{data:z.data,mode:t.BYTE,length:z.length}]);break;case t.ALPHANUMERIC:V.push([z,{data:z.data,mode:t.BYTE,length:z.length}]);break;case t.KANJI:V.push([z,{data:z.data,mode:t.BYTE,length:m(z.data)}]);break;case t.BYTE:V.push([{data:z.data,mode:t.BYTE,length:m(z.data)}])}}return V}function k(j,V){const A={},z={start:{}};let F=["start"];for(let R=0;R<j.length;R++){const I=j[R],q=[];for(let U=0;U<I.length;U++){const Y=I[U],$=""+R+U;q.push($),A[$]={node:Y,lastCount:0},z[$]={};for(let M=0;M<F.length;M++){const N=F[M];A[N]&&A[N].node.mode===Y.mode?(z[N][$]=S(A[N].lastCount+Y.length,Y.mode)-S(A[N].lastCount,Y.mode),A[N].lastCount+=Y.length):(A[N]&&(A[N].lastCount=Y.length),z[N][$]=S(Y.length,Y.mode)+4+t.getCharCountIndicator(Y.mode,V))}}F=q}for(let R=0;R<F.length;R++)z[F[R]].end=0;return{map:z,table:A}}function E(j,V){let A;const z=t.getBestModeForData(j);if(A=t.from(V,z),A!==t.BYTE&&A.bit<z.bit)throw new Error('"'+j+'" cannot be encoded with mode '+t.toString(A)+`.+ Suggested mode is: `+t.toString(z));switch(A===t.KANJI&&!p.isKanjiModeEnabled()&&(A=t.BYTE),A){case t.NUMERIC:return new n(j);case t.ALPHANUMERIC:return new r(j);case t.KANJI:return new h(j);case t.BYTE:return new l(j)}}e.fromArray=function(V){return V.reduce(function(A,z){return typeof z=="string"?A.push(E(z,null)):z.data&&A.push(E(z.data,z.mode)),A},[])},e.fromString=function(V,A){const z=_(V,p.isKanjiModeEnabled()),F=b(z),R=k(F,A),I=g.find_path(R.map,"start","end"),q=[];for(let U=1;U<I.length-1;U++)q.push(R.table[I[U]].node);return e.fromArray(w(q))},e.rawSplit=function(V){return e.fromArray(_(V,p.isKanjiModeEnabled()))}})(Ef)),Ef}var E3;function Zj(){if(E3)return ff;E3=1;const e=Hr(),t=b1(),n=Lj(),r=Bj(),l=Oj(),h=zj(),d=Hj(),p=Vx(),g=Pj(),m=qj(),v=Vj(),_=Ir(),S=Gj();function w(R,I){const q=R.size,U=h.getPositions(I);for(let Y=0;Y<U.length;Y++){const $=U[Y][0],M=U[Y][1];for(let N=-1;N<=7;N++)if(!($+N<=-1||q<=$+N))for(let L=-1;L<=7;L++)M+L<=-1||q<=M+L||(N>=0&&N<=6&&(L===0||L===6)||L>=0&&L<=6&&(N===0||N===6)||N>=2&&N<=4&&L>=2&&L<=4?R.set($+N,M+L,!0,!0):R.set($+N,M+L,!1,!0))}}function b(R){const I=R.size;for(let q=8;q<I-8;q++){const U=q%2===0;R.set(q,6,U,!0),R.set(6,q,U,!0)}}function k(R,I){const q=l.getPositions(I);for(let U=0;U<q.length;U++){const Y=q[U][0],$=q[U][1];for(let M=-2;M<=2;M++)for(let N=-2;N<=2;N++)M===-2||M===2||N===-2||N===2||M===0&&N===0?R.set(Y+M,$+N,!0,!0):R.set(Y+M,$+N,!1,!0)}}function E(R,I){const q=R.size,U=m.getEncodedBits(I);let Y,$,M;for(let N=0;N<18;N++)Y=Math.floor(N/3),$=N%3+q-8-3,M=(U>>N&1)===1,R.set(Y,$,M,!0),R.set($,Y,M,!0)}function j(R,I,q){const U=R.size,Y=v.getEncodedBits(I,q);let $,M;for($=0;$<15;$++)M=(Y>>$&1)===1,$<6?R.set($,8,M,!0):$<8?R.set($+1,8,M,!0):R.set(U-15+$,8,M,!0),$<8?R.set(8,U-$-1,M,!0):$<9?R.set(8,15-$-1+1,M,!0):R.set(8,15-$-1,M,!0);R.set(U-8,8,1,!0)}function V(R,I){const q=R.size;let U=-1,Y=q-1,$=7,M=0;for(let N=q-1;N>0;N-=2)for(N===6&&N--;;){for(let L=0;L<2;L++)if(!R.isReserved(Y,N-L)){let O=!1;M<I.length&&(O=(I[M]>>>$&1)===1),R.set(Y,N-L,O),$--,$===-1&&(M++,$=7)}if(Y+=U,Y<0||q<=Y){Y-=U,U=-U;break}}}function A(R,I,q){const U=new n;q.forEach(function(L){U.put(L.mode.bit,4),U.put(L.getLength(),_.getCharCountIndicator(L.mode,R)),L.write(U)});const Y=e.getSymbolTotalCodewords(R),$=p.getTotalCodewordsCount(R,I),M=(Y-$)*8;for(U.getLengthInBits()+4<=M&&U.put(0,4);U.getLengthInBits()%8!==0;)U.putBit(0);const N=(M-U.getLengthInBits())/8;for(let L=0;L<N;L++)U.put(L%2?17:236,8);return z(U,R,I)}function z(R,I,q){const U=e.getSymbolTotalCodewords(I),Y=p.getTotalCodewordsCount(I,q),$=U-Y,M=p.getBlocksCount(I,q),N=U%M,L=M-N,O=Math.floor(U/M),P=Math.floor($/M),te=P+1,Q=O-P,ce=new g(Q);let re=0;const de=new Array(M),Ce=new Array(M);let je=0;const D=new Uint8Array(R.buffer);for(let xe=0;xe<M;xe++){const be=xe<L?P:te;de[xe]=D.slice(re,re+be),Ce[xe]=ce.encode(de[xe]),re+=be,je=Math.max(je,be)}const J=new Uint8Array(U);let le=0,he,we;for(he=0;he<je;he++)for(we=0;we<M;we++)he<de[we].length&&(J[le++]=de[we][he]);for(he=0;he<Q;he++)for(we=0;we<M;we++)J[le++]=Ce[we][he];return J}function F(R,I,q,U){let Y;if(Array.isArray(R))Y=S.fromArray(R);else if(typeof R=="string"){let O=I;if(!O){const P=S.rawSplit(R);O=m.getBestVersionForData(P,q)}Y=S.fromString(R,O||40)}else throw new Error("Invalid data");const $=m.getBestVersionForData(Y,q);if(!$)throw new Error("The amount of data is too big to be stored in a QR Code");if(!I)I=$;else if(I<$)throw new Error(`The chosen QR Code version cannot contain this amount of data.Minimum version required to store current data is: `+$+`.`);const M=A(I,q,Y),N=e.getSymbolSize(I),L=new r(N);return w(L,I),b(L),k(L,I),j(L,q,0),I>=7&&E(L,I),V(L,M),isNaN(U)&&(U=d.getBestMask(L,j.bind(null,L,q))),d.applyMask(U,L),j(L,q,U),{modules:L,version:I,errorCorrectionLevel:q,maskPattern:U,segments:Y}}return ff.create=function(I,q){if(typeof I>"u"||I==="")throw new Error("No input text");let U=t.M,Y,$;return typeof q<"u"&&(U=t.from(q.errorCorrectionLevel,t.M),Y=m.from(q.version),$=d.from(q.maskPattern),q.toSJISFunc&&e.setToSJISFunction(q.toSJISFunc)),F(I,Y,U,$)},ff}var Af={},Nf={},M3;function Fx(){return M3||(M3=1,(function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let r=n.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+n);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(h){return[h,h]}))),r.length===6&&r.push("F","F");const l=parseInt(r.join(""),16);return{r:l>>24&255,g:l>>16&255,b:l>>8&255,a:l&255,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(r){r||(r={}),r.color||(r.color={});const l=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,h=r.width&&r.width>=21?r.width:void 0,d=r.scale||4;return{width:h,scale:h?4:d,margin:l,color:{dark:t(r.color.dark||"#000000ff"),light:t(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},e.getScale=function(r,l){return l.width&&l.width>=r+l.margin*2?l.width/(r+l.margin*2):l.scale},e.getImageWidth=function(r,l){const h=e.getScale(r,l);return Math.floor((r+l.margin*2)*h)},e.qrToImageData=function(r,l,h){const d=l.modules.size,p=l.modules.data,g=e.getScale(d,h),m=Math.floor((d+h.margin*2)*g),v=h.margin*g,_=[h.color.light,h.color.dark];for(let S=0;S<m;S++)for(let w=0;w<m;w++){let b=(S*m+w)*4,k=h.color.light;if(S>=v&&w>=v&&S<m-v&&w<m-v){const E=Math.floor((S-v)/g),j=Math.floor((w-v)/g);k=_[p[E*d+j]?1:0]}r[b++]=k.r,r[b++]=k.g,r[b++]=k.b,r[b]=k.a}}})(Nf)),Nf}var j3;function Xj(){return j3||(j3=1,(function(e){const t=Fx();function n(l,h,d){l.clearRect(0,0,h.width,h.height),h.style||(h.style={}),h.height=d,h.width=d,h.style.height=d+"px",h.style.width=d+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(h,d,p){let g=p,m=d;typeof g>"u"&&(!d||!d.getContext)&&(g=d,d=void 0),d||(m=r()),g=t.getOptions(g);const v=t.getImageWidth(h.modules.size,g),_=m.getContext("2d"),S=_.createImageData(v,v);return t.qrToImageData(S.data,h,g),n(_,m,v),_.putImageData(S,0,0),m},e.renderToDataURL=function(h,d,p){let g=p;typeof g>"u"&&(!d||!d.getContext)&&(g=d,d=void 0),g||(g={});const m=e.render(h,d,g),v=g.type||"image/png",_=g.rendererOpts||{};return m.toDataURL(v,_.quality)}})(Af)),Af}var Lf={},T3;function Qj(){if(T3)return Lf;T3=1;const e=Fx();function t(l,h){const d=l.a/255,p=h+'="'+l.hex+'"';return d<1?p+" "+h+'-opacity="'+d.toFixed(2).slice(1)+'"':p}function n(l,h,d){let p=l+h;return typeof d<"u"&&(p+=" "+d),p}function r(l,h,d){let p="",g=0,m=!1,v=0;for(let _=0;_<l.length;_++){const S=Math.floor(_%h),w=Math.floor(_/h);!S&&!m&&(m=!0),l[_]?(v++,_>0&&S>0&&l[_-1]||(p+=m?n("M",S+d,.5+w+d):n("m",g,0),g=0,m=!1),S+1<h&&l[_+1]||(p+=n("h",v),v=0)):g++}return p}return Lf.render=function(h,d,p){const g=e.getOptions(d),m=h.modules.size,v=h.modules.data,_=m+g.margin*2,S=g.color.light.a?"<path "+t(g.color.light,"fill")+' d="M0 0h'+_+"v"+_+'H0z"/>':"",w="<path "+t(g.color.dark,"stroke")+' d="'+r(v,m,g.margin)+'"/>',b='viewBox="0 0 '+_+" "+_+'"',E='<svg xmlns="http://www.w3.org/2000/svg" '+(g.width?'width="'+g.width+'" height="'+g.width+'" ':"")+b+' shape-rendering="crispEdges">'+S+w+`</svg>-`;return typeof p=="function"&&p(null,E),E},Lf}var R3;function Jj(){if(R3)return Oa;R3=1;const e=Nj(),t=Zj(),n=Xj(),r=Qj();function l(h,d,p,g,m){const v=[].slice.call(arguments,1),_=v.length,S=typeof v[_-1]=="function";if(!S&&!e())throw new Error("Callback required as last argument");if(S){if(_<2)throw new Error("Too few arguments provided");_===2?(m=p,p=d,d=g=void 0):_===3&&(d.getContext&&typeof m>"u"?(m=g,g=void 0):(m=g,g=p,p=d,d=void 0))}else{if(_<1)throw new Error("Too few arguments provided");return _===1?(p=d,d=g=void 0):_===2&&!d.getContext&&(g=p,p=d,d=void 0),new Promise(function(w,b){try{const k=t.create(p,g);w(h(k,d,g))}catch(k){b(k)}})}try{const w=t.create(p,g);m(null,h(w,d,g))}catch(w){m(w)}}return Oa.create=t.create,Oa.toCanvas=l.bind(null,n.render),Oa.toDataURL=l.bind(null,n.renderToDataURL),Oa.toString=l.bind(null,function(h,d,p){return r.render(h,p)}),Oa}var eT=Jj();const Kx=gb(eT),D3="brew install leepokai/codync/codync-host && codync-host install",tT=()=>({id:crypto.randomUUID(),host:"",port:null,user:null,identityFile:null,remotePort:19222,computerId:null,name:""}),eu=()=>window.codync.ssh??null;class iT extends Br{state={profiles:[],status:{},attachments:[]};started=!1;start(){const t=eu();this.started||!t||(this.started=!0,t.onChange(n=>this.apply(n)),t.state().then(n=>this.apply(n)))}apply(t){this.state=t,this.changed()}status(t){return this.state.status[t]??{kind:"idle"}}isSSH(t){return this.state.attachments.some(n=>n.computer.id===t)}}const vo=new iT;function sT(){return x.useEffect(()=>vo.start(),[]),cn(vo)}function nT(e){x.useEffect(()=>{vo.start();const t=new Map,n=()=>{const l=new Map(vo.state.attachments.map(h=>[h.computer.id,h]));for(const[h,d]of l){const p=`${d.baseURL}|${d.token}`;if(t.get(h)===p)continue;const g=e.computers.find(v=>v.id===h),m={...d.computer,urls:[],color:g?.color??null,device:g?.device??null};e.attach(m,new J3(m,!0,()=>new Z2(d.baseURL,d.token))),t.set(h,p)}for(const h of[...t.keys()])l.has(h)||(t.delete(h),e.detach(h))};n();const r=vo.subscribe(n);return()=>{r();for(const l of t.keys())e.detach(l)}},[e])}function rT(){const e=ns(),t=Ya(),n=sT(),r=cn(e.cloud),[l,h]=x.useState(null),d=e.managedStores,p=new Set(d.map(v=>v.computer.id)),g=e.computers.filter(v=>!p.has(v.id)),m=r.computers.filter(v=>!p.has(v.computerId)&&!g.some(_=>_.id===v.computerId));return c.jsxs("div",{style:{height:"100%",overflowY:"auto",background:"var(--background)"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:26,padding:"14px 14px 20px"},children:[d.map(v=>c.jsx(oT,{store:v,ssh:n.isSSH(v.computer.id)},v.computer.id)),c.jsxs("div",{children:[c.jsx(ey,{title:"Over SSH",children:eu()?c.jsx(ke,{title:"Add SSH computer",icon:"plus",onClick:()=>h({profile:tT(),isNew:!0})}):null}),c.jsx($a,{show:n.state.profiles.length===0,children:c.jsxs("div",{style:{...B("callout"),color:"var(--secondary)"},children:["Run bots on another computer you reach with SSH. It needs codync-host installed; your SSH keys stay on ",go,"."]})}),n.state.profiles.map(v=>c.jsx(uT,{profile:v,status:n.status(v.id),edit:()=>h({profile:v,isNew:!1})},v.id))]}),c.jsxs("div",{children:[c.jsx(ey,{title:"In your account",children:t.isSignedIn?c.jsx(ke,{title:"Refresh",icon:"arrow.clockwise",onClick:()=>{r.refresh()}}):null}),t.isSignedIn?g.length===0&&m.length===0?c.jsx("div",{style:{...B("callout"),color:"var(--secondary)"},children:"No other computers in your account yet."}):null:c.jsxs("div",{style:{...B("callout"),color:"var(--secondary)"},children:["Sign in to reach the other computers in your account from ",go,"."]}),g.map(v=>{const _=e.store(v.id);if(!_)return null;const S=r.computers.find(b=>b.computerId===v.id),w=!!S&&r.isOlderCopy(S)&&_.connection.kind!=="unauthorized";return c.jsx("div",{className:"settings-card settings-appear",children:c.jsxs("div",{className:"settings-row",children:[c.jsx(Va,{computer:_.computer,size:22}),c.jsxs("div",{className:"settings-stack",children:[c.jsx("span",{style:B("callout","medium"),children:_.hostName}),c.jsx("span",{style:{...B("caption"),color:w?"var(--warning)":"var(--secondary)"},children:w?`Older copy of this computer · ${n2(_)}`:n2(_)})]}),c.jsx(aT,{store:_}),c.jsx("span",{style:{flex:1}}),c.jsx(ke,{title:`Remove from ${go}`,icon:"minus.circle",onClick:()=>e.detach(v.id)})]})},v.id)}),m.map(v=>c.jsx("div",{className:"settings-card settings-appear",children:c.jsxs("div",{className:"settings-row",children:[c.jsx(Va,{computer:{id:v.computerId,name:v.name,signKey:v.signKey,urls:[],device:v.device??null},size:22}),c.jsxs("div",{className:"settings-stack",children:[c.jsx("span",{style:B("callout","medium"),children:v.name}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:v.online?"Online":"Offline"})]})]})},v.computerId))]})]}),c.jsx($t,{open:l!==null,onClose:()=>h(null),width:460,children:l?c.jsx(dT,{profile:l.profile,isNew:l.isNew},l.profile.id):null})]})}function aT({store:e}){if(e.connection.kind!=="online"||!e.hostRoute||e.hostRoute==="loopback")return null;const t=e.hostRoute==="relay";return c.jsx("span",{title:t?"Through Cloudflare (encrypted)":"Direct: Wi-Fi or Tailscale","aria-label":t?"Through Cloudflare":"Wi-Fi or Tailscale",style:{display:"flex",color:"var(--tertiary)"},children:c.jsx(ae,{name:t?"cloud":"wifi",size:12})})}const lT=go==="this Mac"?"This Mac":"This computer";function oT({store:e,ssh:t}){const n=ns(),r=Ya();cn(e);const[l,h]=x.useState(null),[d,p]=x.useState(!1),[g,m]=x.useState(!1),[v,_]=x.useState(!1),[S,w]=x.useState(null),[b,k]=x.useState(!1),[E,j]=x.useState(!1),V=e.cloud,A=V?.approval==="auto",z=e.connection.kind==="online",F=e.hostName,D=M=>{p(!0),M().finally(()=>p(!1))},I=x.useCallback(async()=>{const M=Hh(e);if(M)try{h((await M.call("devices")).devices)}catch{}},[e]);x.useEffect(()=>{I()},[I,z,e.accessRequests.length]);const q=M=>D(async()=>{try{await(await e.ready()).call("setApproval",{approval:M})}catch(N){e.setError(Wa(N))}}),U=V?.enabled?V.lastError??(V.connected?"Reachable from anywhere through Cloudflare (encrypted).":"Connecting to Cloudflare…"):"Off: only Wi-Fi and Tailscale reach it, nothing goes through Cloudflare.",Y=V?.owner??null,$=c.jsxs("div",{className:"settings-row",style:{gap:8},children:[c.jsx(ae,{name:Y?"person.crop.circle.badge.checkmark":"person.crop.circle.badge.plus",size:13,color:"var(--secondary)"}),c.jsx("span",{style:{...B("callout"),flex:1},children:Y?Y.userId===r.user?.userId?"In your account":`In ${Y.email??"another"} account`:r.isSignedIn?"Not in your account":"Sign in to add it to your account"}),Y?c.jsx(Fe,{kind:"secondary",onClick:()=>k(!0),disabled:d||!z,children:"Remove from account"}):r.isSignedIn?c.jsx(Fe,{kind:"secondary",onClick:()=>D(async()=>{await n.cloud.claim(e)}),disabled:d||!z,children:d?"Adding…":"Add to account"}):null]});return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:28},children:[c.jsx(Ee,{children:[c.jsxs("div",{className:"settings-row",children:[c.jsx(Va,{computer:e.computer,size:26}),c.jsxs("div",{className:"settings-stack",style:{flex:1},children:[c.jsx("span",{style:B("headline"),children:F}),c.jsxs("span",{style:{...B("caption"),color:"var(--secondary)"},children:[t?"Over SSH":lT," · ",n2(e)]})]}),t?c.jsx(ke,{title:"Voice chat",icon:"waveform",selected:v,disabled:!z,onClick:()=>_(M=>!M)}):null,c.jsx(ke,{title:"Pair iPhone",icon:"qrcode",selected:g,disabled:!z,onClick:()=>m(M=>!M)})]},"header"),c.jsx(rn,{on:V?.enabled??!1,disabled:d||!z,onChange:M=>D(()=>n.cloud.setCloud(e,M)),children:c.jsxs("span",{className:"settings-stack",children:[c.jsx("span",{children:"Reach from anywhere"}),c.jsx("span",{style:{...B("caption"),color:V?.lastError?"var(--warning)":"var(--secondary)"},children:U})]})},"cloud"),$,...Y?[c.jsx(rn,{on:A,disabled:d||!z,onChange:M=>M?j(!0):q("code"),children:c.jsxs("span",{className:"settings-stack settings-appear",children:[c.jsx("span",{children:"Skip the 6-digit check"}),c.jsx("span",{style:{...B("caption"),color:A?"var(--warning)":"var(--secondary)"},children:A?"Devices on your account get in on their own.":"Each new device shows a code you approve here."})]})},"approval")]:[]]}),c.jsx(Ee,{title:`Devices that can use ${F}`,children:l===null?[c.jsx(et,{},"loading")]:[...l.length===0?[c.jsx("span",{style:{color:"var(--secondary)"},children:"None yet. Pair an iPhone, or approve one from your account."},"none")]:[],...l.map(M=>c.jsxs("div",{className:"settings-row settings-appear",style:{gap:8},children:[c.jsx("span",{style:{width:18,display:"flex",justifyContent:"center",color:"var(--secondary)"},children:c.jsx(ae,{name:M.platform==="macos"?"laptopcomputer":"iphone",size:13})}),c.jsxs("div",{className:"settings-stack",style:{flex:1},children:[c.jsx("span",{children:M.name}),c.jsx("span",{style:{...B("caption"),color:"var(--tertiary)"},children:cT(M)})]}),c.jsx(ke,{title:"Revoke access",icon:"xmark.circle",onClick:()=>w(M)})]},M.key))]}),c.jsx($t,{open:v,onClose:()=>_(!1),children:c.jsx(en.Provider,{value:e,children:c.jsx(d1,{})})}),c.jsxs($t,{open:g,onClose:()=>m(!1),width:340,children:[c.jsx(Lt,{title:`Pair iPhone with ${F}`}),c.jsx(hT,{store:e})]}),c.jsx(ts,{open:S!==null,title:`Revoke ${S?.name??"device"}?`,message:"It disconnects right away and has to pair or ask again.",actions:S?[{title:"Revoke access",destructive:!0,action:()=>D(async()=>{try{await(await e.ready()).call("revokeDevice",{key:S.key})}catch(M){e.setError(Wa(M))}await I()})}]:[],onClose:()=>w(null)}),c.jsx(ts,{open:E,title:"Let account devices in without a code?",message:`Any device signed in to your account gets full control of ${F}: its files, terminals and bots, with no check here. If someone gets into your account, or Codync's cloud is ever compromised, they could add their own device and you'd have no chance to stop it. Devices paired with a QR code aren't affected.`,actions:[{title:"Skip the check",destructive:!0,action:()=>q("auto")}],onClose:()=>j(!1)}),c.jsx(ts,{open:b,title:`Remove ${F} from the account?`,message:"Devices that were approved through the account lose access. Devices paired with a QR code keep it.",actions:[{title:"Remove from account",destructive:!0,action:()=>D(()=>n.cloud.unclaim(e))}],onClose:()=>k(!1)})]})}function cT(e){const t=[e.source==="account"?"Approved through the account":"Paired with a QR code"];return e.connected?t.push("connected"):e.lastSeenAt&&t.push(`seen ${YS(new Date(e.lastSeenAt))}`),t.join(" · ")}function hT({store:e}){cn(e);const[t,n]=x.useState(null),[r,l]=x.useState(null),[h,d]=x.useState(null),p=e.hostName,g=x.useCallback(async()=>{const v=Hh(e);if(!v)return d(`${e.hostName} isn't connected.`);try{const _=await v.call("pairing");l(await Kx.toDataURL(_.pairingUrl,{errorCorrectionLevel:"M",margin:0,width:400,color:{dark:"#000000",light:"#ffffff"}})),n(_),d(null)}catch(_){d(Wa(_))}},[e]);x.useEffect(()=>{g()},[g]),x.useEffect(()=>{if(!t?.expiresAt)return;const v=setTimeout(()=>{g()},Math.max(1e3,t.expiresAt-Date.now()));return()=>clearTimeout(v)},[t?.expiresAt,g]);const m={...B("caption"),textAlign:"center"};return c.jsx("div",{style:{padding:16,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:t&&r?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"settings-appear",style:{padding:10,background:"#fff",borderRadius:12},children:c.jsx("img",{src:r,alt:`Pairing code for ${p}`,width:200,height:200,style:{display:"block",imageRendering:"pixelated"}})}),c.jsx("div",{style:{...m,color:"var(--secondary)"},children:"Scan with the Codync app or the iPhone Camera. No Tailscale or open ports needed: your iPhone connects directly on the same Wi-Fi, and through the encrypted relay anywhere else."}),e.cloud?.enabled!==!0?c.jsx("div",{style:{...m,color:"var(--warning)"},children:t.urls.length===0?"No network address found and “Reach from anywhere” is off. Connect to Wi-Fi or turn it on.":`“Reach from anywhere” is off, so the iPhone only reaches ${p} on the same network.`}):null,c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[t.expiresAt?c.jsxs("span",{style:{...B("caption2"),color:"var(--tertiary)"},children:["Works once, until ",new Date(t.expiresAt).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})]}):null,c.jsx(ke,{title:"New code",icon:"arrow.clockwise",onClick:()=>{g()}}),c.jsx(ke,{title:"Copy pairing link",icon:"doc.on.doc",onClick:()=>window.codync.app.copy(t.pairingUrl)})]})]}):h?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{...m,color:"var(--danger)"},children:h}),c.jsx(ke,{title:"Try again",icon:"arrow.clockwise",onClick:()=>{g()}})]}):c.jsx(et,{size:20})})}function uT({profile:e,status:t,edit:n}){const r=eu(),l=`${e.user?`${e.user}@`:""}${e.host}${e.port!==null?`:${e.port}`:""}`,h=(()=>{switch(t.kind){case"idle":return`${l} · Not connected`;case"connecting":return t.step;case"confirmHostKey":return`${l} · Confirm the host key`;case"connected":return`${l} · Connected`;case"retrying":return`${t.message} Retrying…`;case"failed":return t.message;case"notInstalled":return`codync-host isn't installed on ${e.host}. Install it there:`}})(),d=t.kind==="retrying"||t.kind==="failed"||t.kind==="notInstalled",p=t.kind==="connected"||t.kind==="connecting"||t.kind==="retrying";return c.jsxs("div",{className:"settings-card settings-appear",children:[c.jsxs("div",{className:"settings-row",children:[c.jsx("span",{style:{width:22,display:"flex",justifyContent:"center",color:"var(--secondary)"},children:c.jsx(ae,{name:"terminal",size:13})}),c.jsxs("div",{className:"settings-stack",style:{flex:1},children:[c.jsx("span",{style:B("callout","medium"),children:e.name||e.host}),c.jsx("span",{style:{...B("caption"),color:d?"var(--warning)":"var(--secondary)"},children:h})]}),p?c.jsx(ke,{title:"Disconnect",icon:"stop.circle",onClick:()=>r?.disconnect(e.id)}):c.jsx(ke,{title:"Connect",icon:"arrow.clockwise",onClick:()=>r?.connect(e.id)}),c.jsx(ke,{title:"Edit",icon:"pencil",onClick:n}),c.jsx(ke,{title:"Remove",icon:"trash",onClick:()=>r?.remove(e.id)})]}),c.jsx($a,{show:t.kind==="confirmHostKey",children:t.kind==="confirmHostKey"?c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[c.jsxs("span",{style:{...B("caption"),color:"var(--secondary)"},children:["First connection to ",t.name,". Check that its host key fingerprint matches what the computer's owner sees (",c.jsx("code",{style:{fontFamily:"var(--mono)"},children:"ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub"}),")."]}),t.fingerprints.map(g=>c.jsx("span",{className:"selectable",style:B("caption",void 0,"monospaced"),children:g},g)),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsx(Fe,{onClick:()=>r?.trustHostKey(e.id),children:"Trust and connect"}),c.jsx(Fe,{kind:"secondary",onClick:()=>r?.disconnect(e.id),children:"Cancel"})]})]}):null}),c.jsx($a,{show:t.kind==="notInstalled",children:c.jsxs("div",{className:"settings-row",style:{gap:6},children:[c.jsx("span",{className:"settings-code selectable",children:D3}),c.jsx(ke,{title:"Copy install command",icon:"doc.on.doc",onClick:()=>window.codync.app.copy(D3)})]})})]})}function dT({profile:e,isNew:t}){const n=ss(),[r,l]=x.useState(e),[h,d]=x.useState(e.port?.toString()??""),[p,g]=x.useState(String(e.remotePort)),[m,v]=x.useState(e.user??""),[_,S]=x.useState(null),w=eu(),b=async()=>{const E=D=>/^-?\d+$/.test(D),j=h.trim();if(j&&!E(j))return S("The SSH port must be a number.");const V=p.trim();if(!E(V))return S("The Codync port must be a number.");const A=m.trim(),z={...r,host:r.host.trim(),name:r.name.trim(),user:A||null,port:j?Number(j):null,remotePort:Number(V)},F=w?await w.save(z):"SSH computers need a newer build of Codync.";if(F)return S(F);n()},k=(E,j,V,A)=>c.jsxs("div",{className:"settings-row",style:{gap:12},children:[c.jsx("span",{style:{color:"var(--text)"},children:E}),c.jsx("input",{className:"settings-field","aria-label":E,placeholder:A,value:j,spellCheck:!1,onChange:z=>V(z.target.value)})]});return c.jsxs("div",{style:{width:460,display:"flex",flexDirection:"column"},onKeyDown:E=>E.key==="Enter"&&E.target instanceof HTMLInputElement&&void b(),children:[c.jsx(Lt,{title:t?"Add SSH computer":"Edit SSH computer",trailing:c.jsx(ke,{title:t?"Add":"Save",icon:"checkmark",onClick:()=>{b()}})}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"4px 20px 20px"},children:[c.jsxs(Ee,{children:[k("Name",r.name,E=>l({...r,name:E}),"Optional"),k("Host",r.host,E=>l({...r,host:E}),"SSH alias or hostname"),k("User",m,v,"From SSH config"),k("SSH port",h,d,"From SSH config"),c.jsxs("div",{className:"settings-row",children:[c.jsx("span",{children:"Key"}),c.jsx("span",{style:{flex:1}}),c.jsx("span",{style:{color:"var(--secondary)"},children:r.identityFile?.split("/").pop()??"ssh-agent / SSH config"}),c.jsx(ke,{title:"Choose key file",icon:"key",onClick:()=>{w?.chooseKey().then(E=>E&&l(j=>({...j,identityFile:E})))}}),r.identityFile?c.jsx("span",{className:"settings-appear",style:{display:"flex"},children:c.jsx(ke,{title:"Use ssh-agent",icon:"xmark.circle",onClick:()=>l({...r,identityFile:null})})}):null]}),k("Codync port",p,g,"")]}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:"Codync opens an SSH tunnel to codync-host on that computer's loopback. It uses your SSH config and ssh-agent; agent forwarding stays off."}),c.jsx($a,{show:_!==null,children:c.jsx("span",{style:{...B("caption"),color:"var(--danger)"},children:_})})]})]})}function Yx(e){return e==="claude"?"#D97757":Co()?"#FFFFFF":"#000000"}const Gx=e=>e==="claude"?"#D97757":"var(--accent)",Zx=e=>["claude","codex"].includes(e)?`${e}-acp`:e,Xx=e=>e==="codex"?"hex":"blob",Qx=e=>e.windows.reduce((t,n)=>!t||n.percent>t.percent?n:t,null);function Jx(e){return e.label==="5-hour"?"Session":e.label.split(" · ")[1]??e.label}const fT=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function pT(e,t=new Date){const n=/^(?:(\w{3}) (\d{1,2}) at )?(\d{1,2})(?::(\d{2}))?(am|pm)(?: \(([^)]+)\))?$/.exec(e);if(!n)return null;const r=n[6],l=gT(t,r);let h=l.month,d=l.day;if(n[1]){const _=fT.indexOf(n[1]);if(_<0)return null;h=_+1,d=Number(n[2])}const p=Number(n[3])%12+(n[5]==="pm"?12:0),g=n[4]?Number(n[4]):0,m=(_,S,w)=>mT(_,S,w,p,g,r);let v=m(l.year,h,d);return(v.getTime()<t.getTime()-864e5||!n[1]&&v<t)&&(v=n[1]?m(l.year+1,h,d):new Date(v.getTime()+864e5)),v}function gT(e,t){try{const n=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"numeric",day:"numeric"}),r=Object.fromEntries(n.formatToParts(e).map(l=>[l.type,l.value]));return{year:Number(r.year),month:Number(r.month),day:Number(r.day)}}catch{return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}}function mT(e,t,n,r,l,h){const d=Date.UTC(e,t-1,n,r,l);try{const p=new Intl.DateTimeFormat("en-US",{timeZone:h,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}),g=Object.fromEntries(p.formatToParts(new Date(d)).map(v=>[v.type,v.value])),m=Date.UTC(Number(g.year),Number(g.month)-1,Number(g.day),Number(g.hour),Number(g.minute));return new Date(d-(m-d))}catch{return new Date(e,t-1,n,r,l)}}function ew(e){return e.resetsAt?new Date(e.resetsAt):e.resetsText?pT(e.resetsText):null}function tw(e,t=new Date){const n=Math.max(0,(e.getTime()-t.getTime())/1e3),r=Math.floor(n/3600),l=Math.floor(n%3600/60);return r>=48?`${Math.floor(r/24)}d`:r>0?`${r}h ${l}m`:`${l}m`}function vT(e){const t=ew(e);return t?`resets in ${tw(t)}`:e.resetsText?`resets ${e.resetsText.replace(/ \(.*\)$/,"")}`:null}function _T({provider:e,size:t,style:n="character"}){const r=(Qx(e)?.percent??0)>=90;return n==="original"?c.jsx("span",{style:{width:t,height:t,display:"grid",placeItems:"center",flex:"none"},children:c.jsx(wS,{registry:Zx(e.id),size:t*.84,color:Gx(e.id)})}):c.jsxs("span",{style:{position:"relative",width:t,height:t,flex:"none",display:"block"},children:[c.jsx(nn,{shape:Xx(e.id),color:"",tint:Yx(e.id),size:t,mood:r?"needsInput":"idle"}),r?c.jsx("span",{style:{position:"absolute",top:-t*.12,right:-t*.12,display:"flex",color:"var(--danger)",background:"#fff",borderRadius:"50%"},children:c.jsx(ae,{name:"exclamationmark.circle.fill",size:t*.34,weight:"bold",scaled:!1})}):null]})}const A3=new Map;function yT(e,t,n,r){const h=document.createElement("canvas");h.width=t*2,h.height=t*2;const d=h.getContext("2d");d.scale(2,2);const p=e.id==="claude"?"#D97757":r?"#FFFFFF":"#000000";if(n==="original"){const m=l1(Zx(e.id));if(!m)return null;const v=A3.get(m);if(!v){const S=new Image;return S.src=m,S.onload=()=>A3.set(m,S),null}const _=t*.08;return d.drawImage(v,_,_,t-_*2,t-_*2),d.globalCompositeOperation="source-in",d.fillStyle=p,d.fillRect(0,0,t,t),h.toDataURL("image/png")}const g=(Qx(e)?.percent??0)>=90;return K2(d,{shape:Xx(e.id),fill:p,size:t,mood:g?"needsInput":"idle",dark:r,t:0,still:!0}),g&&(d.beginPath(),d.arc(t*.92,t*.08,t*.17,0,Math.PI*2),d.fillStyle=r?"#F0A7A7":"#C23A2B",d.fill()),h.toDataURL("image/png")}function ST({usage:e}){const[t]=ni(Dt.usageIconStyle);return c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:18},children:e.providers.map(n=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx(_T,{provider:n,size:18,style:t}),c.jsx("span",{style:{...B(13,"semibold"),color:"var(--text)"},children:n.name})]}),n.windows.map(r=>c.jsxs("div",{style:{...B(12),display:"flex",alignItems:"center",gap:10,whiteSpace:"nowrap"},children:[c.jsx("span",{style:{width:64,flex:"none",overflow:"hidden",textOverflow:"ellipsis",color:"var(--text)"},children:Jx(r)}),c.jsx(xT,{percent:r.percent,tint:Gx(n.id)}),c.jsxs("span",{style:{width:36,flex:"none",textAlign:"right",fontVariantNumeric:"tabular-nums",color:"var(--text)"},children:[Math.round(r.percent),"%"]}),c.jsx("span",{style:{width:130,flex:"none",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",color:"var(--secondary)"},children:vT(r)??""})]},r.id))]},n.id))})}function xT({percent:e,tint:t}){const n=e>=90?"var(--danger)":e>=70?"var(--warning)":t;return c.jsx("span",{style:{flex:1,minWidth:0,height:6,borderRadius:3,background:"var(--bubble-agent)",overflow:"hidden"},children:c.jsx("span",{style:{display:"block",height:"100%",borderRadius:3,background:n,width:`${Math.min(1,Math.max(.02,e/100))*100}%`,transition:"width var(--layout)"}})})}const q2=KS?"This Mac":"This computer",N3=[{id:"general",title:"General",group:"Personal",icon:"gearshape"},{id:"computers",title:"Computers & devices",label:"Computers",group:q2,icon:"desktopcomputer"},{id:"voice",title:"Voice chat",group:"Personal",icon:"waveform"},{id:"usage",title:"Usage",group:"Personal",icon:"gauge.with.dots.needle.33percent"},{id:"updates",title:"Updates",group:q2,icon:"arrow.down.circle"}];function wT({page:e}){const[t,n]=x.useState(e),r=ns(),l=ss(),h=N3.find(d=>d.id===t);return c.jsxs("div",{className:"settings",children:[c.jsx("nav",{className:"settings-sidebar",children:["Personal",q2].map(d=>c.jsxs("div",{style:{display:"contents"},children:[c.jsx("div",{className:"settings-group",style:{paddingTop:d==="Personal"?0:16},children:d}),N3.filter(p=>p.group===d).map(p=>c.jsxs("button",{className:`settings-item ${p.id===t?"selected":""}`,"aria-selected":p.id===t,onClick:()=>n(p.id),children:[c.jsx("span",{style:{width:18,display:"flex",justifyContent:"center",color:"var(--secondary)"},children:c.jsx(ae,{name:p.icon,size:13})}),c.jsx("span",{style:{flex:1,minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.label??p.title}),p.id==="computers"&&r.approvals.length>0?c.jsx("span",{style:{...B(11,"semibold"),color:"var(--secondary)"},children:r.approvals.length}):null]},p.id))]},d))}),c.jsx("div",{className:"settings-divider"}),c.jsxs("div",{className:"settings-main",children:[c.jsx("div",{style:{...B(24,"semibold"),color:"var(--text)",padding:"30px 32px 8px"},children:h.title}),c.jsx("div",{className:"settings-page",children:c.jsx(bT,{page:t})},t)]}),c.jsx("span",{className:"settings-close",children:c.jsx(ke,{title:"Close",icon:"xmark",onClick:l})})]})}function bT({page:e}){const t=ns();switch(e){case"general":return c.jsx(CT,{});case"computers":return c.jsx(rT,{});case"voice":return t.local?c.jsx(en.Provider,{value:t.local,children:c.jsx(d1,{showsHeader:!1})}):c.jsx(hi,{children:c.jsxs("span",{style:{color:"var(--secondary)"},children:["Voice keys are kept by ",go,"'s host, which isn't running."]})});case"usage":return c.jsx(hi,{children:c.jsx(kT,{})});case"updates":return c.jsx(ET,{})}}function CT(){const e=Ya(),[t,n]=ni(Dt.textSize),[r,l]=ni(Dt.usageIconStyle),[h,d]=ni(Dt.sidebarCompact),[p,g]=x.useState(!0);x.useEffect(()=>{window.codync.app.showInDock().then(g)},[]);const[m,v]=x.useState(!1);return x.useEffect(()=>{window.codync.app.launchAtLogin().then(v)},[]),c.jsxs(hi,{children:[c.jsx(Ee,{title:"Account",footer:e.errorMessage,children:c.jsxs("div",{className:"settings-row",children:[c.jsx(ae,{name:"person.crop.circle",size:26,color:"var(--secondary)"}),c.jsxs("div",{className:"settings-stack",style:{flex:1},children:[c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.isSignedIn?e.user?.email??"Signed in":"Not signed in"}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:e.isSignedIn?"Reach your computers from anywhere":"Sign in to reach your computers from anywhere"})]}),e.isSignedIn?c.jsx(Fe,{kind:"secondary",onClick:()=>{e.signOut()},disabled:e.isBusy,children:e.isBusy?"Please wait…":"Sign out"}):c.jsxs(c.Fragment,{children:[c.jsx(Fe,{kind:"secondary",onClick:()=>{e.signIn("apple")},disabled:e.isBusy,children:"Apple"}),c.jsx(Fe,{kind:"secondary",onClick:()=>{e.signIn("google")},disabled:e.isBusy,children:"Google"})]})]})}),c.jsxs(Ee,{title:"Appearance",children:[c.jsx(Jt,{label:"Text size",children:c.jsx(Ci,{selection:t,options:Uf.map(_=>({id:_,label:_===Ua?`${_} pt (Default)`:`${_} pt`})),onChange:n})}),c.jsx(Jt,{label:"Usage icons",children:c.jsx(Ci,{selection:r,options:[{id:"character",label:"Character"},{id:"original",label:"Original"}],onChange:l})}),c.jsx(rn,{on:h,onChange:d,children:"Compact sidebar"})]}),c.jsxs(Ee,{title:"System",children:[window.codync.platform==="darwin"?c.jsx(rn,{on:p,onChange:_=>{window.codync.app.setShowInDock(_).then(g)},children:"Show in Dock"}):null,c.jsx(rn,{on:m,onChange:_=>{window.codync.app.setLaunchAtLogin(_).then(v)},children:"Open at login"})]})]})}function kT(){const e=ns(),t=e.computers.flatMap(r=>e.store(r.id)??[]),n=t.filter(r=>r.usage.providers.length>0);return n.length===0?c.jsx("span",{style:{color:"var(--secondary)"},children:"No usage information yet."}):c.jsx(c.Fragment,{children:n.flatMap(r=>[t.length>1?c.jsxs("div",{style:{...B("headline"),display:"flex",alignItems:"center",gap:6},children:[c.jsx(Va,{computer:r.computer,size:16}),r.hostName]},`${r.computer.id}-label`):null,c.jsx(ST,{usage:r.usage},r.computer.id)])})}function ET(){const[e,t]=x.useState(null);if(x.useEffect(()=>(window.codync.updates.state().then(t),window.codync.updates.onChange(t)),[]),!e)return null;const n=e.supported?e.waitingForApp?`Waiting for iPhone app ${e.waitingForApp} to pass App Store review.`:null:"Updates are available in release builds.",r=e.lastCheck?`Last checked ${new Date(e.lastCheck).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}`:null;return c.jsx(hi,{children:c.jsx(Ee,{title:"Codync",footer:n,children:[c.jsx(Jt,{label:"Version",detail:r,children:c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10},children:[c.jsx("span",{children:window.codync.appVersion}),c.jsx(Fe,{kind:"secondary",onClick:()=>window.codync.updates.check(),disabled:!e.canCheck&&!e.staged,children:e.availableVersion?`Update to ${e.availableVersion}`:"Check for updates"})]})},"version"),c.jsx(rn,{on:e.autoCheck,onChange:l=>window.codync.updates.setAutoCheck(l),disabled:!e.supported,children:"Automatically check for updates"},"check"),c.jsx(rn,{on:e.autoDownload,onChange:l=>window.codync.updates.setAutoDownload(l),disabled:!e.supported,children:"Automatically download and install"},"download"),...e.error?[c.jsxs("div",{className:"settings-row settings-appear",children:[c.jsx("span",{style:{flex:1,color:"var(--warning)"},children:e.error}),c.jsx(Fe,{kind:"secondary",onClick:()=>window.codync.updates.check(),disabled:e.checking,children:"Retry"})]},"error")]:[]]})})}function MT({approval:e}){const t=ns(),[n,r]=x.useState(!1),[l,h]=x.useState(null),d=e.request,p=async m=>{r(!0);try{await t.decide(e,m),t.deferApproval(e)}catch(v){h(Wa(v))}finally{r(!1)}},g={textAlign:"center"};return c.jsxs("div",{style:{width:420,display:"flex",flexDirection:"column"},children:[c.jsx(Lt,{title:"Access request"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:16,padding:"0 24px 24px"},children:[c.jsx(ae,{name:d.platform==="macos"?"laptopcomputer":"iphone",size:40,weight:"light",color:"var(--secondary)"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:4},children:[c.jsxs("div",{style:{...B("title3","semibold"),...g},children:[d.deviceName," wants to use ",e.store.hostName]}),d.email?c.jsxs("div",{style:{...B("callout"),color:"var(--secondary)"},children:["Signed in as ",d.email]}):null]}),d.code?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"selectable settings-appear",style:{...B(48,"semibold","monospaced"),color:"var(--text)"},"aria-label":`Code ${d.code.split("").join(" ")}`,children:L9(d.code)}),c.jsxs("div",{style:{...B("callout"),color:"var(--secondary)",...g},children:["Approve only if ",d.deviceName," shows exactly this code. If it doesn't, deny: someone may be trying to get in."]})]}):c.jsxs(c.Fragment,{children:[c.jsx(et,{}),c.jsxs("div",{style:{...B("callout"),color:"var(--secondary)"},children:["Waiting for ",d.deviceName," to show its code…"]})]}),c.jsx($a,{show:l!==null,children:c.jsx("div",{style:{...B("caption"),color:"var(--danger)",...g},children:l})}),c.jsxs("div",{style:{display:"flex",gap:12},children:[c.jsx(Fe,{kind:"secondary",onClick:()=>{p(!1)},disabled:n,children:"Deny"}),c.jsx(Fe,{onClick:()=>{p(!0)},disabled:n||!d.code,children:"Approve"})]})]})]})}const iw="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%3e%3cpath%20fill='%23EA4335'%20d='M24%209.5c3.54%200%206.71%201.22%209.21%203.6l6.85-6.85C35.9%202.38%2030.47%200%2024%200%2014.62%200%206.51%205.38%202.56%2013.22l7.98%206.19C12.43%2013.72%2017.74%209.5%2024%209.5z'/%3e%3cpath%20fill='%234285F4'%20d='M46.98%2024.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58%202.96-2.26%205.48-4.78%207.18l7.73%206c4.51-4.18%207.09-10.36%207.09-17.65z'/%3e%3cpath%20fill='%23FBBC05'%20d='M10.53%2028.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92%2016.46%200%2020.12%200%2024c0%203.88.92%207.54%202.56%2010.78l7.97-6.19z'/%3e%3cpath%20fill='%2334A853'%20d='M24%2048c6.48%200%2011.93-2.13%2015.89-5.81l-7.73-6c-2.15%201.45-4.92%202.3-8.16%202.3-6.26%200-11.57-4.22-13.47-9.91l-7.98%206.19C6.51%2042.62%2014.62%2048%2024%2048z'/%3e%3c/svg%3e",Bf=window.codync.platform==="darwin"?"Mac":"computer";function jT({onContinue:e}){const t=Ya(),n=Ka(),[r,l]=x.useState(n?4:0);if(x.useEffect(()=>{t.isSignedIn&&e()},[t.isSignedIn,e]),x.useEffect(()=>{if(n)return l(4);const d=[150,430,710,990].map((p,g)=>setTimeout(()=>l(g+1),p));return()=>d.forEach(clearTimeout)},[n]),!t.isReady)return c.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:14},children:[c.jsx(et,{size:24}),c.jsx("div",{style:{...B("callout"),color:"var(--secondary)"},children:"Checking for a saved account…"}),c.jsxs("button",{style:{color:"var(--secondary)"},onClick:e,children:["Continue on this ",Bf]})]});const h=d=>({opacity:d?1:0,transform:d?"none":"translateY(14px)",transition:"opacity 0.6s cubic-bezier(0.34, 1.3, 0.64, 1), transform 0.6s cubic-bezier(0.34, 1.3, 0.64, 1)"});return c.jsx("div",{style:{height:"100%",overflowY:"auto",background:"var(--background)"},children:c.jsxs("div",{style:{minHeight:"100%",maxWidth:480,margin:"0 auto",display:"flex",flexDirection:"column",padding:"0 24px 12px"},children:[c.jsx("div",{style:{flex:1,minHeight:24}}),c.jsx(RT,{shown:r>=1}),c.jsx("div",{style:{flex:1,minHeight:24}}),c.jsx("div",{style:{paddingBottom:24},children:c.jsx(DT,{shown:r>=2})}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,...h(r>=3)},children:[c.jsxs("div",{style:{fontSize:34,fontWeight:600,letterSpacing:-.6,color:"var(--text)",lineHeight:1.15},children:["Your coding agents,",c.jsx("br",{}),"as teammates."]}),c.jsx("div",{style:{...B("body"),color:"var(--secondary)"},children:"Give each one a name and a project. They work on your computer while you're away."})]}),c.jsx("div",{style:{flex:1,minHeight:32}}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,...h(r>=4)},children:[c.jsxs(Fe,{onClick:e,style:{...B("headline"),minHeight:50,width:"100%"},children:["Continue on this ",Bf]}),c.jsx(Fe,{onClick:()=>{t.signIn("apple")},disabled:!t.isConfigured||t.isBusy,style:{...B("headline"),minHeight:50,width:"100%"},children:t.isBusy?c.jsx(et,{size:18}):c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10},children:[c.jsx(ae,{name:"apple.logo",size:20}),"Continue with Apple"]})}),c.jsx(Fe,{kind:"secondary",onClick:()=>{t.signIn("google")},disabled:!t.isConfigured||t.isBusy,style:{...B("headline"),minHeight:50,width:"100%"},children:t.isBusy?c.jsx(et,{size:18}):c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10},children:[c.jsx("img",{src:iw,alt:"",width:20,height:20}),"Continue with Google"]})}),t.isConfigured?null:c.jsxs("div",{style:{...B("footnote"),color:"var(--tertiary)"},children:["Sign-in isn't configured in this build. You can still use Codync on this ",Bf,"."]}),t.errorMessage?c.jsx("div",{style:{...B("footnote"),color:"var(--warning)"},children:t.errorMessage}):null]})]})})}const TT=[{shape:"blob",color:"blue",size:92,x:0,y:0,mood:"working"},{shape:"squircle",color:"orange",size:64,x:-104,y:-34,mood:"idle"},{shape:"teardrop",color:"violet",size:58,x:100,y:-46,mood:"working"},{shape:"hex",color:"green",size:48,x:-76,y:64,mood:"idle"},{shape:"cloud",color:"magenta",size:52,x:84,y:58,mood:"needsInput"}];function RT({shown:e}){const t=Ka(),[n,r]=x.useState(0);return x.useEffect(()=>{if(t||!e)return;let l=0;const h=d=>{r(d/1e3),l=requestAnimationFrame(h)};return l=requestAnimationFrame(h),()=>cancelAnimationFrame(l)},[t,e]),c.jsx("div",{"aria-hidden":!0,style:{position:"relative",height:170},children:TT.map((l,h)=>c.jsx("div",{style:{position:"absolute",left:"50%",top:"50%",transform:`translate(calc(-50% + ${l.x}px), calc(-50% + ${l.y+(t?0:Math.sin(n*1.3+h*1.7)*5)}px)) scale(${e?1:.3})`,opacity:e?1:0,transition:`opacity 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) ${h*.07}s, scale 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) ${h*.07}s`},children:c.jsx(nn,{shape:l.shape,color:l.color,size:l.size,mood:l.mood})},l.shape))})}function DT({shown:e}){const t=Ka(),[n,r]=x.useState(!1);x.useEffect(()=>{if(!e)return;const h=setTimeout(()=>r(!0),t?0:1600);return()=>clearTimeout(h)},[e,t]);const l={opacity:e?1:0,transform:e?"none":"translateY(14px)",transition:"opacity 0.6s, transform 0.6s cubic-bezier(0.34, 1.3, 0.64, 1)"};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[c.jsx("div",{style:{display:"flex",justifyContent:"flex-end",...l},children:c.jsx("span",{style:{...B("subheadline"),color:"var(--text)",padding:"9px 14px",background:"var(--bubble-user)",borderRadius:18},children:"Fix the flaky login test"})}),c.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,...l},children:[c.jsx(nn,{shape:"blob",color:"blue",size:28,mood:n?"idle":"working"}),n?c.jsx("span",{style:{...B("subheadline"),color:"var(--text)",padding:"9px 14px",background:"var(--bubble-agent)",borderRadius:18,animation:"bubble-in 0.45s cubic-bezier(0.34, 1.3, 0.64, 1) both",transformOrigin:"bottom left"},children:"Done. It raced the session refresh; tests pass on fix/login."}):c.jsx("span",{style:{...B("subheadline"),color:"var(--tertiary)"},children:"Working…"})]}),c.jsx("style",{children:"@keyframes bubble-in { from { opacity: 0; transform: scale(0.92) } }"})]})}function L3(){const{user:e,isBusy:t}=Ya();return c.jsxs("span",{className:"profile-avatar","aria-hidden":!0,style:{position:"relative",overflow:"hidden"},children:[e?.avatarURL?c.jsx("img",{src:e.avatarURL,alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}):c.jsx(ae,{name:"person.fill",size:15,weight:"medium",color:"var(--secondary)"}),t?c.jsx("span",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:c.jsx(et,{size:14})}):null]})}function AT({compact:e,approvals:t,onDismiss:n,onUsage:r,onSettings:l}){const[h,d]=x.useState("main"),{user:p,isBusy:g,errorMessage:m}=Ya(),v=p!==null,_=v?[{title:g?"Please wait…":"Sign out",icon:"rectangle.portrait.and.arrow.right",disabled:g,action:()=>{n(),Zn.signOut()}}]:[{title:"Continue with Apple",icon:"apple.logo",disabled:g,action:()=>{n(),Zn.signIn("apple")}},{title:"Continue with Google",icon:"person.crop.circle.badge.plus",image:iw,disabled:g,action:()=>{n(),Zn.signIn("google")}}],S=b=>{n(),window.codync.app.openExternal(b)},w=h==="support"?[{title:"Support",icon:"chevron.left",action:()=>d("main")},{title:"Help & documentation",icon:"book",chevron:!0,action:()=>S("https://github.com/leepokai/codync#readme")},{title:"Report an issue",icon:"bubble.left",chevron:!0,action:()=>S("https://github.com/leepokai/codync/issues")}]:[{title:"Usage",icon:"gauge.with.dots.needle.33percent",chevron:!0,action:r},{title:"Get Codync for mobile",icon:"iphone",action:()=>S("https://apps.apple.com/app/id6760984418")},{title:"Support",icon:"book.closed",chevron:!0,action:()=>d("support")},{title:"Settings",icon:"gearshape",detail:t>0?String(t):null,action:l},..._];return c.jsx("div",{className:"context-layer",onMouseDown:b=>b.target===b.currentTarget&&n(),children:c.jsxs("div",{className:"account-panel",style:{width:Math.min(260,window.innerWidth-32),left:16,bottom:e?68:64},children:[c.jsx(sw,{items:w,onDismiss:n,after:b=>h==="main"&&b===3?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"panel-divider"}),c.jsxs("div",{className:"panel-identity",children:[c.jsx(ae,{name:"person.crop.circle",size:15}),c.jsx("span",{style:{...B(12),flex:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p?.email??"Account"}),v?null:c.jsx("span",{style:B(11),children:"Not signed in"})]})]}):h==="support"&&b===0?c.jsx("div",{className:"panel-divider"}):null}),h==="main"&&m?c.jsx("div",{style:{...B(12),color:"var(--warning)",padding:"8px 10px"},children:m}):null]})})}function sw({items:e,onDismiss:t,after:n,dismissOnActivate:r=!1}){const[l,h]=x.useState(0);return x.useEffect(()=>{const d=p=>{if(p.key==="Escape")p.preventDefault(),t();else if(p.key==="ArrowDown"||p.key==="Tab"&&!p.shiftKey)p.preventDefault(),h(g=>(g+1)%e.length);else if(p.key==="ArrowUp"||p.key==="Tab"&&p.shiftKey)p.preventDefault(),h(g=>(g-1+e.length)%e.length);else if(p.key==="Enter"||p.key===" "){p.preventDefault();const g=e[l];g&&!g.disabled&&(r&&t(),g.action())}};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,l,t,r]),c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:e.map((d,p)=>c.jsxs("div",{children:[c.jsxs("button",{className:`panel-row ${l===p?"highlight":""}`,style:{color:d.destructive?"var(--danger)":"var(--text)"},disabled:d.disabled,onMouseEnter:()=>h(p),onClick:()=>{r&&t(),d.action()},children:[c.jsx("span",{style:{width:20,display:"flex",justifyContent:"center"},children:d.image?c.jsx("img",{src:d.image,alt:"",width:14,height:14}):c.jsx(ae,{name:d.icon,size:14})}),c.jsx("span",{style:{...B(12),flex:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:d.title}),d.detail?c.jsx("span",{style:{...B(13),color:"var(--secondary)"},children:d.detail}):null,d.chevron?c.jsx(ae,{name:"chevron.right",size:11,color:"var(--secondary)"}):null]}),n?.(p)]},d.title))})}function NT({items:e,onDismiss:t,style:n}){const r=e.map(l=>({title:l.title,icon:l.icon??"circle",destructive:l.destructive,action:l.action}));return c.jsx("div",{className:"action-menu",style:n,children:c.jsx(sw,{items:r,onDismiss:t,dismissOnActivate:!0,after:l=>e[l+1]?.divider?c.jsx("div",{className:"panel-divider"}):null})})}const LT=window.codync.platform==="darwin",B3=new Map;function nw(e,t,n,r){const l=`${e}|${Co()}`,h=B3.get(l);if(h)return h;const d=2,p=document.createElement("canvas");p.width=t*d,p.height=n*d;const g=p.getContext("2d");g.scale(d,d),r(g);const m=p.toDataURL("image/png");return B3.set(l,m),m}function BT(e){const t=`bot|${e.id}|${e.avatarShape}|${e.avatarColor}|${e.status}|${e.unread>0}`;return nw(t,20,20,n=>{const r=Co();K2(n,{shape:e.avatarShape,fill:ko(e.avatarColor),size:20,mood:$3(e,!1),dark:r,t:0,still:!0});const l=ln(e)?"#F0A030":e.unread>0?r?"#FFFFFF":"#000000":null;if(l){const h=ln(e)?3.6:2.8;n.beginPath(),n.arc(20-h,20-h,h+1,0,Math.PI*2),n.fillStyle=r?"#1e1e1e":"#f2f2f2",n.fill(),n.beginPath(),n.arc(20-h,20-h,h,0,Math.PI*2),n.fillStyle=l,n.fill()}})}function OT(e,t){const n=Math.round(t.percent);return nw(`bar|${e}|${n}`,60,16,r=>{const l=Co(),h=t.percent>=90?l?"#F0A7A7":"#C23A2B":t.percent>=70?"#F0A030":Yx(e);r.fillStyle=l?"rgba(255,255,255,0.12)":"rgba(0,0,0,0.12)",r.beginPath(),r.roundRect(0,5.5,60,5,2.5),r.fill(),t.percent>0&&(r.fillStyle=h,r.beginPath(),r.roundRect(0,5.5,Math.max(5,60*Math.min(1,t.percent/100)),5,2.5),r.fill())})}function zT(e){const t=ew(e);return`${Jx(e)} · ${Math.round(e.percent)}%${t?` · resets in ${tw(t)}`:""}`}function HT(e){const t=[...e.stores.values()];Y3(t);const[n]=ni(Dt.textSize),[r]=ni(Dt.usageIconStyle);x.useEffect(()=>{const l=setTimeout(()=>{const h=e.local,d=e.roster.filter(v=>!At(v.bot)),p=e.approvals.length?"A device asks for access":e.needsAttention?"A bot needs you":e.working>0?`${e.working} bot${e.working===1?"":"s"} working`:"Connected",g=h?.screen,m={status:p,canPair:!!h,approval:e.approvals[0]?.request.deviceName??null,bots:d.map(v=>({ref:`${v.ref.computerId}/${v.ref.botId}`,name:e.computers.length>1?`${v.bot.name} · ${v.computer.name}`:v.bot.name,detail:ln(v.bot)?"Needs your response":Jn(v.bot)?v.bot.activity||"Working…":v.bot.lastMessage??bo(v.bot),working:Jn(v.bot),avatar:BT(v.bot)})),usage:(h?.usage.providers??[]).map(v=>({name:v.name,icon:yT(v,16,r,Co()),lines:v.windows.map(_=>({title:zT(_),bar:OT(v.id,_)}))})),screen:g?{enabled:g.enabled,subtitle:IT(e),needsLoginItem:e.screenNeedsApproval,needsCapture:g.enabled&&g.connected&&!g.capture,needsInput:g.enabled&&g.connected&&!g.input,error:e.screenError}:null,version:h?.hello?.version??null,needsAttention:e.needsAttention,textSize:n,usageIconStyle:r};window.codync.app.setTraySummary(m)},150);return()=>clearTimeout(l)})}function IT(e){const t=e.local,n=t?.screen;if(!t||!n||!n.enabled)return`Control this ${LT?"Mac":"computer"} from your iPhone`;if(e.screenNeedsApproval)return"Needs approval in System Settings";if(!n.connected)return"Starting Codync Screen…";if(!n.capture||!n.input)return"Needs permission";if(n.viewers>0)return n.viewers===1?"Your iPhone is viewing":`${n.viewers} viewers`;const r=n.agentBot?t.bots.get(n.agentBot):null;if(r)return`${r.name} is using it`;const l=n.displays.find(h=>h.main)?.name??n.displays[0]?.name;return l?`Ready · ${l}`:"Ready"}const V2=window.codync.platform==="darwin";function UT(){const e=ns(),[t,n]=ni(Dt.onboardingDone),[r,l]=x.useState(!1);HT(e),nT(e);const h=e.host.state.kind==="running"||e.computers.length>0;x.useEffect(()=>window.codync.app.onCommand(p=>{switch(p.kind){case"confirmReset":return l(!0);case"reviewApprovals":return e.reviewApprovals();case"setTextSize":return Dt.textSize.set(p.size);case"stepTextSize":return Dt.textSize.set(p.up===null?Ua:YC(Dt.textSize.get(),p.up));case"setUsageIconStyle":return Dt.usageIconStyle.set(p.style);case"openBot":{const g=R_(p.ref);g&&e.select(g);return}case"stopBot":{const g=R_(p.ref);g&&e.store(g.computerId)?.stop(g.botId);return}case"setRemoteScreen":e.setRemoteScreen(p.on);return}}),[e]);const d=e.currentApproval;return c.jsxs("div",{className:"chat-window",children:[t?h?c.jsx(qT,{}):c.jsx(PT,{}):c.jsx(jT,{onContinue:()=>n(!0)}),c.jsx(ts,{open:r,title:"Reset all data?",message:"Signs out every account and deletes this computer's bots, conversations, keys and settings. Codync then starts over from the welcome screen.",actions:[{title:"Reset everything",destructive:!0,action:()=>{window.codync.app.resetAllData()}}],onClose:()=>l(!1)}),c.jsx($t,{open:d!==null,onClose:()=>d&&e.deferApproval(d),children:d?c.jsx(MT,{approval:d},d.id):null})]})}function PT(){const t=ns().host.state;switch(t.kind){case"notInstalled":return c.jsx(Sh,{icon:"desktopcomputer",title:`Set up this ${V2?"Mac":"computer"}`,message:`Codync runs your coding agents through the host, a small background service on this ${V2?"Mac":"computer"}.`,action:["Install host",()=>window.codync.host.install()]});case"missingBinary":return c.jsx(Sh,{icon:"desktopcomputer.trianglebadge.exclamationmark",title:"The host is missing",message:"This copy of Codync doesn't include codync-host. Download Codync again from codync.dev or GitHub."});case"failed":return c.jsx(Sh,{icon:"desktopcomputer.trianglebadge.exclamationmark",title:"The host isn't running",message:t.message,action:["Try again",()=>window.codync.host.restart()]});default:return c.jsx(Sh,{icon:"desktopcomputer",title:"Starting the host…",message:"This takes a few seconds."})}}function Sh({icon:e,title:t,message:n,action:r}){return c.jsxs("div",{className:"empty-state",children:[c.jsx(ae,{name:e,size:36,weight:"light",color:"var(--tertiary)"}),c.jsx("div",{style:{...B("title3","semibold"),color:"var(--text)"},children:t}),c.jsx("div",{style:{...B("callout"),color:"var(--secondary)",textAlign:"center",maxWidth:360},children:n}),r?c.jsx(Fe,{onClick:r[1],style:{marginTop:4},children:r[0]}):null]})}function qT(){const e=ns(),[t,n]=ni(Dt.sidebarCompact),[r,l]=ni(Dt.sidebarWidth),[h,d]=ni(Dt.hiddenComputers),[p,g]=x.useState(""),[m,v]=x.useState(!1),[_,S]=x.useState(!1),[w,b]=x.useState(null),k=x.useRef(null),[E,j]=x.useState(!1),[V,A]=x.useState(!1),[z,F]=x.useState(null),[D,I]=x.useState(null),[q,U]=x.useState(null),[Y,$]=x.useState(null),[M,N]=x.useState(null),[L,O]=x.useState(null),[P,te]=x.useState(null),Q=x.useCallback(()=>te("voice"),[]),[ce,re]=x.useState(!1),[de,Ce]=x.useState({width:window.innerWidth,height:window.innerHeight}),je=x.useRef(null),R=x.useRef(null),J=x.useRef(null),le=x.useRef(null);Y3([...e.stores.values()]),x.useEffect(()=>{const oe=()=>{Ce({width:window.innerWidth,height:window.innerHeight}),l(Math.min(Dt.sidebarWidth.get(),Math.max(260,window.innerWidth-420)))};return window.addEventListener("resize",oe),()=>window.removeEventListener("resize",oe)},[l]);const he=Math.max(420,de.height-76),we=e.computers.map(oe=>e.store(oe.id)).filter(oe=>!!oe),xe=new Set(iS(e.computers.map(oe=>oe.id),h).shown),be=we.filter(oe=>xe.has(oe.computer.id)&&oe.connection.kind==="online"&&!oe.mismatch),pe=e.selectedStore,_e=w?e.store(w):null,De=p.trim().toLowerCase(),fi=e.roster.filter(oe=>xe.has(oe.ref.computerId)&&(t||!De||oe.bot.name.toLowerCase().includes(De)||(oe.bot.lastMessage??"").toLowerCase().includes(De))),pi=(oe=!1)=>{S(oe);const Ze=[pe,e.local].find(ti=>ti&&be.includes(ti))??be[0];Ze&&(m||(k.current=e.selection),b(Ze.computer.id),e.select(null),v(!0))};x.useEffect(()=>{e.selection&&v(!1)},[e.selection]),x.useEffect(()=>window.codync.app.onCommand(oe=>{oe.kind==="newChat"&&be.length&&pi(),oe.kind==="search"&&(n(!1),setTimeout(()=>je.current?.focus(),0)),oe.kind==="toggleSidebar"&&n(!Dt.sidebarCompact.get())}));const Bt=x.useRef(!1);x.useEffect(()=>{const oe=window.codync.debugOpen;if(!(!oe||Bt.current))if(oe==="compose"||oe==="group"){if(!be.length)return;Bt.current=!0,pi(oe==="group")}else if(oe==="plugins"){if(!e.local)return;Bt.current=!0,O(e.local.computer.id)}else if(oe==="computers")Bt.current=!0,te("computers");else{const Ze=e.roster.find(ti=>ti.bot.name===oe);if(!Ze)return;Bt.current=!0,e.select(Ze.ref)}});const pt=()=>[{title:"New chat",icon:"square.and.pencil",action:()=>pi()},{title:"New group chat",icon:"person.2",action:()=>pi(!0)}],$e=()=>O((pe??e.local??be[0])?.computer.id??null),gi=(oe,Ze)=>[{title:oe.pinned?"Unpin":"Pin",icon:"pin",action:()=>Ze.setPinned(oe,!oe.pinned)},{title:"Mark as Read",icon:"bell.badge",action:()=>Ze.markAllRead(oe.id)},{title:"Edit Profile…",icon:"square.and.pencil",divider:!0,action:()=>U({id:crypto.randomUUID(),draft:yo(oe),store:Ze})},{title:"Copy conversation ID",icon:"square.on.square",divider:!0,action:()=>window.codync.app.copy(oe.id)},{title:"New session",icon:"arrow.counterclockwise",action:()=>N({bot:oe,store:Ze})},{title:"Hide from sidebar",icon:"eye.slash",divider:!0,action:()=>Ze.setHidden(oe,!0)},{title:"Delete",icon:"trash",destructive:!0,action:()=>$({bot:oe,store:Ze})}],ge=oe=>{if(oe.key!=="ArrowUp"&&oe.key!=="ArrowDown")return;const Ze=fi.map(ir=>ir.ref);if(!Ze.length)return;oe.preventDefault();const ti=Ze.findIndex(ir=>D_(ir,e.selection)),ls=oe.key==="ArrowDown"?Math.min(ti+1,Ze.length-1):Math.max(ti-1,0);e.select(Ze[ls])},Ke=x.useRef(null),ki=oe=>{oe.target.setPointerCapture(oe.pointerId),Ke.current={x:oe.clientX,width:t?76:r}},Ur=oe=>{if(!Ke.current)return;const Ze=Ke.current.width+oe.clientX-Ke.current.x,ti=Ze<180;ti!==t&&n(ti),ti||l(Math.min(Math.max(260,Ze),Math.min(420,window.innerWidth-420)))},Bs=e.errorMessage,Pr=we.filter(oe=>xe.has(oe.computer.id)&&oe.mismatch),rs=e.selection,Qa=rs&&pe?.bots.get(rs.botId);let tr;m&&_e?tr=c.jsxs("div",{className:"detail-column",children:[be.length>1?c.jsx($T,{stores:be,value:_e.computer.id,onChange:b}):null,c.jsx(en.Provider,{value:_e,children:c.jsx(ak,{group:_,onClose:()=>{v(!1),e.selection||e.select(k.current)}})})]},`${_e.computer.id}-${_}`):rs&&pe&&Qa?tr=c.jsx(en.Provider,{value:pe,children:c.jsx(J9,{botId:rs.botId},T_(rs))}):tr=c.jsxs("div",{className:"empty-detail",children:[c.jsxs("div",{style:{display:"flex"},children:[c.jsx(nn,{shape:"blob",color:"blue",size:60,mood:"working"}),c.jsx(nn,{shape:"squircle",color:"orange",size:60,style:{marginLeft:-10}}),c.jsx(nn,{shape:"teardrop",color:"violet",size:60,mood:"working",style:{marginLeft:-10}})]}),c.jsx("div",{style:B("title2","semibold"),children:"Your coding agents, as teammates."}),c.jsx("div",{style:{color:"var(--secondary)",textAlign:"center",maxWidth:420},children:"Pick a bot, or create one for each kind of work and point it at a project."}),c.jsx(Fe,{onClick:()=>pi(),disabled:!be.length,children:"New Bot"})]});const as=t?76:r;return c.jsxs("div",{className:"split",style:{pointerEvents:ce||D?"none":void 0},children:[c.jsxs("aside",{className:`sidebar ${t?"compact":""}`,style:{width:as},children:[c.jsxs("div",{className:"sidebar-header drag",style:{paddingLeft:t?0:V2?80:18,opacity:t?0:1,pointerEvents:t?"none":void 0},"aria-hidden":t,children:[c.jsx("span",{style:{flex:1}}),c.jsxs("div",{className:"no-drag",style:{display:"flex",alignItems:"center",gap:6},children:[c.jsx(O_,{hidden:h,setHidden:d,manage:()=>te("computers")}),c.jsx(ke,{title:"New",icon:"plus",buttonRef:R,onClick:()=>j(oe=>!oe),disabled:!be.length})]}),c.jsx(Pa,{open:E,onClose:()=>j(!1),anchor:R,items:pt})]}),t?c.jsx("div",{style:{width:70,alignSelf:"center"},className:"drag",children:c.jsx("div",{className:"no-drag",style:{display:"flex",justifyContent:"center"},children:c.jsx(O_,{hidden:h,setHidden:d,manage:()=>te("computers"),compact:!0})})}):null,t?null:c.jsxs("div",{className:"search",children:[c.jsx(ae,{name:"magnifyingglass",size:13,color:"var(--secondary)"}),c.jsx("input",{ref:je,value:p,placeholder:"Search","aria-label":"Search bots",spellCheck:!1,onChange:oe=>g(oe.target.value),onKeyDown:oe=>{oe.key==="Escape"&&(g(""),je.current?.blur())}}),p?c.jsx("button",{className:"search-clear","aria-label":"Clear search",title:"Clear search",onClick:()=>g(""),children:c.jsx(ae,{name:"xmark.circle.fill",size:13,color:"var(--secondary)"})}):null]}),c.jsxs("div",{className:"roster",ref:le,tabIndex:0,onKeyDown:ge,children:[t?null:Pr.map(oe=>c.jsx("div",{style:{paddingBottom:8},children:c.jsx(en.Provider,{value:oe,children:c.jsx(J2,{})})},oe.computer.id)),fi.map(oe=>{const Ze=T_(oe.ref),ti=D_(oe.ref,rs);return c.jsx("button",{className:"roster-row",style:{padding:t?0:"0 8px",background:ti?"var(--bubble-user)":z===Ze?"var(--bubble-agent)":"transparent"},"aria-label":we.length>1?`${oe.bot.name}, on ${oe.store.hostName}`:oe.bot.name,"aria-selected":ti,title:we.length>1?`${oe.bot.name} · ${oe.store.hostName}`:oe.bot.name,onMouseEnter:()=>F(Ze),onMouseLeave:()=>F(ls=>ls===Ze?null:ls),onClick:()=>e.select(oe.ref),onContextMenu:ls=>{ls.preventDefault(),I({target:{bot:oe.bot,store:oe.store},x:ls.clientX,y:ls.clientY})},children:c.jsx(m8,{bot:oe.bot,store:oe.store,compact:t,usingComputer:oe.store.screen?.agentBot===oe.bot.id,members:At(oe.bot)?oe.store.members(oe.bot):VT})},Ze)}),fi.length===0&&!t&&Pr.length===0?c.jsxs("div",{className:"roster-empty",children:[c.jsx("div",{style:B(13,"medium"),children:p?"No matching bots":"No bots yet"}),c.jsx("div",{style:{...B(12),color:"var(--secondary)"},children:p?"Try another name or message.":"Use + to start a new chat."})]}):null]}),t?c.jsxs("div",{className:"rail-actions",children:[c.jsx(ke,{title:"New",icon:"plus",size:36,buttonRef:J,disabled:!be.length,onClick:()=>A(oe=>!oe)}),c.jsx(Pa,{open:V,onClose:()=>A(!1),anchor:J,items:pt}),c.jsx(ke,{title:"Marketplace",icon:"square.grid.2x2",size:36,onClick:$e}),c.jsx("button",{className:"rail-profile",style:{background:ce?"var(--bubble-agent)":void 0},"aria-label":"Open account menu for Account",title:"Account",onClick:()=>re(oe=>!oe),children:c.jsx(L3,{})})]}):c.jsxs("div",{className:"sidebar-footer",children:[c.jsxs("button",{className:"footer-row",onClick:$e,children:[c.jsx("span",{className:"footer-icon",children:c.jsx(ae,{name:"square.grid.2x2",size:14})}),c.jsx("span",{children:"Marketplace"})]}),c.jsxs("button",{className:`footer-row account ${ce?"active":""}`,"aria-label":"Open account menu for Account",title:"Account menu",onClick:()=>re(oe=>!oe),children:[c.jsx(L3,{}),c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Account"})]})]})]}),c.jsx("div",{className:"sidebar-divider",onPointerDown:ki,onPointerMove:Ur,onPointerUp:()=>Ke.current=null,role:"separator","aria-label":"Resize sidebar","aria-valuenow":as}),c.jsx("main",{className:"detail",children:c.jsx(XS.Provider,{value:Q,children:tr})}),ce?c.jsx(AT,{compact:t,approvals:e.approvals.length,onDismiss:()=>re(!1),onUsage:()=>{re(!1),te("usage")},onSettings:()=>{re(!1),te("general")}}):null,D?c.jsx("div",{className:"context-layer",onMouseDown:oe=>oe.target===oe.currentTarget&&I(null),children:c.jsx(NT,{items:gi(D.target.bot,D.target.store),onDismiss:()=>I(null),style:{left:Math.min(Math.max(8,D.x),de.width-268),top:Math.min(Math.max(8,D.y),Math.max(8,de.height-344))}})}):null,c.jsx($t,{open:q!==null,onClose:()=>U(null),width:520,height:Math.min(680,he),children:q?c.jsx(en.Provider,{value:q.store,children:c.jsx(Z7,{draft:q.draft},q.id)}):null}),c.jsx($t,{open:L!==null,onClose:()=>O(null),width:Math.min(920,de.width-80),height:he,children:L&&e.store(L)?c.jsx(en.Provider,{value:e.store(L),children:c.jsx(Tj,{computers:be.map(oe=>({id:oe.computer.id,name:oe.hostName})),computer:L,onComputer:O},L)}):null}),c.jsx($t,{open:P!==null,onClose:()=>te(null),width:Math.min(800,de.width-80),height:Math.min(620,he),children:P?c.jsx(wT,{page:P}):null}),c.jsx(ts,{open:M!==null,title:"Start a new session?",message:"The conversation stays here, but the agent starts with a fresh context.",actions:M?[{title:"New session",action:()=>M.store.newSession(M.bot.id)}]:[],onClose:()=>N(null)}),c.jsx(ts,{open:Y!==null,title:`Delete ${Y?.bot.name??"bot"}?`,message:"Files it changed on your computer stay as they are.",actions:Y?[{title:"Delete bot and its conversation",destructive:!0,action:()=>Y.store.delete(Y.bot)}]:[],onClose:()=>$(null)}),c.jsx(ts,{open:Bs!==null,title:"Something went wrong",message:Bs,actions:[],cancel:"OK",onClose:()=>e.clearErrors()})]})}const VT=[];function $T({stores:e,value:t,onChange:n}){const r=x.useMemo(()=>e.map(l=>({id:l.computer.id,label:l.hostName})),[e]);return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"12px 22px 0",...B("callout")},children:[c.jsx("span",{style:{color:"var(--secondary)"},children:"On"}),c.jsx(Ci,{selection:t,options:r,onChange:n})]})}function WT(){const t=ns().host.local,[n,r]=x.useState(null),[l,h]=x.useState(null),[d,p]=x.useState(null),[g,m]=x.useState("this computer"),[v,_]=x.useState(null),S=x.useCallback(async()=>{if(!t)return _("This computer's host isn't connected.");const w=new Z2(t.baseURL,t.token);try{const[b,k,E]=await Promise.all([w.call("pairing",{},2e4),w.call("cloudStatus",{},2e4).catch(()=>null),w.call("hello",{},2e4).catch(()=>null)]);r(b),p(k),E?.name&&m(E.name),h(await Kx.toDataURL(b.pairingUrl,{errorCorrectionLevel:"M",margin:0,width:400,color:{dark:"#000000",light:"#ffffff"}})),_(null)}catch(b){_(b instanceof Error?b.message:String(b))}},[t]);return x.useEffect(()=>(S(),window.codync.app.onCommand(w=>w.kind==="reviewApprovals"&&void S())),[S]),x.useEffect(()=>{if(!n?.expiresAt)return;const w=setTimeout(()=>{S()},Math.max(1e3,n.expiresAt-Date.now()));return()=>clearTimeout(w)},[n?.expiresAt,S]),c.jsx("div",{style:{width:340,padding:16,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:n&&l?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{padding:10,background:"#fff",borderRadius:12},children:c.jsx("img",{src:l,alt:`Pairing code for ${g}`,width:200,height:200,style:{display:"block",imageRendering:"pixelated"}})}),c.jsx("div",{style:{...B("caption"),color:"var(--secondary)",textAlign:"center"},children:"Scan with the Codync app or the iPhone Camera. No Tailscale or open ports needed: your iPhone connects directly on the same Wi-Fi, and through the encrypted relay anywhere else."}),d?.enabled!==!0?c.jsx("div",{style:{...B("caption"),color:"var(--warning)",textAlign:"center"},children:n.urls.length===0?"No network address found and “Reach from anywhere” is off. Connect to Wi-Fi or turn it on.":`“Reach from anywhere” is off, so the iPhone only reaches ${g} on the same network.`}):null,c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[n.expiresAt?c.jsxs("span",{style:{...B("caption2"),color:"var(--tertiary)"},children:["Works once, until ",new Date(n.expiresAt).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})]}):null,c.jsx(ke,{title:"New code",icon:"arrow.clockwise",onClick:()=>{S()}}),c.jsx(ke,{title:"Copy pairing link",icon:"doc.on.doc",onClick:()=>window.codync.app.copy(n.pairingUrl)})]})]}):v?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{...B("caption"),color:"var(--danger)",textAlign:"center"},children:v}),c.jsx(ke,{title:"Try again",icon:"arrow.clockwise",onClick:()=>{S()}})]}):c.jsx(et,{size:20})})}const C1=new URLSearchParams(location.search).get("window")??"chat";document.documentElement.dataset.platform=window.codync.platform;G3(Dt.textSize.get());const rw=new h8(C1!=="pairing");rw.start();C1!=="pairing"&&Zn.start();Cb.createRoot(document.getElementById("root")).render(c.jsx(Z3.Provider,{value:rw,children:C1==="pairing"?c.jsx(WT,{}):c.jsx(UT,{})}));+`;return typeof p=="function"&&p(null,E),E},Lf}var D3;function Jj(){if(D3)return Oa;D3=1;const e=Nj(),t=Zj(),n=Xj(),r=Qj();function l(h,d,p,g,m){const v=[].slice.call(arguments,1),_=v.length,S=typeof v[_-1]=="function";if(!S&&!e())throw new Error("Callback required as last argument");if(S){if(_<2)throw new Error("Too few arguments provided");_===2?(m=p,p=d,d=g=void 0):_===3&&(d.getContext&&typeof m>"u"?(m=g,g=void 0):(m=g,g=p,p=d,d=void 0))}else{if(_<1)throw new Error("Too few arguments provided");return _===1?(p=d,d=g=void 0):_===2&&!d.getContext&&(g=p,p=d,d=void 0),new Promise(function(w,b){try{const k=t.create(p,g);w(h(k,d,g))}catch(k){b(k)}})}try{const w=t.create(p,g);m(null,h(w,d,g))}catch(w){m(w)}}return Oa.create=t.create,Oa.toCanvas=l.bind(null,n.render),Oa.toDataURL=l.bind(null,n.renderToDataURL),Oa.toString=l.bind(null,function(h,d,p){return r.render(h,p)}),Oa}var eT=Jj();const Kx=gb(eT),R3="brew install leepokai/codync/codync-host && codync-host install",tT=()=>({id:crypto.randomUUID(),host:"",port:null,user:null,identityFile:null,remotePort:19222,computerId:null,name:""}),eu=()=>window.codync.ssh??null;class iT extends Br{state={profiles:[],status:{},attachments:[]};started=!1;start(){const t=eu();this.started||!t||(this.started=!0,t.onChange(n=>this.apply(n)),t.state().then(n=>this.apply(n)))}apply(t){this.state=t,this.changed()}status(t){return this.state.status[t]??{kind:"idle"}}isSSH(t){return this.state.attachments.some(n=>n.computer.id===t)}}const vo=new iT;function sT(){return x.useEffect(()=>vo.start(),[]),cn(vo)}function nT(e){x.useEffect(()=>{vo.start();const t=new Map,n=()=>{const l=new Map(vo.state.attachments.map(h=>[h.computer.id,h]));for(const[h,d]of l){const p=`${d.baseURL}|${d.token}`;if(t.get(h)===p)continue;const g=e.computers.find(v=>v.id===h),m={...d.computer,urls:[],color:g?.color??null,device:g?.device??null};e.attach(m,new J3(m,!0,()=>new Z2(d.baseURL,d.token))),t.set(h,p)}for(const h of[...t.keys()])l.has(h)||(t.delete(h),e.detach(h))};n();const r=vo.subscribe(n);return()=>{r();for(const l of t.keys())e.detach(l)}},[e])}function rT(){const e=ns(),t=Ya(),n=sT(),r=cn(e.cloud),[l,h]=x.useState(null),d=e.managedStores,p=new Set(d.map(v=>v.computer.id)),g=e.computers.filter(v=>!p.has(v.id)),m=r.computers.filter(v=>!p.has(v.computerId)&&!g.some(_=>_.id===v.computerId));return c.jsxs("div",{style:{height:"100%",overflowY:"auto",background:"var(--background)"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:26,padding:"14px 14px 20px"},children:[d.map(v=>c.jsx(oT,{store:v,ssh:n.isSSH(v.computer.id)},v.computer.id)),c.jsxs("div",{children:[c.jsx(ey,{title:"Over SSH",children:eu()?c.jsx(ke,{title:"Add SSH computer",icon:"plus",onClick:()=>h({profile:tT(),isNew:!0})}):null}),c.jsx($a,{show:n.state.profiles.length===0,children:c.jsxs("div",{style:{...B("callout"),color:"var(--secondary)"},children:["Run bots on another computer you reach with SSH. It needs codync-host installed; your SSH keys stay on ",go,"."]})}),n.state.profiles.map(v=>c.jsx(uT,{profile:v,status:n.status(v.id),edit:()=>h({profile:v,isNew:!1})},v.id))]}),c.jsxs("div",{children:[c.jsx(ey,{title:"In your account",children:t.isSignedIn?c.jsx(ke,{title:"Refresh",icon:"arrow.clockwise",onClick:()=>{r.refresh()}}):null}),t.isSignedIn?g.length===0&&m.length===0?c.jsx("div",{style:{...B("callout"),color:"var(--secondary)"},children:"No other computers in your account yet."}):null:c.jsxs("div",{style:{...B("callout"),color:"var(--secondary)"},children:["Sign in to reach the other computers in your account from ",go,"."]}),g.map(v=>{const _=e.store(v.id);if(!_)return null;const S=r.computers.find(b=>b.computerId===v.id),w=!!S&&r.isOlderCopy(S)&&_.connection.kind!=="unauthorized";return c.jsx("div",{className:"settings-card settings-appear",children:c.jsxs("div",{className:"settings-row",children:[c.jsx(Va,{computer:_.computer,size:22}),c.jsxs("div",{className:"settings-stack",children:[c.jsx("span",{style:B("callout","medium"),children:_.hostName}),c.jsx("span",{style:{...B("caption"),color:w?"var(--warning)":"var(--secondary)"},children:w?`Older copy of this computer · ${n2(_)}`:n2(_)})]}),c.jsx(aT,{store:_}),c.jsx("span",{style:{flex:1}}),c.jsx(ke,{title:`Remove from ${go}`,icon:"minus.circle",onClick:()=>e.detach(v.id)})]})},v.id)}),m.map(v=>c.jsx("div",{className:"settings-card settings-appear",children:c.jsxs("div",{className:"settings-row",children:[c.jsx(Va,{computer:{id:v.computerId,name:v.name,signKey:v.signKey,urls:[],device:v.device??null},size:22}),c.jsxs("div",{className:"settings-stack",children:[c.jsx("span",{style:B("callout","medium"),children:v.name}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:v.online?"Online":"Offline"})]})]})},v.computerId))]})]}),c.jsx($t,{open:l!==null,onClose:()=>h(null),width:460,children:l?c.jsx(dT,{profile:l.profile,isNew:l.isNew},l.profile.id):null})]})}function aT({store:e}){if(e.connection.kind!=="online"||!e.hostRoute||e.hostRoute==="loopback")return null;const t=e.hostRoute==="relay";return c.jsx("span",{title:t?"Through Cloudflare (encrypted)":"Direct: Wi-Fi or Tailscale","aria-label":t?"Through Cloudflare":"Wi-Fi or Tailscale",style:{display:"flex",color:"var(--tertiary)"},children:c.jsx(ae,{name:t?"cloud":"wifi",size:12})})}const lT=go==="this Mac"?"This Mac":"This computer";function oT({store:e,ssh:t}){const n=ns(),r=Ya();cn(e);const[l,h]=x.useState(null),[d,p]=x.useState(!1),[g,m]=x.useState(!1),[v,_]=x.useState(!1),[S,w]=x.useState(null),[b,k]=x.useState(!1),[E,j]=x.useState(!1),V=e.cloud,A=V?.approval==="auto",z=e.connection.kind==="online",F=e.hostName,R=M=>{p(!0),M().finally(()=>p(!1))},I=x.useCallback(async()=>{const M=Hh(e);if(M)try{h((await M.call("devices")).devices)}catch{}},[e]);x.useEffect(()=>{I()},[I,z,e.accessRequests.length]);const q=M=>R(async()=>{try{await(await e.ready()).call("setApproval",{approval:M})}catch(N){e.setError(Wa(N))}}),U=V?.enabled?V.lastError??(V.connected?"Reachable from anywhere through Cloudflare (encrypted).":"Connecting to Cloudflare…"):"Off: only Wi-Fi and Tailscale reach it, nothing goes through Cloudflare.",Y=V?.owner??null,$=c.jsxs("div",{className:"settings-row",style:{gap:8},children:[c.jsx(ae,{name:Y?"person.crop.circle.badge.checkmark":"person.crop.circle.badge.plus",size:13,color:"var(--secondary)"}),c.jsx("span",{style:{...B("callout"),flex:1},children:Y?Y.userId===r.user?.userId?"In your account":`In ${Y.email??"another"} account`:r.isSignedIn?"Not in your account":"Sign in to add it to your account"}),Y?c.jsx(Fe,{kind:"secondary",onClick:()=>k(!0),disabled:d||!z,children:"Remove from account"}):r.isSignedIn?c.jsx(Fe,{kind:"secondary",onClick:()=>R(async()=>{await n.cloud.claim(e)}),disabled:d||!z,children:d?"Adding…":"Add to account"}):null]});return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:28},children:[c.jsx(Ee,{children:[c.jsxs("div",{className:"settings-row",children:[c.jsx(Va,{computer:e.computer,size:26}),c.jsxs("div",{className:"settings-stack",style:{flex:1},children:[c.jsx("span",{style:B("headline"),children:F}),c.jsxs("span",{style:{...B("caption"),color:"var(--secondary)"},children:[t?"Over SSH":lT," · ",n2(e)]})]}),t?c.jsx(ke,{title:"Voice chat",icon:"waveform",selected:v,disabled:!z,onClick:()=>_(M=>!M)}):null,c.jsx(ke,{title:"Pair iPhone",icon:"qrcode",selected:g,disabled:!z,onClick:()=>m(M=>!M)})]},"header"),c.jsx(rn,{on:V?.enabled??!1,disabled:d||!z,onChange:M=>R(()=>n.cloud.setCloud(e,M)),children:c.jsxs("span",{className:"settings-stack",children:[c.jsx("span",{children:"Reach from anywhere"}),c.jsx("span",{style:{...B("caption"),color:V?.lastError?"var(--warning)":"var(--secondary)"},children:U})]})},"cloud"),$,...Y?[c.jsx(rn,{on:A,disabled:d||!z,onChange:M=>M?j(!0):q("code"),children:c.jsxs("span",{className:"settings-stack settings-appear",children:[c.jsx("span",{children:"Skip the 6-digit check"}),c.jsx("span",{style:{...B("caption"),color:A?"var(--warning)":"var(--secondary)"},children:A?"Devices on your account get in on their own.":"Each new device shows a code you approve here."})]})},"approval")]:[]]}),c.jsx(Ee,{title:`Devices that can use ${F}`,children:l===null?[c.jsx(et,{},"loading")]:[...l.length===0?[c.jsx("span",{style:{color:"var(--secondary)"},children:"None yet. Pair an iPhone, or approve one from your account."},"none")]:[],...l.map(M=>c.jsxs("div",{className:"settings-row settings-appear",style:{gap:8},children:[c.jsx("span",{style:{width:18,display:"flex",justifyContent:"center",color:"var(--secondary)"},children:c.jsx(ae,{name:M.platform==="macos"?"laptopcomputer":"iphone",size:13})}),c.jsxs("div",{className:"settings-stack",style:{flex:1},children:[c.jsx("span",{children:M.name}),c.jsx("span",{style:{...B("caption"),color:"var(--tertiary)"},children:cT(M)})]}),c.jsx(ke,{title:"Revoke access",icon:"xmark.circle",onClick:()=>w(M)})]},M.key))]}),c.jsx($t,{open:v,onClose:()=>_(!1),children:c.jsx(en.Provider,{value:e,children:c.jsx(d1,{})})}),c.jsxs($t,{open:g,onClose:()=>m(!1),width:340,children:[c.jsx(Lt,{title:`Pair iPhone with ${F}`}),c.jsx(hT,{store:e})]}),c.jsx(ts,{open:S!==null,title:`Revoke ${S?.name??"device"}?`,message:"It disconnects right away and has to pair or ask again.",actions:S?[{title:"Revoke access",destructive:!0,action:()=>R(async()=>{try{await(await e.ready()).call("revokeDevice",{key:S.key})}catch(M){e.setError(Wa(M))}await I()})}]:[],onClose:()=>w(null)}),c.jsx(ts,{open:E,title:"Let account devices in without a code?",message:`Any device signed in to your account gets full control of ${F}: its files, terminals and bots, with no check here. If someone gets into your account, or Codync's cloud is ever compromised, they could add their own device and you'd have no chance to stop it. Devices paired with a QR code aren't affected.`,actions:[{title:"Skip the check",destructive:!0,action:()=>q("auto")}],onClose:()=>j(!1)}),c.jsx(ts,{open:b,title:`Remove ${F} from the account?`,message:"Devices that were approved through the account lose access. Devices paired with a QR code keep it.",actions:[{title:"Remove from account",destructive:!0,action:()=>R(()=>n.cloud.unclaim(e))}],onClose:()=>k(!1)})]})}function cT(e){const t=[e.source==="account"?"Approved through the account":"Paired with a QR code"];return e.connected?t.push("connected"):e.lastSeenAt&&t.push(`seen ${YS(new Date(e.lastSeenAt))}`),t.join(" · ")}function hT({store:e}){cn(e);const[t,n]=x.useState(null),[r,l]=x.useState(null),[h,d]=x.useState(null),p=e.hostName,g=x.useCallback(async()=>{const v=Hh(e);if(!v)return d(`${e.hostName} isn't connected.`);try{const _=await v.call("pairing");l(await Kx.toDataURL(_.pairingUrl,{errorCorrectionLevel:"M",margin:0,width:400,color:{dark:"#000000",light:"#ffffff"}})),n(_),d(null)}catch(_){d(Wa(_))}},[e]);x.useEffect(()=>{g()},[g]),x.useEffect(()=>{if(!t?.expiresAt)return;const v=setTimeout(()=>{g()},Math.max(1e3,t.expiresAt-Date.now()));return()=>clearTimeout(v)},[t?.expiresAt,g]);const m={...B("caption"),textAlign:"center"};return c.jsx("div",{style:{padding:16,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:t&&r?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"settings-appear",style:{padding:10,background:"#fff",borderRadius:12},children:c.jsx("img",{src:r,alt:`Pairing code for ${p}`,width:200,height:200,style:{display:"block",imageRendering:"pixelated"}})}),c.jsx("div",{style:{...m,color:"var(--secondary)"},children:"Scan with the Codync app or the iPhone Camera. No Tailscale or open ports needed: your iPhone connects directly on the same Wi-Fi, and through the encrypted relay anywhere else."}),e.cloud?.enabled!==!0?c.jsx("div",{style:{...m,color:"var(--warning)"},children:t.urls.length===0?"No network address found and “Reach from anywhere” is off. Connect to Wi-Fi or turn it on.":`“Reach from anywhere” is off, so the iPhone only reaches ${p} on the same network.`}):null,c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[t.expiresAt?c.jsxs("span",{style:{...B("caption2"),color:"var(--tertiary)"},children:["Works once, until ",new Date(t.expiresAt).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})]}):null,c.jsx(ke,{title:"New code",icon:"arrow.clockwise",onClick:()=>{g()}}),c.jsx(ke,{title:"Copy pairing link",icon:"doc.on.doc",onClick:()=>window.codync.app.copy(t.pairingUrl)})]})]}):h?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{...m,color:"var(--danger)"},children:h}),c.jsx(ke,{title:"Try again",icon:"arrow.clockwise",onClick:()=>{g()}})]}):c.jsx(et,{size:20})})}function uT({profile:e,status:t,edit:n}){const r=eu(),l=`${e.user?`${e.user}@`:""}${e.host}${e.port!==null?`:${e.port}`:""}`,h=(()=>{switch(t.kind){case"idle":return`${l} · Not connected`;case"connecting":return t.step;case"confirmHostKey":return`${l} · Confirm the host key`;case"connected":return`${l} · Connected`;case"retrying":return`${t.message} Retrying…`;case"failed":return t.message;case"notInstalled":return`codync-host isn't installed on ${e.host}. Install it there:`}})(),d=t.kind==="retrying"||t.kind==="failed"||t.kind==="notInstalled",p=t.kind==="connected"||t.kind==="connecting"||t.kind==="retrying";return c.jsxs("div",{className:"settings-card settings-appear",children:[c.jsxs("div",{className:"settings-row",children:[c.jsx("span",{style:{width:22,display:"flex",justifyContent:"center",color:"var(--secondary)"},children:c.jsx(ae,{name:"terminal",size:13})}),c.jsxs("div",{className:"settings-stack",style:{flex:1},children:[c.jsx("span",{style:B("callout","medium"),children:e.name||e.host}),c.jsx("span",{style:{...B("caption"),color:d?"var(--warning)":"var(--secondary)"},children:h})]}),p?c.jsx(ke,{title:"Disconnect",icon:"stop.circle",onClick:()=>r?.disconnect(e.id)}):c.jsx(ke,{title:"Connect",icon:"arrow.clockwise",onClick:()=>r?.connect(e.id)}),c.jsx(ke,{title:"Edit",icon:"pencil",onClick:n}),c.jsx(ke,{title:"Remove",icon:"trash",onClick:()=>r?.remove(e.id)})]}),c.jsx($a,{show:t.kind==="confirmHostKey",children:t.kind==="confirmHostKey"?c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[c.jsxs("span",{style:{...B("caption"),color:"var(--secondary)"},children:["First connection to ",t.name,". Check that its host key fingerprint matches what the computer's owner sees (",c.jsx("code",{style:{fontFamily:"var(--mono)"},children:"ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub"}),")."]}),t.fingerprints.map(g=>c.jsx("span",{className:"selectable",style:B("caption",void 0,"monospaced"),children:g},g)),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsx(Fe,{onClick:()=>r?.trustHostKey(e.id),children:"Trust and connect"}),c.jsx(Fe,{kind:"secondary",onClick:()=>r?.disconnect(e.id),children:"Cancel"})]})]}):null}),c.jsx($a,{show:t.kind==="notInstalled",children:c.jsxs("div",{className:"settings-row",style:{gap:6},children:[c.jsx("span",{className:"settings-code selectable",children:R3}),c.jsx(ke,{title:"Copy install command",icon:"doc.on.doc",onClick:()=>window.codync.app.copy(R3)})]})})]})}function dT({profile:e,isNew:t}){const n=ss(),[r,l]=x.useState(e),[h,d]=x.useState(e.port?.toString()??""),[p,g]=x.useState(String(e.remotePort)),[m,v]=x.useState(e.user??""),[_,S]=x.useState(null),w=eu(),b=async()=>{const E=R=>/^-?\d+$/.test(R),j=h.trim();if(j&&!E(j))return S("The SSH port must be a number.");const V=p.trim();if(!E(V))return S("The Codync port must be a number.");const A=m.trim(),z={...r,host:r.host.trim(),name:r.name.trim(),user:A||null,port:j?Number(j):null,remotePort:Number(V)},F=w?await w.save(z):"SSH computers need a newer build of Codync.";if(F)return S(F);n()},k=(E,j,V,A)=>c.jsxs("div",{className:"settings-row",style:{gap:12},children:[c.jsx("span",{style:{color:"var(--text)"},children:E}),c.jsx("input",{className:"settings-field","aria-label":E,placeholder:A,value:j,spellCheck:!1,onChange:z=>V(z.target.value)})]});return c.jsxs("div",{style:{width:460,display:"flex",flexDirection:"column"},onKeyDown:E=>E.key==="Enter"&&E.target instanceof HTMLInputElement&&void b(),children:[c.jsx(Lt,{title:t?"Add SSH computer":"Edit SSH computer",trailing:c.jsx(ke,{title:t?"Add":"Save",icon:"checkmark",onClick:()=>{b()}})}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"4px 20px 20px"},children:[c.jsxs(Ee,{children:[k("Name",r.name,E=>l({...r,name:E}),"Optional"),k("Host",r.host,E=>l({...r,host:E}),"SSH alias or hostname"),k("User",m,v,"From SSH config"),k("SSH port",h,d,"From SSH config"),c.jsxs("div",{className:"settings-row",children:[c.jsx("span",{children:"Key"}),c.jsx("span",{style:{flex:1}}),c.jsx("span",{style:{color:"var(--secondary)"},children:r.identityFile?.split("/").pop()??"ssh-agent / SSH config"}),c.jsx(ke,{title:"Choose key file",icon:"key",onClick:()=>{w?.chooseKey().then(E=>E&&l(j=>({...j,identityFile:E})))}}),r.identityFile?c.jsx("span",{className:"settings-appear",style:{display:"flex"},children:c.jsx(ke,{title:"Use ssh-agent",icon:"xmark.circle",onClick:()=>l({...r,identityFile:null})})}):null]}),k("Codync port",p,g,"")]}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:"Codync opens an SSH tunnel to codync-host on that computer's loopback. It uses your SSH config and ssh-agent; agent forwarding stays off."}),c.jsx($a,{show:_!==null,children:c.jsx("span",{style:{...B("caption"),color:"var(--danger)"},children:_})})]})]})}function Yx(e){return e==="claude"?"#D97757":Co()?"#FFFFFF":"#000000"}const Gx=e=>e==="claude"?"#D97757":"var(--accent)",Zx=e=>["claude","codex"].includes(e)?`${e}-acp`:e,Xx=e=>e==="codex"?"hex":"blob",Qx=e=>e.windows.reduce((t,n)=>!t||n.percent>t.percent?n:t,null);function Jx(e){return e.label==="5-hour"?"Session":e.label.split(" · ")[1]??e.label}const fT=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function pT(e,t=new Date){const n=/^(?:(\w{3}) (\d{1,2}) at )?(\d{1,2})(?::(\d{2}))?(am|pm)(?: \(([^)]+)\))?$/.exec(e);if(!n)return null;const r=n[6],l=gT(t,r);let h=l.month,d=l.day;if(n[1]){const _=fT.indexOf(n[1]);if(_<0)return null;h=_+1,d=Number(n[2])}const p=Number(n[3])%12+(n[5]==="pm"?12:0),g=n[4]?Number(n[4]):0,m=(_,S,w)=>mT(_,S,w,p,g,r);let v=m(l.year,h,d);return(v.getTime()<t.getTime()-864e5||!n[1]&&v<t)&&(v=n[1]?m(l.year+1,h,d):new Date(v.getTime()+864e5)),v}function gT(e,t){try{const n=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"numeric",day:"numeric"}),r=Object.fromEntries(n.formatToParts(e).map(l=>[l.type,l.value]));return{year:Number(r.year),month:Number(r.month),day:Number(r.day)}}catch{return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}}function mT(e,t,n,r,l,h){const d=Date.UTC(e,t-1,n,r,l);try{const p=new Intl.DateTimeFormat("en-US",{timeZone:h,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}),g=Object.fromEntries(p.formatToParts(new Date(d)).map(v=>[v.type,v.value])),m=Date.UTC(Number(g.year),Number(g.month)-1,Number(g.day),Number(g.hour),Number(g.minute));return new Date(d-(m-d))}catch{return new Date(e,t-1,n,r,l)}}function ew(e){return e.resetsAt?new Date(e.resetsAt):e.resetsText?pT(e.resetsText):null}function tw(e,t=new Date){const n=Math.max(0,(e.getTime()-t.getTime())/1e3),r=Math.floor(n/3600),l=Math.floor(n%3600/60);return r>=48?`${Math.floor(r/24)}d`:r>0?`${r}h ${l}m`:`${l}m`}function vT(e){const t=ew(e);return t?`resets in ${tw(t)}`:e.resetsText?`resets ${e.resetsText.replace(/ \(.*\)$/,"")}`:null}function _T({provider:e,size:t,style:n="character"}){const r=(Qx(e)?.percent??0)>=90;return n==="original"?c.jsx("span",{style:{width:t,height:t,display:"grid",placeItems:"center",flex:"none"},children:c.jsx(wS,{registry:Zx(e.id),size:t*.84,color:Gx(e.id)})}):c.jsxs("span",{style:{position:"relative",width:t,height:t,flex:"none",display:"block"},children:[c.jsx(nn,{shape:Xx(e.id),color:"",tint:Yx(e.id),size:t,mood:r?"needsInput":"idle"}),r?c.jsx("span",{style:{position:"absolute",top:-t*.12,right:-t*.12,display:"flex",color:"var(--danger)",background:"#fff",borderRadius:"50%"},children:c.jsx(ae,{name:"exclamationmark.circle.fill",size:t*.34,weight:"bold",scaled:!1})}):null]})}const A3=new Map;function yT(e,t,n,r){const h=document.createElement("canvas");h.width=t*2,h.height=t*2;const d=h.getContext("2d");d.scale(2,2);const p=e.id==="claude"?"#D97757":r?"#FFFFFF":"#000000";if(n==="original"){const m=l1(Zx(e.id));if(!m)return null;const v=A3.get(m);if(!v){const S=new Image;return S.src=m,S.onload=()=>A3.set(m,S),null}const _=t*.08;return d.drawImage(v,_,_,t-_*2,t-_*2),d.globalCompositeOperation="source-in",d.fillStyle=p,d.fillRect(0,0,t,t),h.toDataURL("image/png")}const g=(Qx(e)?.percent??0)>=90;return K2(d,{shape:Xx(e.id),fill:p,size:t,mood:g?"needsInput":"idle",dark:r,t:0,still:!0}),g&&(d.beginPath(),d.arc(t*.92,t*.08,t*.17,0,Math.PI*2),d.fillStyle=r?"#F0A7A7":"#C23A2B",d.fill()),h.toDataURL("image/png")}function ST({usage:e}){const[t]=ni(Rt.usageIconStyle);return c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:18},children:e.providers.map(n=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx(_T,{provider:n,size:18,style:t}),c.jsx("span",{style:{...B(13,"semibold"),color:"var(--text)"},children:n.name})]}),n.windows.map(r=>c.jsxs("div",{style:{...B(12),display:"flex",alignItems:"center",gap:10,whiteSpace:"nowrap"},children:[c.jsx("span",{style:{width:64,flex:"none",overflow:"hidden",textOverflow:"ellipsis",color:"var(--text)"},children:Jx(r)}),c.jsx(xT,{percent:r.percent,tint:Gx(n.id)}),c.jsxs("span",{style:{width:36,flex:"none",textAlign:"right",fontVariantNumeric:"tabular-nums",color:"var(--text)"},children:[Math.round(r.percent),"%"]}),c.jsx("span",{style:{width:130,flex:"none",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",color:"var(--secondary)"},children:vT(r)??""})]},r.id))]},n.id))})}function xT({percent:e,tint:t}){const n=e>=90?"var(--danger)":e>=70?"var(--warning)":t;return c.jsx("span",{style:{flex:1,minWidth:0,height:6,borderRadius:3,background:"var(--bubble-agent)",overflow:"hidden"},children:c.jsx("span",{style:{display:"block",height:"100%",borderRadius:3,background:n,width:`${Math.min(1,Math.max(.02,e/100))*100}%`,transition:"width var(--layout)"}})})}const q2=KS?"This Mac":"This computer",N3=[{id:"general",title:"General",group:"Personal",icon:"gearshape"},{id:"computers",title:"Computers & devices",label:"Computers",group:q2,icon:"desktopcomputer"},{id:"voice",title:"Voice chat",group:"Personal",icon:"waveform"},{id:"usage",title:"Usage",group:"Personal",icon:"gauge.with.dots.needle.33percent"},{id:"updates",title:"Updates",group:q2,icon:"arrow.down.circle"}];function wT({page:e}){const[t,n]=x.useState(e),r=ns(),l=ss(),h=N3.find(d=>d.id===t);return c.jsxs("div",{className:"settings",children:[c.jsx("nav",{className:"settings-sidebar",children:["Personal",q2].map(d=>c.jsxs("div",{style:{display:"contents"},children:[c.jsx("div",{className:"settings-group",style:{paddingTop:d==="Personal"?0:16},children:d}),N3.filter(p=>p.group===d).map(p=>c.jsxs("button",{className:`settings-item ${p.id===t?"selected":""}`,"aria-selected":p.id===t,onClick:()=>n(p.id),children:[c.jsx("span",{style:{width:18,display:"flex",justifyContent:"center",color:"var(--secondary)"},children:c.jsx(ae,{name:p.icon,size:13})}),c.jsx("span",{style:{flex:1,minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.label??p.title}),p.id==="computers"&&r.approvals.length>0?c.jsx("span",{style:{...B(11,"semibold"),color:"var(--secondary)"},children:r.approvals.length}):null]},p.id))]},d))}),c.jsx("div",{className:"settings-divider"}),c.jsxs("div",{className:"settings-main",children:[c.jsx("div",{style:{...B(24,"semibold"),color:"var(--text)",padding:"30px 32px 8px"},children:h.title}),c.jsx("div",{className:"settings-page",children:c.jsx(bT,{page:t})},t)]}),c.jsx("span",{className:"settings-close",children:c.jsx(ke,{title:"Close",icon:"xmark",onClick:l})})]})}function bT({page:e}){const t=ns();switch(e){case"general":return c.jsx(CT,{});case"computers":return c.jsx(rT,{});case"voice":return t.local?c.jsx(en.Provider,{value:t.local,children:c.jsx(d1,{showsHeader:!1})}):c.jsx(hi,{children:c.jsxs("span",{style:{color:"var(--secondary)"},children:["Voice keys are kept by ",go,"'s host, which isn't running."]})});case"usage":return c.jsx(hi,{children:c.jsx(kT,{})});case"updates":return c.jsx(ET,{})}}function CT(){const e=Ya(),[t,n]=ni(Rt.textSize),[r,l]=ni(Rt.usageIconStyle),[h,d]=ni(Rt.sidebarCompact),[p,g]=x.useState(!0);x.useEffect(()=>{window.codync.app.showInDock().then(g)},[]);const[m,v]=x.useState(!1);return x.useEffect(()=>{window.codync.app.launchAtLogin().then(v)},[]),c.jsxs(hi,{children:[c.jsx(Ee,{title:"Account",footer:e.errorMessage,children:c.jsxs("div",{className:"settings-row",children:[c.jsx(ae,{name:"person.crop.circle",size:26,color:"var(--secondary)"}),c.jsxs("div",{className:"settings-stack",style:{flex:1},children:[c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.isSignedIn?e.user?.email??"Signed in":"Not signed in"}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:e.isSignedIn?"Reach your computers from anywhere":"Sign in to reach your computers from anywhere"})]}),e.isSignedIn?c.jsx(Fe,{kind:"secondary",onClick:()=>{e.signOut()},disabled:e.isBusy,children:e.isBusy?"Please wait…":"Sign out"}):c.jsxs(c.Fragment,{children:[c.jsx(Fe,{kind:"secondary",onClick:()=>{e.signIn("apple")},disabled:e.isBusy,children:"Apple"}),c.jsx(Fe,{kind:"secondary",onClick:()=>{e.signIn("google")},disabled:e.isBusy,children:"Google"})]})]})}),c.jsxs(Ee,{title:"Appearance",children:[c.jsx(Jt,{label:"Text size",children:c.jsx(Ci,{selection:t,options:Uf.map(_=>({id:_,label:_===Ua?`${_} pt (Default)`:`${_} pt`})),onChange:n})}),c.jsx(Jt,{label:"Usage icons",children:c.jsx(Ci,{selection:r,options:[{id:"character",label:"Character"},{id:"original",label:"Original"}],onChange:l})}),c.jsx(rn,{on:h,onChange:d,children:"Compact sidebar"})]}),c.jsxs(Ee,{title:"System",children:[window.codync.platform==="darwin"?c.jsx(rn,{on:p,onChange:_=>{window.codync.app.setShowInDock(_).then(g)},children:"Show in Dock"}):null,c.jsx(rn,{on:m,onChange:_=>{window.codync.app.setLaunchAtLogin(_).then(v)},children:"Open at login"})]})]})}function kT(){const e=ns(),t=e.computers.flatMap(r=>e.store(r.id)??[]),n=t.filter(r=>r.usage.providers.length>0);return n.length===0?c.jsx("span",{style:{color:"var(--secondary)"},children:"No usage information yet."}):c.jsx(c.Fragment,{children:n.flatMap(r=>[t.length>1?c.jsxs("div",{style:{...B("headline"),display:"flex",alignItems:"center",gap:6},children:[c.jsx(Va,{computer:r.computer,size:16}),r.hostName]},`${r.computer.id}-label`):null,c.jsx(ST,{usage:r.usage},r.computer.id)])})}function ET(){const[e,t]=x.useState(null);if(x.useEffect(()=>(window.codync.updates.state().then(t),window.codync.updates.onChange(t)),[]),!e)return null;const n=e.supported?e.waitingForApp?`Waiting for iPhone app ${e.waitingForApp} to pass App Store review.`:null:"Updates are available in release builds.",r=e.lastCheck?`Last checked ${new Date(e.lastCheck).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}`:null;return c.jsx(hi,{children:c.jsx(Ee,{title:"Codync",footer:n,children:[c.jsx(Jt,{label:"Version",detail:r,children:c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10},children:[c.jsx("span",{children:window.codync.appVersion}),c.jsx(Fe,{kind:"secondary",onClick:()=>window.codync.updates.check(),disabled:!e.canCheck&&!e.staged,children:e.availableVersion?`Update to ${e.availableVersion}`:"Check for updates"})]})},"version"),c.jsx(rn,{on:e.autoCheck,onChange:l=>window.codync.updates.setAutoCheck(l),disabled:!e.supported,children:"Automatically check for updates"},"check"),c.jsx(rn,{on:e.autoDownload,onChange:l=>window.codync.updates.setAutoDownload(l),disabled:!e.supported,children:"Automatically download and install"},"download"),...e.error?[c.jsxs("div",{className:"settings-row settings-appear",children:[c.jsx("span",{style:{flex:1,color:"var(--warning)"},children:e.error}),c.jsx(Fe,{kind:"secondary",onClick:()=>window.codync.updates.check(),disabled:e.checking,children:"Retry"})]},"error")]:[]]})})}function MT({approval:e}){const t=ns(),[n,r]=x.useState(!1),[l,h]=x.useState(null),d=e.request,p=async m=>{r(!0);try{await t.decide(e,m),t.deferApproval(e)}catch(v){h(Wa(v))}finally{r(!1)}},g={textAlign:"center"};return c.jsxs("div",{style:{width:420,display:"flex",flexDirection:"column"},children:[c.jsx(Lt,{title:"Access request"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:16,padding:"0 24px 24px"},children:[c.jsx(ae,{name:d.platform==="macos"?"laptopcomputer":"iphone",size:40,weight:"light",color:"var(--secondary)"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:4},children:[c.jsxs("div",{style:{...B("title3","semibold"),...g},children:[d.deviceName," wants to use ",e.store.hostName]}),d.email?c.jsxs("div",{style:{...B("callout"),color:"var(--secondary)"},children:["Signed in as ",d.email]}):null]}),d.code?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"selectable settings-appear",style:{...B(48,"semibold","monospaced"),color:"var(--text)"},"aria-label":`Code ${d.code.split("").join(" ")}`,children:L9(d.code)}),c.jsxs("div",{style:{...B("callout"),color:"var(--secondary)",...g},children:["Approve only if ",d.deviceName," shows exactly this code. If it doesn't, deny: someone may be trying to get in."]})]}):c.jsxs(c.Fragment,{children:[c.jsx(et,{}),c.jsxs("div",{style:{...B("callout"),color:"var(--secondary)"},children:["Waiting for ",d.deviceName," to show its code…"]})]}),c.jsx($a,{show:l!==null,children:c.jsx("div",{style:{...B("caption"),color:"var(--danger)",...g},children:l})}),c.jsxs("div",{style:{display:"flex",gap:12},children:[c.jsx(Fe,{kind:"secondary",onClick:()=>{p(!1)},disabled:n,children:"Deny"}),c.jsx(Fe,{onClick:()=>{p(!0)},disabled:n||!d.code,children:"Approve"})]})]})]})}const iw="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%3e%3cpath%20fill='%23EA4335'%20d='M24%209.5c3.54%200%206.71%201.22%209.21%203.6l6.85-6.85C35.9%202.38%2030.47%200%2024%200%2014.62%200%206.51%205.38%202.56%2013.22l7.98%206.19C12.43%2013.72%2017.74%209.5%2024%209.5z'/%3e%3cpath%20fill='%234285F4'%20d='M46.98%2024.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58%202.96-2.26%205.48-4.78%207.18l7.73%206c4.51-4.18%207.09-10.36%207.09-17.65z'/%3e%3cpath%20fill='%23FBBC05'%20d='M10.53%2028.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92%2016.46%200%2020.12%200%2024c0%203.88.92%207.54%202.56%2010.78l7.97-6.19z'/%3e%3cpath%20fill='%2334A853'%20d='M24%2048c6.48%200%2011.93-2.13%2015.89-5.81l-7.73-6c-2.15%201.45-4.92%202.3-8.16%202.3-6.26%200-11.57-4.22-13.47-9.91l-7.98%206.19C6.51%2042.62%2014.62%2048%2024%2048z'/%3e%3c/svg%3e",Bf=window.codync.platform==="darwin"?"Mac":"computer";function jT({onContinue:e}){const t=Ya(),n=Ka(),[r,l]=x.useState(n?4:0);if(x.useEffect(()=>{t.isSignedIn&&e()},[t.isSignedIn,e]),x.useEffect(()=>{if(n)return l(4);const d=[150,430,710,990].map((p,g)=>setTimeout(()=>l(g+1),p));return()=>d.forEach(clearTimeout)},[n]),!t.isReady)return c.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:14},children:[c.jsx(et,{size:24}),c.jsx("div",{style:{...B("callout"),color:"var(--secondary)"},children:"Checking for a saved account…"}),c.jsxs("button",{style:{color:"var(--secondary)"},onClick:e,children:["Continue on this ",Bf]})]});const h=d=>({opacity:d?1:0,transform:d?"none":"translateY(14px)",transition:"opacity 0.6s cubic-bezier(0.34, 1.3, 0.64, 1), transform 0.6s cubic-bezier(0.34, 1.3, 0.64, 1)"});return c.jsx("div",{style:{height:"100%",overflowY:"auto",background:"var(--background)"},children:c.jsxs("div",{style:{minHeight:"100%",maxWidth:480,margin:"0 auto",display:"flex",flexDirection:"column",padding:"0 24px 12px"},children:[c.jsx("div",{style:{flex:1,minHeight:24}}),c.jsx(DT,{shown:r>=1}),c.jsx("div",{style:{flex:1,minHeight:24}}),c.jsx("div",{style:{paddingBottom:24},children:c.jsx(RT,{shown:r>=2})}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,...h(r>=3)},children:[c.jsxs("div",{style:{fontSize:34,fontWeight:600,letterSpacing:-.6,color:"var(--text)",lineHeight:1.15},children:["Your coding agents,",c.jsx("br",{}),"as teammates."]}),c.jsx("div",{style:{...B("body"),color:"var(--secondary)"},children:"Give each one a name and a project. They work on your computer while you're away."})]}),c.jsx("div",{style:{flex:1,minHeight:32}}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,...h(r>=4)},children:[c.jsxs(Fe,{onClick:e,style:{...B("headline"),minHeight:50,width:"100%"},children:["Continue on this ",Bf]}),c.jsx(Fe,{onClick:()=>{t.signIn("apple")},disabled:!t.isConfigured||t.isBusy,style:{...B("headline"),minHeight:50,width:"100%"},children:t.isBusy?c.jsx(et,{size:18}):c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10},children:[c.jsx(ae,{name:"apple.logo",size:20}),"Continue with Apple"]})}),c.jsx(Fe,{kind:"secondary",onClick:()=>{t.signIn("google")},disabled:!t.isConfigured||t.isBusy,style:{...B("headline"),minHeight:50,width:"100%"},children:t.isBusy?c.jsx(et,{size:18}):c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10},children:[c.jsx("img",{src:iw,alt:"",width:20,height:20}),"Continue with Google"]})}),t.isConfigured?null:c.jsxs("div",{style:{...B("footnote"),color:"var(--tertiary)"},children:["Sign-in isn't configured in this build. You can still use Codync on this ",Bf,"."]}),t.errorMessage?c.jsx("div",{style:{...B("footnote"),color:"var(--warning)"},children:t.errorMessage}):null]})]})})}const TT=[{shape:"blob",color:"blue",size:92,x:0,y:0,mood:"working"},{shape:"squircle",color:"orange",size:64,x:-104,y:-34,mood:"idle"},{shape:"teardrop",color:"violet",size:58,x:100,y:-46,mood:"working"},{shape:"hex",color:"green",size:48,x:-76,y:64,mood:"idle"},{shape:"cloud",color:"magenta",size:52,x:84,y:58,mood:"needsInput"}];function DT({shown:e}){const t=Ka(),[n,r]=x.useState(0);return x.useEffect(()=>{if(t||!e)return;let l=0;const h=d=>{r(d/1e3),l=requestAnimationFrame(h)};return l=requestAnimationFrame(h),()=>cancelAnimationFrame(l)},[t,e]),c.jsx("div",{"aria-hidden":!0,style:{position:"relative",height:170},children:TT.map((l,h)=>c.jsx("div",{style:{position:"absolute",left:"50%",top:"50%",transform:`translate(calc(-50% + ${l.x}px), calc(-50% + ${l.y+(t?0:Math.sin(n*1.3+h*1.7)*5)}px)) scale(${e?1:.3})`,opacity:e?1:0,transition:`opacity 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) ${h*.07}s, scale 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) ${h*.07}s`},children:c.jsx(nn,{shape:l.shape,color:l.color,size:l.size,mood:l.mood})},l.shape))})}function RT({shown:e}){const t=Ka(),[n,r]=x.useState(!1);x.useEffect(()=>{if(!e)return;const h=setTimeout(()=>r(!0),t?0:1600);return()=>clearTimeout(h)},[e,t]);const l={opacity:e?1:0,transform:e?"none":"translateY(14px)",transition:"opacity 0.6s, transform 0.6s cubic-bezier(0.34, 1.3, 0.64, 1)"};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[c.jsx("div",{style:{display:"flex",justifyContent:"flex-end",...l},children:c.jsx("span",{style:{...B("subheadline"),color:"var(--text)",padding:"9px 14px",background:"var(--bubble-user)",borderRadius:18},children:"Fix the flaky login test"})}),c.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,...l},children:[c.jsx(nn,{shape:"blob",color:"blue",size:28,mood:n?"idle":"working"}),n?c.jsx("span",{style:{...B("subheadline"),color:"var(--text)",padding:"9px 14px",background:"var(--bubble-agent)",borderRadius:18,animation:"bubble-in 0.45s cubic-bezier(0.34, 1.3, 0.64, 1) both",transformOrigin:"bottom left"},children:"Done. It raced the session refresh; tests pass on fix/login."}):c.jsx("span",{style:{...B("subheadline"),color:"var(--tertiary)"},children:"Working…"})]}),c.jsx("style",{children:"@keyframes bubble-in { from { opacity: 0; transform: scale(0.92) } }"})]})}function L3(){const{user:e,isBusy:t}=Ya();return c.jsxs("span",{className:"profile-avatar","aria-hidden":!0,style:{position:"relative",overflow:"hidden"},children:[e?.avatarURL?c.jsx("img",{src:e.avatarURL,alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}):c.jsx(ae,{name:"person.fill",size:15,weight:"medium",color:"var(--secondary)"}),t?c.jsx("span",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:c.jsx(et,{size:14})}):null]})}function AT({compact:e,approvals:t,onDismiss:n,onUsage:r,onSettings:l}){const[h,d]=x.useState("main"),{user:p,isBusy:g,errorMessage:m}=Ya(),v=p!==null,_=v?[{title:g?"Please wait…":"Sign out",icon:"rectangle.portrait.and.arrow.right",disabled:g,action:()=>{n(),Zn.signOut()}}]:[{title:"Continue with Apple",icon:"apple.logo",disabled:g,action:()=>{n(),Zn.signIn("apple")}},{title:"Continue with Google",icon:"person.crop.circle.badge.plus",image:iw,disabled:g,action:()=>{n(),Zn.signIn("google")}}],S=b=>{n(),window.codync.app.openExternal(b)},w=h==="support"?[{title:"Support",icon:"chevron.left",action:()=>d("main")},{title:"Help & documentation",icon:"book",chevron:!0,action:()=>S("https://github.com/leepokai/codync#readme")},{title:"Report an issue",icon:"bubble.left",chevron:!0,action:()=>S("https://github.com/leepokai/codync/issues")}]:[{title:"Usage",icon:"gauge.with.dots.needle.33percent",chevron:!0,action:r},{title:"Get Codync for mobile",icon:"iphone",action:()=>S("https://apps.apple.com/app/id6760984418")},{title:"Support",icon:"book.closed",chevron:!0,action:()=>d("support")},{title:"Settings",icon:"gearshape",detail:t>0?String(t):null,action:l},..._];return c.jsx("div",{className:"context-layer",onMouseDown:b=>b.target===b.currentTarget&&n(),children:c.jsxs("div",{className:"account-panel",style:{width:Math.min(260,window.innerWidth-32),left:16,bottom:e?68:64},children:[c.jsx(sw,{items:w,onDismiss:n,after:b=>h==="main"&&b===3?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"panel-divider"}),c.jsxs("div",{className:"panel-identity",children:[c.jsx(ae,{name:"person.crop.circle",size:15}),c.jsx("span",{style:{...B(12),flex:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p?.email??"Account"}),v?null:c.jsx("span",{style:B(11),children:"Not signed in"})]})]}):h==="support"&&b===0?c.jsx("div",{className:"panel-divider"}):null}),h==="main"&&m?c.jsx("div",{style:{...B(12),color:"var(--warning)",padding:"8px 10px"},children:m}):null]})})}function sw({items:e,onDismiss:t,after:n,dismissOnActivate:r=!1}){const[l,h]=x.useState(0);return x.useEffect(()=>{const d=p=>{if(p.key==="Escape")p.preventDefault(),t();else if(p.key==="ArrowDown"||p.key==="Tab"&&!p.shiftKey)p.preventDefault(),h(g=>(g+1)%e.length);else if(p.key==="ArrowUp"||p.key==="Tab"&&p.shiftKey)p.preventDefault(),h(g=>(g-1+e.length)%e.length);else if(p.key==="Enter"||p.key===" "){p.preventDefault();const g=e[l];g&&!g.disabled&&(r&&t(),g.action())}};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,l,t,r]),c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:e.map((d,p)=>c.jsxs("div",{children:[c.jsxs("button",{className:`panel-row ${l===p?"highlight":""}`,style:{color:d.destructive?"var(--danger)":"var(--text)"},disabled:d.disabled,onMouseEnter:()=>h(p),onClick:()=>{r&&t(),d.action()},children:[c.jsx("span",{style:{width:20,display:"flex",justifyContent:"center"},children:d.image?c.jsx("img",{src:d.image,alt:"",width:14,height:14}):c.jsx(ae,{name:d.icon,size:14})}),c.jsx("span",{style:{...B(12),flex:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:d.title}),d.detail?c.jsx("span",{style:{...B(13),color:"var(--secondary)"},children:d.detail}):null,d.chevron?c.jsx(ae,{name:"chevron.right",size:11,color:"var(--secondary)"}):null]}),n?.(p)]},d.title))})}function NT({items:e,onDismiss:t,style:n}){const r=e.map(l=>({title:l.title,icon:l.icon??"circle",destructive:l.destructive,action:l.action}));return c.jsx("div",{className:"action-menu",style:n,children:c.jsx(sw,{items:r,onDismiss:t,dismissOnActivate:!0,after:l=>e[l+1]?.divider?c.jsx("div",{className:"panel-divider"}):null})})}const LT=window.codync.platform==="darwin",B3=new Map;function nw(e,t,n,r){const l=`${e}|${Co()}`,h=B3.get(l);if(h)return h;const d=2,p=document.createElement("canvas");p.width=t*d,p.height=n*d;const g=p.getContext("2d");g.scale(d,d),r(g);const m=p.toDataURL("image/png");return B3.set(l,m),m}function BT(e){const t=`bot|${e.id}|${e.avatarShape}|${e.avatarColor}|${e.status}|${e.unread>0}`;return nw(t,20,20,n=>{const r=Co();K2(n,{shape:e.avatarShape,fill:ko(e.avatarColor),size:20,mood:$3(e,!1),dark:r,t:0,still:!0});const l=ln(e)?"#F0A030":e.unread>0?r?"#FFFFFF":"#000000":null;if(l){const h=ln(e)?3.6:2.8;n.beginPath(),n.arc(20-h,20-h,h+1,0,Math.PI*2),n.fillStyle=r?"#1e1e1e":"#f2f2f2",n.fill(),n.beginPath(),n.arc(20-h,20-h,h,0,Math.PI*2),n.fillStyle=l,n.fill()}})}function OT(e,t){const n=Math.round(t.percent);return nw(`bar|${e}|${n}`,60,16,r=>{const l=Co(),h=t.percent>=90?l?"#F0A7A7":"#C23A2B":t.percent>=70?"#F0A030":Yx(e);r.fillStyle=l?"rgba(255,255,255,0.12)":"rgba(0,0,0,0.12)",r.beginPath(),r.roundRect(0,5.5,60,5,2.5),r.fill(),t.percent>0&&(r.fillStyle=h,r.beginPath(),r.roundRect(0,5.5,Math.max(5,60*Math.min(1,t.percent/100)),5,2.5),r.fill())})}function zT(e){const t=ew(e);return`${Jx(e)} · ${Math.round(e.percent)}%${t?` · resets in ${tw(t)}`:""}`}function HT(e){const t=[...e.stores.values()];Y3(t);const[n]=ni(Rt.textSize),[r]=ni(Rt.usageIconStyle);x.useEffect(()=>{const l=setTimeout(()=>{const h=e.local,d=e.roster.filter(v=>!At(v.bot)),p=e.approvals.length?"A device asks for access":e.needsAttention?"A bot needs you":e.working>0?`${e.working} bot${e.working===1?"":"s"} working`:"Connected",g=h?.screen,m={status:p,canPair:!!h,approval:e.approvals[0]?.request.deviceName??null,bots:d.map(v=>({ref:`${v.ref.computerId}/${v.ref.botId}`,name:e.computers.length>1?`${v.bot.name} · ${v.computer.name}`:v.bot.name,detail:ln(v.bot)?"Needs your response":Jn(v.bot)?v.bot.activity||"Working…":v.bot.lastMessage??bo(v.bot),working:Jn(v.bot),avatar:BT(v.bot)})),usage:(h?.usage.providers??[]).map(v=>({name:v.name,icon:yT(v,16,r,Co()),lines:v.windows.map(_=>({title:zT(_),bar:OT(v.id,_)}))})),screen:g?{enabled:g.enabled,subtitle:IT(e),needsLoginItem:e.screenNeedsApproval,needsCapture:g.enabled&&g.connected&&!g.capture,needsInput:g.enabled&&g.connected&&!g.input,error:e.screenError}:null,version:h?.hello?.version??null,needsAttention:e.needsAttention,textSize:n,usageIconStyle:r};window.codync.app.setTraySummary(m)},150);return()=>clearTimeout(l)})}function IT(e){const t=e.local,n=t?.screen;if(!t||!n||!n.enabled)return`Control this ${LT?"Mac":"computer"} from your iPhone`;if(e.screenNeedsApproval)return"Needs approval in System Settings";if(!n.connected)return"Starting Codync Screen…";if(!n.capture||!n.input)return"Needs permission";if(n.viewers>0)return n.viewers===1?"Your iPhone is viewing":`${n.viewers} viewers`;const r=n.agentBot?t.bots.get(n.agentBot):null;if(r)return`${r.name} is using it`;const l=n.displays.find(h=>h.main)?.name??n.displays[0]?.name;return l?`Ready · ${l}`:"Ready"}const V2=window.codync.platform==="darwin";function UT(){const e=ns(),[t,n]=ni(Rt.onboardingDone),[r,l]=x.useState(!1);HT(e),nT(e);const h=e.host.state.kind==="running"||e.computers.length>0;x.useEffect(()=>window.codync.app.onCommand(p=>{switch(p.kind){case"confirmReset":return l(!0);case"reviewApprovals":return e.reviewApprovals();case"setTextSize":return Rt.textSize.set(p.size);case"stepTextSize":return Rt.textSize.set(p.up===null?Ua:YC(Rt.textSize.get(),p.up));case"setUsageIconStyle":return Rt.usageIconStyle.set(p.style);case"openBot":{const g=D_(p.ref);g&&e.select(g);return}case"stopBot":{const g=D_(p.ref);g&&e.store(g.computerId)?.stop(g.botId);return}case"setRemoteScreen":e.setRemoteScreen(p.on);return}}),[e]);const d=e.currentApproval;return c.jsxs("div",{className:"chat-window",children:[t?h?c.jsx(qT,{}):c.jsx(PT,{}):c.jsx(jT,{onContinue:()=>n(!0)}),c.jsx(ts,{open:r,title:"Reset all data?",message:"Signs out every account and deletes this computer's bots, conversations, keys and settings. Codync then starts over from the welcome screen.",actions:[{title:"Reset everything",destructive:!0,action:()=>{window.codync.app.resetAllData()}}],onClose:()=>l(!1)}),c.jsx($t,{open:d!==null,onClose:()=>d&&e.deferApproval(d),children:d?c.jsx(MT,{approval:d},d.id):null})]})}function PT(){const t=ns().host.state;switch(t.kind){case"notInstalled":return c.jsx(Sh,{icon:"desktopcomputer",title:`Set up this ${V2?"Mac":"computer"}`,message:`Codync runs your coding agents through the host, a small background service on this ${V2?"Mac":"computer"}.`,action:["Install host",()=>window.codync.host.install()]});case"missingBinary":return c.jsx(Sh,{icon:"desktopcomputer.trianglebadge.exclamationmark",title:"The host is missing",message:"This copy of Codync doesn't include codync-host. Download Codync again from codync.dev or GitHub."});case"failed":return c.jsx(Sh,{icon:"desktopcomputer.trianglebadge.exclamationmark",title:"The host isn't running",message:t.message,action:["Try again",()=>window.codync.host.restart()]});default:return c.jsx(Sh,{icon:"desktopcomputer",title:"Starting the host…",message:"This takes a few seconds."})}}function Sh({icon:e,title:t,message:n,action:r}){return c.jsxs("div",{className:"empty-state",children:[c.jsx(ae,{name:e,size:36,weight:"light",color:"var(--tertiary)"}),c.jsx("div",{style:{...B("title3","semibold"),color:"var(--text)"},children:t}),c.jsx("div",{style:{...B("callout"),color:"var(--secondary)",textAlign:"center",maxWidth:360},children:n}),r?c.jsx(Fe,{onClick:r[1],style:{marginTop:4},children:r[0]}):null]})}function qT(){const e=ns(),[t,n]=ni(Rt.sidebarCompact),[r,l]=ni(Rt.sidebarWidth),[h,d]=ni(Rt.hiddenComputers),[p,g]=x.useState(""),[m,v]=x.useState(!1),[_,S]=x.useState(!1),[w,b]=x.useState(null),k=x.useRef(null),[E,j]=x.useState(!1),[V,A]=x.useState(!1),[z,F]=x.useState(null),[R,I]=x.useState(null),[q,U]=x.useState(null),[Y,$]=x.useState(null),[M,N]=x.useState(null),[L,O]=x.useState(null),[P,te]=x.useState(null),Q=x.useCallback(()=>te("voice"),[]),[ce,re]=x.useState(!1),[de,Ce]=x.useState({width:window.innerWidth,height:window.innerHeight}),je=x.useRef(null),D=x.useRef(null),J=x.useRef(null),le=x.useRef(null);Y3([...e.stores.values()]),x.useEffect(()=>{const oe=()=>{Ce({width:window.innerWidth,height:window.innerHeight}),l(Math.min(Rt.sidebarWidth.get(),Math.max(260,window.innerWidth-420)))};return window.addEventListener("resize",oe),()=>window.removeEventListener("resize",oe)},[l]);const he=Math.max(420,de.height-76),we=e.computers.map(oe=>e.store(oe.id)).filter(oe=>!!oe),xe=new Set(iS(e.computers.map(oe=>oe.id),h).shown),be=we.filter(oe=>xe.has(oe.computer.id)&&oe.connection.kind==="online"&&!oe.mismatch),pe=e.selectedStore,_e=w?e.store(w):null,Re=p.trim().toLowerCase(),fi=e.roster.filter(oe=>xe.has(oe.ref.computerId)&&(t||!Re||oe.bot.name.toLowerCase().includes(Re)||(oe.bot.lastMessage??"").toLowerCase().includes(Re))),pi=(oe=!1)=>{S(oe);const Ze=[pe,e.local].find(ti=>ti&&be.includes(ti))??be[0];Ze&&(m||(k.current=e.selection),b(Ze.computer.id),e.select(null),v(!0))};x.useEffect(()=>{e.selection&&v(!1)},[e.selection]),x.useEffect(()=>window.codync.app.onCommand(oe=>{oe.kind==="newChat"&&be.length&&pi(),oe.kind==="search"&&(n(!1),setTimeout(()=>je.current?.focus(),0)),oe.kind==="toggleSidebar"&&n(!Rt.sidebarCompact.get())}));const Bt=x.useRef(!1);x.useEffect(()=>{const oe=window.codync.debugOpen;if(!(!oe||Bt.current))if(oe==="compose"||oe==="group"){if(!be.length)return;Bt.current=!0,pi(oe==="group")}else if(oe==="plugins"){if(!e.local)return;Bt.current=!0,O(e.local.computer.id)}else if(oe==="computers")Bt.current=!0,te("computers");else{const Ze=e.roster.find(ti=>ti.bot.name===oe);if(!Ze)return;Bt.current=!0,e.select(Ze.ref)}});const pt=()=>[{title:"New chat",icon:"square.and.pencil",action:()=>pi()},{title:"New group chat",icon:"person.2",action:()=>pi(!0)}],$e=()=>O((pe??e.local??be[0])?.computer.id??null),gi=(oe,Ze)=>[{title:oe.pinned?"Unpin":"Pin",icon:"pin",action:()=>Ze.setPinned(oe,!oe.pinned)},{title:"Mark as Read",icon:"bell.badge",action:()=>Ze.markAllRead(oe.id)},{title:"Edit Profile…",icon:"square.and.pencil",divider:!0,action:()=>U({id:crypto.randomUUID(),draft:yo(oe),store:Ze})},{title:"Copy conversation ID",icon:"square.on.square",divider:!0,action:()=>window.codync.app.copy(oe.id)},{title:"New session",icon:"arrow.counterclockwise",action:()=>N({bot:oe,store:Ze})},{title:"Hide from sidebar",icon:"eye.slash",divider:!0,action:()=>Ze.setHidden(oe,!0)},{title:"Delete",icon:"trash",destructive:!0,action:()=>$({bot:oe,store:Ze})}],ge=oe=>{if(oe.key!=="ArrowUp"&&oe.key!=="ArrowDown")return;const Ze=fi.map(ir=>ir.ref);if(!Ze.length)return;oe.preventDefault();const ti=Ze.findIndex(ir=>R_(ir,e.selection)),ls=oe.key==="ArrowDown"?Math.min(ti+1,Ze.length-1):Math.max(ti-1,0);e.select(Ze[ls])},Ke=x.useRef(null),ki=oe=>{oe.target.setPointerCapture(oe.pointerId),Ke.current={x:oe.clientX,width:t?76:r}},Ur=oe=>{if(!Ke.current)return;const Ze=Ke.current.width+oe.clientX-Ke.current.x,ti=Ze<180;ti!==t&&n(ti),ti||l(Math.min(Math.max(260,Ze),Math.min(420,window.innerWidth-420)))},Bs=e.errorMessage,Pr=we.filter(oe=>xe.has(oe.computer.id)&&oe.mismatch),rs=e.selection,Qa=rs&&pe?.bots.get(rs.botId);let tr;m&&_e?tr=c.jsxs("div",{className:"detail-column",children:[be.length>1?c.jsx($T,{stores:be,value:_e.computer.id,onChange:b}):null,c.jsx(en.Provider,{value:_e,children:c.jsx(ak,{group:_,onClose:()=>{v(!1),e.selection||e.select(k.current)}})})]},`${_e.computer.id}-${_}`):rs&&pe&&Qa?tr=c.jsx(en.Provider,{value:pe,children:c.jsx(J9,{botId:rs.botId},T_(rs))}):tr=c.jsxs("div",{className:"empty-detail",children:[c.jsxs("div",{style:{display:"flex"},children:[c.jsx(nn,{shape:"blob",color:"blue",size:60,mood:"working"}),c.jsx(nn,{shape:"squircle",color:"orange",size:60,style:{marginLeft:-10}}),c.jsx(nn,{shape:"teardrop",color:"violet",size:60,mood:"working",style:{marginLeft:-10}})]}),c.jsx("div",{style:B("title2","semibold"),children:"Your coding agents, as teammates."}),c.jsx("div",{style:{color:"var(--secondary)",textAlign:"center",maxWidth:420},children:"Pick a bot, or create one for each kind of work and point it at a project."}),c.jsx(Fe,{onClick:()=>pi(),disabled:!be.length,children:"New Bot"})]});const as=t?76:r;return c.jsxs("div",{className:"split",style:{pointerEvents:ce||R?"none":void 0},children:[c.jsxs("aside",{className:`sidebar ${t?"compact":""}`,style:{width:as},children:[c.jsxs("div",{className:"sidebar-header drag",style:{paddingLeft:t?0:V2?80:18,opacity:t?0:1,pointerEvents:t?"none":void 0},"aria-hidden":t,children:[c.jsx("span",{style:{flex:1}}),c.jsxs("div",{className:"no-drag",style:{display:"flex",alignItems:"center",gap:6},children:[c.jsx(O_,{hidden:h,setHidden:d,manage:()=>te("computers")}),c.jsx(ke,{title:"New",icon:"plus",buttonRef:D,onClick:()=>j(oe=>!oe),disabled:!be.length})]}),c.jsx(Pa,{open:E,onClose:()=>j(!1),anchor:D,items:pt})]}),t?c.jsx("div",{style:{width:70,alignSelf:"center"},className:"drag",children:c.jsx("div",{className:"no-drag",style:{display:"flex",justifyContent:"center"},children:c.jsx(O_,{hidden:h,setHidden:d,manage:()=>te("computers"),compact:!0})})}):null,t?null:c.jsxs("div",{className:"search",children:[c.jsx(ae,{name:"magnifyingglass",size:13,color:"var(--secondary)"}),c.jsx("input",{ref:je,value:p,placeholder:"Search","aria-label":"Search bots",spellCheck:!1,onChange:oe=>g(oe.target.value),onKeyDown:oe=>{oe.key==="Escape"&&(g(""),je.current?.blur())}}),p?c.jsx("button",{className:"search-clear","aria-label":"Clear search",title:"Clear search",onClick:()=>g(""),children:c.jsx(ae,{name:"xmark.circle.fill",size:13,color:"var(--secondary)"})}):null]}),c.jsxs("div",{className:"roster",ref:le,tabIndex:0,onKeyDown:ge,children:[t?null:Pr.map(oe=>c.jsx("div",{style:{paddingBottom:8},children:c.jsx(en.Provider,{value:oe,children:c.jsx(J2,{})})},oe.computer.id)),fi.map(oe=>{const Ze=T_(oe.ref),ti=R_(oe.ref,rs);return c.jsx("button",{className:"roster-row",style:{padding:t?0:"0 8px",background:ti?"var(--bubble-user)":z===Ze?"var(--bubble-agent)":"transparent"},"aria-label":we.length>1?`${oe.bot.name}, on ${oe.store.hostName}`:oe.bot.name,"aria-selected":ti,title:we.length>1?`${oe.bot.name} · ${oe.store.hostName}`:oe.bot.name,onMouseEnter:()=>F(Ze),onMouseLeave:()=>F(ls=>ls===Ze?null:ls),onClick:()=>e.select(oe.ref),onContextMenu:ls=>{ls.preventDefault(),I({target:{bot:oe.bot,store:oe.store},x:ls.clientX,y:ls.clientY})},children:c.jsx(m8,{bot:oe.bot,store:oe.store,compact:t,usingComputer:oe.store.screen?.agentBot===oe.bot.id,members:At(oe.bot)?oe.store.members(oe.bot):VT})},Ze)}),fi.length===0&&!t&&Pr.length===0?c.jsxs("div",{className:"roster-empty",children:[c.jsx("div",{style:B(13,"medium"),children:p?"No matching bots":"No bots yet"}),c.jsx("div",{style:{...B(12),color:"var(--secondary)"},children:p?"Try another name or message.":"Use + to start a new chat."})]}):null]}),t?c.jsxs("div",{className:"rail-actions",children:[c.jsx(ke,{title:"New",icon:"plus",size:36,buttonRef:J,disabled:!be.length,onClick:()=>A(oe=>!oe)}),c.jsx(Pa,{open:V,onClose:()=>A(!1),anchor:J,items:pt}),c.jsx(ke,{title:"Marketplace",icon:"square.grid.2x2",size:36,onClick:$e}),c.jsx("button",{className:"rail-profile",style:{background:ce?"var(--bubble-agent)":void 0},"aria-label":"Open account menu for Account",title:"Account",onClick:()=>re(oe=>!oe),children:c.jsx(L3,{})})]}):c.jsxs("div",{className:"sidebar-footer",children:[c.jsxs("button",{className:"footer-row",onClick:$e,children:[c.jsx("span",{className:"footer-icon",children:c.jsx(ae,{name:"square.grid.2x2",size:14})}),c.jsx("span",{children:"Marketplace"})]}),c.jsxs("button",{className:`footer-row account ${ce?"active":""}`,"aria-label":"Open account menu for Account",title:"Account menu",onClick:()=>re(oe=>!oe),children:[c.jsx(L3,{}),c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Account"})]})]})]}),c.jsx("div",{className:"sidebar-divider",onPointerDown:ki,onPointerMove:Ur,onPointerUp:()=>Ke.current=null,role:"separator","aria-label":"Resize sidebar","aria-valuenow":as}),c.jsx("main",{className:"detail",children:c.jsx(XS.Provider,{value:Q,children:tr})}),ce?c.jsx(AT,{compact:t,approvals:e.approvals.length,onDismiss:()=>re(!1),onUsage:()=>{re(!1),te("usage")},onSettings:()=>{re(!1),te("general")}}):null,R?c.jsx("div",{className:"context-layer",onMouseDown:oe=>oe.target===oe.currentTarget&&I(null),children:c.jsx(NT,{items:gi(R.target.bot,R.target.store),onDismiss:()=>I(null),style:{left:Math.min(Math.max(8,R.x),de.width-268),top:Math.min(Math.max(8,R.y),Math.max(8,de.height-344))}})}):null,c.jsx($t,{open:q!==null,onClose:()=>U(null),width:520,height:Math.min(680,he),children:q?c.jsx(en.Provider,{value:q.store,children:c.jsx(Z7,{draft:q.draft},q.id)}):null}),c.jsx($t,{open:L!==null,onClose:()=>O(null),width:Math.min(920,de.width-80),height:he,children:L&&e.store(L)?c.jsx(en.Provider,{value:e.store(L),children:c.jsx(Tj,{computers:be.map(oe=>({id:oe.computer.id,name:oe.hostName})),computer:L,onComputer:O},L)}):null}),c.jsx($t,{open:P!==null,onClose:()=>te(null),width:Math.min(800,de.width-80),height:Math.min(620,he),children:P?c.jsx(wT,{page:P}):null}),c.jsx(ts,{open:M!==null,title:"Start a new session?",message:"The conversation stays here, but the agent starts with a fresh context.",actions:M?[{title:"New session",action:()=>M.store.newSession(M.bot.id)}]:[],onClose:()=>N(null)}),c.jsx(ts,{open:Y!==null,title:`Delete ${Y?.bot.name??"bot"}?`,message:"Files it changed on your computer stay as they are.",actions:Y?[{title:"Delete bot and its conversation",destructive:!0,action:()=>Y.store.delete(Y.bot)}]:[],onClose:()=>$(null)}),c.jsx(ts,{open:Bs!==null,title:"Something went wrong",message:Bs,actions:[],cancel:"OK",onClose:()=>e.clearErrors()})]})}const VT=[];function $T({stores:e,value:t,onChange:n}){const r=x.useMemo(()=>e.map(l=>({id:l.computer.id,label:l.hostName})),[e]);return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"12px 22px 0",...B("callout")},children:[c.jsx("span",{style:{color:"var(--secondary)"},children:"On"}),c.jsx(Ci,{selection:t,options:r,onChange:n})]})}function WT(){const t=ns().host.local,[n,r]=x.useState(null),[l,h]=x.useState(null),[d,p]=x.useState(null),[g,m]=x.useState("this computer"),[v,_]=x.useState(null),S=x.useCallback(async()=>{if(!t)return _("This computer's host isn't connected.");const w=new Z2(t.baseURL,t.token);try{const[b,k,E]=await Promise.all([w.call("pairing",{},2e4),w.call("cloudStatus",{},2e4).catch(()=>null),w.call("hello",{},2e4).catch(()=>null)]);r(b),p(k),E?.name&&m(E.name),h(await Kx.toDataURL(b.pairingUrl,{errorCorrectionLevel:"M",margin:0,width:400,color:{dark:"#000000",light:"#ffffff"}})),_(null)}catch(b){_(b instanceof Error?b.message:String(b))}},[t]);return x.useEffect(()=>(S(),window.codync.app.onCommand(w=>w.kind==="reviewApprovals"&&void S())),[S]),x.useEffect(()=>{if(!n?.expiresAt)return;const w=setTimeout(()=>{S()},Math.max(1e3,n.expiresAt-Date.now()));return()=>clearTimeout(w)},[n?.expiresAt,S]),c.jsx("div",{style:{width:340,padding:16,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:n&&l?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{padding:10,background:"#fff",borderRadius:12},children:c.jsx("img",{src:l,alt:`Pairing code for ${g}`,width:200,height:200,style:{display:"block",imageRendering:"pixelated"}})}),c.jsx("div",{style:{...B("caption"),color:"var(--secondary)",textAlign:"center"},children:"Scan with the Codync app or the iPhone Camera. No Tailscale or open ports needed: your iPhone connects directly on the same Wi-Fi, and through the encrypted relay anywhere else."}),d?.enabled!==!0?c.jsx("div",{style:{...B("caption"),color:"var(--warning)",textAlign:"center"},children:n.urls.length===0?"No network address found and “Reach from anywhere” is off. Connect to Wi-Fi or turn it on.":`“Reach from anywhere” is off, so the iPhone only reaches ${g} on the same network.`}):null,c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[n.expiresAt?c.jsxs("span",{style:{...B("caption2"),color:"var(--tertiary)"},children:["Works once, until ",new Date(n.expiresAt).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})]}):null,c.jsx(ke,{title:"New code",icon:"arrow.clockwise",onClick:()=>{S()}}),c.jsx(ke,{title:"Copy pairing link",icon:"doc.on.doc",onClick:()=>window.codync.app.copy(n.pairingUrl)})]})]}):v?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{...B("caption"),color:"var(--danger)",textAlign:"center"},children:v}),c.jsx(ke,{title:"Try again",icon:"arrow.clockwise",onClick:()=>{S()}})]}):c.jsx(et,{size:20})})}const C1=new URLSearchParams(location.search).get("window")??"chat";document.documentElement.dataset.platform=window.codync.platform;G3(Rt.textSize.get());const rw=new h8(C1!=="pairing");rw.start();C1!=="pairing"&&Zn.start();Cb.createRoot(document.getElementById("root")).render(c.jsx(Z3.Provider,{value:rw,children:C1==="pairing"?c.jsx(WT,{}):c.jsx(UT,{})}));diff --git a/web/public/demo/desktop/index.html b/web/public/demo/desktop/index.htmlindex d6832d51..e6b485eb 100644--- a/web/public/demo/desktop/index.html+++ b/web/public/demo/desktop/index.html@@ -5,8 +5,8 @@<meta name="viewport" content="width=device-width, initial-scale=1" /><meta name="robots" content="noindex" /><title>Codync demo</title>- <script type="module" crossorigin src="./assets/index-D8ZgdR6B.js"></script>- <link rel="stylesheet" crossorigin href="./assets/index-DLwuTq6o.css">+ <script type="module" crossorigin src="/demo/desktop/assets/index-DJ5oPlCe.js"></script>+ <link rel="stylesheet" crossorigin href="/demo/desktop/assets/index-DLwuTq6o.css"></head><body><div id="root"></div>