@puddle-code/cli 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/CHANGELOG.md +11 -8
  2. package/README.md +2 -0
  3. package/dist/index.js +64 -27
  4. package/dist/public/assets/{Dashboard-Sq34AFXs.js → Dashboard-CSBXMYGY.js} +1 -1
  5. package/dist/public/assets/{EditorTabClose-C5BL8wr0.js → EditorTabClose-Cd7hOLfl.js} +1 -1
  6. package/dist/public/assets/{LazyTerminal-CeLHCKsO.js → LazyTerminal-DfuTR0O9.js} +2 -2
  7. package/dist/public/assets/{ModelRefcount-sJruf69B.js → ModelRefcount-C02fYdz4.js} +1 -1
  8. package/dist/public/assets/{PaneEditorBody-CbwKaj3E.js → PaneEditorBody-Z1Ke6fH8.js} +1 -1
  9. package/dist/public/assets/SettingsDialog-B55dU0g7.js +1 -0
  10. package/dist/public/assets/{Terminal-CN5FGN0_.js → Terminal-gjgBodjJ.js} +1 -1
  11. package/dist/public/assets/Workspace-2C-EaQLX.js +7 -0
  12. package/dist/public/assets/{buffer-store-CiF8VU5A.js → buffer-store-C0jIh5zW.js} +2 -2
  13. package/dist/public/assets/{context-menu-Bitp8sY-.js → context-menu-Z1HjXU39.js} +1 -1
  14. package/dist/public/assets/{cssMode-cJJRRtLZ.js → cssMode-DizQlgHk.js} +1 -1
  15. package/dist/public/assets/{htmlMode-Caw-2LOw.js → htmlMode-Dau_DmTs.js} +1 -1
  16. package/dist/public/assets/index-9VfaB4iq.css +2 -0
  17. package/dist/public/assets/{index-iPj6x3rM.js → index-A5BuRryw.js} +3 -3
  18. package/dist/public/assets/{jsonMode-CijUS1dz.js → jsonMode-BAVVDr3Y.js} +1 -1
  19. package/dist/public/assets/{session-seed-B2YmPsU-.js → session-seed-DiqfOmWL.js} +1 -1
  20. package/dist/public/assets/ssh-mode-DUOUmezi.js +1 -0
  21. package/dist/public/assets/{tsMode-_wbIu1Es.js → tsMode-DJANh-y6.js} +1 -1
  22. package/dist/public/index.html +3 -3
  23. package/package.json +1 -1
  24. package/dist/public/assets/SettingsDialog-BuTx8DF2.js +0 -1
  25. package/dist/public/assets/Workspace-NHcfAFZP.js +0 -7
  26. package/dist/public/assets/index-CRUVuFoo.css +0 -2
  27. package/dist/public/assets/ssh-mode-CAA0-mpZ.js +0 -1
package/CHANGELOG.md CHANGED
@@ -7,17 +7,20 @@ Past releases: see docs/changelogs/.
7
7
 
8
8
  # Changelog
9
9
 
10
- ## [0.0.20] — 2026-08-03
10
+ ## [0.0.21] — 2026-08-03
11
11
 
12
- ### Changed
12
+ ### Added
13
13
 
14
- - Place Settings Sync export above import, keeping the one-click export-and-copy flow ahead of the paste target it produces.
15
- - Session rows and tabs show one glyph, not two: the agent's brand mark (or a terminal glyph) drawn in the status colour, replacing the separate coloured dot beside it. The collapsed session rail keeps the dot there is no mark beside it to deduplicate. The sidebar's account line drops its agent mark too, now that the row already leads with one.
14
+ - Add an independent Monaco editor font-size control in Appearance; changing it does not change terminal text.
15
+ - Offer “Open Terminal in Directory” when right-clicking empty space in the explorer, opening a terminal at the worktree root (it was previously only on folder rows).
16
16
 
17
- ### Fixed
17
+ ### Changed
18
18
 
19
- - Show Codex's observed idle composer and Claude's first completed prompt as waiting-for-input green instead of leaving their status running amber.
19
+ - Keep every non-archived project visible in the right session sidebar, including projects with no sessions, so a project stays a navigation target: expanded groups get clickable project-name headers, and the collapsed rail gains a five-character project label above each divider.
20
+ - Show the session's agent or terminal glyph on the collapsed rail instead of a bare status dot, matching the expanded rows and tab chips.
21
+ - Name the agent (or `terminal`) on every sidebar row's second line, with the account appended after a `·` when there is one — previously the line appeared only for agent sessions with an account.
20
22
 
21
- ### Removed
23
+ ### Fixed
22
24
 
23
- - Status animations, and the **Reduced motion** setting with them. The running ripple and the waiting pulse are gone: the indicator's colour already carried the state and the motion only repeated it, at the cost of compositor frames after every status change on every visible session. With nothing left animating there is nothing for reduced motion to reduce, so the Appearance toggle has gone too — an existing value in local storage is simply ignored, and an imported settings payload carrying it is skipped.
25
+ - Let `puddle upgrade desktop` install the latest macOS app when no existing Puddle bundle is present, choosing writable `/Applications` or falling back to `~/Applications` and no longer requiring an old bundle to swap aside.
26
+ - Tighten adjacent captured-environment and ports rows beneath a terminal pane.
package/README.md CHANGED
@@ -58,6 +58,8 @@ curl -fsSL https://github.com/PerceptronV/puddle-code/releases/latest/download/i
58
58
 
59
59
  The same cockpit also ships as a standalone desktop app — identical UI and engine, plus a File → "Connect to SSH Host…" menu for remote hosts. Grab the dmg (macOS arm64) or AppImage (Linux x64) from the Releases page.
60
60
 
61
+ On macOS, an installed Puddle CLI can install or update the desktop app directly: quit Puddle, then run `puddle upgrade desktop`. A fresh install goes to `/Applications` when writable, otherwise `~/Applications`.
62
+
61
63
  The macOS downloads are **not code-signed** (an open-source project without Apple Developer Program fees), so Gatekeeper will refuse the first launch. Either allow it once — open the app, let macOS block it, then System Settings → Privacy & Security → **Open Anyway** — or clear the download quarantine in a terminal:
62
64
 
63
65
  ```sh
package/dist/index.js CHANGED
@@ -3930,7 +3930,7 @@ daemon restart if needed \u2014 keeping the old UI port so open tabs survive.
3930
3930
  list shows running cockpits; kill stops one \u2014 sessions keep running on the
3931
3931
  host either way. upgrade with no subject updates the CLI itself through npm;
3932
3932
  'daemon' updates puddled (on this machine, or on a user@host) and 'desktop'
3933
- updates the app bundle.`;
3933
+ installs or updates the macOS app bundle (Linux AppImages update in-app).`;
3934
3934
  function parseArgs(argv) {
3935
3935
  const [cmd, ...rest] = argv;
3936
3936
  if (cmd === void 0 || cmd === "help" || cmd === "--help" || cmd === "-h")
@@ -4147,15 +4147,15 @@ function argvFor(command) {
4147
4147
  init_attach();
4148
4148
  import { spawn as spawn7 } from "node:child_process";
4149
4149
  import { existsSync as existsSync3 } from "node:fs";
4150
- import { dirname as dirname6, join as join9 } from "node:path";
4150
+ import { dirname as dirname7, join as join9 } from "node:path";
4151
4151
  import { fileURLToPath as fileURLToPath3 } from "node:url";
4152
4152
 
4153
4153
  // src/lib/desktop-update.ts
4154
4154
  import { createHash } from "node:crypto";
4155
4155
  import { spawn } from "node:child_process";
4156
- import { createReadStream, createWriteStream } from "node:fs";
4157
- import { chmod, mkdir, readdir, rm, writeFile } from "node:fs/promises";
4158
- import { join as join3 } from "node:path";
4156
+ import { constants, createReadStream, createWriteStream } from "node:fs";
4157
+ import { access, chmod, mkdir, readdir, rm, writeFile } from "node:fs/promises";
4158
+ import { dirname as dirname2, join as join3 } from "node:path";
4159
4159
  import { Readable } from "node:stream";
4160
4160
  import { pipeline } from "node:stream/promises";
4161
4161
 
@@ -4184,7 +4184,7 @@ import { readFileSync } from "node:fs";
4184
4184
  import { dirname, join as join2 } from "node:path";
4185
4185
  import { fileURLToPath } from "node:url";
4186
4186
  function cliVersion() {
4187
- if (true) return "0.0.20";
4187
+ if (true) return "0.0.21";
4188
4188
  const here = dirname(fileURLToPath(import.meta.url));
4189
4189
  for (const candidate of [
4190
4190
  join2(here, "..", "..", "package.json"),
@@ -4351,9 +4351,15 @@ function swapScript(staged, opts) {
4351
4351
  `# puddle desktop update ${staged.version} \u2014 swap once the app exits`,
4352
4352
  ...wait,
4353
4353
  `target=${q(opts.targetPath)}`,
4354
+ `target_dir=${q(dirname2(opts.targetPath))}`,
4354
4355
  `staged=${q(staged.stagedPath)}`,
4356
+ `mkdir -p "$target_dir" || exit 1`,
4355
4357
  `rm -rf "$target.old"`,
4356
- `mv "$target" "$target.old" || exit 1`,
4358
+ `had_old=0`,
4359
+ `if [ -e "$target" ]; then`,
4360
+ ` mv "$target" "$target.old" || exit 1`,
4361
+ ` had_old=1`,
4362
+ `fi`,
4357
4363
  `if mv "$staged" "$target" 2>/dev/null || /usr/bin/ditto "$staged" "$target"; then`,
4358
4364
  // Defence in depth: the normal path never quarantines (node's fetch is
4359
4365
  // not a quarantine-opted-in app, and ditto only propagates what the
@@ -4363,7 +4369,8 @@ function swapScript(staged, opts) {
4363
4369
  ` rm -rf "$target.old" ${q(staged.dir)}`,
4364
4370
  ...opts.relaunch ? [` open "$target"`] : [],
4365
4371
  `else`,
4366
- ` mv "$target.old" "$target"`,
4372
+ ` rm -rf "$target"`,
4373
+ ` [ "$had_old" -eq 0 ] || mv "$target.old" "$target"`,
4367
4374
  ` exit 1`,
4368
4375
  `fi`,
4369
4376
  ``
@@ -4381,11 +4388,16 @@ function swapScript(staged, opts) {
4381
4388
  ``
4382
4389
  ].join("\n");
4383
4390
  }
