@puddle-code/cli 0.0.55 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +12 -5
  2. package/dist/index.js +36 -9
  3. package/dist/public/assets/{Dashboard-Zy1p889G.js → Dashboard-C-wNOOZz.js} +1 -1
  4. package/dist/public/assets/EditorTabClose-C6dJw6dO.js +1 -0
  5. package/dist/public/assets/LazyTerminal-DWVZosNX.js +2 -0
  6. package/dist/public/assets/{ModelRefcount-C0OKUgxA.js → ModelRefcount-Cpz178w9.js} +1 -1
  7. package/dist/public/assets/PaneEditorBody-Ch0DQkBa.js +515 -0
  8. package/dist/public/assets/SettingsDialog-Dsr73xNW.js +1 -0
  9. package/dist/public/assets/Terminal-BUVKPPZS.js +60 -0
  10. package/dist/public/assets/Workspace-XDes03e-.js +7 -0
  11. package/dist/public/assets/{buffer-logic-CqYsttLM.js → buffer-logic-BAkSBQT7.js} +1 -1
  12. package/dist/public/assets/buffer-store-ue6VuXQd.js +16 -0
  13. package/dist/public/assets/context-menu-YihyOCU5.js +1 -0
  14. package/dist/public/assets/{cssMode-Bs34S34J.js → cssMode-D94T4Psw.js} +1 -1
  15. package/dist/public/assets/drafts-dNFvUOnn.js +1 -0
  16. package/dist/public/assets/editor-context-DBjXfTll.js +1 -0
  17. package/dist/public/assets/editor-sync-W1bamxAP.js +1 -0
  18. package/dist/public/assets/{file-links-BxADyqBz.js → file-links-DuC9xUoS.js} +1 -1
  19. package/dist/public/assets/hotkeys-CekBkaTu.js +73 -0
  20. package/dist/public/assets/{htmlMode-BHdZ3i0j.js → htmlMode-BcHClAZo.js} +1 -1
  21. package/dist/public/assets/index-BiyEBNqW.js +10 -0
  22. package/dist/public/assets/index-DzFZUNIz.css +2 -0
  23. package/dist/public/assets/{jsonMode-D65P-gpW.js → jsonMode-N9kz4q4I.js} +1 -1
  24. package/dist/public/assets/{session-seed-CbqaUf_D.js → session-seed-DJeqULeP.js} +1 -1
  25. package/dist/public/assets/{tsMode-xCXSLtgj.js → tsMode-D6039GCw.js} +1 -1
  26. package/dist/public/assets/{use-find-controls-DHY2DUR7.js → use-find-controls-CjnZGtVa.js} +1 -1
  27. package/dist/public/index.html +4 -4
  28. package/package.json +1 -1
  29. package/dist/public/assets/EditorTabClose-CNutQ8jD.js +0 -1
  30. package/dist/public/assets/LazyTerminal-D02uMOCY.js +0 -2
  31. package/dist/public/assets/PaneEditorBody-B88Ve_Um.js +0 -515
  32. package/dist/public/assets/SettingsDialog-CH5WxI03.js +0 -1
  33. package/dist/public/assets/Terminal-D5J5edCq.js +0 -60
  34. package/dist/public/assets/Workspace-CgTBejI-.js +0 -7
  35. package/dist/public/assets/buffer-store-B0PeSmyA.js +0 -16
  36. package/dist/public/assets/context-menu-DIsDoDEm.js +0 -1
  37. package/dist/public/assets/editor-context-BZHPtUDq.js +0 -1
  38. package/dist/public/assets/editor-sync-D8goZh5D.js +0 -1
  39. package/dist/public/assets/hotkeys-BApA7bsN.js +0 -73
  40. package/dist/public/assets/index-CTI7M7xM.css +0 -2
  41. package/dist/public/assets/index-PreRneCj.js +0 -10
package/CHANGELOG.md CHANGED
@@ -7,11 +7,18 @@ Past releases: see docs/changelogs/.
7
7
 
8
8
  # Changelog
9
9
 
10
- ## [0.0.55] — 2026-08-21
10
+ ## [0.1.0] — 2026-08-23
11
11
 
12
12
  ### Fixed
13
13
 