4384
- async function findInstalledDesktopApp() {
4385
- if (process.platform !== "darwin") return null;
4391
+ async function findInstalledDesktopApp(opts = {}) {
4392
+ if ((opts.platform ?? process.platform) !== "darwin") return null;
4386
4393
  const { readFile } = await import("node:fs/promises");
4387
4394
  const { homedir: homedir2 } = await import("node:os");
4388
- for (const appPath of ["/Applications/Puddle.app", join3(homedir2(), "Applications/Puddle.app")]) {
4395
+ const systemApplications = opts.systemApplicationsDir ?? "/Applications";
4396
+ const home = opts.homeDir ?? homedir2();
4397
+ for (const appPath of [
4398
+ join3(systemApplications, "Puddle.app"),
4399
+ join3(home, "Applications", "Puddle.app")
4400
+ ]) {
4389
4401
  try {
4390
4402
  const plist = await readFile(join3(appPath, "Contents/Info.plist"), "utf8");
4391
4403
  const match = /<key>CFBundleShortVersionString<\/key>\s*<string>([^<]+)<\/string>/.exec(
@@ -4397,6 +4409,23 @@ async function findInstalledDesktopApp() {
4397
4409
  }
4398
4410
  return null;
4399
4411
  }
4412
+ async function desktopAppInstallPath(opts = {}) {
4413
+ if ((opts.platform ?? process.platform) !== "darwin") return null;
4414
+ const { homedir: homedir2 } = await import("node:os");
4415
+ const systemApplications = opts.systemApplicationsDir ?? "/Applications";
4416
+ const canWrite = opts.canWrite ?? (async (path) => {
4417
+ try {
4418
+ await access(path, constants.W_OK);
4419
+ return true;
4420
+ } catch {
4421
+ return false;
4422
+ }
4423
+ });
4424
+ if (await canWrite(systemApplications)) return join3(systemApplications, "Puddle.app");
4425
+ const userApplications = join3(opts.homeDir ?? homedir2(), "Applications");
4426
+ await mkdir(userApplications, { recursive: true });
4427
+ return join3(userApplications, "Puddle.app");
4428
+ }
4400
4429
  function isDesktopAppRunning(appPath) {
4401
4430
  return new Promise((resolve3) => {
4402
4431
  const child = spawn("/usr/bin/pgrep", ["-f", `${appPath}/Contents/MacOS/`], {
@@ -19949,7 +19978,7 @@ async function waitForToken(transport, timeoutMs) {
19949
19978
 
19950
19979
  // src/lib/bootstrap.ts
19951
19980
  import { existsSync, readFileSync as readFileSync2 } from "node:fs";
19952
- import { dirname as dirname2, join as join4, resolve } from "node:path";
19981
+ import { dirname as dirname3, join as join4, resolve } from "node:path";
19953
19982
  import { fileURLToPath as fileURLToPath2 } from "node:url";
19954
19983
  init_types();
19955
19984
  async function installedVersion(transport) {
@@ -20019,7 +20048,7 @@ function lastLines(text, count = 3) {
20019
20048
  return text.trim().split("\n").slice(-count).join("\n");
20020
20049
  }
20021
20050
  function readInstallScript() {
20022
- const here = dirname2(fileURLToPath2(import.meta.url));
20051
+ const here = dirname3(fileURLToPath2(import.meta.url));
20023
20052
  const candidates = [
20024
20053
  join4(here, "install.sh"),
20025
20054
  // dist/index.js → dist/install.sh
@@ -20183,7 +20212,7 @@ function isLocalOrigin(origin) {
20183
20212
 
20184
20213
  // src/lib/serve/local-sync.ts
20185
20214
  import { mkdirSync, readFileSync as readFileSync3, renameSync, writeFileSync } from "node:fs";
20186
- import { dirname as dirname3 } from "node:path";
20215
+ import { dirname as dirname4 } from "node:path";
20187
20216
  var MAX_BODY_BYTES = 5 * 1024 * 1024;
20188
20217
  function readStore(file2) {
20189
20218
  try {
@@ -20196,7 +20225,7 @@ function readStore(file2) {
20196
20225
  return { version: 1, profiles: {} };
20197
20226
  }
20198
20227
  function writeStore(file2, store) {
20199
- mkdirSync(dirname3(file2), { recursive: true });
20228
+ mkdirSync(dirname4(file2), { recursive: true });
20200
20229
  const tmp = `${file2}.tmp-${process.pid}`;
20201
20230
  writeFileSync(tmp, JSON.stringify(store, null, 2) + "\n");
20202
20231
  renameSync(tmp, file2);
@@ -20734,7 +20763,7 @@ async function openTunnel(ssh, remotePort, opts = {}) {
20734
20763
  // src/lib/transport/local.ts
20735
20764
  import { spawn as spawn4 } from "node:child_process";
20736
20765
  import { copyFileSync, mkdirSync as mkdirSync2, readFileSync as readFileSync4 } from "node:fs";
20737
- import { dirname as dirname4 } from "node:path";
20766
+ import { dirname as dirname5 } from "node:path";
20738
20767
  var LocalTransport = class {
20739
20768
  kind = "local";
20740
20769
  label = "this machine";
@@ -20775,7 +20804,7 @@ var LocalTransport = class {
20775
20804
  }
20776
20805
  copyTo(localPath, destPath) {
20777
20806
  const dest = expandHome(destPath);
20778
- mkdirSync2(dirname4(dest), { recursive: true });
20807
+ mkdirSync2(dirname5(dest), { recursive: true });
20779
20808
  copyFileSync(localPath, dest);
20780
20809
  return Promise.resolve();
20781
20810
  }
@@ -21188,7 +21217,7 @@ async function upgradeDaemon(transport, opts = {}) {
21188
21217
  // src/cli/detach.ts
21189
21218
  import { spawn as spawn6 } from "node:child_process";
21190
21219
  import { closeSync, mkdirSync as mkdirSync5, openSync, readFileSync as readFileSync6 } from "node:fs";
21191
- import { dirname as dirname5 } from "node:path";
21220
+ import { dirname as dirname6 } from "node:path";
21192
21221
  init_types();
21193
21222
  var COCKPIT_CHILD_ENV = "PUDDLE_COCKPIT_CHILD";
21194
21223
  var READY_TIMEOUT_MS = 3e5;
@@ -21229,7 +21258,7 @@ async function launchDetached(opts) {
21229
21258
  }
21230
21259
  if (target !== "local") await new SshTransport(target).open();
21231
21260
  const logFile = cockpitLogPath(target);
21232
- mkdirSync5(dirname5(logFile), { recursive: true });
21261
+ mkdirSync5(dirname6(logFile), { recursive: true });
21233
21262
  const fd = openSync(logFile, "w");
21234
21263
  const argv = opts.argv ?? process.argv.slice(2);
21235
21264
  const child = spawn6(process.execPath, [process.argv[1] ?? "", ...argv], {
@@ -21294,7 +21323,7 @@ async function followStartup(target, childPid, logFile) {
21294
21323
  }
21295
21324
  function spawnDetachedRefresh(target, argv) {
21296
21325
  const logFile = cockpitLogPath(target);
21297
- mkdirSync5(dirname5(logFile), { recursive: true });
21326
+ mkdirSync5(dirname6(logFile), { recursive: true });
21298
21327
  const fd = openSync(logFile, "a");
21299
21328
  const env = { ...process.env };
21300
21329
  delete env[COCKPIT_CHILD_ENV];
@@ -21351,7 +21380,7 @@ function timestampedLogger() {
21351
21380
 
21352
21381
  // src/cli/run.ts
21353
21382
  function assetsDir() {
21354
- const here = dirname6(fileURLToPath3(import.meta.url));
21383
+ const here = dirname7(fileURLToPath3(import.meta.url));
21355
21384
  for (const candidate of [join9(here, "public"), join9(here, "..", "..", "dist", "public")]) {
21356
21385
  if (existsSync3(join9(candidate, "index.html"))) return candidate;
21357
21386
  }
@@ -21689,33 +21718,41 @@ function upgradeCli(logger) {
21689
21718
  }
21690
21719
  async function upgradeDesktop(logger) {
21691
21720
  const installed = await findInstalledDesktopApp();
21692
- if (installed === null) {
21721
+ const targetPath = installed?.appPath ?? await desktopAppInstallPath();
21722
+ if (targetPath === null) {
21693
21723
  throw new CliError(
21694
21724
  "not_installed",
21695
21725
  "no Puddle.app in /Applications or ~/Applications",
21696
21726
  process.platform === "linux" ? "AppImages carry no fixed path \u2014 update from the app itself (its banner knows $APPIMAGE)" : void 0
21697
21727
  );
21698
21728
  }
21699
- if (await isDesktopAppRunning(installed.appPath)) {
21729
+ if (installed !== null && await isDesktopAppRunning(installed.appPath)) {
21700
21730
  throw new CliError(
21701
21731
  "already_running",
21702
21732
  "Puddle is running \u2014 use its update banner, or quit it and rerun"
21703
21733
  );
21704
21734
  }
21705
- const update = await checkForDesktopUpdate(installed.version);
21735
+ const update = await checkForDesktopUpdate(installed?.version ?? "0.0.0");
21706
21736
  if (update === null) {
21737
+ if (installed === null) {
21738
+ throw new CliError(
21739
+ "not_installed",
21740
+ "no Puddle desktop release is available for this macOS architecture"
21741
+ );
21742
+ }
21707
21743
  logger.info(`Puddle ${installed.version} is already the latest release`);
21708
21744
  return 0;
21709
21745
  }
21710
- logger.info(`Puddle ${installed.version} \u2192 ${update.version}`);
21746
+ if (installed === null) logger.info(`installing Puddle ${update.version}`);
21747
+ else logger.info(`Puddle ${installed.version} \u2192 ${update.version}`);
21711
21748
  const staged = await stageDesktopUpdate(update, { logger });
21712
21749
  await applyDesktopUpdate(staged, {
21713
- targetPath: installed.appPath,
21750
+ targetPath,
21714
21751
  detach: false,
21715
21752
  relaunch: false,
21716
21753
  logger
21717
21754
  });
21718
- logger.info(`Puddle ${update.version} installed at ${installed.appPath}`);
21755
+ logger.info(`Puddle ${update.version} installed at ${targetPath}`);
21719
21756
  return 0;
21720
21757
  }
21721
21758
  async function runCockpit(command, target, terminal) {
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{r}from"./profile-store-D2pB4wB-.js";import{a as i}from"./api-CZDct42i.js";import{a,g as o,i as s,n as c,o as l,t as u}from"./dialog-B43iKmfK.js";import{G as d,H as f,R as p,X as m,a as h,it as g,o as _,r as v,rt as y,t as b,tt as x,z as S}from"./LazyTerminal-CeLHCKsO.js";import{t as C}from"./utils-B6KiDbIe.js";import{A as w,O as T,c as E,j as D,k as O,n as k,r as A,t as j}from"./context-menu-Bitp8sY-.js";import{r as M}from"./dist-i-QevsUb.js";import{I as N,K as P,N as F,Q as I,dt as L}from"./index-iPj6x3rM.js";var R=e(t(),1),z=n(),B=!1;function V(){let[e,t]=(0,R.useState)(B),[n,r]=(0,R.useState)(null);(0,R.useEffect)(()=>{if(!e)return;let t=!1;return N.spawnShell(i).then(e=>{t||r(e)}),()=>{t=!0}},[e]);let a=()=>{B=!1,t(!1),r(null)};return{open:e,term:n,toggle:()=>{e?(n&&N.killShell(i,n),a()):(B=!0,t(!0))},onExit:a}}function H({term:e,onExit:t}){return(0,z.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,z.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:e!==null&&(0,z.jsx)(b,{stream:`home`,term:e,onExit:t})})})}var U=[{status:`running`,colour:`bg-running`},{status:`waiting_input`,colour:`bg-waiting`},{status:`interrupted`,colour:`bg-interrupted`}];function W({projectId:e}){let t=x(e),n=(0,R.useMemo)(()=>{let e=new Map;for(let n of t.data??[])e.set(n.status,(e.get(n.status)??0)+1);return e},[t.data]),r=(t.data??[]).filter(e=>e.status!==`archived`).length;return(0,z.jsxs)(`div`,{className:`flex items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,z.jsxs)(`span`,{children:[r,` session`,r===1?``:`s`]}),U.map(({status:e,colour:t})=>{let r=n.get(e)??0;return r===0?null:(0,z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),r,` `,e.replace(`_`,` `)]},e)})]})}function G({icon:e,label:t,onClick:n}){return(0,z.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:`flex items-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-ground hover:text-fg`,children:(0,z.jsx)(e,{className:`size-4`})})}function K({project:e,repoPath:t,draggable:n,dragging:r,onDragStart:i,onDragEnd:d,onDragOver:f}){let p=S(),[m,_]=(0,R.useState)(!1),[b,x]=(0,R.useState)(e.name),T=t=>p.mutate({id:e.id,archived:t},{onError:e=>v(e)}),O=()=>{let t=b.trim();if(!t||t===e.name){_(!1);return}p.mutate({id:e.id,name:t},{onSuccess:()=>_(!1),onError:e=>v(e)})};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(j,{children:[(0,z.jsx)(E,{asChild:!0,children:(0,z.jsxs)(`div`,{draggable:n,onDragStart:i,onDragEnd:d,onDragOver:f,className:C(`group relative transition-opacity`,r&&`opacity-50`),children:[(0,z.jsxs)(L,{draggable:!1,to:`/project/${e.id}`,className:`block rounded-lg bg-surface p-4 transition-colors hover:bg-elevated`,children:[(0,z.jsx)(`h2`,{className:`truncate pr-16 text-base font-semibold text-fg group-hover:text-accent`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-1 truncate font-mono text-2xs text-fg-muted`,children:t??`…`}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(W,{projectId:e.id})})]}),(0,z.jsx)(`div`,{className:`absolute right-2 top-2 hidden gap-0.5 group-hover:flex has-[[data-state=open]]:flex pointer-coarse:flex`,children:e.archived?(0,z.jsx)(G,{icon:D,label:`Reopen project`,onClick:()=>T(!1)}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(G,{icon:h,label:`Rename project`,onClick:()=>{x(e.name),_(!0)}}),(0,z.jsx)(G,{icon:w,label:`Archive project`,onClick:()=>T(!0)})]})})]})}),(0,z.jsx)(k,{children:e.archived?(0,z.jsxs)(A,{onSelect:()=>T(!1),children:[(0,z.jsx)(D,{}),` Reopen`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(A,{onSelect:()=>{x(e.name),_(!0)},children:[(0,z.jsx)(h,{}),` Rename`]}),(0,z.jsxs)(A,{onSelect:()=>T(!0),children:[(0,z.jsx)(w,{}),` Archive`]})]})})]}),(0,z.jsx)(u,{open:m,onOpenChange:_,children:(0,z.jsxs)(c,{children:[(0,z.jsx)(a,{children:(0,z.jsx)(l,{children:`Rename project`})}),(0,z.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),O()},children:[(0,z.jsx)(g,{value:b,onChange:e=>x(e.target.value),autoFocus:!0}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(y,{className:`text-fg-muted`,children:`Path`}),(0,z.jsx)(`p`,{className:`truncate font-mono text-2xs text-fg-muted`,children:t??`…`})]}),(0,z.jsxs)(s,{children:[(0,z.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>_(!1),children:`Cancel`}),(0,z.jsx)(o,{type:`submit`,disabled:!b.trim()||p.isPending,children:`Rename`})]})]})]})})]})}function q({icon:e,label:t,hint:n,onClick:r}){return(0,z.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex flex-col rounded-lg bg-surface p-4 text-left transition-colors hover:bg-elevated`,children:[(0,z.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,z.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,z.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function J(){let e=r(),t=d(e??void 0),n=m(),i=f(e??void 0),a=p(e??``),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(null),[u,h]=(0,R.useState)(!1),g=V(),v=e=>n.data?.find(t=>t.id===e)?.path,y=t.data??[],b=i.data?.projectOrder??[],x=T(y.filter(e=>!e.archived),b),S=y.filter(e=>e.archived),E=(e,t)=>{e!==t&&a.mutate({projectOrder:O(x.map(e=>e.id),e,t)})};return(0,z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,z.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[y.length===0&&(0,z.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,z.jsx)(_,{className:`size-8 text-fg-muted`}),(0,z.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`No projects yet — open one below, or press ⌘K.`})]}),(0,z.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[x.map(e=>(0,z.jsx)(K,{project:e,repoPath:v(e.repo_id),draggable:!0,dragging:c===e.id,onDragStart:()=>l(e.id),onDragEnd:()=>l(null),onDragOver:t=>{t.preventDefault(),c&&c!==e.id&&E(c,e.id)}},e.id)),(0,z.jsx)(q,{icon:I,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>s(!0)}),(0,z.jsx)(q,{icon:P,label:g.open?`Close terminal`:`Open terminal`,hint:g.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:g.toggle})]}),S.length>0&&(0,z.jsxs)(`div`,{className:`mt-6`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>h(e=>!e),className:`flex items-center gap-1.5 px-1 py-1.5 text-2xs uppercase tracking-wide text-fg-muted transition-colors hover:text-fg`,children:[(0,z.jsx)(M,{className:C(`size-3 transition-transform`,u&&`rotate-90`)}),(0,z.jsx)(w,{className:`size-3`}),(0,z.jsx)(`span`,{children:`Archived`}),(0,z.jsx)(`span`,{className:`tabular-nums`,children:S.length})]}),u&&(0,z.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:S.map(e=>(0,z.jsx)(K,{project:e,repoPath:v(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),g.open&&(0,z.jsx)(H,{term:g.term,onExit:g.onExit}),e!==null&&(0,z.jsx)(F,{profileId:e,open:o,onOpenChange:s})]})}export{J as Dashboard};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{r}from"./profile-store-D2pB4wB-.js";import{a as i}from"./api-CZDct42i.js";import{a,g as o,i as s,n as c,o as l,t as u}from"./dialog-B43iKmfK.js";import{G as d,H as f,R as p,X as m,a as h,it as g,o as _,r as v,rt as y,t as b,tt as x,z as S}from"./LazyTerminal-DfuTR0O9.js";import{t as C}from"./utils-B6KiDbIe.js";import{A as w,O as T,c as E,j as D,k as O,n as k,r as A,t as j}from"./context-menu-Z1HjXU39.js";import{r as M}from"./dist-i-QevsUb.js";import{I as N,K as P,N as F,Q as I,dt as L}from"./index-A5BuRryw.js";var R=e(t(),1),z=n(),B=!1;function V(){let[e,t]=(0,R.useState)(B),[n,r]=(0,R.useState)(null);(0,R.useEffect)(()=>{if(!e)return;let t=!1;return N.spawnShell(i).then(e=>{t||r(e)}),()=>{t=!0}},[e]);let a=()=>{B=!1,t(!1),r(null)};return{open:e,term:n,toggle:()=>{e?(n&&N.killShell(i,n),a()):(B=!0,t(!0))},onExit:a}}function H({term:e,onExit:t}){return(0,z.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,z.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:e!==null&&(0,z.jsx)(b,{stream:`home`,term:e,onExit:t})})})}var U=[{status:`running`,colour:`bg-running`},{status:`waiting_input`,colour:`bg-waiting`},{status:`interrupted`,colour:`bg-interrupted`}];function W({projectId:e}){let t=x(e),n=(0,R.useMemo)(()=>{let e=new Map;for(let n of t.data??[])e.set(n.status,(e.get(n.status)??0)+1);return e},[t.data]),r=(t.data??[]).filter(e=>e.status!==`archived`).length;return(0,z.jsxs)(`div`,{className:`flex items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,z.jsxs)(`span`,{children:[r,` session`,r===1?``:`s`]}),U.map(({status:e,colour:t})=>{let r=n.get(e)??0;return r===0?null:(0,z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),r,` `,e.replace(`_`,` `)]},e)})]})}function G({icon:e,label:t,onClick:n}){return(0,z.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:`flex items-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-ground hover:text-fg`,children:(0,z.jsx)(e,{className:`size-4`})})}function K({project:e,repoPath:t,draggable:n,dragging:r,onDragStart:i,onDragEnd:d,onDragOver:f}){let p=S(),[m,_]=(0,R.useState)(!1),[b,x]=(0,R.useState)(e.name),T=t=>p.mutate({id:e.id,archived:t},{onError:e=>v(e)}),O=()=>{let t=b.trim();if(!t||t===e.name){_(!1);return}p.mutate({id:e.id,name:t},{onSuccess:()=>_(!1),onError:e=>v(e)})};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(j,{children:[(0,z.jsx)(E,{asChild:!0,children:(0,z.jsxs)(`div`,{draggable:n,onDragStart:i,onDragEnd:d,onDragOver:f,className:C(`group relative transition-opacity`,r&&`opacity-50`),children:[(0,z.jsxs)(L,{draggable:!1,to:`/project/${e.id}`,className:`block rounded-lg bg-surface p-4 transition-colors hover:bg-elevated`,children:[(0,z.jsx)(`h2`,{className:`truncate pr-16 text-base font-semibold text-fg group-hover:text-accent`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-1 truncate font-mono text-2xs text-fg-muted`,children:t??`…`}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(W,{projectId:e.id})})]}),(0,z.jsx)(`div`,{className:`absolute right-2 top-2 hidden gap-0.5 group-hover:flex has-[[data-state=open]]:flex pointer-coarse:flex`,children:e.archived?(0,z.jsx)(G,{icon:D,label:`Reopen project`,onClick:()=>T(!1)}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(G,{icon:h,label:`Rename project`,onClick:()=>{x(e.name),_(!0)}}),(0,z.jsx)(G,{icon:w,label:`Archive project`,onClick:()=>T(!0)})]})})]})}),(0,z.jsx)(k,{children:e.archived?(0,z.jsxs)(A,{onSelect:()=>T(!1),children:[(0,z.jsx)(D,{}),` Reopen`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(A,{onSelect:()=>{x(e.name),_(!0)},children:[(0,z.jsx)(h,{}),` Rename`]}),(0,z.jsxs)(A,{onSelect:()=>T(!0),children:[(0,z.jsx)(w,{}),` Archive`]})]})})]}),(0,z.jsx)(u,{open:m,onOpenChange:_,children:(0,z.jsxs)(c,{children:[(0,z.jsx)(a,{children:(0,z.jsx)(l,{children:`Rename project`})}),(0,z.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),O()},children:[(0,z.jsx)(g,{value:b,onChange:e=>x(e.target.value),autoFocus:!0}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(y,{className:`text-fg-muted`,children:`Path`}),(0,z.jsx)(`p`,{className:`truncate font-mono text-2xs text-fg-muted`,children:t??`…`})]}),(0,z.jsxs)(s,{children:[(0,z.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>_(!1),children:`Cancel`}),(0,z.jsx)(o,{type:`submit`,disabled:!b.trim()||p.isPending,children:`Rename`})]})]})]})})]})}function q({icon:e,label:t,hint:n,onClick:r}){return(0,z.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex flex-col rounded-lg bg-surface p-4 text-left transition-colors hover:bg-elevated`,children:[(0,z.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,z.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,z.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function J(){let e=r(),t=d(e??void 0),n=m(),i=f(e??void 0),a=p(e??``),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(null),[u,h]=(0,R.useState)(!1),g=V(),v=e=>n.data?.find(t=>t.id===e)?.path,y=t.data??[],b=i.data?.projectOrder??[],x=T(y.filter(e=>!e.archived),b),S=y.filter(e=>e.archived),E=(e,t)=>{e!==t&&a.mutate({projectOrder:O(x.map(e=>e.id),e,t)})};return(0,z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,z.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[y.length===0&&(0,z.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,z.jsx)(_,{className:`size-8 text-fg-muted`}),(0,z.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`No projects yet — open one below, or press ⌘K.`})]}),(0,z.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[x.map(e=>(0,z.jsx)(K,{project:e,repoPath:v(e.repo_id),draggable:!0,dragging:c===e.id,onDragStart:()=>l(e.id),onDragEnd:()=>l(null),onDragOver:t=>{t.preventDefault(),c&&c!==e.id&&E(c,e.id)}},e.id)),(0,z.jsx)(q,{icon:I,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>s(!0)}),(0,z.jsx)(q,{icon:P,label:g.open?`Close terminal`:`Open terminal`,hint:g.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:g.toggle})]}),S.length>0&&(0,z.jsxs)(`div`,{className:`mt-6`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>h(e=>!e),className:`flex items-center gap-1.5 px-1 py-1.5 text-2xs uppercase tracking-wide text-fg-muted transition-colors hover:text-fg`,children:[(0,z.jsx)(M,{className:C(`size-3 transition-transform`,u&&`rotate-90`)}),(0,z.jsx)(w,{className:`size-3`}),(0,z.jsx)(`span`,{children:`Archived`}),(0,z.jsx)(`span`,{className:`tabular-nums`,children:S.length})]}),u&&(0,z.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:S.map(e=>(0,z.jsx)(K,{project:e,repoPath:v(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),g.open&&(0,z.jsx)(H,{term:g.term,onExit:g.onExit}),e!==null&&(0,z.jsx)(F,{profileId:e,open:o,onOpenChange:s})]})}export{J as Dashboard};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{a as r,g as i,h as a,i as o,n as s,o as c,r as l,t as u}from"./dialog-B43iKmfK.js";import{t as d}from"./utils-B6KiDbIe.js";import{t as f}from"./createLucideIcon-DyMAgLa3.js";import{l as p,r as m,t as h}from"./buffer-store-CiF8VU5A.js";import{s as g,t as _}from"./editor-sync-f1V6Wuxn.js";var v=f(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),y=e(t(),1),b=n();function x(e,t,n){let r=h(e,t,n);return(0,y.useSyncExternalStore)((0,y.useCallback)(e=>p(r,e),[r]),()=>m(r))}function S({session:e,path:t,kind:n,root:f,label:p,onClose:m}){let h=x(e,t,f)&&n!==`commit`,[S,C]=(0,y.useState)(!1),w=()=>h?C(!0):m();return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{onClick:e=>{e.stopPropagation(),w()},className:d(`size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg`,h?`flex`:`hidden group-hover:flex pointer-coarse:flex`),"aria-label":`Close ${p}`,children:h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(v,{className:`size-2 fill-current group-hover:hidden`}),(0,b.jsx)(a,{className:`hidden size-3 group-hover:block`})]}):(0,b.jsx)(a,{className:`size-3`})}),(0,b.jsx)(u,{open:S,onOpenChange:e=>!e&&C(!1),children:(0,b.jsxs)(s,{children:[(0,b.jsxs)(r,{children:[(0,b.jsxs)(c,{children:[`Discard changes to `,p,`?`]}),(0,b.jsx)(l,{children:`This file has unsaved changes. Closing the tab will discard them.`})]}),(0,b.jsxs)(o,{children:[(0,b.jsx)(i,{variant:`ghost`,onClick:()=>C(!1),children:`Keep editing`}),(0,b.jsx)(i,{variant:`danger`,onClick:()=>{g(e,t,f),_(e,t,f),C(!1),m()},children:`Discard`})]})]})})]})}export{S as EditorTabClose};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{a as r,g as i,h as a,i as o,n as s,o as c,r as l,t as u}from"./dialog-B43iKmfK.js";import{t as d}from"./utils-B6KiDbIe.js";import{t as f}from"./createLucideIcon-DyMAgLa3.js";import{l as p,r as m,t as h}from"./buffer-store-C0jIh5zW.js";import{s as g,t as _}from"./editor-sync-f1V6Wuxn.js";var v=f(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),y=e(t(),1),b=n();function x(e,t,n){let r=h(e,t,n);return(0,y.useSyncExternalStore)((0,y.useCallback)(e=>p(r,e),[r]),()=>m(r))}function S({session:e,path:t,kind:n,root:f,label:p,onClose:m}){let h=x(e,t,f)&&n!==`commit`,[S,C]=(0,y.useState)(!1),w=()=>h?C(!0):m();return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{onClick:e=>{e.stopPropagation(),w()},className:d(`size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg`,h?`flex`:`hidden group-hover:flex pointer-coarse:flex`),"aria-label":`Close ${p}`,children:h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(v,{className:`size-2 fill-current group-hover:hidden`}),(0,b.jsx)(a,{className:`hidden size-3 group-hover:block`})]}):(0,b.jsx)(a,{className:`size-3`})}),(0,b.jsx)(u,{open:S,onOpenChange:e=>!e&&C(!1),children:(0,b.jsxs)(s,{children:[(0,b.jsxs)(r,{children:[(0,b.jsxs)(c,{children:[`Discard changes to `,p,`?`]}),(0,b.jsx)(l,{children:`This file has unsaved changes. Closing the tab will discard them.`})]}),(0,b.jsxs)(o,{children:[(0,b.jsx)(i,{variant:`ghost`,onClick:()=>C(!1),children:`Keep editing`}),(0,b.jsx)(i,{variant:`danger`,onClick:()=>{g(e,t,f),_(e,t,f),C(!1),m()},children:`Discard`})]})]})})]})}export{S as EditorTabClose};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-CN5FGN0_.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-ffCh33zF.js","assets/api-CZDct42i.js","assets/utils-B6KiDbIe.js","assets/index-iPj6x3rM.js","assets/profile-store-D2pB4wB-.js","assets/preload-helper-Czpn1I53.js","assets/dialog-B43iKmfK.js","assets/createLucideIcon-DyMAgLa3.js","assets/index-CRUVuFoo.css","assets/ssh-mode-CAA0-mpZ.js","assets/Terminal-BrP-ENHg.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n,t as r}from"./jsx-runtime-ffCh33zF.js";import{a as i,i as a,l as o,o as s}from"./profile-store-D2pB4wB-.js";import{t as c}from"./preload-helper-Czpn1I53.js";import{S as l,n as u}from"./api-CZDct42i.js";import{A as d,C as f,O as p,w as m,x as h}from"./dialog-B43iKmfK.js";import{t as g}from"./utils-B6KiDbIe.js";import{t as _}from"./createLucideIcon-DyMAgLa3.js";var v=e(t(),1),y=[`top`,`right`,`bottom`,`left`],b=Math.min,x=Math.max,S=Math.round,C=Math.floor,w=e=>({x:e,y:e}),T={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function E(e,t,n){return x(e,b(t,n))}function D(e,t){return typeof e==`function`?e(t):e}function O(e){return e.split(`-`)[0]}function k(e){return e.split(`-`)[1]}function A(e){return e===`x`?`y`:`x`}function j(e){return e===`y`?`height`:`width`}function M(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function N(e){return A(M(e))}function P(e,t,n){n===void 0&&(n=!1);let r=k(e),i=N(e),a=j(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=B(o)),[o,B(o)]}function F(e){let t=B(e);return[I(e),t,I(t)]}function I(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var L=[`left`,`right`],R=[`right`,`left`],z=[`top`,`bottom`],ee=[`bottom`,`top`];function te(e,t,n){switch(e){case`top`:case`bottom`:return n?t?R:L:t?L:R;case`left`:case`right`:return t?z:ee;default:return[]}}function ne(e,t,n,r){let i=k(e),a=te(O(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(I)))),a}function B(e){let t=O(e);return T[t]+e.slice(t.length)}function re(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ie(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:re(e)}function V(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ae(e,t,n){let{reference:r,floating:i}=e,a=M(t),o=N(t),s=j(o),c=O(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=k(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function oe(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=D(t,e),p=ie(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=V(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=V(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var se=50,ce=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:oe},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ae(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<se&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ae(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},le=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=D(e,t)||{};if(l==null)return{};let d=ie(u),f={x:n,y:r},p=N(i),m=j(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,x=a.reference[m]+a.reference[p]-f[p]-a.floating[m],S=f[p]-a.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),w=C?C[y]:0;(!w||!await(o.isElement==null?void 0:o.isElement(C)))&&(w=s.floating[y]||a.floating[m]);let T=x/2-S/2,O=w/2-h[m]/2-1,A=b(d[_],O),M=b(d[v],O),P=w-h[m]-M,F=w/2-h[m]/2+T,I=E(A,F,P),L=!c.arrow&&k(i)!=null&&F!==I&&a.reference[m]/2-(F<A?A:M)-h[m]/2<0,R=L?F<A?F-A:F-P:0;return{[p]:f[p]+R,data:{[p]:I,centerOffset:F-I-R,...L&&{alignmentOffset:R}},reset:L}}}),ue=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=D(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=O(r),_=M(o),v=O(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[B(o)]:F(o)),x=p!==`none`;!d&&x&&b.push(...ne(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=P(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==M(t))||T.every(e=>M(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=M(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function de(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fe(e){return y.some(t=>e[t]>=0)}var pe=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=D(e,t);switch(i){case`referenceHidden`:{let e=de(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:fe(e)}}}case`escaped`:{let e=de(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:fe(e)}}}default:return{}}}}},me=new Set([`left`,`top`]);async function he(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=O(n),s=k(n),c=M(n)===`y`,l=me.has(o)?-1:1,u=a&&c?-1:1,d=D(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ge=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await he(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},_e=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=D(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=M(i),p=A(f),m=u[p],h=u[f],g=(e,t)=>E(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},ve=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=D(e,t),u={x:n,y:r},d=M(i),f=A(d),p=u[f],m=u[d],h=D(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=me.has(O(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ye=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=D(e,t),c=await i.detectOverflow(t,s),l=O(n),u=k(n),d=M(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=b(p-c[m],g),y=b(f-c[h],_),S=t.middlewareData.shift,C=!S,w=v,T=y;S!=null&&S.enabled.x&&(T=_),S!=null&&S.enabled.y&&(w=g),C&&!u&&(d?T=f-2*x(c.left,c.right):w=p-2*x(c.top,c.bottom)),await o({...t,availableWidth:T,availableHeight:w});let E=await i.getDimensions(a.floating);return f!==E.width||p!==E.height?{reset:{rects:!0}}:{}}}};function be(){return typeof window<`u`}function H(e){return xe(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){return((xe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function xe(e){return be()?e instanceof Node||e instanceof U(e).Node:!1}function G(e){return be()?e instanceof Element||e instanceof U(e).Element:!1}function K(e){return be()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function Se(e){return!be()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}function Ce(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=J(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function we(e){return/^(table|td|th)$/.test(H(e))}function Te(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ee=/transform|translate|scale|rotate|perspective|filter/,De=/paint|layout|strict|content/,q=e=>!!e&&e!==`none`,Oe;function ke(e){let t=G(e)?J(e):e;return q(t.transform)||q(t.translate)||q(t.scale)||q(t.rotate)||q(t.perspective)||!je()&&(q(t.backdropFilter)||q(t.filter))||Ee.test(t.willChange||``)||De.test(t.contain||``)}function Ae(e){let t=Y(e);for(;K(t)&&!Me(t);){if(ke(t))return t;if(Te(t))return null;t=Y(t)}return null}function je(){return Oe??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Oe}function Me(e){return/^(html|body|#document)$/.test(H(e))}function J(e){return U(e).getComputedStyle(e)}function Ne(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Y(e){if(H(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Se(e)&&e.host||W(e);return Se(t)?t.host:t}function Pe(e){let t=Y(e);return Me(t)?(e.ownerDocument||e).body:K(t)&&Ce(t)?t:Pe(t)}function Fe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Pe(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=Ie(a);return t.concat(a,a.visualViewport||[],Ce(r)?r:[],e&&n?Fe(e):[])}else return t.concat(r,Fe(r,[],n))}function Ie(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Le(e){let t=J(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=S(n)!==a||S(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Re(e){return G(e)?e:e.contextElement}function X(e){let t=Re(e);if(!K(t))return w(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Le(t),o=(a?S(n.width):n.width)/r,s=(a?S(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ze=w(0);function Be(e){let t=U(e);return!je()||!t.visualViewport?ze:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ve(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===U(e)}function Z(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Re(e),o=w(1);t&&(r?G(r)&&(o=X(r)):o=X(e));let s=Ve(a,n,r)?Be(a):w(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=U(a),t=G(r)?U(r):r,n=e,i=Ie(n);for(;i&&t!==n;){let e=X(i),t=i.getBoundingClientRect(),r=J(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=U(i),i=Ie(n)}}return V({width:u,height:d,x:c,y:l})}function He(e,t){let n=Ne(e).scrollLeft;return t?t.left+n:Z(W(e)).left+n}function Ue(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-He(e,n),y:n.top+t.scrollTop}}function We(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=W(r),s=t?Te(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=w(1),u=w(0),d=K(r);if((d||!a)&&((H(r)!==`body`||Ce(o))&&(c=Ne(r)),d)){let e=Z(r);l=X(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ue(o,c):w(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ge(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ke(e){let t=Ne(e),n=e.ownerDocument.body,r=x(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=x(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+He(e),o=-t.scrollTop;return J(n).direction===`rtl`&&(a+=x(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var qe=25;function Je(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=U(e),a=W(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!je()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(He(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=qe&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ye(e,t){let n=Z(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=X(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Xe(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Je(e,n,t);else if(t===`document`)r=Ke(W(e));else if(G(t))r=Ye(t,n);else{let n=Be(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return V(r)}function Ze(e,t){let n=t.get(e);if(n)return n;let r=Fe(e,[],!1).filter(e=>G(e)&&H(e)!==`body`),i=null,a=J(e).position===`fixed`,o=a?Y(e):e;for(;G(o)&&!Me(o);){let e=J(o),t=ke(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Y(o)}return t.set(e,r),r}function Qe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Te(t)?[]:Ze(t,this._c):[].concat(n),r],o=Xe(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Xe(t,a[e],i);s=x(n.top,s),c=b(n.right,c),l=b(n.bottom,l),u=x(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function $e(e){let{width:t,height:n}=Le(e);return{width:t,height:n}}function et(e,t,n){let r=K(t),i=W(t),a=n===`fixed`,o=Z(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=w(0);if((r||!a)&&((H(t)!==`body`||Ce(i))&&(s=Ne(t)),r)){let e=Z(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=He(i));let l=i&&!r&&!a?Ue(i,s):w(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function tt(e){return J(e).position===`static`}function nt(e,t){if(!K(e)||J(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function rt(e,t){let n=U(e);if(Te(e))return n;if(!K(e)){let t=Y(e);for(;t&&!Me(t);){if(G(t)&&!tt(t))return t;t=Y(t)}return n}let r=nt(e,t);for(;r&&we(r)&&tt(r);)r=nt(r,t);return r&&Me(r)&&tt(r)&&!ke(r)?n:r||Ae(e)||n}var it=async function(e){let t=this.getOffsetParent||rt,n=this.getDimensions,r=await n(e.floating);return{reference:et(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function at(e){return J(e).direction===`rtl`}var ot={convertOffsetParentRelativeRectToViewportRelativeRect:We,getDocumentElement:W,getClippingRect:Qe,getOffsetParent:rt,getElementRects:it,getClientRects:Ge,getDimensions:$e,getScale:X,isElement:G,isRTL:at};function st(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ct(e,t,n){let r=null,i,a=W(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=C(d),h=C(a.clientWidth-(u+f)),g=C(a.clientHeight-(d+p)),_=C(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:x(0,b(1,c))||1},y=!0;function S(t){let n=t[0].intersectionRatio;if(!st(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(S,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(S,v)}r.observe(e)}let c=U(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function lt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Re(e),u=i||a?[...l?Fe(l):[],...t?Fe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?ct(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Z(e):null;c&&g();function g(){let t=Z(e);h&&!st(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var ut=ge,dt=_e,ft=ue,pt=ye,mt=pe,ht=le,gt=ve,_t=(e,t,n)=>{let r=new Map,i=n??{},a={...ot,...i.platform,_c:r};return ce(e,t,{...i,platform:a})},vt=e(n(),1),yt=typeof document<`u`?v.useLayoutEffect:function(){};function bt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!bt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!bt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function xt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function St(e,t){let n=xt(e);return Math.round(t*n)/n}function Ct(e){let t=v.useRef(e);return yt(()=>{t.current=e}),t}function wt(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);bt(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),y=v.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=v.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=v.useRef(null),w=v.useRef(null),T=v.useRef(u),E=c!=null,D=Ct(c),O=Ct(i),k=Ct(l),A=v.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),_t(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!bt(T.current,t)&&(T.current=t,vt.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);yt(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=v.useRef(!1);yt(()=>(j.current=!0,()=>{j.current=!1}),[]),yt(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=v.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=v.useMemo(()=>({reference:x,floating:S}),[x,S]),P=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=St(N.floating,u.x),r=St(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...xt(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var Tt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ht({element:r.current,padding:i}).fn(n):r?ht({element:r,padding:i}).fn(n):{}}}},Et=(e,t)=>{let n=ut(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dt=(e,t)=>{let n=dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ot=(e,t)=>({fn:gt(e).fn,options:[e,t]}),kt=(e,t)=>{let n=ft(e);return{name:n.name,fn:n.fn,options:[e,t]}},At=(e,t)=>{let n=pt(e);return{name:n.name,fn:n.fn,options:[e,t]}},jt=(e,t)=>{let n=mt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mt=(e,t)=>{let n=Tt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Q=r(),Nt=`Arrow`,Pt=v.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,Q.jsx)(m.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,Q.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Pt.displayName=Nt;var Ft=Pt;function It(e){let[t,n]=v.useState(void 0);return h(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Lt=`Popper`,[Rt,zt]=p(Lt),[Bt,Vt]=Rt(Lt),Ht=e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null),[a,o]=v.useState(void 0);return(0,Q.jsx)(Bt,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Ht.displayName=Lt;var Ut=`PopperAnchor`,Wt=v.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Vt(Ut,n),o=v.useRef(null),s=a.onAnchorChange,c=d(t,v.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=v.useRef(null);v.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&en(a.placementState),f=u?.[0],p=u?.[1];return r?null:(0,Q.jsx)(m.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...i,ref:c})});Wt.displayName=Ut;var Gt=`PopperContent`,[Kt,qt]=Rt(Gt),Jt=v.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:p=`partial`,hideWhenDetached:g=!1,updatePositionStrategy:_=`optimized`,onPlaced:y,...b}=e,x=Vt(Gt,n),[S,C]=v.useState(null),w=d(t,C),[T,E]=v.useState(null),D=It(T),O=D?.width??0,k=D?.height??0,A=r+(a===`center`?``:`-`+a),j=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},M=Array.isArray(l)?l:[l],N=M.length>0,P={padding:j,boundary:M.filter(Qt),altBoundary:N},{refs:F,floatingStyles:I,placement:L,isPositioned:R,middlewareData:z}=wt({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>lt(...e,{animationFrame:_===`always`}),elements:{reference:x.anchor},middleware:[Et({mainAxis:i+k,alignmentAxis:o}),c&&Dt({mainAxis:!0,crossAxis:!1,limiter:p===`partial`?Ot():void 0,...P}),c&&kt({...P}),At({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),T&&Mt({element:T,padding:s}),$t({arrowWidth:O,arrowHeight:k}),g&&jt({strategy:`referenceHidden`,...P,boundary:N?P.boundary:void 0})]}),ee=x.setPlacementState;h(()=>(ee(L),()=>{ee(void 0)}),[L,ee]);let[te,ne]=en(L),B=f(y);h(()=>{R&&B?.()},[R,B]);let re=z.arrow?.x,ie=z.arrow?.y,V=z.arrow?.centerOffset!==0,[ae,oe]=v.useState();return h(()=>{S&&oe(window.getComputedStyle(S).zIndex)},[S]),(0,Q.jsx)(`div`,{ref:F.setFloating,"data-radix-popper-content-wrapper":``,style:{...I,transform:R?I.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,Q.jsx)(Kt,{scope:n,placedSide:te,placedAlign:ne,onArrowChange:E,arrowX:re,arrowY:ie,shouldHideArrow:V,children:(0,Q.jsx)(m.div,{"data-side":te,"data-align":ne,...b,ref:w,style:{...b.style,animation:R?void 0:`none`}})})})});Jt.displayName=Gt;var Yt=`PopperArrow`,Xt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Zt=v.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=qt(Yt,n),a=Xt[i.placedSide];return(0,Q.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,Q.jsx)(Ft,{...r,ref:t,style:{...r.style,display:`block`}})})});Zt.displayName=Yt;function Qt(e){return e!==null}var $t=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=en(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function en(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var tn=Ht,nn=Wt,rn=Jt,an=Zt,on=`rounded-md bg-border/50 text-sm text-fg placeholder:text-fg-muted transition-colors hover:bg-border/80 focus:bg-border/80 disabled:cursor-not-allowed disabled:opacity-50`,sn=`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,cn=`data-[highlighted]:bg-action data-[highlighted]:text-action-ink data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,ln=`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`;function un({className:e,type:t,...n}){return(0,Q.jsx)(`input`,{type:t,className:g(`flex h-8 w-full px-2.5`,on,e),...n})}function dn({className:e,...t}){return(0,Q.jsx)(`textarea`,{className:g(`flex min-h-16 w-full px-2.5 py-2`,on,e),...t})}var fn=`Label`,pn=v.forwardRef((e,t)=>(0,Q.jsx)(m.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));pn.displayName=fn;var mn=pn;function hn({className:e,...t}){return(0,Q.jsx)(mn,{className:g(`text-xs font-medium text-fg-secondary peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function gn(){return s({queryKey:[`profiles`],queryFn:()=>u(`GET`,`/api/profiles`)})}function _n(e){return s({queryKey:[`profile-settings`,e],queryFn:()=>u(`GET`,`/api/profiles/${e}/settings`),enabled:e!==void 0})}function vn(e){return s({queryKey:[`accounts`,e],queryFn:()=>u(`GET`,`/api/accounts?profile=${e}`),enabled:e!==void 0})}function yn(e){return s({queryKey:[`account-usage`,e],queryFn:()=>u(`GET`,`/api/accounts/${e}/usage`),enabled:e!==void 0,staleTime:15e3})}function bn(){return s({queryKey:[`repos`],queryFn:()=>u(`GET`,`/api/repos`)})}function xn(e){return s({queryKey:[`projects`,e??`all`],queryFn:()=>u(`GET`,e===void 0?`/api/projects`:`/api/projects?profile=${e}`)})}function Sn(e){return s({queryKey:[`project`,e],queryFn:()=>u(`GET`,`/api/projects/${e}`),enabled:e!==void 0})}function Cn(e){return s({queryKey:[`sessions`,e],queryFn:()=>u(`GET`,`/api/sessions?project=${e}`),enabled:e!==void 0})}var wn={queryKey:[`sessions`,`all`],queryFn:()=>u(`GET`,`/api/sessions`)};function Tn(){return s(wn)}function En(e){return e.fetchQuery(wn)}function Dn(){return s({queryKey:[`config`],queryFn:()=>u(`GET`,`/api/config`)})}function On(e){return s({queryKey:[`repo-branches`,e],queryFn:()=>u(`GET`,`/api/repos/${e}/branches`),enabled:e!==void 0,staleTime:3e4})}function kn(e){return s({queryKey:[`repo-worktrees`,e],queryFn:()=>u(`GET`,`/api/repos/${e}/worktrees`),enabled:e!==void 0,staleTime:1e4})}function An(e,t){let n=o();return i({mutationFn:t=>u(`DELETE`,`/api/repos/${e}/worktrees?path=${encodeURIComponent(t)}`),onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function jn(e,t){let n=o();return i({mutationFn:({name:t,confirm:n})=>{let r=new URLSearchParams({name:t});return n&&r.set(`confirm`,`1`),u(`DELETE`,`/api/repos/${e}/branches?${r.toString()}`)},onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function Mn(e){return s({queryKey:[`fs-dirs`,e],queryFn:()=>u(`GET`,`/api/fs/dirs?prefix=${encodeURIComponent(e)}`),enabled:e.startsWith(`/`)||e.startsWith(`~`),placeholderData:e=>e,staleTime:1e4})}function Nn(){return s({queryKey:[`version`],queryFn:()=>u(`GET`,`/api/version`),staleTime:1/0})}function Pn(){return s({queryKey:[`host`],queryFn:()=>u(`GET`,`/api/host`),staleTime:1/0})}function Fn(e){return e?e.displayName||e.hostname:void 0}function In(){return s({queryKey:[`agents`],queryFn:()=>u(`GET`,`/api/agents`),staleTime:3e4,refetchOnWindowFocus:!0})}function Ln(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/profiles`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function Rn(e){let t=o();return i({mutationFn:t=>u(`PATCH`,`/api/profiles/${e}/settings`,t),onSuccess:n=>t.setQueryData([`profile-settings`,e],n)})}function zn(){let e=o();return i({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/profiles/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function Bn(){let e=o();return i({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/accounts/${e}`,t),onSuccess:t=>{e.invalidateQueries({queryKey:[`accounts`,t.profile_id]}),e.invalidateQueries({queryKey:[`account-usage`,t.id]})}})}function Vn(){let e=o();return i({mutationFn:e=>u(`DELETE`,`/api/profiles/${e}`),onSuccess:()=>e.clear()})}function Hn(){let e=o();return i({mutationFn:e=>u(`DELETE`,`/api/accounts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`accounts`]})})}function Un(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/accounts`,e),onSuccess:t=>void e.invalidateQueries({queryKey:[`accounts`,t.profile_id]})})}function Wn(){return i({mutationFn:e=>u(`POST`,`/api/accounts/${e}/login`)})}function Gn(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/repos`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Kn(){let e=o();return i({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/repos/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function qn(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/repos/${e}/fetch`),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Jn(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/projects`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function Yn(){let e=o();return i({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/projects/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function Xn(e,t){return s({queryKey:[`scratchpad`,e,t??`none`],queryFn:()=>u(`GET`,`/api/scratchpad?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function Zn(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/scratchpad`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function Qn(){let e=o();return i({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/scratchpad/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function $n(){let e=o();return i({mutationFn:e=>u(`DELETE`,`/api/scratchpad/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function $(e,t){e.invalidateQueries({queryKey:[`sessions`]}),e.invalidateQueries({queryKey:[`project`,t.project_id]})}function er(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/sessions`,e),onSuccess:t=>$(e,t)})}function tr(e){let t=o();return i({mutationFn:t=>u(`POST`,`/api/sessions/${t}/${e}`),onSuccess:e=>$(t,e)})}function nr(){let e=o();return i({mutationFn:({sessionId:e,accountId:t})=>u(`POST`,`/api/sessions/${e}/migrate`,{account_id:t}),onSuccess:t=>$(e,t)})}function rr(){let e=o();return i({mutationFn:({sessionId:e,accountId:t})=>u(`POST`,`/api/sessions/${e}/handoff`,{account_id:t}),onSuccess:(t,{sessionId:n})=>{$(e,t),e.invalidateQueries({queryKey:[`session`,n]})}})}function ir(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/sessions/${e}/archive`),onSuccess:t=>$(e,t)})}function ar(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/sessions/${e}/unarchive`),onSuccess:t=>$(e,t)})}function or(){let e=o();return i({mutationFn:({sessionId:e,title:t})=>u(`PATCH`,`/api/sessions/${e}`,{title:t}),onSuccess:t=>$(e,t)})}function sr(){let e=o();return i({mutationFn:e=>u(`PATCH`,`/api/config`,e),onSuccess:(t,n)=>{e.setQueryData([`config`],t),`displayName`in n&&e.invalidateQueries({queryKey:[`host`]})}})}async function cr(e){try{return await u(`GET`,`/api/profiles/${e}/state`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`no_state`)return null;throw e}}function lr(e,t){return u(`PUT`,`/api/profiles/${e}/state`,{ui_state:t})}function ur(e,t){return s({queryKey:[`ports`,e],queryFn:()=>u(`GET`,`/api/sessions/${e}/ports`),enabled:e!==void 0&&t,refetchInterval:a(5e3),refetchIntervalInBackground:!1})}function dr(e,t){return s({queryKey:[`session-env`,e],queryFn:()=>u(`GET`,`/api/sessions/${e}/env`),enabled:e!==void 0&&t,refetchInterval:a(5e3),refetchIntervalInBackground:!1})}function fr(){let e=o();return i({mutationFn:e=>u(`DELETE`,`/api/sessions/${e}/env`),onSuccess:(t,n)=>{e.setQueryData([`session-env`,n],{vars:[]})}})}var pr=_(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),mr=_(`pencil`,[[`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`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]);function hr({id:e,value:t,onValueChange:n,onChoose:r,hints:i,placeholder:a,className:o,hintsClassName:s,autoFocus:c}){let[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(0),p=e=>{n(e.value),r?.(e),u(!1)};return(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(un,{id:e,value:t,onChange:e=>{n(e.target.value),u(!0),f(0)},onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:e=>{if(!(!l||i.length===0))if(e.key===`ArrowDown`)e.preventDefault(),f(e=>(e+1)%i.length);else if(e.key===`ArrowUp`)e.preventDefault(),f(e=>(e-1+i.length)%i.length);else if(e.key===`Enter`||e.key===`Tab`){let t=i[d]??i[0];t&&(e.preventDefault(),p(t))}else e.key===`Escape`&&(e.stopPropagation(),u(!1))},placeholder:a,className:o,autoComplete:`off`,spellCheck:!1,autoFocus:c}),l&&i.length>0&&(0,Q.jsx)(`ul`,{className:g(`absolute top-full z-10 mt-1 max-h-56 overflow-y-auto rounded-md bg-elevated p-1 shadow-xl`,s??`w-full`),children:i.map((e,t)=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),p(e)},onMouseEnter:()=>f(t),className:g(`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,`w-full font-mono text-xs`),"data-selected":t===d,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e.label??e.value}),e.badge&&(0,Q.jsx)(`span`,{className:`ml-auto shrink-0 text-2xs opacity-70`,children:e.badge})]})},e.value))})]})}function gr(e){l.error(_r(e),{id:`err:${_r(e)}`})}function _r(e){return e instanceof Error&&e.message.trim()!==``?e.message:typeof e==`string`&&e.trim()!==``?e:`Something went wrong`}var vr=(0,v.lazy)(()=>c(()=>import(`./Terminal-CN5FGN0_.js`).then(e=>({default:e.Terminal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),yr=null;async function br(){yr=(await c(()=>import(`./Terminal-CN5FGN0_.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))).Terminal}function xr(e){return yr?(0,Q.jsx)(yr,{...e}):(0,Q.jsx)(v.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`size-full bg-ground`}),children:(0,Q.jsx)(vr,{...e})})}export{dr as $,qn as A,Kn as B,er as C,Vn as D,jn as E,Bn as F,xn as G,_n as H,sr as I,On as J,An as K,zn as L,Pn as M,Wn as N,$n as O,nr as P,tr as Q,Rn as R,Zn as S,Hn as T,gn as U,Qn as V,Sn as W,bn as X,kn as Y,Xn as Z,Dn as _,mr as a,dn as at,Jn as b,cr as c,cn as ct,yn as d,an as dt,ur as et,vn as f,rn as ft,fr as g,ir as h,It as ht,hr as i,un as it,rr as j,Mn as k,Fn as l,sn as lt,Tn as m,zt as mt,br as n,ar as nt,pr as o,on as ot,In as p,tn as pt,or as q,gr as r,hn as rt,En as s,ln as st,xr as t,Cn as tt,lr as u,nn as ut,Un as v,Nn as w,Gn as x,Ln as y,Yn as z};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-gjgBodjJ.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-ffCh33zF.js","assets/api-CZDct42i.js","assets/utils-B6KiDbIe.js","assets/index-A5BuRryw.js","assets/profile-store-D2pB4wB-.js","assets/preload-helper-Czpn1I53.js","assets/dialog-B43iKmfK.js","assets/createLucideIcon-DyMAgLa3.js","assets/index-9VfaB4iq.css","assets/ssh-mode-DUOUmezi.js","assets/Terminal-BrP-ENHg.css"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n,t as r}from"./jsx-runtime-ffCh33zF.js";import{a as i,i as a,l as o,o as s}from"./profile-store-D2pB4wB-.js";import{t as c}from"./preload-helper-Czpn1I53.js";import{S as l,n as u}from"./api-CZDct42i.js";import{A as d,C as f,O as p,w as m,x as h}from"./dialog-B43iKmfK.js";import{t as g}from"./utils-B6KiDbIe.js";import{t as _}from"./createLucideIcon-DyMAgLa3.js";var v=e(t(),1),y=[`top`,`right`,`bottom`,`left`],b=Math.min,x=Math.max,S=Math.round,C=Math.floor,w=e=>({x:e,y:e}),T={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function E(e,t,n){return x(e,b(t,n))}function D(e,t){return typeof e==`function`?e(t):e}function O(e){return e.split(`-`)[0]}function k(e){return e.split(`-`)[1]}function A(e){return e===`x`?`y`:`x`}function j(e){return e===`y`?`height`:`width`}function M(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function N(e){return A(M(e))}function P(e,t,n){n===void 0&&(n=!1);let r=k(e),i=N(e),a=j(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=B(o)),[o,B(o)]}function F(e){let t=B(e);return[I(e),t,I(t)]}function I(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var L=[`left`,`right`],R=[`right`,`left`],z=[`top`,`bottom`],ee=[`bottom`,`top`];function te(e,t,n){switch(e){case`top`:case`bottom`:return n?t?R:L:t?L:R;case`left`:case`right`:return t?z:ee;default:return[]}}function ne(e,t,n,r){let i=k(e),a=te(O(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(I)))),a}function B(e){let t=O(e);return T[t]+e.slice(t.length)}function re(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ie(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:re(e)}function V(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ae(e,t,n){let{reference:r,floating:i}=e,a=M(t),o=N(t),s=j(o),c=O(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=k(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function oe(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=D(t,e),p=ie(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=V(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=V(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var se=50,ce=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:oe},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ae(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<se&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ae(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},le=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=D(e,t)||{};if(l==null)return{};let d=ie(u),f={x:n,y:r},p=N(i),m=j(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,x=a.reference[m]+a.reference[p]-f[p]-a.floating[m],S=f[p]-a.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),w=C?C[y]:0;(!w||!await(o.isElement==null?void 0:o.isElement(C)))&&(w=s.floating[y]||a.floating[m]);let T=x/2-S/2,O=w/2-h[m]/2-1,A=b(d[_],O),M=b(d[v],O),P=w-h[m]-M,F=w/2-h[m]/2+T,I=E(A,F,P),L=!c.arrow&&k(i)!=null&&F!==I&&a.reference[m]/2-(F<A?A:M)-h[m]/2<0,R=L?F<A?F-A:F-P:0;return{[p]:f[p]+R,data:{[p]:I,centerOffset:F-I-R,...L&&{alignmentOffset:R}},reset:L}}}),ue=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=D(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=O(r),_=M(o),v=O(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[B(o)]:F(o)),x=p!==`none`;!d&&x&&b.push(...ne(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=P(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==M(t))||T.every(e=>M(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=M(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function de(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fe(e){return y.some(t=>e[t]>=0)}var pe=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=D(e,t);switch(i){case`referenceHidden`:{let e=de(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:fe(e)}}}case`escaped`:{let e=de(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:fe(e)}}}default:return{}}}}},me=new Set([`left`,`top`]);async function he(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=O(n),s=k(n),c=M(n)===`y`,l=me.has(o)?-1:1,u=a&&c?-1:1,d=D(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ge=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await he(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},_e=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=D(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=M(i),p=A(f),m=u[p],h=u[f],g=(e,t)=>E(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},ve=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=D(e,t),u={x:n,y:r},d=M(i),f=A(d),p=u[f],m=u[d],h=D(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=me.has(O(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ye=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=D(e,t),c=await i.detectOverflow(t,s),l=O(n),u=k(n),d=M(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=b(p-c[m],g),y=b(f-c[h],_),S=t.middlewareData.shift,C=!S,w=v,T=y;S!=null&&S.enabled.x&&(T=_),S!=null&&S.enabled.y&&(w=g),C&&!u&&(d?T=f-2*x(c.left,c.right):w=p-2*x(c.top,c.bottom)),await o({...t,availableWidth:T,availableHeight:w});let E=await i.getDimensions(a.floating);return f!==E.width||p!==E.height?{reset:{rects:!0}}:{}}}};function be(){return typeof window<`u`}function H(e){return xe(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){return((xe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function xe(e){return be()?e instanceof Node||e instanceof U(e).Node:!1}function G(e){return be()?e instanceof Element||e instanceof U(e).Element:!1}function K(e){return be()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function Se(e){return!be()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}function Ce(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=J(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function we(e){return/^(table|td|th)$/.test(H(e))}function Te(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ee=/transform|translate|scale|rotate|perspective|filter/,De=/paint|layout|strict|content/,q=e=>!!e&&e!==`none`,Oe;function ke(e){let t=G(e)?J(e):e;return q(t.transform)||q(t.translate)||q(t.scale)||q(t.rotate)||q(t.perspective)||!je()&&(q(t.backdropFilter)||q(t.filter))||Ee.test(t.willChange||``)||De.test(t.contain||``)}function Ae(e){let t=Y(e);for(;K(t)&&!Me(t);){if(ke(t))return t;if(Te(t))return null;t=Y(t)}return null}function je(){return Oe??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Oe}function Me(e){return/^(html|body|#document)$/.test(H(e))}function J(e){return U(e).getComputedStyle(e)}function Ne(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Y(e){if(H(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Se(e)&&e.host||W(e);return Se(t)?t.host:t}function Pe(e){let t=Y(e);return Me(t)?(e.ownerDocument||e).body:K(t)&&Ce(t)?t:Pe(t)}function Fe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Pe(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=Ie(a);return t.concat(a,a.visualViewport||[],Ce(r)?r:[],e&&n?Fe(e):[])}else return t.concat(r,Fe(r,[],n))}function Ie(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Le(e){let t=J(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=S(n)!==a||S(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Re(e){return G(e)?e:e.contextElement}function X(e){let t=Re(e);if(!K(t))return w(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Le(t),o=(a?S(n.width):n.width)/r,s=(a?S(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ze=w(0);function Be(e){let t=U(e);return!je()||!t.visualViewport?ze:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ve(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===U(e)}function Z(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Re(e),o=w(1);t&&(r?G(r)&&(o=X(r)):o=X(e));let s=Ve(a,n,r)?Be(a):w(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=U(a),t=G(r)?U(r):r,n=e,i=Ie(n);for(;i&&t!==n;){let e=X(i),t=i.getBoundingClientRect(),r=J(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=U(i),i=Ie(n)}}return V({width:u,height:d,x:c,y:l})}function He(e,t){let n=Ne(e).scrollLeft;return t?t.left+n:Z(W(e)).left+n}function Ue(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-He(e,n),y:n.top+t.scrollTop}}function We(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=W(r),s=t?Te(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=w(1),u=w(0),d=K(r);if((d||!a)&&((H(r)!==`body`||Ce(o))&&(c=Ne(r)),d)){let e=Z(r);l=X(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ue(o,c):w(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ge(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ke(e){let t=Ne(e),n=e.ownerDocument.body,r=x(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=x(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+He(e),o=-t.scrollTop;return J(n).direction===`rtl`&&(a+=x(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var qe=25;function Je(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=U(e),a=W(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!je()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(He(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=qe&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ye(e,t){let n=Z(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=X(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Xe(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Je(e,n,t);else if(t===`document`)r=Ke(W(e));else if(G(t))r=Ye(t,n);else{let n=Be(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return V(r)}function Ze(e,t){let n=t.get(e);if(n)return n;let r=Fe(e,[],!1).filter(e=>G(e)&&H(e)!==`body`),i=null,a=J(e).position===`fixed`,o=a?Y(e):e;for(;G(o)&&!Me(o);){let e=J(o),t=ke(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Y(o)}return t.set(e,r),r}function Qe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Te(t)?[]:Ze(t,this._c):[].concat(n),r],o=Xe(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Xe(t,a[e],i);s=x(n.top,s),c=b(n.right,c),l=b(n.bottom,l),u=x(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function $e(e){let{width:t,height:n}=Le(e);return{width:t,height:n}}function et(e,t,n){let r=K(t),i=W(t),a=n===`fixed`,o=Z(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=w(0);if((r||!a)&&((H(t)!==`body`||Ce(i))&&(s=Ne(t)),r)){let e=Z(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=He(i));let l=i&&!r&&!a?Ue(i,s):w(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function tt(e){return J(e).position===`static`}function nt(e,t){if(!K(e)||J(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function rt(e,t){let n=U(e);if(Te(e))return n;if(!K(e)){let t=Y(e);for(;t&&!Me(t);){if(G(t)&&!tt(t))return t;t=Y(t)}return n}let r=nt(e,t);for(;r&&we(r)&&tt(r);)r=nt(r,t);return r&&Me(r)&&tt(r)&&!ke(r)?n:r||Ae(e)||n}var it=async function(e){let t=this.getOffsetParent||rt,n=this.getDimensions,r=await n(e.floating);return{reference:et(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function at(e){return J(e).direction===`rtl`}var ot={convertOffsetParentRelativeRectToViewportRelativeRect:We,getDocumentElement:W,getClippingRect:Qe,getOffsetParent:rt,getElementRects:it,getClientRects:Ge,getDimensions:$e,getScale:X,isElement:G,isRTL:at};function st(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ct(e,t,n){let r=null,i,a=W(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=C(d),h=C(a.clientWidth-(u+f)),g=C(a.clientHeight-(d+p)),_=C(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:x(0,b(1,c))||1},y=!0;function S(t){let n=t[0].intersectionRatio;if(!st(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(S,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(S,v)}r.observe(e)}let c=U(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function lt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Re(e),u=i||a?[...l?Fe(l):[],...t?Fe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?ct(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Z(e):null;c&&g();function g(){let t=Z(e);h&&!st(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var ut=ge,dt=_e,ft=ue,pt=ye,mt=pe,ht=le,gt=ve,_t=(e,t,n)=>{let r=new Map,i=n??{},a={...ot,...i.platform,_c:r};return ce(e,t,{...i,platform:a})},vt=e(n(),1),yt=typeof document<`u`?v.useLayoutEffect:function(){};function bt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!bt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!bt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function xt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function St(e,t){let n=xt(e);return Math.round(t*n)/n}function Ct(e){let t=v.useRef(e);return yt(()=>{t.current=e}),t}function wt(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);bt(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),y=v.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=v.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=v.useRef(null),w=v.useRef(null),T=v.useRef(u),E=c!=null,D=Ct(c),O=Ct(i),k=Ct(l),A=v.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),_t(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!bt(T.current,t)&&(T.current=t,vt.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);yt(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=v.useRef(!1);yt(()=>(j.current=!0,()=>{j.current=!1}),[]),yt(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=v.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=v.useMemo(()=>({reference:x,floating:S}),[x,S]),P=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=St(N.floating,u.x),r=St(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...xt(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var Tt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ht({element:r.current,padding:i}).fn(n):r?ht({element:r,padding:i}).fn(n):{}}}},Et=(e,t)=>{let n=ut(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dt=(e,t)=>{let n=dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ot=(e,t)=>({fn:gt(e).fn,options:[e,t]}),kt=(e,t)=>{let n=ft(e);return{name:n.name,fn:n.fn,options:[e,t]}},At=(e,t)=>{let n=pt(e);return{name:n.name,fn:n.fn,options:[e,t]}},jt=(e,t)=>{let n=mt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mt=(e,t)=>{let n=Tt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Q=r(),Nt=`Arrow`,Pt=v.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,Q.jsx)(m.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,Q.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Pt.displayName=Nt;var Ft=Pt;function It(e){let[t,n]=v.useState(void 0);return h(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Lt=`Popper`,[Rt,zt]=p(Lt),[Bt,Vt]=Rt(Lt),Ht=e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null),[a,o]=v.useState(void 0);return(0,Q.jsx)(Bt,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Ht.displayName=Lt;var Ut=`PopperAnchor`,Wt=v.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Vt(Ut,n),o=v.useRef(null),s=a.onAnchorChange,c=d(t,v.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=v.useRef(null);v.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&en(a.placementState),f=u?.[0],p=u?.[1];return r?null:(0,Q.jsx)(m.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...i,ref:c})});Wt.displayName=Ut;var Gt=`PopperContent`,[Kt,qt]=Rt(Gt),Jt=v.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:p=`partial`,hideWhenDetached:g=!1,updatePositionStrategy:_=`optimized`,onPlaced:y,...b}=e,x=Vt(Gt,n),[S,C]=v.useState(null),w=d(t,C),[T,E]=v.useState(null),D=It(T),O=D?.width??0,k=D?.height??0,A=r+(a===`center`?``:`-`+a),j=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},M=Array.isArray(l)?l:[l],N=M.length>0,P={padding:j,boundary:M.filter(Qt),altBoundary:N},{refs:F,floatingStyles:I,placement:L,isPositioned:R,middlewareData:z}=wt({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>lt(...e,{animationFrame:_===`always`}),elements:{reference:x.anchor},middleware:[Et({mainAxis:i+k,alignmentAxis:o}),c&&Dt({mainAxis:!0,crossAxis:!1,limiter:p===`partial`?Ot():void 0,...P}),c&&kt({...P}),At({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),T&&Mt({element:T,padding:s}),$t({arrowWidth:O,arrowHeight:k}),g&&jt({strategy:`referenceHidden`,...P,boundary:N?P.boundary:void 0})]}),ee=x.setPlacementState;h(()=>(ee(L),()=>{ee(void 0)}),[L,ee]);let[te,ne]=en(L),B=f(y);h(()=>{R&&B?.()},[R,B]);let re=z.arrow?.x,ie=z.arrow?.y,V=z.arrow?.centerOffset!==0,[ae,oe]=v.useState();return h(()=>{S&&oe(window.getComputedStyle(S).zIndex)},[S]),(0,Q.jsx)(`div`,{ref:F.setFloating,"data-radix-popper-content-wrapper":``,style:{...I,transform:R?I.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,Q.jsx)(Kt,{scope:n,placedSide:te,placedAlign:ne,onArrowChange:E,arrowX:re,arrowY:ie,shouldHideArrow:V,children:(0,Q.jsx)(m.div,{"data-side":te,"data-align":ne,...b,ref:w,style:{...b.style,animation:R?void 0:`none`}})})})});Jt.displayName=Gt;var Yt=`PopperArrow`,Xt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Zt=v.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=qt(Yt,n),a=Xt[i.placedSide];return(0,Q.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,Q.jsx)(Ft,{...r,ref:t,style:{...r.style,display:`block`}})})});Zt.displayName=Yt;function Qt(e){return e!==null}var $t=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=en(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function en(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var tn=Ht,nn=Wt,rn=Jt,an=Zt,on=`rounded-md bg-border/50 text-sm text-fg placeholder:text-fg-muted transition-colors hover:bg-border/80 focus:bg-border/80 disabled:cursor-not-allowed disabled:opacity-50`,sn=`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,cn=`data-[highlighted]:bg-action data-[highlighted]:text-action-ink data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,ln=`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`;function un({className:e,type:t,...n}){return(0,Q.jsx)(`input`,{type:t,className:g(`flex h-8 w-full px-2.5`,on,e),...n})}function dn({className:e,...t}){return(0,Q.jsx)(`textarea`,{className:g(`flex min-h-16 w-full px-2.5 py-2`,on,e),...t})}var fn=`Label`,pn=v.forwardRef((e,t)=>(0,Q.jsx)(m.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));pn.displayName=fn;var mn=pn;function hn({className:e,...t}){return(0,Q.jsx)(mn,{className:g(`text-xs font-medium text-fg-secondary peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function gn(){return s({queryKey:[`profiles`],queryFn:()=>u(`GET`,`/api/profiles`)})}function _n(e){return s({queryKey:[`profile-settings`,e],queryFn:()=>u(`GET`,`/api/profiles/${e}/settings`),enabled:e!==void 0})}function vn(e){return s({queryKey:[`accounts`,e],queryFn:()=>u(`GET`,`/api/accounts?profile=${e}`),enabled:e!==void 0})}function yn(e){return s({queryKey:[`account-usage`,e],queryFn:()=>u(`GET`,`/api/accounts/${e}/usage`),enabled:e!==void 0,staleTime:15e3})}function bn(){return s({queryKey:[`repos`],queryFn:()=>u(`GET`,`/api/repos`)})}function xn(e){return s({queryKey:[`projects`,e??`all`],queryFn:()=>u(`GET`,e===void 0?`/api/projects`:`/api/projects?profile=${e}`)})}function Sn(e){return s({queryKey:[`project`,e],queryFn:()=>u(`GET`,`/api/projects/${e}`),enabled:e!==void 0})}function Cn(e){return s({queryKey:[`sessions`,e],queryFn:()=>u(`GET`,`/api/sessions?project=${e}`),enabled:e!==void 0})}var wn={queryKey:[`sessions`,`all`],queryFn:()=>u(`GET`,`/api/sessions`)};function Tn(){return s(wn)}function En(e){return e.fetchQuery(wn)}function Dn(){return s({queryKey:[`config`],queryFn:()=>u(`GET`,`/api/config`)})}function On(e){return s({queryKey:[`repo-branches`,e],queryFn:()=>u(`GET`,`/api/repos/${e}/branches`),enabled:e!==void 0,staleTime:3e4})}function kn(e){return s({queryKey:[`repo-worktrees`,e],queryFn:()=>u(`GET`,`/api/repos/${e}/worktrees`),enabled:e!==void 0,staleTime:1e4})}function An(e,t){let n=o();return i({mutationFn:t=>u(`DELETE`,`/api/repos/${e}/worktrees?path=${encodeURIComponent(t)}`),onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function jn(e,t){let n=o();return i({mutationFn:({name:t,confirm:n})=>{let r=new URLSearchParams({name:t});return n&&r.set(`confirm`,`1`),u(`DELETE`,`/api/repos/${e}/branches?${r.toString()}`)},onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function Mn(e){return s({queryKey:[`fs-dirs`,e],queryFn:()=>u(`GET`,`/api/fs/dirs?prefix=${encodeURIComponent(e)}`),enabled:e.startsWith(`/`)||e.startsWith(`~`),placeholderData:e=>e,staleTime:1e4})}function Nn(){return s({queryKey:[`version`],queryFn:()=>u(`GET`,`/api/version`),staleTime:1/0})}function Pn(){return s({queryKey:[`host`],queryFn:()=>u(`GET`,`/api/host`),staleTime:1/0})}function Fn(e){return e?e.displayName||e.hostname:void 0}function In(){return s({queryKey:[`agents`],queryFn:()=>u(`GET`,`/api/agents`),staleTime:3e4,refetchOnWindowFocus:!0})}function Ln(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/profiles`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function Rn(e){let t=o();return i({mutationFn:t=>u(`PATCH`,`/api/profiles/${e}/settings`,t),onSuccess:n=>t.setQueryData([`profile-settings`,e],n)})}function zn(){let e=o();return i({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/profiles/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function Bn(){let e=o();return i({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/accounts/${e}`,t),onSuccess:t=>{e.invalidateQueries({queryKey:[`accounts`,t.profile_id]}),e.invalidateQueries({queryKey:[`account-usage`,t.id]})}})}function Vn(){let e=o();return i({mutationFn:e=>u(`DELETE`,`/api/profiles/${e}`),onSuccess:()=>e.clear()})}function Hn(){let e=o();return i({mutationFn:e=>u(`DELETE`,`/api/accounts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`accounts`]})})}function Un(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/accounts`,e),onSuccess:t=>void e.invalidateQueries({queryKey:[`accounts`,t.profile_id]})})}function Wn(){return i({mutationFn:e=>u(`POST`,`/api/accounts/${e}/login`)})}function Gn(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/repos`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Kn(){let e=o();return i({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/repos/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function qn(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/repos/${e}/fetch`),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Jn(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/projects`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function Yn(){let e=o();return i({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/projects/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function Xn(e,t){return s({queryKey:[`scratchpad`,e,t??`none`],queryFn:()=>u(`GET`,`/api/scratchpad?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function Zn(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/scratchpad`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function Qn(){let e=o();return i({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/scratchpad/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function $n(){let e=o();return i({mutationFn:e=>u(`DELETE`,`/api/scratchpad/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function $(e,t){e.invalidateQueries({queryKey:[`sessions`]}),e.invalidateQueries({queryKey:[`project`,t.project_id]})}function er(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/sessions`,e),onSuccess:t=>$(e,t)})}function tr(e){let t=o();return i({mutationFn:t=>u(`POST`,`/api/sessions/${t}/${e}`),onSuccess:e=>$(t,e)})}function nr(){let e=o();return i({mutationFn:({sessionId:e,accountId:t})=>u(`POST`,`/api/sessions/${e}/migrate`,{account_id:t}),onSuccess:t=>$(e,t)})}function rr(){let e=o();return i({mutationFn:({sessionId:e,accountId:t})=>u(`POST`,`/api/sessions/${e}/handoff`,{account_id:t}),onSuccess:(t,{sessionId:n})=>{$(e,t),e.invalidateQueries({queryKey:[`session`,n]})}})}function ir(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/sessions/${e}/archive`),onSuccess:t=>$(e,t)})}function ar(){let e=o();return i({mutationFn:e=>u(`POST`,`/api/sessions/${e}/unarchive`),onSuccess:t=>$(e,t)})}function or(){let e=o();return i({mutationFn:({sessionId:e,title:t})=>u(`PATCH`,`/api/sessions/${e}`,{title:t}),onSuccess:t=>$(e,t)})}function sr(){let e=o();return i({mutationFn:e=>u(`PATCH`,`/api/config`,e),onSuccess:(t,n)=>{e.setQueryData([`config`],t),`displayName`in n&&e.invalidateQueries({queryKey:[`host`]})}})}async function cr(e){try{return await u(`GET`,`/api/profiles/${e}/state`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`no_state`)return null;throw e}}function lr(e,t){return u(`PUT`,`/api/profiles/${e}/state`,{ui_state:t})}function ur(e,t){return s({queryKey:[`ports`,e],queryFn:()=>u(`GET`,`/api/sessions/${e}/ports`),enabled:e!==void 0&&t,refetchInterval:a(5e3),refetchIntervalInBackground:!1})}function dr(e,t){return s({queryKey:[`session-env`,e],queryFn:()=>u(`GET`,`/api/sessions/${e}/env`),enabled:e!==void 0&&t,refetchInterval:a(5e3),refetchIntervalInBackground:!1})}function fr(){let e=o();return i({mutationFn:e=>u(`DELETE`,`/api/sessions/${e}/env`),onSuccess:(t,n)=>{e.setQueryData([`session-env`,n],{vars:[]})}})}var pr=_(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),mr=_(`pencil`,[[`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`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]);function hr({id:e,value:t,onValueChange:n,onChoose:r,hints:i,placeholder:a,className:o,hintsClassName:s,autoFocus:c}){let[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(0),p=e=>{n(e.value),r?.(e),u(!1)};return(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(un,{id:e,value:t,onChange:e=>{n(e.target.value),u(!0),f(0)},onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:e=>{if(!(!l||i.length===0))if(e.key===`ArrowDown`)e.preventDefault(),f(e=>(e+1)%i.length);else if(e.key===`ArrowUp`)e.preventDefault(),f(e=>(e-1+i.length)%i.length);else if(e.key===`Enter`||e.key===`Tab`){let t=i[d]??i[0];t&&(e.preventDefault(),p(t))}else e.key===`Escape`&&(e.stopPropagation(),u(!1))},placeholder:a,className:o,autoComplete:`off`,spellCheck:!1,autoFocus:c}),l&&i.length>0&&(0,Q.jsx)(`ul`,{className:g(`absolute top-full z-10 mt-1 max-h-56 overflow-y-auto rounded-md bg-elevated p-1 shadow-xl`,s??`w-full`),children:i.map((e,t)=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),p(e)},onMouseEnter:()=>f(t),className:g(`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,`w-full font-mono text-xs`),"data-selected":t===d,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e.label??e.value}),e.badge&&(0,Q.jsx)(`span`,{className:`ml-auto shrink-0 text-2xs opacity-70`,children:e.badge})]})},e.value))})]})}function gr(e){l.error(_r(e),{id:`err:${_r(e)}`})}function _r(e){return e instanceof Error&&e.message.trim()!==``?e.message:typeof e==`string`&&e.trim()!==``?e:`Something went wrong`}var vr=(0,v.lazy)(()=>c(()=>import(`./Terminal-gjgBodjJ.js`).then(e=>({default:e.Terminal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),yr=null;async function br(){yr=(await c(()=>import(`./Terminal-gjgBodjJ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))).Terminal}function xr(e){return yr?(0,Q.jsx)(yr,{...e}):(0,Q.jsx)(v.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`size-full bg-ground`}),children:(0,Q.jsx)(vr,{...e})})}export{dr as $,qn as A,Kn as B,er as C,Vn as D,jn as E,Bn as F,xn as G,_n as H,sr as I,On as J,An as K,zn as L,Pn as M,Wn as N,$n as O,nr as P,tr as Q,Rn as R,Zn as S,Hn as T,gn as U,Qn as V,Sn as W,bn as X,kn as Y,Xn as Z,Dn as _,mr as a,dn as at,Jn as b,cr as c,cn as ct,yn as d,an as dt,ur as et,vn as f,rn as ft,fr as g,ir as h,It as ht,hr as i,un as it,rr as j,Mn as k,Fn as l,sn as lt,Tn as m,zt as mt,br as n,ar as nt,pr as o,on as ot,In as p,tn as pt,or as q,gr as r,hn as rt,En as s,ln as st,xr as t,Cn as tt,lr as u,nn as ut,Un as v,Nn as w,Gn as x,Ln as y,Yn as z};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,s as r,t as i}from"./buffer-store-CiF8VU5A.js";var a=e(t(),1);function o({buffers:e}){let t=(0,a.useRef)(new Set);return(0,a.useEffect)(()=>{let a=new Set(e.map(e=>i(e.session,e.path,e.root))),o=t.current;for(let e of a)o.has(e)||(r(e),o.add(e));for(let e of[...o])a.has(e)||(n(e),o.delete(e))},[e]),(0,a.useEffect)(()=>()=>{for(let e of t.current)n(e);t.current.clear()},[]),null}export{o as ModelRefcount};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,s as r,t as i}from"./buffer-store-C0jIh5zW.js";var a=e(t(),1);function o({buffers:e}){let t=(0,a.useRef)(new Set);return(0,a.useEffect)(()=>{let a=new Set(e.map(e=>i(e.session,e.path,e.root))),o=t.current;for(let e of a)o.has(e)||(r(e),o.add(e));for(let e of[...o])a.has(e)||(n(e),o.delete(e))},[e]),(0,a.useEffect)(()=>()=>{for(let e of t.current)n(e);t.current.clear()},[]),null}export{o as ModelRefcount};