14
- - Honour the configured editor tab size instead of letting Monaco override it from file contents.
15
- - Use each newly registered repository's checked-out clone branch as its default base instead of assuming `main`.
16
- - Make terminal file paths clickable across every visual row when they wrap onto multiple lines.
17
- - Preserve each terminal's scroll position when leaving and returning to its session.
14
+ - Preserve a deliberately scrolled terminal's transcript position through pane/window resizing, focus refits, font changes, and hidden-tab reattachment across every terminal-backed agent.
15
+ - Keep overflowing captured-environment names and detected ports on single horizontally scrollable rows with hidden scrollbars.
16
+ - Recover legacy Codex chats directly from their rollout and creation time even when the old remote bridge recorded `~` as cwd or Codex has not yet restored the chat to its SQLite index, eliminating the throwaway-new-chat plus `/resume` workaround.
17
+ - Restore terminal sessions in the directory most recently reached with `cd`, and isolate Up/Down command history per Puddle session across shell and daemon restarts.
18
+ - Rename files inline from their editor-tab context menu instead of revealing a rename field in the Files sidebar, while keeping open views and unsaved buffers attached to the new path.
19
+ - Retire no-op editor drafts whose text already matches the file instead of repeatedly warning after an mtime-only rewrite.
20
+ - Keep remote Codex sessions rooted in their Puddle worktree so the footer and tools retain the correct directory and Git branch, while preserving safe resume for sessions created during the regression.
21
+
22
+ ### Changed
23
+
24
+ - Bump the communication protocol to 17.0 to force connected daemons to upgrade before using the 0.1.0 runtime.
package/dist/index.js CHANGED
@@ -4260,7 +4260,7 @@ import {
4260
4260
  import { dirname as dirname3, join as join4, resolve } from "node:path";
4261
4261
 
4262
4262
  // ../shared/src/protocol.ts
4263
- var PROTOCOL_VERSION = { major: 16, minor: 3 };
4263
+ var PROTOCOL_VERSION = { major: 17, minor: 0 };
4264
4264
 
4265
4265
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
4266
4266
  var external_exports = {};
@@ -18780,7 +18780,9 @@ config(en_default());
18780
18780
  var errorResponseSchema = external_exports.object({
18781
18781
  error: external_exports.object({
18782
18782
  code: external_exports.string(),
18783
- message: external_exports.string()
18783
+ message: external_exports.string(),
18784
+ /** Optional machine-readable context for recoverable conflicts. */
18785
+ details: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
18784
18786
  })
18785
18787
  });
18786
18788
  var isoTimestamp = external_exports.iso.datetime({ offset: true });
@@ -18799,10 +18801,23 @@ var versionResponseSchema = external_exports.object({
18799
18801
  });
18800
18802
 
18801
18803
  // ../shared/src/api/agent-signal.ts
18802
- var agentSignalRequestSchema = external_exports.object({
18804
+ var statusSignalSchema = external_exports.object({
18803
18805
  nonce: external_exports.string().min(16),
18804
18806
  state: external_exports.enum(["working", "waiting_input"])
18805
18807
  });
18808
+ var agentLifecycleSignalSchema = external_exports.object({
18809
+ nonce: external_exports.string().min(16),
18810
+ event: external_exports.enum(["session_start", "session_end"]),
18811
+ /** Agent-native conversation id. Required for a start; optional on a best-effort end hook. */
18812
+ agent_session_ref: external_exports.string().min(1).optional(),
18813
+ cwd: external_exports.string().min(1),
18814
+ source: external_exports.enum(["startup", "resume", "clear", "fork", "compact", "exit", "other"]),
18815
+ parent_agent_session_ref: external_exports.string().min(1).optional(),
18816
+ native_title: external_exports.string().optional(),
18817
+ native_created_at: external_exports.iso.datetime({ offset: true }).optional(),
18818
+ native_updated_at: external_exports.iso.datetime({ offset: true }).optional()
18819
+ });
18820
+ var agentSignalRequestSchema = external_exports.union([statusSignalSchema, agentLifecycleSignalSchema]);
18806
18821
 
18807
18822
  // ../shared/src/api/config.ts
18808
18823
  var fields = {
@@ -19152,6 +19167,10 @@ var sessionSchema = external_exports.object({
19152
19167
  /** Null for terminal sessions, which run a plain shell rather than an agent. */
19153
19168
  agent_type: external_exports.string().nullable(),
19154
19169
  agent_session_ref: external_exports.string().nullable(),
19170
+ /** Durable native-conversation catalogue row; null for terminal sessions. */
19171
+ conversation_id: rowId.nullable().optional(),
19172
+ /** Native parent conversation, when the agent records a fork relationship. */
19173
+ parent_conversation_id: rowId.nullable().optional(),
19155
19174
  /** User-set display override; null means "use the agent's own name" (agent_title) then the id. */
19156
19175
  title: external_exports.string().nullable(),
19157
19176
  /**
@@ -19161,6 +19180,12 @@ var sessionSchema = external_exports.object({
19161
19180
  * older daemons omit it; null when the agent has not named the session yet.
19162
19181
  */
19163
19182
  agent_title: external_exports.string().nullable().optional(),
19183
+ /** Two successful native scans could no longer find this conversation. */
19184
+ conversation_missing: external_exports.boolean().optional(),
19185
+ /** This placement owns worktree/branch-dependent destructive actions. */
19186
+ branch_owner: external_exports.boolean().optional(),
19187
+ /** Strength of exact in-agent lifecycle synchronisation for this runtime. */
19188
+ native_sync: external_exports.enum(["pending", "full", "fallback"]).optional(),
19164
19189
  /**
19165
19190
  * The terminal-title "sequence" name: the last title the process set on its
19166
19191
  * PTY via an OSC 0/1/2 escape, normalised (leading spinner/status glyphs
@@ -19172,10 +19197,10 @@ var sessionSchema = external_exports.object({
19172
19197
  osc_title: external_exports.string().nullable().optional(),
19173
19198
  status: sessionStatusSchema,
19174
19199
  /**
19175
- * Where a TERMINAL session's shell starts, relative to `worktree_path`; null
19176
- * (or absent, on an older daemon) means the worktree root. Set by the file
19177
- * tree's "Open Terminal in Directory" and persisted, so a resume after a
19178
- * daemon restart comes back to the same directory. Always null for agents.
19200
+ * A TERMINAL session's last prompt directory, relative to `worktree_path`;
19201
+ * null (or absent, on an older daemon) means the worktree root. Initially set
19202
+ * by "Open Terminal in Directory", then updated after `cd`, so a resume
19203
+ * returns to the same directory. Always null for agents.
19179
19204
  */
19180
19205
  cwd: external_exports.string().nullable().optional(),
19181
19206
  skip_permissions: external_exports.boolean(),
@@ -19852,7 +19877,7 @@ import { readFileSync } from "node:fs";
19852
19877
  import { dirname, join as join2 } from "node:path";
19853
19878
  import { fileURLToPath } from "node:url";
19854
19879
  function cliVersion() {
19855
- if (true) return "0.0.55";
19880
+ if (true) return "0.1.0";
19856
19881
  const here = dirname(fileURLToPath(import.meta.url));
19857
19882
  for (const candidate of [
19858
19883
  join2(here, "..", "..", "package.json"),
@@ -20209,7 +20234,9 @@ var RELEASE_PROTOCOLS = {
20209
20234
  "0.0.52": { major: 16, minor: 3 },
20210
20235
  "0.0.53": { major: 16, minor: 3 },
20211
20236
  "0.0.54": { major: 16, minor: 3 },
20212
- "0.0.55": { major: 16, minor: 3 }
20237
+ "0.0.55": { major: 16, minor: 3 },
20238
+ "0.0.56": { major: 16, minor: 4 },
20239
+ "0.1.0": { major: 17, minor: 0 }
20213
20240
  };
20214
20241
  function validProtocol(value) {
20215
20242
  if (typeof value !== "object" || value === null) return false;
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,r}from"./x-BJOrp_m5.js";import{_t as i,et as a,ft as o,it as s,p as c,st as l,tt as u,v as d,wt as f}from"./hotkeys-BApA7bsN.js";import{a as p,h as m,i as h,n as g,o as _,t as v}from"./dialog-DjL0qoAv.js";import{a as y,c as b,i as x,o as S,s as C,t as w}from"./LazyTerminal-D02uMOCY.js";import{A as T,M as E,c as D,j as O,k,n as A,r as j,t as M}from"./context-menu-DIsDoDEm.js";import{r as N}from"./dist-DDFe8e3m.js";import{Et as P,Gt as F,Mt as I,at as L,ct as R,lt as z,st as B}from"./index-PreRneCj.js";var V=e(t(),1),H=n(),U=!1;function W(){let[e,t]=(0,V.useState)(U),[n,r]=(0,V.useState)(null);(0,V.useEffect)(()=>{if(!e)return;let t=!1;return z.spawnShell(f).then(e=>{t||r(e)}),()=>{t=!0}},[e]);let i=()=>{U=!1,t(!1),r(null)};return{open:e,term:n,toggle:()=>{e?(n&&z.killShell(f,n),i()):(U=!0,t(!0))},onExit:i}}function G({term:e,onExit:t}){return(0,H.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,H.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:e!==null&&(0,H.jsx)(w,{stream:`home`,term:e,onExit:t})})})}var K=[{status:`running`,colour:`bg-running`},{status:`waiting_input`,colour:`bg-waiting`},{status:`interrupted`,colour:`bg-interrupted`}];function q({projectId:e}){let t=i(e),n=(0,V.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,H.jsxs)(`div`,{className:`flex items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,H.jsxs)(`span`,{children:[r,` session`,r===1?``:`s`]}),K.map(({status:e,colour:t})=>{let r=n.get(e)??0;return r===0?null:(0,H.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),r,` `,e.replace(`_`,` `)]},e)})]})}function J({icon:e,label:t,onClick:n}){return(0,H.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,H.jsx)(e,{className:`size-4`})})}function Y({project:e,repoPath:t,draggable:n,dragging:i,onDragStart:a,onDragEnd:o,onDragOver:s}){let c=u(),[l,d]=(0,V.useState)(!1),[f,S]=(0,V.useState)(e.name),[w,T]=(0,V.useState)(R(e)),k=t=>c.mutate({id:e.id,archived:t},{onError:e=>x(e)}),N=()=>{S(e.name),T(R(e)),d(!0)},P=()=>{let t=f.trim(),n=B(w);if(!t){d(!1);return}let r={...t===e.name?{}:{name:t},...n&&n!==R(e)?{abbrev:n}:{}};if(Object.keys(r).length===0){d(!1);return}c.mutate({id:e.id,...r},{onSuccess:()=>d(!1),onError:e=>x(e)})};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(M,{children:[(0,H.jsx)(D,{asChild:!0,children:(0,H.jsxs)(`div`,{draggable:n,onDragStart:a,onDragEnd:o,onDragOver:s,className:r(`group relative transition-opacity`,i&&`opacity-50`),children:[(0,H.jsxs)(F,{draggable:!1,to:`/project/${e.id}`,className:`block rounded-lg bg-surface p-4 transition-colors hover:bg-elevated`,children:[(0,H.jsx)(`h2`,{className:`truncate pr-16 text-base font-semibold text-fg group-hover:text-accent`,children:e.name}),(0,H.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:t??`…`}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(q,{projectId:e.id})})]}),(0,H.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,H.jsx)(J,{icon:E,label:`Reopen project`,onClick:()=>k(!1)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(J,{icon:y,label:`Edit project`,onClick:N}),(0,H.jsx)(J,{icon:O,label:`Archive project`,onClick:()=>k(!0)})]})})]})}),(0,H.jsx)(A,{children:e.archived?(0,H.jsxs)(j,{onSelect:()=>k(!1),children:[(0,H.jsx)(E,{}),` Reopen`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(j,{onSelect:N,children:[(0,H.jsx)(y,{}),` Edit`]}),(0,H.jsxs)(j,{onSelect:()=>k(!0),children:[(0,H.jsx)(O,{}),` Archive`]})]})})]}),(0,H.jsx)(v,{open:l,onOpenChange:d,children:(0,H.jsxs)(g,{children:[(0,H.jsx)(p,{children:(0,H.jsx)(_,{children:`Edit project`})}),(0,H.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),P()},children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(C,{htmlFor:`project-name-${e.id}`,children:`Name`}),(0,H.jsx)(b,{id:`project-name-${e.id}`,value:f,onChange:e=>S(e.target.value),autoFocus:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(C,{htmlFor:`project-abbrev-${e.id}`,children:`Abbreviation`}),(0,H.jsx)(b,{id:`project-abbrev-${e.id}`,maxLength:5,value:w,onChange:e=>T(B(e.target.value)),className:`w-24 uppercase`}),(0,H.jsxs)(`p`,{className:`text-2xs text-fg-muted`,children:[`Up to `,5,` characters — the label on the collapsed sidebar rail.`]})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(C,{className:`text-fg-muted`,children:`Path`}),(0,H.jsx)(`p`,{className:`truncate text-2xs text-fg-muted`,children:t??`…`})]}),(0,H.jsxs)(h,{children:[(0,H.jsx)(m,{type:`button`,variant:`ghost`,onClick:()=>d(!1),children:`Cancel`}),(0,H.jsx)(m,{type:`submit`,disabled:!f.trim()||c.isPending,children:`Save`})]})]})]})})]})}function X({icon:e,label:t,hint:n,onClick:r}){return(0,H.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,H.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,H.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,H.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function Z(){let e=d(),t=l(e??void 0),n=o(),i=s(e??void 0),u=a(e??``),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(null),[g,_]=(0,V.useState)(!1),v=W(),y=c(`palette.toggle`),b=e=>n.data?.find(t=>t.id===e)?.path,x=t.data??[],C=i.data?.projectOrder??[],w=k(x.filter(e=>!e.archived),C),E=x.filter(e=>e.archived),D=(e,t)=>{e!==t&&u.mutate({projectOrder:T(w.map(e=>e.id),e,t)})};return(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[x.length===0&&(0,H.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,H.jsx)(S,{className:`size-8 text-fg-muted`}),(0,H.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`No projects yet — open one below, or press `,y,`.`]})]}),(0,H.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[w.map(e=>(0,H.jsx)(Y,{project:e,repoPath:b(e.repo_id),draggable:!0,dragging:m===e.id,onDragStart:()=>h(e.id),onDragEnd:()=>h(null),onDragOver:t=>{t.preventDefault(),m&&m!==e.id&&D(m,e.id)}},e.id)),(0,H.jsx)(X,{icon:I,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>p(!0)}),(0,H.jsx)(X,{icon:P,label:v.open?`Close terminal`:`Open terminal`,hint:v.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:v.toggle})]}),E.length>0&&(0,H.jsxs)(`div`,{className:`mt-6`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>_(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,H.jsx)(N,{className:r(`size-3 transition-transform`,g&&`rotate-90`)}),(0,H.jsx)(O,{className:`size-3`}),(0,H.jsx)(`span`,{children:`Archived`}),(0,H.jsx)(`span`,{className:`tabular-nums`,children:E.length})]}),g&&(0,H.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:E.map(e=>(0,H.jsx)(Y,{project:e,repoPath:b(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),v.open&&(0,H.jsx)(G,{term:v.term,onExit:v.onExit}),e!==null&&(0,H.jsx)(L,{profileId:e,open:f,onOpenChange:p})]})}export{Z as Dashboard};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,r}from"./x-BJOrp_m5.js";import{Tt as i,at as a,ct as o,nt as s,p as c,pt as l,tt as u,v as d,vt as f}from"./hotkeys-CekBkaTu.js";import{a as p,h as m,i as h,n as g,o as _,t as v}from"./dialog-DjL0qoAv.js";import{a as y,c as b,l as x,o as S,s as C,t as w}from"./LazyTerminal-DWVZosNX.js";import{A as T,M as E,c as D,j as O,k,n as A,r as j,t as M}from"./context-menu-YihyOCU5.js";import{r as N}from"./dist-DDFe8e3m.js";import{Ot as P,Pt as F,ct as I,lt as L,ot as R,qt as z,ut as B}from"./index-BiyEBNqW.js";var V=e(t(),1),H=n(),U=!1;function W(){let[e,t]=(0,V.useState)(U),[n,r]=(0,V.useState)(null);(0,V.useEffect)(()=>{if(!e)return;let t=!1;return B.spawnShell(i).then(e=>{t||r(e)}),()=>{t=!0}},[e]);let a=()=>{U=!1,t(!1),r(null)};return{open:e,term:n,toggle:()=>{e?(n&&B.killShell(i,n),a()):(U=!0,t(!0))},onExit:a}}function G({term:e,onExit:t}){return(0,H.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,H.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:e!==null&&(0,H.jsx)(w,{stream:`home`,term:e,onExit:t})})})}var K=[{status:`running`,colour:`bg-running`},{status:`waiting_input`,colour:`bg-waiting`},{status:`interrupted`,colour:`bg-interrupted`}];function q({projectId:e}){let t=f(e),n=(0,V.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,H.jsxs)(`div`,{className:`flex items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,H.jsxs)(`span`,{children:[r,` session`,r===1?``:`s`]}),K.map(({status:e,colour:t})=>{let r=n.get(e)??0;return r===0?null:(0,H.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),r,` `,e.replace(`_`,` `)]},e)})]})}function J({icon:e,label:t,onClick:n}){return(0,H.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,H.jsx)(e,{className:`size-4`})})}function Y({project:e,repoPath:t,draggable:n,dragging:i,onDragStart:a,onDragEnd:o,onDragOver:c}){let l=s(),[u,d]=(0,V.useState)(!1),[f,C]=(0,V.useState)(e.name),[w,T]=(0,V.useState)(L(e)),k=t=>l.mutate({id:e.id,archived:t},{onError:e=>y(e)}),N=()=>{C(e.name),T(L(e)),d(!0)},P=()=>{let t=f.trim(),n=I(w);if(!t){d(!1);return}let r={...t===e.name?{}:{name:t},...n&&n!==L(e)?{abbrev:n}:{}};if(Object.keys(r).length===0){d(!1);return}l.mutate({id:e.id,...r},{onSuccess:()=>d(!1),onError:e=>y(e)})};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(M,{children:[(0,H.jsx)(D,{asChild:!0,children:(0,H.jsxs)(`div`,{draggable:n,onDragStart:a,onDragEnd:o,onDragOver:c,className:r(`group relative transition-opacity`,i&&`opacity-50`),children:[(0,H.jsxs)(z,{draggable:!1,to:`/project/${e.id}`,className:`block rounded-lg bg-surface p-4 transition-colors hover:bg-elevated`,children:[(0,H.jsx)(`h2`,{className:`truncate pr-16 text-base font-semibold text-fg group-hover:text-accent`,children:e.name}),(0,H.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:t??`…`}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(q,{projectId:e.id})})]}),(0,H.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,H.jsx)(J,{icon:E,label:`Reopen project`,onClick:()=>k(!1)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(J,{icon:S,label:`Edit project`,onClick:N}),(0,H.jsx)(J,{icon:O,label:`Archive project`,onClick:()=>k(!0)})]})})]})}),(0,H.jsx)(A,{children:e.archived?(0,H.jsxs)(j,{onSelect:()=>k(!1),children:[(0,H.jsx)(E,{}),` Reopen`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(j,{onSelect:N,children:[(0,H.jsx)(S,{}),` Edit`]}),(0,H.jsxs)(j,{onSelect:()=>k(!0),children:[(0,H.jsx)(O,{}),` Archive`]})]})})]}),(0,H.jsx)(v,{open:u,onOpenChange:d,children:(0,H.jsxs)(g,{children:[(0,H.jsx)(p,{children:(0,H.jsx)(_,{children:`Edit project`})}),(0,H.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),P()},children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(b,{htmlFor:`project-name-${e.id}`,children:`Name`}),(0,H.jsx)(x,{id:`project-name-${e.id}`,value:f,onChange:e=>C(e.target.value),autoFocus:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(b,{htmlFor:`project-abbrev-${e.id}`,children:`Abbreviation`}),(0,H.jsx)(x,{id:`project-abbrev-${e.id}`,maxLength:5,value:w,onChange:e=>T(I(e.target.value)),className:`w-24 uppercase`}),(0,H.jsxs)(`p`,{className:`text-2xs text-fg-muted`,children:[`Up to `,5,` characters — the label on the collapsed sidebar rail.`]})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(b,{className:`text-fg-muted`,children:`Path`}),(0,H.jsx)(`p`,{className:`truncate text-2xs text-fg-muted`,children:t??`…`})]}),(0,H.jsxs)(h,{children:[(0,H.jsx)(m,{type:`button`,variant:`ghost`,onClick:()=>d(!1),children:`Cancel`}),(0,H.jsx)(m,{type:`submit`,disabled:!f.trim()||l.isPending,children:`Save`})]})]})]})})]})}function X({icon:e,label:t,hint:n,onClick:r}){return(0,H.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,H.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,H.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,H.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function Z(){let e=d(),t=o(e??void 0),n=l(),i=a(e??void 0),s=u(e??``),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(null),[g,_]=(0,V.useState)(!1),v=W(),y=c(`palette.toggle`),b=e=>n.data?.find(t=>t.id===e)?.path,x=t.data??[],S=i.data?.projectOrder??[],w=k(x.filter(e=>!e.archived),S),E=x.filter(e=>e.archived),D=(e,t)=>{e!==t&&s.mutate({projectOrder:T(w.map(e=>e.id),e,t)})};return(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[x.length===0&&(0,H.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,H.jsx)(C,{className:`size-8 text-fg-muted`}),(0,H.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`No projects yet — open one below, or press `,y,`.`]})]}),(0,H.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[w.map(e=>(0,H.jsx)(Y,{project:e,repoPath:b(e.repo_id),draggable:!0,dragging:m===e.id,onDragStart:()=>h(e.id),onDragEnd:()=>h(null),onDragOver:t=>{t.preventDefault(),m&&m!==e.id&&D(m,e.id)}},e.id)),(0,H.jsx)(X,{icon:F,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>p(!0)}),(0,H.jsx)(X,{icon:P,label:v.open?`Close terminal`:`Open terminal`,hint:v.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:v.toggle})]}),E.length>0&&(0,H.jsxs)(`div`,{className:`mt-6`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>_(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,H.jsx)(N,{className:r(`size-3 transition-transform`,g&&`rotate-90`)}),(0,H.jsx)(O,{className:`size-3`}),(0,H.jsx)(`span`,{children:`Archived`}),(0,H.jsx)(`span`,{className:`tabular-nums`,children:E.length})]}),g&&(0,H.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:E.map(e=>(0,H.jsx)(Y,{project:e,repoPath:b(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),v.open&&(0,H.jsx)(G,{term:v.term,onExit:v.onExit}),e!==null&&(0,H.jsx)(R,{profileId:e,open:f,onOpenChange:p})]})}export{Z as Dashboard};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,n as r,t as i}from"./x-BJOrp_m5.js";import{a,h as o,i as s,n as c,o as l,r as u,t as d}from"./dialog-DjL0qoAv.js";import{i as f,t as p,u as m}from"./buffer-store-ue6VuXQd.js";import{t as h}from"./drafts-dNFvUOnn.js";import{t as g}from"./editor-sync-W1bamxAP.js";var _=r(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),v=e(t(),1),y=n();function b(e,t,n){let r=p(e,t,n);return(0,v.useSyncExternalStore)((0,v.useCallback)(e=>m(r,e),[r]),()=>f(r))}function x({session:e,path:t,kind:n,root:r}){return b(e,t,r)&&n!==`commit`?(0,y.jsx)(_,{"aria-hidden":!0,className:`size-2 shrink-0 fill-current text-fg-muted group-hover:hidden`}):null}function S({session:e,path:t,kind:n,root:r,label:f,onClose:p}){let m=b(e,t,r)&&n!==`commit`,[_,x]=(0,v.useState)(!1),S=()=>m?x(!0):p();return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`button`,{onClick:e=>{e.stopPropagation(),S()},className:`hidden size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg group-hover:flex pointer-coarse:flex`,"aria-label":`Close ${f}`,children:(0,y.jsx)(i,{className:`size-3`})}),(0,y.jsx)(d,{open:_,onOpenChange:e=>!e&&x(!1),children:(0,y.jsxs)(c,{children:[(0,y.jsxs)(a,{children:[(0,y.jsxs)(l,{children:[`Discard changes to `,f,`?`]}),(0,y.jsx)(u,{children:`This file has unsaved changes. Closing the tab will discard them.`})]}),(0,y.jsxs)(s,{children:[(0,y.jsx)(o,{variant:`ghost`,onClick:()=>x(!1),children:`Keep editing`}),(0,y.jsx)(o,{variant:`danger`,onClick:()=>{h(e,t,r),g(e,t,r),x(!1),p()},children:`Discard`})]})]})})]})}export{x as EditorDirtyDot,S as EditorTabClose};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-BUVKPPZS.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/x-BJOrp_m5.js","assets/hotkeys-CekBkaTu.js","assets/file-links-DuC9xUoS.js","assets/index-BiyEBNqW.js","assets/preload-helper-Czpn1I53.js","assets/dialog-DjL0qoAv.js","assets/index-DzFZUNIz.css","assets/use-find-controls-CjnZGtVa.js","assets/chevron-down-59O6CgEo.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{a as n,n as r,o as i,r as a}from"./x-BJOrp_m5.js";import{Ht as o,xt as s}from"./hotkeys-CekBkaTu.js";import{t as c}from"./preload-helper-Czpn1I53.js";import{C as l,D as u,S as d,b as f,k as p}from"./dialog-DjL0qoAv.js";var m=e(t(),1),h=[`top`,`right`,`bottom`,`left`],g=Math.min,_=Math.max,v=Math.round,y=Math.floor,b=e=>({x:e,y:e}),x={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function S(e,t,n){return _(e,g(t,n))}function C(e,t){return typeof e==`function`?e(t):e}function w(e){return e.split(`-`)[0]}function T(e){return e.split(`-`)[1]}function E(e){return e===`x`?`y`:`x`}function D(e){return e===`y`?`height`:`width`}function O(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function k(e){return E(O(e))}function A(e,t,n){n===void 0&&(n=!1);let r=T(e),i=k(e),a=D(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=z(o)),[o,z(o)]}function j(e){let t=z(e);return[M(e),t,M(t)]}function M(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var N=[`left`,`right`],P=[`right`,`left`],F=[`top`,`bottom`],I=[`bottom`,`top`];function L(e,t,n){switch(e){case`top`:case`bottom`:return n?t?P:N:t?N:P;case`left`:case`right`:return t?F:I;default:return[]}}function R(e,t,n,r){let i=T(e),a=L(w(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(M)))),a}function z(e){let t=w(e);return x[t]+e.slice(t.length)}function ee(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function te(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ee(e)}function B(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 ne(e,t,n){let{reference:r,floating:i}=e,a=O(t),o=k(t),s=D(o),c=w(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=T(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function re(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}=C(t,e),p=te(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=B(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=B(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 ie=50,ae=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:re},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ne(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<ie&&(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}=ne(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},oe=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}=C(e,t)||{};if(l==null)return{};let d=te(u),f={x:n,y:r},p=k(i),m=D(p),h=await o.getDimensions(l),_=p===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[m]+a.reference[p]-f[p]-a.floating[m],w=f[p]-a.reference[p],E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),O=E?E[b]:0;(!O||!await(o.isElement==null?void 0:o.isElement(E)))&&(O=s.floating[b]||a.floating[m]);let A=x/2-w/2,j=O/2-h[m]/2-1,M=g(d[v],j),N=g(d[y],j),P=O-h[m]-N,F=O/2-h[m]/2+A,I=S(M,F,P),L=!c.arrow&&T(i)!=null&&F!==I&&a.reference[m]/2-(F<M?M:N)-h[m]/2<0,R=L?F<M?F-M:F-P:0;return{[p]:f[p]+R,data:{[p]:I,centerOffset:F-I-R,...L&&{alignmentOffset:R}},reset:L}}}),se=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}=C(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=w(r),_=O(o),v=w(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[z(o)]:j(o)),x=p!==`none`;!d&&x&&b.push(...R(o,m,p,y));let S=[o,...b],T=await s.detectOverflow(t,h),E=[],D=i.flip?.overflows||[];if(l&&E.push(T[g]),u){let e=A(r,a,y);E.push(T[e[0]],T[e[1]])}if(D=[...D,{placement:r,overflows:E}],!E.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==O(t))||D.every(e=>O(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:D},reset:{placement:t}};let n=D.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=D.filter(e=>{if(x){let t=O(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 ce(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function le(e){return h.some(t=>e[t]>=0)}var ue=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=C(e,t);switch(i){case`referenceHidden`:{let e=ce(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:le(e)}}}case`escaped`:{let e=ce(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:le(e)}}}default:return{}}}}},de=new Set([`left`,`top`]);async function fe(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=w(n),s=T(n),c=O(n)===`y`,l=de.has(o)?-1:1,u=a&&c?-1:1,d=C(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 pe=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 fe(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}}}}},me=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}=C(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=O(i),p=E(f),m=u[p],h=u[f],g=(e,t)=>S(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}}}}}},he=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}=C(e,t),u={x:n,y:r},d=O(i),f=E(d),p=u[f],m=u[d],h=C(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=de.has(w(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}}}},ge=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}=C(e,t),c=await i.detectOverflow(t,s),l=w(n),u=T(n),d=O(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 v=p-c.top-c.bottom,y=f-c.left-c.right,b=g(p-c[m],v),x=g(f-c[h],y),S=t.middlewareData.shift,E=!S,D=b,k=x;S!=null&&S.enabled.x&&(k=y),S!=null&&S.enabled.y&&(D=v),E&&!u&&(d?k=f-2*_(c.left,c.right):D=p-2*_(c.top,c.bottom)),await o({...t,availableWidth:k,availableHeight:D});let A=await i.getDimensions(a.floating);return f!==A.width||p!==A.height?{reset:{rects:!0}}:{}}}};function _e(){return typeof window<`u`}function V(e){return ve(e)?(e.nodeName||``).toLowerCase():`#document`}function H(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function U(e){return((ve(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ve(e){return _e()?e instanceof Node||e instanceof H(e).Node:!1}function W(e){return _e()?e instanceof Element||e instanceof H(e).Element:!1}function G(e){return _e()?e instanceof HTMLElement||e instanceof H(e).HTMLElement:!1}function ye(e){return!_e()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof H(e).ShadowRoot}function be(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 xe(e){return/^(table|td|th)$/.test(V(e))}function Se(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ce=/transform|translate|scale|rotate|perspective|filter/,we=/paint|layout|strict|content/,K=e=>!!e&&e!==`none`,Te;function Ee(e){let t=W(e)?J(e):e;return K(t.transform)||K(t.translate)||K(t.scale)||K(t.rotate)||K(t.perspective)||!Oe()&&(K(t.backdropFilter)||K(t.filter))||Ce.test(t.willChange||``)||we.test(t.contain||``)}function De(e){let t=Y(e);for(;G(t)&&!q(t);){if(Ee(t))return t;if(Se(t))return null;t=Y(t)}return null}function Oe(){return Te??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Te}function q(e){return/^(html|body|#document)$/.test(V(e))}function J(e){return H(e).getComputedStyle(e)}function ke(e){return W(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Y(e){if(V(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ye(e)&&e.host||U(e);return ye(t)?t.host:t}function Ae(e){let t=Y(e);return q(t)?(e.ownerDocument||e).body:G(t)&&be(t)?t:Ae(t)}function X(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ae(e),i=r===e.ownerDocument?.body,a=H(r);if(i){let e=je(a);return t.concat(a,a.visualViewport||[],be(r)?r:[],e&&n?X(e):[])}else return t.concat(r,X(r,[],n))}function je(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Me(e){let t=J(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=G(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=v(n)!==a||v(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ne(e){return W(e)?e:e.contextElement}function Z(e){let t=Ne(e);if(!G(t))return b(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Me(t),o=(a?v(n.width):n.width)/r,s=(a?v(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Pe=b(0);function Fe(e){let t=H(e);return!Oe()||!t.visualViewport?Pe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ie(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===H(e)}function Q(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ne(e),o=b(1);t&&(r?W(r)&&(o=Z(r)):o=Z(e));let s=Ie(a,n,r)?Fe(a):b(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=H(a),t=W(r)?H(r):r,n=e,i=je(n);for(;i&&t!==n;){let e=Z(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=H(i),i=je(n)}}return B({width:u,height:d,x:c,y:l})}function Le(e,t){let n=ke(e).scrollLeft;return t?t.left+n:Q(U(e)).left+n}function Re(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Le(e,n),y:n.top+t.scrollTop}}function ze(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=U(r),s=t?Se(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=b(1),u=b(0),d=G(r);if((d||!a)&&((V(r)!==`body`||be(o))&&(c=ke(r)),d)){let e=Q(r);l=Z(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Re(o,c):b(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 Be(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ve(e){let t=ke(e),n=e.ownerDocument.body,r=_(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=_(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Le(e),o=-t.scrollTop;return J(n).direction===`rtl`&&(a+=_(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var He=25;function Ue(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=H(e),a=U(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Oe()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Le(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<=He&&(s-=o)}return{width:s,height:c,x:l,y:u}}function We(e,t){let n=Q(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Z(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ge(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Ue(e,n,t);else if(t===`document`)r=Ve(U(e));else if(W(t))r=We(t,n);else{let n=Fe(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return B(r)}function Ke(e,t){let n=t.get(e);if(n)return n;let r=X(e,[],!1).filter(e=>W(e)&&V(e)!==`body`),i=null,a=J(e).position===`fixed`,o=a?Y(e):e;for(;W(o)&&!q(o);){let e=J(o),t=Ee(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`?Se(t)?[]:Ke(t,this._c):[].concat(n),r],o=Ge(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=Ge(t,a[e],i);s=_(n.top,s),c=g(n.right,c),l=g(n.bottom,l),u=_(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Je(e){let{width:t,height:n}=Me(e);return{width:t,height:n}}function Ye(e,t,n){let r=G(t),i=U(t),a=n===`fixed`,o=Q(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=b(0);if((r||!a)&&((V(t)!==`body`||be(i))&&(s=ke(t)),r)){let e=Q(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Le(i));let l=i&&!r&&!a?Re(i,s):b(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 Xe(e){return J(e).position===`static`}function Ze(e,t){if(!G(e)||J(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return U(e)===n&&(n=n.ownerDocument.body),n}function Qe(e,t){let n=H(e);if(Se(e))return n;if(!G(e)){let t=Y(e);for(;t&&!q(t);){if(W(t)&&!Xe(t))return t;t=Y(t)}return n}let r=Ze(e,t);for(;r&&xe(r)&&Xe(r);)r=Ze(r,t);return r&&q(r)&&Xe(r)&&!Ee(r)?n:r||De(e)||n}var $e=async function(e){let t=this.getOffsetParent||Qe,n=this.getDimensions,r=await n(e.floating);return{reference:Ye(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function et(e){return J(e).direction===`rtl`}var tt={convertOffsetParentRelativeRectToViewportRelativeRect:ze,getDocumentElement:U,getClippingRect:qe,getOffsetParent:Qe,getElementRects:$e,getClientRects:Be,getDimensions:Je,getScale:Z,isElement:W,isRTL:et};function nt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function rt(e,t,n){let r=null,i,a=U(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=y(d),h=y(a.clientWidth-(u+f)),v=y(a.clientHeight-(d+p)),b=y(u),x={rootMargin:-m+`px `+-h+`px `+-v+`px `+-b+`px`,threshold:_(0,g(1,c))||1},S=!0;function C(t){let n=t[0].intersectionRatio;if(!nt(l,e.getBoundingClientRect()))return s();if(n!==c){if(!S)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}S=!1}try{r=new IntersectionObserver(C,{...x,root:a.ownerDocument})}catch{r=new IntersectionObserver(C,x)}r.observe(e)}let c=H(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function it(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=Ne(e),u=i||a?[...l?X(l):[],...t?X(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?rt(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?Q(e):null;c&&g();function g(){let t=Q(e);h&&!nt(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 at=pe,ot=me,st=se,ct=ge,lt=ue,ut=oe,dt=he,ft=(e,t,n)=>{let r=new Map,i=n??{},a={...tt,...i.platform,_c:r};return ae(e,t,{...i,platform:a})},pt=e(i(),1),mt=typeof document<`u`?m.useLayoutEffect:function(){};function ht(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(!ht(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)&&!ht(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function gt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function _t(e,t){let n=gt(e);return Math.round(t*n)/n}function vt(e){let t=m.useRef(e);return mt(()=>{t.current=e}),t}function yt(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]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=m.useState(r);ht(f,r)||p(r);let[h,g]=m.useState(null),[_,v]=m.useState(null),y=m.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=m.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=m.useRef(null),w=m.useRef(null),T=m.useRef(u),E=c!=null,D=vt(c),O=vt(i),k=vt(l),A=m.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),ft(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!ht(T.current,t)&&(T.current=t,pt.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);mt(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=m.useRef(!1);mt(()=>(j.current=!0,()=>{j.current=!1}),[]),mt(()=>{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=m.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=m.useMemo(()=>({reference:x,floating:S}),[x,S]),P=m.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=_t(N.floating,u.x),r=_t(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...gt(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var bt=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?{}:ut({element:r.current,padding:i}).fn(n):r?ut({element:r,padding:i}).fn(n):{}}}},xt=(e,t)=>{let n=at(e);return{name:n.name,fn:n.fn,options:[e,t]}},St=(e,t)=>{let n=ot(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ct=(e,t)=>({fn:dt(e).fn,options:[e,t]}),wt=(e,t)=>{let n=st(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tt=(e,t)=>{let n=ct(e);return{name:n.name,fn:n.fn,options:[e,t]}},Et=(e,t)=>{let n=lt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dt=(e,t)=>{let n=bt(e);return{name:n.name,fn:n.fn,options:[e,t]}},$=n(),Ot=`Arrow`,kt=m.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,$.jsx)(l.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,$.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});kt.displayName=Ot;var At=kt;function jt(e){let[t,n]=m.useState(void 0);return f(()=>{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 Mt=`Popper`,[Nt,Pt]=u(Mt),[Ft,It]=Nt(Mt),Lt=e=>{let{__scopePopper:t,children:n}=e,[r,i]=m.useState(null),[a,o]=m.useState(void 0);return(0,$.jsx)(Ft,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Lt.displayName=Mt;var Rt=`PopperAnchor`,zt=m.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=It(Rt,n),o=m.useRef(null),s=a.onAnchorChange,c=p(t,m.useCallback(e=>{o.current=e,e&&s(e)},[s])),u=m.useRef(null);m.useEffect(()=>{if(!r)return;let e=u.current;u.current=r.current,e!==u.current&&s(u.current)});let d=a.placementState&&Yt(a.placementState),f=d?.[0],h=d?.[1];return r?null:(0,$.jsx)(l.div,{"data-radix-popper-side":f,"data-radix-popper-align":h,...i,ref:c})});zt.displayName=Rt;var Bt=`PopperContent`,[Vt,Ht]=Nt(Bt),Ut=m.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:u=[],collisionPadding:h=0,sticky:g=`partial`,hideWhenDetached:_=!1,updatePositionStrategy:v=`optimized`,onPlaced:y,...b}=e,x=It(Bt,n),[S,C]=m.useState(null),w=p(t,C),[T,E]=m.useState(null),D=jt(T),O=D?.width??0,k=D?.height??0,A=r+(a===`center`?``:`-`+a),j=typeof h==`number`?h:{top:0,right:0,bottom:0,left:0,...h},M=Array.isArray(u)?u:[u],N=M.length>0,P={padding:j,boundary:M.filter(qt),altBoundary:N},{refs:F,floatingStyles:I,placement:L,isPositioned:R,middlewareData:z}=yt({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>it(...e,{animationFrame:v===`always`}),elements:{reference:x.anchor},middleware:[xt({mainAxis:i+k,alignmentAxis:o}),c&&St({mainAxis:!0,crossAxis:!1,limiter:g===`partial`?Ct():void 0,...P}),c&&wt({...P}),Tt({...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&&Dt({element:T,padding:s}),Jt({arrowWidth:O,arrowHeight:k}),_&&Et({strategy:`referenceHidden`,...P,boundary:N?P.boundary:void 0})]}),ee=x.setPlacementState;f(()=>(ee(L),()=>{ee(void 0)}),[L,ee]);let[te,B]=Yt(L),ne=d(y);f(()=>{R&&ne?.()},[R,ne]);let re=z.arrow?.x,ie=z.arrow?.y,ae=z.arrow?.centerOffset!==0,[oe,se]=m.useState();return f(()=>{S&&se(window.getComputedStyle(S).zIndex)},[S]),(0,$.jsx)(`div`,{ref:F.setFloating,"data-radix-popper-content-wrapper":``,style:{...I,transform:R?I.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,$.jsx)(Vt,{scope:n,placedSide:te,placedAlign:B,onArrowChange:E,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,$.jsx)(l.div,{"data-side":te,"data-align":B,...b,ref:w,style:{...b.style,animation:R?void 0:`none`}})})})});Ut.displayName=Bt;var Wt=`PopperArrow`,Gt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Kt=m.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Ht(Wt,n),a=Gt[i.placedSide];return(0,$.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,$.jsx)(At,{...r,ref:t,style:{...r.style,display:`block`}})})});Kt.displayName=Wt;function qt(e){return e!==null}var Jt=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]=Yt(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 Yt(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Xt=Lt,Zt=zt,Qt=Ut,$t=Kt,en=`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`,tn=`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`,nn=`data-[highlighted]:bg-action data-[highlighted]:text-action-ink data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,rn=`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`;function an({className:e,type:t,...n}){return(0,$.jsx)(`input`,{type:t,className:a(`flex h-8 w-full px-2.5`,en,e),...n})}function on({className:e,...t}){return(0,$.jsx)(`textarea`,{className:a(`flex min-h-16 w-full px-2.5 py-2`,en,e),...t})}var sn=`Label`,cn=m.forwardRef((e,t)=>(0,$.jsx)(l.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));cn.displayName=sn;var ln=cn;function un({className:e,...t}){return(0,$.jsx)(ln,{className:a(`text-xs font-medium text-fg-secondary peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var dn=r(`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`}]]),fn=r(`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 pn(e){o.error(hn(e),{id:`err:${hn(e)}`})}function mn(e){if(!(e instanceof s)||e.code!==`conversation_live`)return null;let t=e.details?.existing_session_id,n=e.details?.existing_project_id;return typeof t==`string`&&typeof n==`string`?{sessionId:t,projectId:n}:null}function hn(e){return e instanceof Error&&e.message.trim()!==``?e.message:typeof e==`string`&&e.trim()!==``?e:`Something went wrong`}function gn({id:e,value:t,onValueChange:n,onChoose:r,hints:i,placeholder:o,className:s,hintsClassName:c,autoFocus:l}){let[u,d]=(0,m.useState)(!1),[f,p]=(0,m.useState)(0),h=e=>{n(e.value),r?.(e),d(!1)};return(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(an,{id:e,value:t,onChange:e=>{n(e.target.value),d(!0),p(0)},onFocus:()=>d(!0),onBlur:()=>d(!1),onKeyDown:e=>{if(!(!u||i.length===0))if(e.key===`ArrowDown`)e.preventDefault(),p(e=>(e+1)%i.length);else if(e.key===`ArrowUp`)e.preventDefault(),p(e=>(e-1+i.length)%i.length);else if(e.key===`Enter`||e.key===`Tab`){let t=i[f]??i[0];t&&(e.preventDefault(),h(t))}else e.key===`Escape`&&(e.stopPropagation(),d(!1))},placeholder:o,className:s,autoComplete:`off`,spellCheck:!1,autoFocus:l}),u&&i.length>0&&(0,$.jsx)(`ul`,{className:a(`absolute top-full z-10 mt-1 max-h-56 overflow-y-auto rounded-md bg-elevated p-1 shadow-xl`,c??`w-full`),children:i.map((e,t)=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),h(e)},onMouseEnter:()=>p(t),className:a(`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 text-xs`),"data-selected":t===f,children:[(0,$.jsx)(`span`,{className:`truncate`,children:e.label??e.value}),e.badge&&(0,$.jsx)(`span`,{className:`ml-auto shrink-0 text-2xs opacity-70`,children:e.badge})]})},e.value))})]})}var _n=(0,m.lazy)(()=>c(()=>import(`./Terminal-BUVKPPZS.js`).then(e=>({default:e.Terminal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),vn=null;async function yn(){vn=(await c(()=>import(`./Terminal-BUVKPPZS.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))).Terminal}function bn(e){return vn?(0,$.jsx)(vn,{...e}):(0,$.jsx)(m.Suspense,{fallback:(0,$.jsx)(`div`,{className:`size-full bg-ground`}),children:(0,$.jsx)(_n,{...e})})}export{Qt as _,pn as a,jt as b,un as c,en as d,rn as f,$t as g,Zt as h,mn as i,an as l,tn as m,yn as n,fn as o,nn as p,gn as r,dn as s,bn as t,on as u,Xt as v,Pt as y};
@@ -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-B0PeSmyA.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{c as n,o as r,t as i}from"./buffer-store-ue6VuXQd.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)||(n(e),o.add(e));for(let e of[...o])a.has(e)||(r(e),o.delete(e))},[e]),(0,a.useEffect)(()=>()=>{for(let e of t.current)r(e);t.current.clear()},[]),null}export{o as ModelRefcount};