@puddle-code/cli 0.0.35 → 0.0.37

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 (26) hide show
  1. package/CHANGELOG.md +7 -9
  2. package/dist/index.js +15 -4
  3. package/dist/public/assets/{Dashboard-CjcXc41s.js → Dashboard-De0qibC9.js} +1 -1
  4. package/dist/public/assets/{EditorTabClose-CR8qjstC.js → EditorTabClose-CUYeSES1.js} +1 -1
  5. package/dist/public/assets/{LazyTerminal-CSezaFiz.js → LazyTerminal-BMAKZ-LV.js} +2 -2
  6. package/dist/public/assets/{ModelRefcount-ruz_Q9xr.js → ModelRefcount-B_SYSR4t.js} +1 -1
  7. package/dist/public/assets/{PaneEditorBody-66So4Ff7.js → PaneEditorBody-C19PH386.js} +1 -1
  8. package/dist/public/assets/{SettingsDialog-Bye-gWnk.js → SettingsDialog-CIqhsL22.js} +1 -1
  9. package/dist/public/assets/{Terminal-Cd5V3epm.js → Terminal-C_jdwu6i.js} +2 -2
  10. package/dist/public/assets/Workspace-BclF89l6.js +7 -0
  11. package/dist/public/assets/{buffer-store-C7PmP6Kk.js → buffer-store-ON5LQeHS.js} +2 -2
  12. package/dist/public/assets/{context-menu-CNjTT3SL.js → context-menu-Dcek1hv6.js} +1 -1
  13. package/dist/public/assets/{cssMode-BszXvhfs.js → cssMode-BWXQD6Ms.js} +1 -1
  14. package/dist/public/assets/{editor-context-CFhFe8Rl.js → editor-context-BbDRtFbv.js} +1 -1
  15. package/dist/public/assets/{editor-sync-W2W78_MY.js → editor-sync-DL-NkjyA.js} +1 -1
  16. package/dist/public/assets/{hotkeys-DJt0-uY0.js → hotkeys-CGVAxX-R.js} +1 -1
  17. package/dist/public/assets/{htmlMode-BdSq1oJt.js → htmlMode-DAiLNOsw.js} +1 -1
  18. package/dist/public/assets/{index-oaI2xX3B.js → index-De_cN03H.js} +3 -3
  19. package/dist/public/assets/{jsonMode-BGITbv0h.js → jsonMode-BHtI91Q6.js} +1 -1
  20. package/dist/public/assets/{session-seed-DyZA5Bb-.js → session-seed-DUI1gVzC.js} +1 -1
  21. package/dist/public/assets/ssh-mode-CJ0lbAR5.js +1 -0
  22. package/dist/public/assets/{tsMode-B9a_Su_k.js → tsMode-DpTmzuCP.js} +1 -1
  23. package/dist/public/index.html +3 -3
  24. package/package.json +1 -1
  25. package/dist/public/assets/Workspace-DWKoGE_e.js +0 -7
  26. package/dist/public/assets/ssh-mode-D1ZueIgo.js +0 -1
package/CHANGELOG.md CHANGED
@@ -7,17 +7,15 @@ Past releases: see docs/changelogs/.
7
7
 
8
8
  # Changelog
9
9
 
10
- ## [0.0.35] — 2026-08-09
10
+ ## [0.0.37] — 2026-08-10
11
11
 
12
- ### Changed
12
+ ### Added
13
13
 
14
- - Auto-resume ("Resume sessions" in Settings → Host) is now ON by default: a daemon restart brings interrupted sessions straight back. Config version 3 migrates an existing `autoResume: false` the old default that `loadConfig` wrote to every config.json — to true exactly once; a false set after the migration is respected.
14
+ - New untitled file hotkey (`tab.newUntitled`, Settings → Hotkeys): ⌃⌥N on the web, plain ⌘N in the desktop shell the keyboard route to double-clicking a tab strip's blank tail. The desktop menu's New Window moved from ⌘N to ⇧⌘N to yield the key.
15
15
 
16
16
  ### Fixed
17
17
 
18
- - The accounts UI's logged-in badge now updates the moment a login verifies. The daemon records the flag only after the agent's own auth check answers — after the login dialog has closed — so the badge sat stale until an unrelated refetch; it now broadcasts an `account` WS message on every change and the UI patches its cached lists live. Protocol **15.1** (additive).
19
-
20
- ### Added
21
-
22
- - Markdown/HTML tabs gain a third view mode, **linked** (chain icon): the tab chip's toggle now cycles source → preview → linked, the icon naming the current mode. A linked tab is a follow-along rendered preview — it retargets to the most recently active renderable tab (every linked pane moving together), scoped per project under project-based layout and profile-wide otherwise, and keeps rendering its last target until the next one. Protocol **15.0** (major: a 14.x daemon's strict `view` enum would reject any snapshot carrying a linked tab, so it must auto-upgrade rather than fail every workspace save).
23
- - The desktop app's "Restart to update" reopens the windows it closed: the shell records every open window's target (local and SSH — targets only, never credentials) as the swap begins, and the relaunch brings each back, falling back to the host picker when none can be reopened. One-shot with a 15-minute TTL, so a failed swap's leftover cannot resurrect windows on a later launch.
18
+ - Untitled drafts now follow the editor word-wrap setting (and the ⌥Z toggle) like every other editor, instead of never wrapping.
19
+ - Terminals no longer type cryptic `^[[37;143R`-style sequences into the shell after a tab switch or reload: those were xterm's auto-replies to cursor-position/device queries replayed from scrollback, now suppressed while a replay parses (the asker of a historical query is long gone).
20
+ - A session viewed from several windows at once no longer answers a program's device queries once per viewer: the daemon elects the most recent attacher as the one answering viewer and strips duplicate reply sequences from the others' input — this also covers `puddle attach`, where the user's own terminal answers alongside the web's.
21
+ - A terminal whose bottom went blank when the same session was open in another window heals on click: focusing a terminal re-asserts that viewer's size (tmux's `window-size latest`), where previously the other window's re-attach shrank the PTY and only a page reload grew it back.
package/dist/index.js CHANGED
@@ -4249,7 +4249,7 @@ function openBrowser(url2, platform = process.platform) {
4249
4249
  import { join as join5 } from "node:path";
4250
4250
 
4251
4251
  // ../shared/src/protocol.ts
4252
- var PROTOCOL_VERSION = { major: 15, minor: 1 };
4252
+ var PROTOCOL_VERSION = { major: 15, minor: 2 };
4253
4253
 
4254
4254
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
4255
4255
  var external_exports = {};
@@ -19504,10 +19504,21 @@ var pasteImageResponseSchema = external_exports.object({
19504
19504
  path: external_exports.string()
19505
19505
  });
19506
19506
  var resolvePathResponseSchema = external_exports.object({
19507
- /** Normalised worktree-relative path of the resolved file. */
19507
+ /**
19508
+ * The resolved identity: worktree-relative for a file inside the worktree;
19509
+ * relative to `root` for a file outside it; the ABSOLUTE directory for
19510
+ * `kind: 'dir'` (the UI binds the file tree there, it never opens an editor).
19511
+ */
19508
19512
  path: external_exports.string(),
19509
19513
  /** Requested line echoed back, clamped to >= 1; null when absent. */
19510
- line: external_exports.number().int().nullable()
19514
+ line: external_exports.number().int().nullable(),
19515
+ /** What resolved (15.2). Absent means `file` — pre-15.2 daemons only answered files. */
19516
+ kind: external_exports.enum(["file", "dir"]).optional(),
19517
+ /**
19518
+ * Absolute browse root when the file lies OUTSIDE the worktree (15.2):
19519
+ * `path` is then relative to it — the `external` tab convention (SPEC §8).
19520
+ */
19521
+ root: external_exports.string().optional()
19511
19522
  });
19512
19523
 
19513
19524
  // ../shared/src/api/worktree-files.ts
@@ -19887,7 +19898,7 @@ import { readFileSync } from "node:fs";
19887
19898
  import { dirname, join as join2 } from "node:path";
19888
19899
  import { fileURLToPath } from "node:url";
19889
19900
  function cliVersion() {
19890
- if (true) return "0.0.35";
19901
+ if (true) return "0.0.37";
19891
19902
  const here = dirname(fileURLToPath(import.meta.url));
19892
19903
  for (const candidate of [
19893
19904
  join2(here, "..", "..", "package.json"),
@@ -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{C as r,_ as i,f as a}from"./hotkeys-DJt0-uY0.js";import{a as o,g as s,i as c,n as l,o as u,t as d}from"./dialog-B43iKmfK.js";import{a as f,c as p,i as m,o as h,s as g,t as _}from"./LazyTerminal-CSezaFiz.js";import{t as v}from"./utils-B6KiDbIe.js";import{A as y,M as b,c as x,j as S,k as C,n as w,r as T,t as E}from"./context-menu-CNjTT3SL.js";import{r as D}from"./dist-i-QevsUb.js";import{Ct as O,_n as k,at as A,ct as j,fn as M,in as N,kn as P,kt as F,lt as I,nn as L,sn as R,st as z,tn as B}from"./index-oaI2xX3B.js";var V=e(t(),1),H=n(),U=!1;function W(){let[e,t]=(0,V.useState)(U),[n,i]=(0,V.useState)(null);(0,V.useEffect)(()=>{if(!e)return;let t=!1;return I.spawnShell(r).then(e=>{t||i(e)}),()=>{t=!0}},[e]);let a=()=>{U=!1,t(!1),i(null)};return{open:e,term:n,toggle:()=>{e?(n&&I.killShell(r,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)(_,{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=k(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:r,onDragStart:i,onDragEnd:a,onDragOver:h}){let _=L(),[y,C]=(0,V.useState)(!1),[D,O]=(0,V.useState)(e.name),[k,A]=(0,V.useState)(j(e)),M=t=>_.mutate({id:e.id,archived:t},{onError:e=>m(e)}),N=()=>{O(e.name),A(j(e)),C(!0)},F=()=>{let t=D.trim(),n=z(k);if(!t){C(!1);return}let r={...t===e.name?{}:{name:t},...n&&n!==j(e)?{abbrev:n}:{}};if(Object.keys(r).length===0){C(!1);return}_.mutate({id:e.id,...r},{onSuccess:()=>C(!1),onError:e=>m(e)})};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(E,{children:[(0,H.jsx)(x,{asChild:!0,children:(0,H.jsxs)(`div`,{draggable:n,onDragStart:i,onDragEnd:a,onDragOver:h,className:v(`group relative transition-opacity`,r&&`opacity-50`),children:[(0,H.jsxs)(P,{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:b,label:`Reopen project`,onClick:()=>M(!1)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(J,{icon:f,label:`Edit project`,onClick:N}),(0,H.jsx)(J,{icon:S,label:`Archive project`,onClick:()=>M(!0)})]})})]})}),(0,H.jsx)(w,{children:e.archived?(0,H.jsxs)(T,{onSelect:()=>M(!1),children:[(0,H.jsx)(b,{}),` Reopen`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(T,{onSelect:N,children:[(0,H.jsx)(f,{}),` Edit`]}),(0,H.jsxs)(T,{onSelect:()=>M(!0),children:[(0,H.jsx)(S,{}),` Archive`]})]})})]}),(0,H.jsx)(d,{open:y,onOpenChange:C,children:(0,H.jsxs)(l,{children:[(0,H.jsx)(o,{children:(0,H.jsx)(u,{children:`Edit project`})}),(0,H.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),F()},children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(g,{htmlFor:`project-name-${e.id}`,children:`Name`}),(0,H.jsx)(p,{id:`project-name-${e.id}`,value:D,onChange:e=>O(e.target.value),autoFocus:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(g,{htmlFor:`project-abbrev-${e.id}`,children:`Abbreviation`}),(0,H.jsx)(p,{id:`project-abbrev-${e.id}`,maxLength:5,value:k,onChange:e=>A(z(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)(g,{className:`text-fg-muted`,children:`Path`}),(0,H.jsx)(`p`,{className:`truncate text-2xs text-fg-muted`,children:t??`…`})]}),(0,H.jsxs)(c,{children:[(0,H.jsx)(s,{type:`button`,variant:`ghost`,onClick:()=>C(!1),children:`Cancel`}),(0,H.jsx)(s,{type:`submit`,disabled:!D.trim()||_.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=i(),t=R(e??void 0),n=M(),r=N(e??void 0),o=B(e??``),[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(!1),p=W(),m=a(`palette.toggle`),g=e=>n.data?.find(t=>t.id===e)?.path,_=t.data??[],b=r.data?.projectOrder??[],x=C(_.filter(e=>!e.archived),b),w=_.filter(e=>e.archived),T=(e,t)=>{e!==t&&o.mutate({projectOrder:y(x.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:[_.length===0&&(0,H.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,H.jsx)(h,{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 `,m,`.`]})]}),(0,H.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[x.map(e=>(0,H.jsx)(Y,{project:e,repoPath:g(e.repo_id),draggable:!0,dragging:l===e.id,onDragStart:()=>u(e.id),onDragEnd:()=>u(null),onDragOver:t=>{t.preventDefault(),l&&l!==e.id&&T(l,e.id)}},e.id)),(0,H.jsx)(X,{icon:F,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>c(!0)}),(0,H.jsx)(X,{icon:O,label:p.open?`Close terminal`:`Open terminal`,hint:p.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:p.toggle})]}),w.length>0&&(0,H.jsxs)(`div`,{className:`mt-6`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>f(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)(D,{className:v(`size-3 transition-transform`,d&&`rotate-90`)}),(0,H.jsx)(S,{className:`size-3`}),(0,H.jsx)(`span`,{children:`Archived`}),(0,H.jsx)(`span`,{className:`tabular-nums`,children:w.length})]}),d&&(0,H.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:w.map(e=>(0,H.jsx)(Y,{project:e,repoPath:g(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),p.open&&(0,H.jsx)(G,{term:p.term,onExit:p.onExit}),e!==null&&(0,H.jsx)(A,{profileId:e,open:s,onOpenChange:c})]})}export{Z 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{C as r,_ as i,f as a}from"./hotkeys-CGVAxX-R.js";import{a as o,g as s,i as c,n as l,o as u,t as d}from"./dialog-B43iKmfK.js";import{a as f,c as p,i as m,o as h,s as g,t as _}from"./LazyTerminal-BMAKZ-LV.js";import{t as v}from"./utils-B6KiDbIe.js";import{A as y,M as b,c as x,j as S,k as C,n as w,r as T,t as E}from"./context-menu-Dcek1hv6.js";import{r as D}from"./dist-i-QevsUb.js";import{Ct as O,_n as k,at as A,ct as j,fn as M,in as N,kn as P,kt as F,lt as I,nn as L,sn as R,st as z,tn as B}from"./index-De_cN03H.js";var V=e(t(),1),H=n(),U=!1;function W(){let[e,t]=(0,V.useState)(U),[n,i]=(0,V.useState)(null);(0,V.useEffect)(()=>{if(!e)return;let t=!1;return I.spawnShell(r).then(e=>{t||i(e)}),()=>{t=!0}},[e]);let a=()=>{U=!1,t(!1),i(null)};return{open:e,term:n,toggle:()=>{e?(n&&I.killShell(r,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)(_,{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=k(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:r,onDragStart:i,onDragEnd:a,onDragOver:h}){let _=L(),[y,C]=(0,V.useState)(!1),[D,O]=(0,V.useState)(e.name),[k,A]=(0,V.useState)(j(e)),M=t=>_.mutate({id:e.id,archived:t},{onError:e=>m(e)}),N=()=>{O(e.name),A(j(e)),C(!0)},F=()=>{let t=D.trim(),n=z(k);if(!t){C(!1);return}let r={...t===e.name?{}:{name:t},...n&&n!==j(e)?{abbrev:n}:{}};if(Object.keys(r).length===0){C(!1);return}_.mutate({id:e.id,...r},{onSuccess:()=>C(!1),onError:e=>m(e)})};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(E,{children:[(0,H.jsx)(x,{asChild:!0,children:(0,H.jsxs)(`div`,{draggable:n,onDragStart:i,onDragEnd:a,onDragOver:h,className:v(`group relative transition-opacity`,r&&`opacity-50`),children:[(0,H.jsxs)(P,{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:b,label:`Reopen project`,onClick:()=>M(!1)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(J,{icon:f,label:`Edit project`,onClick:N}),(0,H.jsx)(J,{icon:S,label:`Archive project`,onClick:()=>M(!0)})]})})]})}),(0,H.jsx)(w,{children:e.archived?(0,H.jsxs)(T,{onSelect:()=>M(!1),children:[(0,H.jsx)(b,{}),` Reopen`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(T,{onSelect:N,children:[(0,H.jsx)(f,{}),` Edit`]}),(0,H.jsxs)(T,{onSelect:()=>M(!0),children:[(0,H.jsx)(S,{}),` Archive`]})]})})]}),(0,H.jsx)(d,{open:y,onOpenChange:C,children:(0,H.jsxs)(l,{children:[(0,H.jsx)(o,{children:(0,H.jsx)(u,{children:`Edit project`})}),(0,H.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),F()},children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(g,{htmlFor:`project-name-${e.id}`,children:`Name`}),(0,H.jsx)(p,{id:`project-name-${e.id}`,value:D,onChange:e=>O(e.target.value),autoFocus:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(g,{htmlFor:`project-abbrev-${e.id}`,children:`Abbreviation`}),(0,H.jsx)(p,{id:`project-abbrev-${e.id}`,maxLength:5,value:k,onChange:e=>A(z(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)(g,{className:`text-fg-muted`,children:`Path`}),(0,H.jsx)(`p`,{className:`truncate text-2xs text-fg-muted`,children:t??`…`})]}),(0,H.jsxs)(c,{children:[(0,H.jsx)(s,{type:`button`,variant:`ghost`,onClick:()=>C(!1),children:`Cancel`}),(0,H.jsx)(s,{type:`submit`,disabled:!D.trim()||_.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=i(),t=R(e??void 0),n=M(),r=N(e??void 0),o=B(e??``),[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(!1),p=W(),m=a(`palette.toggle`),g=e=>n.data?.find(t=>t.id===e)?.path,_=t.data??[],b=r.data?.projectOrder??[],x=C(_.filter(e=>!e.archived),b),w=_.filter(e=>e.archived),T=(e,t)=>{e!==t&&o.mutate({projectOrder:y(x.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:[_.length===0&&(0,H.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,H.jsx)(h,{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 `,m,`.`]})]}),(0,H.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[x.map(e=>(0,H.jsx)(Y,{project:e,repoPath:g(e.repo_id),draggable:!0,dragging:l===e.id,onDragStart:()=>u(e.id),onDragEnd:()=>u(null),onDragOver:t=>{t.preventDefault(),l&&l!==e.id&&T(l,e.id)}},e.id)),(0,H.jsx)(X,{icon:F,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>c(!0)}),(0,H.jsx)(X,{icon:O,label:p.open?`Close terminal`:`Open terminal`,hint:p.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:p.toggle})]}),w.length>0&&(0,H.jsxs)(`div`,{className:`mt-6`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>f(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)(D,{className:v(`size-3 transition-transform`,d&&`rotate-90`)}),(0,H.jsx)(S,{className:`size-3`}),(0,H.jsx)(`span`,{children:`Archived`}),(0,H.jsx)(`span`,{className:`tabular-nums`,children:w.length})]}),d&&(0,H.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:w.map(e=>(0,H.jsx)(Y,{project:e,repoPath:g(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),p.open&&(0,H.jsx)(G,{term:p.term,onExit:p.onExit}),e!==null&&(0,H.jsx)(A,{profileId:e,open:s,onOpenChange:c})]})}export{Z 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"./createLucideIcon-DyMAgLa3.js";import{l as f,r as p,t as m}from"./buffer-store-C7PmP6Kk.js";import{s as h,t as g}from"./editor-sync-W2W78_MY.js";var _=d(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),v=e(t(),1),y=n();function b(e,t,n){let r=m(e,t,n);return(0,v.useSyncExternalStore)((0,v.useCallback)(e=>f(r,e),[r]),()=>p(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:d,label:f,onClose:p}){let m=b(e,t,d)&&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)(a,{className:`size-3`})}),(0,y.jsx)(u,{open:_,onOpenChange:e=>!e&&x(!1),children:(0,y.jsxs)(s,{children:[(0,y.jsxs)(r,{children:[(0,y.jsxs)(c,{children:[`Discard changes to `,f,`?`]}),(0,y.jsx)(l,{children:`This file has unsaved changes. Closing the tab will discard them.`})]}),(0,y.jsxs)(o,{children:[(0,y.jsx)(i,{variant:`ghost`,onClick:()=>x(!1),children:`Keep editing`}),(0,y.jsx)(i,{variant:`danger`,onClick:()=>{h(e,t,d),g(e,t,d),x(!1),p()},children:`Discard`})]})]})})]})}export{x as EditorDirtyDot,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"./createLucideIcon-DyMAgLa3.js";import{l as f,r as p,t as m}from"./buffer-store-ON5LQeHS.js";import{s as h,t as g}from"./editor-sync-DL-NkjyA.js";var _=d(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),v=e(t(),1),y=n();function b(e,t,n){let r=m(e,t,n);return(0,v.useSyncExternalStore)((0,v.useCallback)(e=>f(r,e),[r]),()=>p(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:d,label:f,onClose:p}){let m=b(e,t,d)&&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)(a,{className:`size-3`})}),(0,y.jsx)(u,{open:_,onOpenChange:e=>!e&&x(!1),children:(0,y.jsxs)(s,{children:[(0,y.jsxs)(r,{children:[(0,y.jsxs)(c,{children:[`Discard changes to `,f,`?`]}),(0,y.jsx)(l,{children:`This file has unsaved changes. Closing the tab will discard them.`})]}),(0,y.jsxs)(o,{children:[(0,y.jsx)(i,{variant:`ghost`,onClick:()=>x(!1),children:`Keep editing`}),(0,y.jsx)(i,{variant:`danger`,onClick:()=>{h(e,t,d),g(e,t,d),x(!1),p()},children:`Discard`})]})]})})]})}export{x as EditorDirtyDot,S as EditorTabClose};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-Cd5V3epm.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-ffCh33zF.js","assets/hotkeys-DJt0-uY0.js","assets/utils-B6KiDbIe.js","assets/index-oaI2xX3B.js","assets/preload-helper-Czpn1I53.js","assets/dialog-B43iKmfK.js","assets/createLucideIcon-DyMAgLa3.js","assets/index-ChpBP8Zc.css","assets/ssh-mode-D1ZueIgo.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{B as i}from"./hotkeys-DJt0-uY0.js";import{t as a}from"./preload-helper-Czpn1I53.js";import{A as o,C as s,O as c,w as l,x as u}from"./dialog-B43iKmfK.js";import{t as d}from"./utils-B6KiDbIe.js";import{t as f}from"./createLucideIcon-DyMAgLa3.js";var p=e(t(),1),m=[`top`,`right`,`bottom`,`left`],h=Math.min,g=Math.max,_=Math.round,v=Math.floor,y=e=>({x:e,y:e}),b={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function x(e,t,n){return g(e,h(t,n))}function S(e,t){return typeof e==`function`?e(t):e}function C(e){return e.split(`-`)[0]}function w(e){return e.split(`-`)[1]}function T(e){return e===`x`?`y`:`x`}function E(e){return e===`y`?`height`:`width`}function D(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function O(e){return T(D(e))}function k(e,t,n){n===void 0&&(n=!1);let r=w(e),i=O(e),a=E(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=R(o)),[o,R(o)]}function A(e){let t=R(e);return[j(e),t,j(t)]}function j(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var M=[`left`,`right`],N=[`right`,`left`],P=[`top`,`bottom`],F=[`bottom`,`top`];function I(e,t,n){switch(e){case`top`:case`bottom`:return n?t?N:M:t?M:N;case`left`:case`right`:return t?P:F;default:return[]}}function L(e,t,n,r){let i=w(e),a=I(C(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(j)))),a}function R(e){let t=C(e);return b[t]+e.slice(t.length)}function z(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ee(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:z(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 te(e,t,n){let{reference:r,floating:i}=e,a=D(t),o=O(t),s=E(o),c=C(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=w(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ne(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}=S(t,e),p=ee(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 re=50,ie=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ne},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=te(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<re&&(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}=te(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ae=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}=S(e,t)||{};if(l==null)return{};let d=ee(u),f={x:n,y:r},p=O(i),m=E(p),g=await o.getDimensions(l),_=p===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,C=a.reference[m]+a.reference[p]-f[p]-a.floating[m],T=f[p]-a.reference[p],D=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),k=D?D[b]:0;(!k||!await(o.isElement==null?void 0:o.isElement(D)))&&(k=s.floating[b]||a.floating[m]);let A=C/2-T/2,j=k/2-g[m]/2-1,M=h(d[v],j),N=h(d[y],j),P=k-g[m]-N,F=k/2-g[m]/2+A,I=x(M,F,P),L=!c.arrow&&w(i)!=null&&F!==I&&a.reference[m]/2-(F<M?M:N)-g[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}}}),oe=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}=S(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=C(r),_=D(o),v=C(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[R(o)]:A(o)),x=p!==`none`;!d&&x&&b.push(...L(o,m,p,y));let w=[o,...b],T=await s.detectOverflow(t,h),E=[],O=i.flip?.overflows||[];if(l&&E.push(T[g]),u){let e=k(r,a,y);E.push(T[e[0]],T[e[1]])}if(O=[...O,{placement:r,overflows:E}],!E.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=w[e];if(t&&(!(u===`alignment`&&_!==D(t))||O.every(e=>D(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:O},reset:{placement:t}};let n=O.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=O.filter(e=>{if(x){let t=D(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 se(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ce(e){return m.some(t=>e[t]>=0)}var le=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=S(e,t);switch(i){case`referenceHidden`:{let e=se(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ce(e)}}}case`escaped`:{let e=se(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ce(e)}}}default:return{}}}}},ue=new Set([`left`,`top`]);async function de(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=C(n),s=w(n),c=D(n)===`y`,l=ue.has(o)?-1:1,u=a&&c?-1:1,d=S(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 fe=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 de(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}}}}},pe=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}=S(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=D(i),p=T(f),m=u[p],h=u[f],g=(e,t)=>x(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}}}}}},me=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}=S(e,t),u={x:n,y:r},d=D(i),f=T(d),p=u[f],m=u[d],h=S(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=ue.has(C(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}}}},he=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}=S(e,t),c=await i.detectOverflow(t,s),l=C(n),u=w(n),d=D(n)===`y`,{width:f,height:p}=r.floating,m,_;l===`top`||l===`bottom`?(m=l,_=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(_=l,m=u===`end`?`top`:`bottom`);let v=p-c.top-c.bottom,y=f-c.left-c.right,b=h(p-c[m],v),x=h(f-c[_],y),T=t.middlewareData.shift,E=!T,O=b,k=x;T!=null&&T.enabled.x&&(k=y),T!=null&&T.enabled.y&&(O=v),E&&!u&&(d?k=f-2*g(c.left,c.right):O=p-2*g(c.top,c.bottom)),await o({...t,availableWidth:k,availableHeight:O});let A=await i.getDimensions(a.floating);return f!==A.width||p!==A.height?{reset:{rects:!0}}:{}}}};function ge(){return typeof window<`u`}function V(e){return _e(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((_e(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function _e(e){return ge()?e instanceof Node||e instanceof H(e).Node:!1}function W(e){return ge()?e instanceof Element||e instanceof H(e).Element:!1}function G(e){return ge()?e instanceof HTMLElement||e instanceof H(e).HTMLElement:!1}function ve(e){return!ge()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof H(e).ShadowRoot}function ye(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 be(e){return/^(table|td|th)$/.test(V(e))}function xe(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Se=/transform|translate|scale|rotate|perspective|filter/,Ce=/paint|layout|strict|content/,K=e=>!!e&&e!==`none`,we;function Te(e){let t=W(e)?J(e):e;return K(t.transform)||K(t.translate)||K(t.scale)||K(t.rotate)||K(t.perspective)||!De()&&(K(t.backdropFilter)||K(t.filter))||Se.test(t.willChange||``)||Ce.test(t.contain||``)}function Ee(e){let t=Y(e);for(;G(t)&&!q(t);){if(Te(t))return t;if(xe(t))return null;t=Y(t)}return null}function De(){return we??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),we}function q(e){return/^(html|body|#document)$/.test(V(e))}function J(e){return H(e).getComputedStyle(e)}function Oe(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||ve(e)&&e.host||U(e);return ve(t)?t.host:t}function ke(e){let t=Y(e);return q(t)?(e.ownerDocument||e).body:G(t)&&ye(t)?t:ke(t)}function X(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ke(e),i=r===e.ownerDocument?.body,a=H(r);if(i){let e=Ae(a);return t.concat(a,a.visualViewport||[],ye(r)?r:[],e&&n?X(e):[])}else return t.concat(r,X(r,[],n))}function Ae(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function je(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=_(n)!==a||_(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Me(e){return W(e)?e:e.contextElement}function Z(e){let t=Me(e);if(!G(t))return y(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=je(t),o=(a?_(n.width):n.width)/r,s=(a?_(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ne=y(0);function Pe(e){let t=H(e);return!De()||!t.visualViewport?Ne:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Fe(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=Me(e),o=y(1);t&&(r?W(r)&&(o=Z(r)):o=Z(e));let s=Fe(a,n,r)?Pe(a):y(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=Ae(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=Ae(n)}}return B({width:u,height:d,x:c,y:l})}function Ie(e,t){let n=Oe(e).scrollLeft;return t?t.left+n:Q(U(e)).left+n}function Le(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ie(e,n),y:n.top+t.scrollTop}}function Re(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=U(r),s=t?xe(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=y(1),u=y(0),d=G(r);if((d||!a)&&((V(r)!==`body`||ye(o))&&(c=Oe(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?Le(o,c):y(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 ze(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Be(e){let t=Oe(e),n=e.ownerDocument.body,r=g(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=g(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Ie(e),o=-t.scrollTop;return J(n).direction===`rtl`&&(a+=g(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Ve=25;function He(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=!De()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Ie(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<=Ve&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ue(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 We(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=He(e,n,t);else if(t===`document`)r=Be(U(e));else if(W(t))r=Ue(t,n);else{let n=Pe(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return B(r)}function Ge(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=Te(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 Ke(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?xe(t)?[]:Ge(t,this._c):[].concat(n),r],o=We(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=We(t,a[e],i);s=g(n.top,s),c=h(n.right,c),l=h(n.bottom,l),u=g(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function qe(e){let{width:t,height:n}=je(e);return{width:t,height:n}}function Je(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=y(0);if((r||!a)&&((V(t)!==`body`||ye(i))&&(s=Oe(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=Ie(i));let l=i&&!r&&!a?Le(i,s):y(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 Ye(e){return J(e).position===`static`}function Xe(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 Ze(e,t){let n=H(e);if(xe(e))return n;if(!G(e)){let t=Y(e);for(;t&&!q(t);){if(W(t)&&!Ye(t))return t;t=Y(t)}return n}let r=Xe(e,t);for(;r&&be(r)&&Ye(r);)r=Xe(r,t);return r&&q(r)&&Ye(r)&&!Te(r)?n:r||Ee(e)||n}var Qe=async function(e){let t=this.getOffsetParent||Ze,n=this.getDimensions,r=await n(e.floating);return{reference:Je(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $e(e){return J(e).direction===`rtl`}var et={convertOffsetParentRelativeRectToViewportRelativeRect:Re,getDocumentElement:U,getClippingRect:Ke,getOffsetParent:Ze,getElementRects:Qe,getClientRects:ze,getDimensions:qe,getScale:Z,isElement:W,isRTL:$e};function tt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nt(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=v(d),_=v(a.clientWidth-(u+f)),y=v(a.clientHeight-(d+p)),b=v(u),x={rootMargin:-m+`px `+-_+`px `+-y+`px `+-b+`px`,threshold:g(0,h(1,c))||1},S=!0;function C(t){let n=t[0].intersectionRatio;if(!tt(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 rt(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=Me(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?nt(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&&!tt(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 it=fe,at=pe,ot=oe,st=he,ct=le,lt=ae,ut=me,dt=(e,t,n)=>{let r=new Map,i=n??{},a={...et,...i.platform,_c:r};return ie(e,t,{...i,platform:a})},ft=e(n(),1),pt=typeof document<`u`?p.useLayoutEffect:function(){};function mt(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(!mt(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)&&!mt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ht(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gt(e,t){let n=ht(e);return Math.round(t*n)/n}function _t(e){let t=p.useRef(e);return pt(()=>{t.current=e}),t}function vt(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]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,m]=p.useState(r);mt(f,r)||m(r);let[h,g]=p.useState(null),[_,v]=p.useState(null),y=p.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=p.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=p.useRef(null),w=p.useRef(null),T=p.useRef(u),E=c!=null,D=_t(c),O=_t(i),k=_t(l),A=p.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),dt(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!mt(T.current,t)&&(T.current=t,ft.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);pt(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=p.useRef(!1);pt(()=>(j.current=!0,()=>{j.current=!1}),[]),pt(()=>{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=p.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=p.useMemo(()=>({reference:x,floating:S}),[x,S]),P=p.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=gt(N.floating,u.x),r=gt(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ht(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return p.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var yt=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?{}:lt({element:r.current,padding:i}).fn(n):r?lt({element:r,padding:i}).fn(n):{}}}},bt=(e,t)=>{let n=it(e);return{name:n.name,fn:n.fn,options:[e,t]}},xt=(e,t)=>{let n=at(e);return{name:n.name,fn:n.fn,options:[e,t]}},St=(e,t)=>({fn:ut(e).fn,options:[e,t]}),Ct=(e,t)=>{let n=ot(e);return{name:n.name,fn:n.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=yt(e);return{name:n.name,fn:n.fn,options:[e,t]}},$=r(),Dt=`Arrow`,Ot=p.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`})})});Ot.displayName=Dt;var kt=Ot;function At(e){let[t,n]=p.useState(void 0);return u(()=>{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 jt=`Popper`,[Mt,Nt]=c(jt),[Pt,Ft]=Mt(jt),It=e=>{let{__scopePopper:t,children:n}=e,[r,i]=p.useState(null),[a,o]=p.useState(void 0);return(0,$.jsx)(Pt,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};It.displayName=jt;var Lt=`PopperAnchor`,Rt=p.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Ft(Lt,n),s=p.useRef(null),c=a.onAnchorChange,u=o(t,p.useCallback(e=>{s.current=e,e&&c(e)},[c])),d=p.useRef(null);p.useEffect(()=>{if(!r)return;let e=d.current;d.current=r.current,e!==d.current&&c(d.current)});let f=a.placementState&&Jt(a.placementState),m=f?.[0],h=f?.[1];return r?null:(0,$.jsx)(l.div,{"data-radix-popper-side":m,"data-radix-popper-align":h,...i,ref:u})});Rt.displayName=Lt;var zt=`PopperContent`,[Bt,Vt]=Mt(zt),Ht=p.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:c=0,arrowPadding:d=0,avoidCollisions:f=!0,collisionBoundary:m=[],collisionPadding:h=0,sticky:g=`partial`,hideWhenDetached:_=!1,updatePositionStrategy:v=`optimized`,onPlaced:y,...b}=e,x=Ft(zt,n),[S,C]=p.useState(null),w=o(t,C),[T,E]=p.useState(null),D=At(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(m)?m:[m],N=M.length>0,P={padding:j,boundary:M.filter(Kt),altBoundary:N},{refs:F,floatingStyles:I,placement:L,isPositioned:R,middlewareData:z}=vt({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>rt(...e,{animationFrame:v===`always`}),elements:{reference:x.anchor},middleware:[bt({mainAxis:i+k,alignmentAxis:c}),f&&xt({mainAxis:!0,crossAxis:!1,limiter:g===`partial`?St():void 0,...P}),f&&Ct({...P}),wt({...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&&Et({element:T,padding:d}),qt({arrowWidth:O,arrowHeight:k}),_&&Tt({strategy:`referenceHidden`,...P,boundary:N?P.boundary:void 0})]}),ee=x.setPlacementState;u(()=>(ee(L),()=>{ee(void 0)}),[L,ee]);let[B,te]=Jt(L),ne=s(y);u(()=>{R&&ne?.()},[R,ne]);let re=z.arrow?.x,ie=z.arrow?.y,ae=z.arrow?.centerOffset!==0,[oe,se]=p.useState();return u(()=>{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)(Bt,{scope:n,placedSide:B,placedAlign:te,onArrowChange:E,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,$.jsx)(l.div,{"data-side":B,"data-align":te,...b,ref:w,style:{...b.style,animation:R?void 0:`none`}})})})});Ht.displayName=zt;var Ut=`PopperArrow`,Wt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Gt=p.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Vt(Ut,n),a=Wt[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)(kt,{...r,ref:t,style:{...r.style,display:`block`}})})});Gt.displayName=Ut;function Kt(e){return e!==null}var qt=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]=Jt(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 Jt(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Yt=It,Xt=Rt,Zt=Ht,Qt=Gt,$t=`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`,en=`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`,tn=`data-[highlighted]:bg-action data-[highlighted]:text-action-ink data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,nn=`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`;function rn({className:e,type:t,...n}){return(0,$.jsx)(`input`,{type:t,className:d(`flex h-8 w-full px-2.5`,$t,e),...n})}function an({className:e,...t}){return(0,$.jsx)(`textarea`,{className:d(`flex min-h-16 w-full px-2.5 py-2`,$t,e),...t})}var on=`Label`,sn=p.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())}}));sn.displayName=on;var cn=sn;function ln({className:e,...t}){return(0,$.jsx)(cn,{className:d(`text-xs font-medium text-fg-secondary peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var un=f(`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`}]]),dn=f(`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 fn(e){i.error(pn(e),{id:`err:${pn(e)}`})}function pn(e){return e instanceof Error&&e.message.trim()!==``?e.message:typeof e==`string`&&e.trim()!==``?e:`Something went wrong`}function mn({id:e,value:t,onValueChange:n,onChoose:r,hints:i,placeholder:a,className:o,hintsClassName:s,autoFocus:c}){let[l,u]=(0,p.useState)(!1),[f,m]=(0,p.useState)(0),h=e=>{n(e.value),r?.(e),u(!1)};return(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(rn,{id:e,value:t,onChange:e=>{n(e.target.value),u(!0),m(0)},onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:e=>{if(!(!l||i.length===0))if(e.key===`ArrowDown`)e.preventDefault(),m(e=>(e+1)%i.length);else if(e.key===`ArrowUp`)e.preventDefault(),m(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(),u(!1))},placeholder:a,className:o,autoComplete:`off`,spellCheck:!1,autoFocus:c}),l&&i.length>0&&(0,$.jsx)(`ul`,{className:d(`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,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),h(e)},onMouseEnter:()=>m(t),className:d(`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 hn=(0,p.lazy)(()=>a(()=>import(`./Terminal-Cd5V3epm.js`).then(e=>({default:e.Terminal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),gn=null;async function _n(){gn=(await a(()=>import(`./Terminal-Cd5V3epm.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))).Terminal}function vn(e){return gn?(0,$.jsx)(gn,{...e}):(0,$.jsx)(p.Suspense,{fallback:(0,$.jsx)(`div`,{className:`size-full bg-ground`}),children:(0,$.jsx)(hn,{...e})})}export{Yt as _,dn as a,rn as c,nn as d,tn as f,Zt as g,Qt as h,fn as i,an as l,Xt as m,_n as n,un as o,en as p,mn as r,ln as s,vn as t,$t as u,Nt as v,At as y};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-C_jdwu6i.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-ffCh33zF.js","assets/hotkeys-CGVAxX-R.js","assets/utils-B6KiDbIe.js","assets/index-De_cN03H.js","assets/preload-helper-Czpn1I53.js","assets/dialog-B43iKmfK.js","assets/createLucideIcon-DyMAgLa3.js","assets/index-ChpBP8Zc.css","assets/ssh-mode-CJ0lbAR5.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{B as i}from"./hotkeys-CGVAxX-R.js";import{t as a}from"./preload-helper-Czpn1I53.js";import{A as o,C as s,O as c,w as l,x as u}from"./dialog-B43iKmfK.js";import{t as d}from"./utils-B6KiDbIe.js";import{t as f}from"./createLucideIcon-DyMAgLa3.js";var p=e(t(),1),m=[`top`,`right`,`bottom`,`left`],h=Math.min,g=Math.max,_=Math.round,v=Math.floor,y=e=>({x:e,y:e}),b={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function x(e,t,n){return g(e,h(t,n))}function S(e,t){return typeof e==`function`?e(t):e}function C(e){return e.split(`-`)[0]}function w(e){return e.split(`-`)[1]}function T(e){return e===`x`?`y`:`x`}function E(e){return e===`y`?`height`:`width`}function D(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function O(e){return T(D(e))}function k(e,t,n){n===void 0&&(n=!1);let r=w(e),i=O(e),a=E(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=R(o)),[o,R(o)]}function A(e){let t=R(e);return[j(e),t,j(t)]}function j(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var M=[`left`,`right`],N=[`right`,`left`],P=[`top`,`bottom`],F=[`bottom`,`top`];function I(e,t,n){switch(e){case`top`:case`bottom`:return n?t?N:M:t?M:N;case`left`:case`right`:return t?P:F;default:return[]}}function L(e,t,n,r){let i=w(e),a=I(C(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(j)))),a}function R(e){let t=C(e);return b[t]+e.slice(t.length)}function z(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ee(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:z(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 te(e,t,n){let{reference:r,floating:i}=e,a=D(t),o=O(t),s=E(o),c=C(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=w(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ne(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}=S(t,e),p=ee(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 re=50,ie=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ne},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=te(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<re&&(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}=te(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ae=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}=S(e,t)||{};if(l==null)return{};let d=ee(u),f={x:n,y:r},p=O(i),m=E(p),g=await o.getDimensions(l),_=p===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,C=a.reference[m]+a.reference[p]-f[p]-a.floating[m],T=f[p]-a.reference[p],D=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),k=D?D[b]:0;(!k||!await(o.isElement==null?void 0:o.isElement(D)))&&(k=s.floating[b]||a.floating[m]);let A=C/2-T/2,j=k/2-g[m]/2-1,M=h(d[v],j),N=h(d[y],j),P=k-g[m]-N,F=k/2-g[m]/2+A,I=x(M,F,P),L=!c.arrow&&w(i)!=null&&F!==I&&a.reference[m]/2-(F<M?M:N)-g[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}}}),oe=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}=S(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=C(r),_=D(o),v=C(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[R(o)]:A(o)),x=p!==`none`;!d&&x&&b.push(...L(o,m,p,y));let w=[o,...b],T=await s.detectOverflow(t,h),E=[],O=i.flip?.overflows||[];if(l&&E.push(T[g]),u){let e=k(r,a,y);E.push(T[e[0]],T[e[1]])}if(O=[...O,{placement:r,overflows:E}],!E.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=w[e];if(t&&(!(u===`alignment`&&_!==D(t))||O.every(e=>D(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:O},reset:{placement:t}};let n=O.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=O.filter(e=>{if(x){let t=D(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 se(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ce(e){return m.some(t=>e[t]>=0)}var le=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=S(e,t);switch(i){case`referenceHidden`:{let e=se(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ce(e)}}}case`escaped`:{let e=se(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ce(e)}}}default:return{}}}}},ue=new Set([`left`,`top`]);async function de(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=C(n),s=w(n),c=D(n)===`y`,l=ue.has(o)?-1:1,u=a&&c?-1:1,d=S(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 fe=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 de(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}}}}},pe=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}=S(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=D(i),p=T(f),m=u[p],h=u[f],g=(e,t)=>x(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}}}}}},me=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}=S(e,t),u={x:n,y:r},d=D(i),f=T(d),p=u[f],m=u[d],h=S(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=ue.has(C(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}}}},he=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}=S(e,t),c=await i.detectOverflow(t,s),l=C(n),u=w(n),d=D(n)===`y`,{width:f,height:p}=r.floating,m,_;l===`top`||l===`bottom`?(m=l,_=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(_=l,m=u===`end`?`top`:`bottom`);let v=p-c.top-c.bottom,y=f-c.left-c.right,b=h(p-c[m],v),x=h(f-c[_],y),T=t.middlewareData.shift,E=!T,O=b,k=x;T!=null&&T.enabled.x&&(k=y),T!=null&&T.enabled.y&&(O=v),E&&!u&&(d?k=f-2*g(c.left,c.right):O=p-2*g(c.top,c.bottom)),await o({...t,availableWidth:k,availableHeight:O});let A=await i.getDimensions(a.floating);return f!==A.width||p!==A.height?{reset:{rects:!0}}:{}}}};function ge(){return typeof window<`u`}function V(e){return _e(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((_e(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function _e(e){return ge()?e instanceof Node||e instanceof H(e).Node:!1}function W(e){return ge()?e instanceof Element||e instanceof H(e).Element:!1}function G(e){return ge()?e instanceof HTMLElement||e instanceof H(e).HTMLElement:!1}function ve(e){return!ge()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof H(e).ShadowRoot}function ye(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 be(e){return/^(table|td|th)$/.test(V(e))}function xe(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Se=/transform|translate|scale|rotate|perspective|filter/,Ce=/paint|layout|strict|content/,K=e=>!!e&&e!==`none`,we;function Te(e){let t=W(e)?J(e):e;return K(t.transform)||K(t.translate)||K(t.scale)||K(t.rotate)||K(t.perspective)||!De()&&(K(t.backdropFilter)||K(t.filter))||Se.test(t.willChange||``)||Ce.test(t.contain||``)}function Ee(e){let t=Y(e);for(;G(t)&&!q(t);){if(Te(t))return t;if(xe(t))return null;t=Y(t)}return null}function De(){return we??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),we}function q(e){return/^(html|body|#document)$/.test(V(e))}function J(e){return H(e).getComputedStyle(e)}function Oe(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||ve(e)&&e.host||U(e);return ve(t)?t.host:t}function ke(e){let t=Y(e);return q(t)?(e.ownerDocument||e).body:G(t)&&ye(t)?t:ke(t)}function X(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ke(e),i=r===e.ownerDocument?.body,a=H(r);if(i){let e=Ae(a);return t.concat(a,a.visualViewport||[],ye(r)?r:[],e&&n?X(e):[])}else return t.concat(r,X(r,[],n))}function Ae(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function je(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=_(n)!==a||_(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Me(e){return W(e)?e:e.contextElement}function Z(e){let t=Me(e);if(!G(t))return y(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=je(t),o=(a?_(n.width):n.width)/r,s=(a?_(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ne=y(0);function Pe(e){let t=H(e);return!De()||!t.visualViewport?Ne:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Fe(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=Me(e),o=y(1);t&&(r?W(r)&&(o=Z(r)):o=Z(e));let s=Fe(a,n,r)?Pe(a):y(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=Ae(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=Ae(n)}}return B({width:u,height:d,x:c,y:l})}function Ie(e,t){let n=Oe(e).scrollLeft;return t?t.left+n:Q(U(e)).left+n}function Le(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ie(e,n),y:n.top+t.scrollTop}}function Re(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=U(r),s=t?xe(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=y(1),u=y(0),d=G(r);if((d||!a)&&((V(r)!==`body`||ye(o))&&(c=Oe(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?Le(o,c):y(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 ze(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Be(e){let t=Oe(e),n=e.ownerDocument.body,r=g(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=g(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Ie(e),o=-t.scrollTop;return J(n).direction===`rtl`&&(a+=g(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Ve=25;function He(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=!De()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Ie(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<=Ve&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ue(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 We(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=He(e,n,t);else if(t===`document`)r=Be(U(e));else if(W(t))r=Ue(t,n);else{let n=Pe(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return B(r)}function Ge(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=Te(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 Ke(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?xe(t)?[]:Ge(t,this._c):[].concat(n),r],o=We(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=We(t,a[e],i);s=g(n.top,s),c=h(n.right,c),l=h(n.bottom,l),u=g(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function qe(e){let{width:t,height:n}=je(e);return{width:t,height:n}}function Je(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=y(0);if((r||!a)&&((V(t)!==`body`||ye(i))&&(s=Oe(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=Ie(i));let l=i&&!r&&!a?Le(i,s):y(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 Ye(e){return J(e).position===`static`}function Xe(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 Ze(e,t){let n=H(e);if(xe(e))return n;if(!G(e)){let t=Y(e);for(;t&&!q(t);){if(W(t)&&!Ye(t))return t;t=Y(t)}return n}let r=Xe(e,t);for(;r&&be(r)&&Ye(r);)r=Xe(r,t);return r&&q(r)&&Ye(r)&&!Te(r)?n:r||Ee(e)||n}var Qe=async function(e){let t=this.getOffsetParent||Ze,n=this.getDimensions,r=await n(e.floating);return{reference:Je(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $e(e){return J(e).direction===`rtl`}var et={convertOffsetParentRelativeRectToViewportRelativeRect:Re,getDocumentElement:U,getClippingRect:Ke,getOffsetParent:Ze,getElementRects:Qe,getClientRects:ze,getDimensions:qe,getScale:Z,isElement:W,isRTL:$e};function tt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nt(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=v(d),_=v(a.clientWidth-(u+f)),y=v(a.clientHeight-(d+p)),b=v(u),x={rootMargin:-m+`px `+-_+`px `+-y+`px `+-b+`px`,threshold:g(0,h(1,c))||1},S=!0;function C(t){let n=t[0].intersectionRatio;if(!tt(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 rt(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=Me(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?nt(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&&!tt(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 it=fe,at=pe,ot=oe,st=he,ct=le,lt=ae,ut=me,dt=(e,t,n)=>{let r=new Map,i=n??{},a={...et,...i.platform,_c:r};return ie(e,t,{...i,platform:a})},ft=e(n(),1),pt=typeof document<`u`?p.useLayoutEffect:function(){};function mt(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(!mt(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)&&!mt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ht(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gt(e,t){let n=ht(e);return Math.round(t*n)/n}function _t(e){let t=p.useRef(e);return pt(()=>{t.current=e}),t}function vt(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]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,m]=p.useState(r);mt(f,r)||m(r);let[h,g]=p.useState(null),[_,v]=p.useState(null),y=p.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=p.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=p.useRef(null),w=p.useRef(null),T=p.useRef(u),E=c!=null,D=_t(c),O=_t(i),k=_t(l),A=p.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),dt(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!mt(T.current,t)&&(T.current=t,ft.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);pt(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=p.useRef(!1);pt(()=>(j.current=!0,()=>{j.current=!1}),[]),pt(()=>{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=p.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=p.useMemo(()=>({reference:x,floating:S}),[x,S]),P=p.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=gt(N.floating,u.x),r=gt(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ht(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return p.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var yt=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?{}:lt({element:r.current,padding:i}).fn(n):r?lt({element:r,padding:i}).fn(n):{}}}},bt=(e,t)=>{let n=it(e);return{name:n.name,fn:n.fn,options:[e,t]}},xt=(e,t)=>{let n=at(e);return{name:n.name,fn:n.fn,options:[e,t]}},St=(e,t)=>({fn:ut(e).fn,options:[e,t]}),Ct=(e,t)=>{let n=ot(e);return{name:n.name,fn:n.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=yt(e);return{name:n.name,fn:n.fn,options:[e,t]}},$=r(),Dt=`Arrow`,Ot=p.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`})})});Ot.displayName=Dt;var kt=Ot;function At(e){let[t,n]=p.useState(void 0);return u(()=>{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 jt=`Popper`,[Mt,Nt]=c(jt),[Pt,Ft]=Mt(jt),It=e=>{let{__scopePopper:t,children:n}=e,[r,i]=p.useState(null),[a,o]=p.useState(void 0);return(0,$.jsx)(Pt,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};It.displayName=jt;var Lt=`PopperAnchor`,Rt=p.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Ft(Lt,n),s=p.useRef(null),c=a.onAnchorChange,u=o(t,p.useCallback(e=>{s.current=e,e&&c(e)},[c])),d=p.useRef(null);p.useEffect(()=>{if(!r)return;let e=d.current;d.current=r.current,e!==d.current&&c(d.current)});let f=a.placementState&&Jt(a.placementState),m=f?.[0],h=f?.[1];return r?null:(0,$.jsx)(l.div,{"data-radix-popper-side":m,"data-radix-popper-align":h,...i,ref:u})});Rt.displayName=Lt;var zt=`PopperContent`,[Bt,Vt]=Mt(zt),Ht=p.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:c=0,arrowPadding:d=0,avoidCollisions:f=!0,collisionBoundary:m=[],collisionPadding:h=0,sticky:g=`partial`,hideWhenDetached:_=!1,updatePositionStrategy:v=`optimized`,onPlaced:y,...b}=e,x=Ft(zt,n),[S,C]=p.useState(null),w=o(t,C),[T,E]=p.useState(null),D=At(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(m)?m:[m],N=M.length>0,P={padding:j,boundary:M.filter(Kt),altBoundary:N},{refs:F,floatingStyles:I,placement:L,isPositioned:R,middlewareData:z}=vt({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>rt(...e,{animationFrame:v===`always`}),elements:{reference:x.anchor},middleware:[bt({mainAxis:i+k,alignmentAxis:c}),f&&xt({mainAxis:!0,crossAxis:!1,limiter:g===`partial`?St():void 0,...P}),f&&Ct({...P}),wt({...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&&Et({element:T,padding:d}),qt({arrowWidth:O,arrowHeight:k}),_&&Tt({strategy:`referenceHidden`,...P,boundary:N?P.boundary:void 0})]}),ee=x.setPlacementState;u(()=>(ee(L),()=>{ee(void 0)}),[L,ee]);let[B,te]=Jt(L),ne=s(y);u(()=>{R&&ne?.()},[R,ne]);let re=z.arrow?.x,ie=z.arrow?.y,ae=z.arrow?.centerOffset!==0,[oe,se]=p.useState();return u(()=>{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)(Bt,{scope:n,placedSide:B,placedAlign:te,onArrowChange:E,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,$.jsx)(l.div,{"data-side":B,"data-align":te,...b,ref:w,style:{...b.style,animation:R?void 0:`none`}})})})});Ht.displayName=zt;var Ut=`PopperArrow`,Wt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Gt=p.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Vt(Ut,n),a=Wt[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)(kt,{...r,ref:t,style:{...r.style,display:`block`}})})});Gt.displayName=Ut;function Kt(e){return e!==null}var qt=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]=Jt(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 Jt(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Yt=It,Xt=Rt,Zt=Ht,Qt=Gt,$t=`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`,en=`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`,tn=`data-[highlighted]:bg-action data-[highlighted]:text-action-ink data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,nn=`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`;function rn({className:e,type:t,...n}){return(0,$.jsx)(`input`,{type:t,className:d(`flex h-8 w-full px-2.5`,$t,e),...n})}function an({className:e,...t}){return(0,$.jsx)(`textarea`,{className:d(`flex min-h-16 w-full px-2.5 py-2`,$t,e),...t})}var on=`Label`,sn=p.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())}}));sn.displayName=on;var cn=sn;function ln({className:e,...t}){return(0,$.jsx)(cn,{className:d(`text-xs font-medium text-fg-secondary peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var un=f(`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`}]]),dn=f(`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 fn(e){i.error(pn(e),{id:`err:${pn(e)}`})}function pn(e){return e instanceof Error&&e.message.trim()!==``?e.message:typeof e==`string`&&e.trim()!==``?e:`Something went wrong`}function mn({id:e,value:t,onValueChange:n,onChoose:r,hints:i,placeholder:a,className:o,hintsClassName:s,autoFocus:c}){let[l,u]=(0,p.useState)(!1),[f,m]=(0,p.useState)(0),h=e=>{n(e.value),r?.(e),u(!1)};return(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(rn,{id:e,value:t,onChange:e=>{n(e.target.value),u(!0),m(0)},onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:e=>{if(!(!l||i.length===0))if(e.key===`ArrowDown`)e.preventDefault(),m(e=>(e+1)%i.length);else if(e.key===`ArrowUp`)e.preventDefault(),m(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(),u(!1))},placeholder:a,className:o,autoComplete:`off`,spellCheck:!1,autoFocus:c}),l&&i.length>0&&(0,$.jsx)(`ul`,{className:d(`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,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),h(e)},onMouseEnter:()=>m(t),className:d(`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 hn=(0,p.lazy)(()=>a(()=>import(`./Terminal-C_jdwu6i.js`).then(e=>({default:e.Terminal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),gn=null;async function _n(){gn=(await a(()=>import(`./Terminal-C_jdwu6i.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))).Terminal}function vn(e){return gn?(0,$.jsx)(gn,{...e}):(0,$.jsx)(p.Suspense,{fallback:(0,$.jsx)(`div`,{className:`size-full bg-ground`}),children:(0,$.jsx)(hn,{...e})})}export{Yt as _,dn as a,rn as c,nn as d,tn as f,Zt as g,Qt as h,fn as i,an as l,Xt as m,_n as n,un as o,en as p,mn as r,ln as s,vn as t,$t as u,Nt as v,At 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-C7PmP6Kk.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-ON5LQeHS.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,4 +1,4 @@
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{B as r,_ as i,c as a,f as o,x as s,y as c}from"./hotkeys-DJt0-uY0.js";import{D as l,E as u,O as d,S as f,T as p,a as m,b as h,d as g,f as _,g as v,m as y,n as b,o as x,u as S,w as C}from"./editor-context-CFhFe8Rl.js";import{t as ee}from"./preload-helper-Czpn1I53.js";import{t as te}from"./createLucideIcon-DyMAgLa3.js";import{F as w,I as ne,J as re,N as ie,P as ae,X as oe,Y as se,a as ce}from"./index-oaI2xX3B.js";import{i as le,r as ue}from"./editor.api2-4X9Vh9Zw.js";import{a as T,c as de,d as fe,f as pe,i as me,l as he,n as ge,o as _e,r as ve,s as ye,t as E,u as be}from"./buffer-store-C7PmP6Kk.js";import{a as xe,c as Se,i as Ce,l as we,n as Te,o as Ee,r as De,s as Oe}from"./editor-sync-W2W78_MY.js";import{r as ke}from"./buffer-logic-BrpRsL1b.js";var Ae=te(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),D=e(t(),1),O=n();function je({session:e,path:t,conflict:n,model:r,onTakeDisk:i,onKeepMine:a,onSave:o}){let s=oe(),c=(0,D.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),l=(0,D.useRef)(o);l.current=o;let u=(0,D.useRef)(null),d=()=>{let e=u.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),u.current=null},f=(0,D.useRef)(d);return f.current=d,(0,D.useEffect)(()=>()=>f.current(),[]),(0,O.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3 bg-elevated px-3 py-1.5 text-xs text-fg-secondary`,children:[(0,O.jsx)(`span`,{children:`This file changed on disk. Yours is on the right — merge what you want, then save.`}),(0,O.jsx)(`button`,{type:`button`,onClick:i,className:`ml-auto shrink-0 text-fg-muted transition-colors hover:text-fg`,children:`Take the disk version`}),(0,O.jsx)(`button`,{type:`button`,onClick:a,className:`shrink-0 text-fg-muted transition-colors hover:text-fg`,children:`Keep mine`})]}),(0,O.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,O.jsx)(pe,{modifiedModelPath:r.uri.toString(),originalModelPath:`puddle-disk://${encodeURIComponent(e)}/${n.mtimeMs}/${t.split(`/`).map(encodeURIComponent).join(`/`)}`,original:n.content,language:r.getLanguageId(),theme:be,keepCurrentModifiedModel:!0,loading:(0,O.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),onMount:e=>{u.current=e,e.onDidDispose(()=>{u.current=null}),e.getModifiedEditor().addCommand(le.CtrlCmd|ue.KeyS,()=>l.current())},options:{readOnly:!1,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:c,fontSize:s.editorFontSize,wordWrap:s.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}var Me=new Map,Ne=new Map;function Pe(e){for(let t of Ne.get(e)??[])t()}function Fe(e,t){Me.set(e,t),Pe(e)}function Ie(e){Me.delete(e)&&Pe(e)}function Le(e){return Me.get(e)??null}function Re(e,t){let n=Ne.get(e);return n||(n=new Set,Ne.set(e,n)),n.add(t),()=>n.delete(t)}function ze(e){return!e}function Be(e){let t=e.split(`+`),n=t.pop()??``,r=0;for(let e of t)e===`meta`?r|=le.CtrlCmd:e===`ctrl`?r|=le.WinCtrl:e===`alt`?r|=le.Alt:e===`shift`&&(r|=le.Shift);let i=ue[/^Key[A-Z]$/.test(n)?`Key${n.slice(3)}`:/^Digit[0-9]$/.test(n)?`Digit${n.slice(5)}`:n];return typeof i==`number`?r|i:null}function Ve(e,t){let n=Be(a(`editor.save`));n!==null&&e.addCommand(n,()=>t.onSave());let r=Be(a(`editor.wordWrap`));e.addAction({id:`puddle.toggleWordWrap`,label:`Toggle Word Wrap`,keybindings:r===null?[]:[r],run:()=>se({editorWordWrap:ze(re().editorWordWrap)})})}function He(e,t,n,i,a){let o=a?.passive===!0,s=E(e,t,i),l=d(e,t,{root:i,live:a?.live}),f=u(e,i),[p,m]=(0,D.useState)(null),[h,g]=(0,D.useState)(!1),_=(0,D.useRef)(!1),b=(0,D.useRef)(null),x=(0,D.useRef)(null),S=(0,D.useRef)(n);S.current=n;let C=(0,D.useRef)(!1),ee=(0,D.useCallback)((e,t)=>{x.current?.cancel(),C.current=!0;try{_e(s,e,t)}finally{C.current=!1}},[s]),te=(0,D.useSyncExternalStore)((0,D.useCallback)(e=>he(s,e),[s]),()=>ve(s)),w=(0,D.useSyncExternalStore)((0,D.useCallback)(e=>Ee(s,e),[s]),()=>xe(s)),ne=(0,D.useSyncExternalStore)((0,D.useCallback)(e=>Re(s,e),[s]),()=>Le(s));(0,D.useEffect)(()=>{let n=l.data;if(!n||n.binary||n.content===null||_.current)return;_.current=!0;let a=de(s)!==void 0,o=ge(e,t,n.content,n.mtime_ms,i);m(o),!a&&we(e,t,i).then(e=>{e&&(e.base_mtime_ms===n.mtime_ms?ke(o,e.content)&&g(!0):r(`This file has an unsaved draft from an earlier version.`,{description:`The file changed on disk since the draft was saved.`,duration:12e3,action:{label:`Restore draft`,onClick:()=>{ke(o,e.content)&&g(!0)}}}))})},[l.data,s,e,t,i]),(0,D.useEffect)(()=>{if(!p||o)return;let n=Se(e,t,i);x.current=n;let r=p.onDidChangeContent(()=>{C.current||(n(p.getValue(),de(s)??0),Te(e,t,i))});return()=>{n.flush(),r.dispose(),x.current=null}},[p,s,e,t,i,o]),(0,D.useEffect)(()=>{!p||!w.savedElsewhere||ve(s)||l.refetch().then(e=>{ve(s)||(e.data&&e.data.content!==null&&ee(e.data.content,e.data.mtime_ms),Ce(s))})},[w.savedElsewhere,p,s]),(0,D.useEffect)(()=>{let e=l.data;!p||!e||e.content===null||!ve(s)&&e.mtime_ms!==de(s)&&ee(e.content,e.mtime_ms)},[l.data,p,s]);let re=(0,D.useCallback)((n,r)=>{me(s,n,r),x.current?.cancel(),Oe(e,t,i),De(e,t,r,i),g(!1),Ie(s)},[s,e,t,i]),ie=(0,D.useCallback)(()=>{l.refetch().then(n=>{n.data&&n.data.content!==null&&ee(n.data.content,n.data.mtime_ms),Oe(e,t,i),g(!1),Ie(s)})},[s,e,t,ee]),ae=(0,D.useCallback)((e,n)=>{f.mutate({path:t,content:e},{onSuccess:e=>re(n,e.mtime_ms),onError:e=>r.error(e instanceof Error?e.message:`Overwrite failed`)})},[f,t,re]),oe=(0,D.useCallback)(()=>{if(!p||!ve(s))return;let e=p.getValue(),n=p.getAlternativeVersionId(),i=Le(s)?.mtimeMs??de(s);f.mutate({path:t,content:e,expected_mtime_ms:i},{onSuccess:e=>re(n,e.mtime_ms),onError:t=>{t instanceof c&&t.status===409&&t.code===`stale_file`?(l.refetch().then(e=>{e.data&&e.data.content!==null&&Fe(s,{content:e.data.content,mtimeMs:e.data.mtime_ms})}),r.error(`File changed on disk (probably the agent)`,{description:`Nothing was written — your unsaved version is intact.`,duration:1/0,action:{label:`Reload`,onClick:()=>ie()},cancel:{label:`Overwrite`,onClick:()=>ae(e,n)}})):r.error(t instanceof Error?t.message:`Save failed`)}})},[p,s,f,t,re,ie,ae]),se=(0,D.useRef)(oe);se.current=oe,(0,D.useEffect)(()=>y(v(e,t,i),()=>se.current()),[e,t,i]);let ce=(0,D.useCallback)(()=>{let n=b.current,r=S.current;i===void 0&&(!n||!r||r.session!==e||r.path!==t||(n.revealLineInCenter(r.line),n.setPosition({lineNumber:r.line,column:r.column??1}),n.focus()))},[e,t,i]),le=(0,D.useCallback)(e=>{b.current=e,Ve(e,{onSave:()=>se.current()}),ce()},[ce]);(0,D.useEffect)(()=>{ce()},[n,p,ce]);let ue=(0,D.useCallback)(()=>{ie()},[ie]),T=(0,D.useCallback)(()=>{p&&ae(p.getValue(),p.getAlternativeVersionId())},[p,ae]),fe,pe=null;l.data?.binary?fe=`binary`:l.error?l.error instanceof c&&l.error.status===413?fe=`too-large`:(fe=`error`,pe=l.error instanceof Error?l.error.message:`Failed to load file`):fe=p?`ready`:`loading`;let ye=te&&w.savedElsewhere?`saved-elsewhere`:te&&w.dirtyElsewhere?`dirty-elsewhere`:null;return{status:fe,errorMessage:pe,model:p,dirty:te,restoredNotice:h,discardRestore:ue,peerBadge:ye,conflict:ne,takeDisk:ie,keepMine:T,save:oe,onMount:le}}function Ue({message:e,session:t,path:n,root:i,download:a}){return(0,O.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 bg-ground text-sm text-fg-muted`,children:[(0,O.jsx)(`span`,{children:e}),a&&(0,O.jsxs)(`button`,{type:`button`,onClick:()=>void h(t,n,i).catch(e=>r.error(e instanceof Error?e.message:`Download failed`)),className:`flex items-center gap-1.5 text-fg-secondary transition-colors hover:text-fg`,children:[(0,O.jsx)(Ae,{className:`size-4`}),`Download`]})]})}function We({session:e,path:t,reveal:n,root:r}){let i=oe(),a=He(e,t,n,r),o=(0,D.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if(a.status===`binary`)return(0,O.jsx)(Ue,{message:`Binary file — use Download`,session:e,path:t,root:r,download:!0});if(a.status===`too-large`)return(0,O.jsx)(Ue,{message:`File too large to edit — use Download`,session:e,path:t,root:r,download:!0});if(a.status===`error`)return(0,O.jsx)(Ue,{message:a.errorMessage??`Failed to load file`,session:e,path:t,root:r});if(a.conflict&&a.model)return(0,O.jsx)(je,{session:e,path:t,conflict:a.conflict,model:a.model,onTakeDisk:a.takeDisk,onKeepMine:a.keepMine,onSave:a.save});let s=a.peerBadge===`saved-elsewhere`?`Saved in another window`:a.peerBadge===`dirty-elsewhere`?`Also being edited in another window`:null;return(0,O.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[a.restoredNotice&&(0,O.jsxs)(`div`,{className:`flex items-center gap-3 bg-elevated px-3 py-1.5 text-xs text-fg-secondary`,children:[(0,O.jsx)(`span`,{children:`Restored unsaved changes`}),(0,O.jsx)(`button`,{type:`button`,onClick:a.discardRestore,className:`text-fg-muted transition-colors hover:text-fg`,children:`Discard`})]}),s&&(0,O.jsx)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:s}),(0,O.jsx)(`div`,{className:`min-h-0 flex-1`,children:a.model&&(0,O.jsx)(fe,{path:a.model.uri.toString(),defaultValue:a.model.getValue(),theme:`puddle`,keepCurrentModel:!0,onMount:e=>a.onMount(e),loading:(0,O.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),options:{automaticLayout:!0,fontFamily:o,fontSize:i.editorFontSize,tabSize:i.editorTabSize,wordWrap:i.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function k({children:e}){return(0,O.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-xs text-fg-muted`,children:e})}function Ge(e,t){let n=(0,D.useRef)(t);n.current=t,(0,D.useEffect)(()=>(ye(e),()=>{n.current?.(),T(e)}),[e])}function Ke(e,t,n,r){let i=r.split(`/`).map(encodeURIComponent).join(`/`);return`${e}://${encodeURIComponent(t)}/${encodeURIComponent(n)}/${i}`}function qe({session:e,refName:t,path:n,content:r}){let i=oe(),a=(0,D.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,O.jsx)(fe,{path:Ke(`puddle-view`,e,t,n),defaultValue:r,theme:be,loading:(0,O.jsx)(k,{children:`…`}),options:{readOnly:!0,automaticLayout:!0,fontFamily:a,fontSize:i.editorFontSize,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function Je({session:e,against:t,path:n,root:r}){let i=p(e,t,n,{root:r});return i.isPending?(0,O.jsx)(k,{children:`…`}):i.error?(0,O.jsx)(k,{children:i.error instanceof Error?i.error.message:`Failed to load`}):i.data.binary?(0,O.jsx)(k,{children:`Binary file — deleted`}):(0,O.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,O.jsx)(`div`,{className:`bg-surface px-4 py-1 text-xs text-fg-muted`,children:`Deleted`}),(0,O.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,O.jsx)(qe,{session:e,refName:t,path:n,content:i.data.content??``})})]})}function Ye({session:e,against:t,path:n,basePath:r,root:i}){let a=oe(),o=He(e,n,null,i),s=p(e,t,r,{root:i}),l=(0,D.useRef)(null);Ge(E(e,n),()=>{let e=l.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),l.current=null});let u=(0,D.useRef)(o.save);u.current=o.save;let d=(0,D.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),f=s.error instanceof c&&s.error.status===404;return o.status===`binary`||s.data?.binary?(0,O.jsx)(k,{children:`Binary file`}):o.status===`too-large`?(0,O.jsx)(k,{children:`File too large to show`}):o.status===`error`?(0,O.jsx)(k,{children:o.errorMessage??`Failed to load file`}):f?(0,O.jsx)(We,{session:e,path:n,reveal:null}):s.isPending||!o.model?(0,O.jsx)(k,{children:`…`}):s.error?(0,O.jsx)(k,{children:s.error instanceof Error?s.error.message:`Failed to load base`}):(0,O.jsx)(pe,{modifiedModelPath:o.model.uri.toString(),originalModelPath:Ke(`puddle-base`,e,t,r),original:s.data.content??``,language:o.model.getLanguageId(),theme:be,keepCurrentModifiedModel:!0,loading:(0,O.jsx)(k,{children:`…`}),onMount:e=>{l.current=e,e.onDidDispose(()=>{l.current=null}),e.getModifiedEditor().addCommand(le.CtrlCmd|ue.KeyS,()=>u.current())},options:{readOnly:!1,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:d,fontSize:a.editorFontSize,wordWrap:a.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function Xe({session:e,path:t,root:n}){return Ge(E(e,t,n)),(0,O.jsx)(We,{session:e,path:t,reveal:null,root:n})}function Ze({session:e,against:t,entry:n,root:r}){switch(n.status){case`added`:return(0,O.jsx)(Xe,{session:e,path:n.path,root:r});case`deleted`:return(0,O.jsx)(Je,{session:e,against:t,path:n.path,root:r});case`modified`:case`renamed`:return(0,O.jsx)(Ye,{session:e,against:t,path:n.path,basePath:n.old_path??n.path,root:r});default:return null}}function Qe({session:e,sha:t,path:n}){let r=p(e,t,n);return r.isPending?(0,O.jsx)(k,{children:`…`}):r.error?(0,O.jsx)(k,{children:r.error instanceof Error?r.error.message:`Failed to load file`}):r.data.binary?(0,O.jsx)(k,{children:`Binary file`}):(0,O.jsx)(qe,{session:e,refName:t,path:n,content:r.data.content??``})}function $e({session:e,originalRef:t,originalPath:n,originalContent:r,modifiedRef:i,modifiedPath:a,modifiedContent:o}){let s=oe(),c=(0,D.useRef)(null),l=(0,D.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,D.useEffect)(()=>()=>{let e=c.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),t?.modified.dispose(),c.current=null},[]),(0,O.jsx)(pe,{originalModelPath:Ke(`puddle-hist-orig`,e,t,n),modifiedModelPath:Ke(`puddle-hist-mod`,e,i,a),original:r,modified:o,theme:be,keepCurrentOriginalModel:!0,keepCurrentModifiedModel:!0,loading:(0,O.jsx)(k,{children:`…`}),onMount:e=>{c.current=e,e.onDidDispose(()=>{c.current=null})},options:{readOnly:!0,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:l,fontSize:s.editorFontSize,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function et({session:e,sha:t,path:n,basePath:r}){let i=p(e,`${t}^`,r),a=p(e,t,n);return i.error instanceof c&&i.error.status===404?(0,O.jsx)(Qe,{session:e,sha:t,path:n}):i.isPending||a.isPending?(0,O.jsx)(k,{children:`…`}):i.error?(0,O.jsx)(k,{children:i.error instanceof Error?i.error.message:`Failed to load original`}):a.error?(0,O.jsx)(k,{children:a.error instanceof Error?a.error.message:`Failed to load file`}):i.data.binary||a.data.binary?(0,O.jsx)(k,{children:`Binary file`}):(0,O.jsx)($e,{session:e,originalRef:`${t}^`,originalPath:r,originalContent:i.data.content??``,modifiedRef:t,modifiedPath:n,modifiedContent:a.data.content??``})}function tt({session:e,sha:t,entry:n,isRootCommit:r}){switch(_(n.status,r)){case`added`:return(0,O.jsx)(Qe,{session:e,sha:t,path:n.path});case`deleted`:return(0,O.jsx)(Je,{session:e,against:`${t}^`,path:n.path});case`modified`:case`renamed`:return(0,O.jsx)(et,{session:e,sha:t,path:n.path,basePath:n.old_path??n.path});default:return null}}function nt({session:e,sha:t,path:n,root:r}){let i=C(e,t,r);if(i.isPending)return(0,O.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading commit…`});if(i.error)return(0,O.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:i.error instanceof Error?i.error.message:`Failed to load commit`});let a=i.data.files.find(e=>e.path===n);return a?(0,O.jsx)(`div`,{className:`h-full`,children:(0,O.jsx)(tt,{session:e,sha:t,entry:a,isRootCommit:i.data.parents.length===0})}):(0,O.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[(0,O.jsx)(`span`,{className:`text-fg-secondary`,children:n}),` is not part of`,` `,(0,O.jsx)(`span`,{className:`font-mono`,children:t.slice(0,7)}),`.`]})}function rt({session:e,path:t,root:n}){let r=l(e,{root:n});if(r.isPending)return(0,O.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading diff…`});if(r.error)return(0,O.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:r.error instanceof Error?r.error.message:`Failed to load diff`});let i=r.data.entries.find(e=>e.path===t);return i?(0,O.jsx)(`div`,{className:`h-full`,children:(0,O.jsx)(Ze,{session:e,against:r.data.against,entry:i,root:n})}):(0,O.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[`No changes to `,(0,O.jsx)(`span`,{className:`mx-1 text-fg-secondary`,children:t}),` against the base.`]})}var it=800;function at({name:e}){let t=oe(),n=i(),a=g(n,e),s=o(`editor.save`),c=(0,D.useRef)(null),l=(0,D.useRef)(null),u=(0,D.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if((0,D.useEffect)(()=>{if(n===null)return;let t=ce(t=>{S(n,e,t).catch(e=>r.error(e instanceof Error?e.message:`Draft not saved`))},it);return l.current=t,()=>{t.flush(),l.current=null}},[n,e]),n===null)return null;if(a.error)return(0,O.jsx)(`div`,{className:`flex h-full items-center justify-center bg-ground text-sm text-fg-muted`,children:a.error instanceof Error?a.error.message:`Failed to load the draft`});if(a.data===void 0)return(0,O.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`});let d=()=>{let t=c.current;t&&(l.current?.flush(),x({name:e,content:t.getValue()}))};return(0,O.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[(0,O.jsxs)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:[`Draft — not in any worktree; `,s,` saves it into one`]}),(0,O.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,O.jsx)(fe,{path:`puddle-untitled://${n}/${e}`,defaultValue:a.data.content,theme:be,keepCurrentModel:!1,loading:(0,O.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),onMount:t=>{c.current=t,m(e,t.getValue()),Ve(t,{onSave:d})},onChange:t=>{let n=t??``;m(e,n),l.current?.(n)},options:{automaticLayout:!0,fontFamily:u,fontSize:t.editorFontSize,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function ot(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function st(e){if(Array.isArray(e))return e}function ct(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function lt(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
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{B as r,_ as i,c as a,f as o,x as s,y as c}from"./hotkeys-CGVAxX-R.js";import{D as l,E as u,O as d,S as f,T as p,a as m,b as h,d as g,f as _,g as v,m as y,n as b,o as x,u as S,w as C}from"./editor-context-BbDRtFbv.js";import{t as ee}from"./preload-helper-Czpn1I53.js";import{t as te}from"./createLucideIcon-DyMAgLa3.js";import{F as w,I as ne,J as re,N as ie,P as ae,X as oe,Y as se,a as ce}from"./index-De_cN03H.js";import{i as le,r as ue}from"./editor.api2-4X9Vh9Zw.js";import{a as T,c as de,d as fe,f as pe,i as me,l as he,n as ge,o as _e,r as ve,s as ye,t as E,u as be}from"./buffer-store-ON5LQeHS.js";import{a as xe,c as Se,i as Ce,l as we,n as Te,o as Ee,r as De,s as Oe}from"./editor-sync-DL-NkjyA.js";import{r as ke}from"./buffer-logic-BrpRsL1b.js";var Ae=te(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),D=e(t(),1),O=n();function je({session:e,path:t,conflict:n,model:r,onTakeDisk:i,onKeepMine:a,onSave:o}){let s=oe(),c=(0,D.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),l=(0,D.useRef)(o);l.current=o;let u=(0,D.useRef)(null),d=()=>{let e=u.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),u.current=null},f=(0,D.useRef)(d);return f.current=d,(0,D.useEffect)(()=>()=>f.current(),[]),(0,O.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3 bg-elevated px-3 py-1.5 text-xs text-fg-secondary`,children:[(0,O.jsx)(`span`,{children:`This file changed on disk. Yours is on the right — merge what you want, then save.`}),(0,O.jsx)(`button`,{type:`button`,onClick:i,className:`ml-auto shrink-0 text-fg-muted transition-colors hover:text-fg`,children:`Take the disk version`}),(0,O.jsx)(`button`,{type:`button`,onClick:a,className:`shrink-0 text-fg-muted transition-colors hover:text-fg`,children:`Keep mine`})]}),(0,O.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,O.jsx)(pe,{modifiedModelPath:r.uri.toString(),originalModelPath:`puddle-disk://${encodeURIComponent(e)}/${n.mtimeMs}/${t.split(`/`).map(encodeURIComponent).join(`/`)}`,original:n.content,language:r.getLanguageId(),theme:be,keepCurrentModifiedModel:!0,loading:(0,O.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),onMount:e=>{u.current=e,e.onDidDispose(()=>{u.current=null}),e.getModifiedEditor().addCommand(le.CtrlCmd|ue.KeyS,()=>l.current())},options:{readOnly:!1,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:c,fontSize:s.editorFontSize,wordWrap:s.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}var Me=new Map,Ne=new Map;function Pe(e){for(let t of Ne.get(e)??[])t()}function Fe(e,t){Me.set(e,t),Pe(e)}function Ie(e){Me.delete(e)&&Pe(e)}function Le(e){return Me.get(e)??null}function Re(e,t){let n=Ne.get(e);return n||(n=new Set,Ne.set(e,n)),n.add(t),()=>n.delete(t)}function ze(e){return!e}function Be(e){let t=e.split(`+`),n=t.pop()??``,r=0;for(let e of t)e===`meta`?r|=le.CtrlCmd:e===`ctrl`?r|=le.WinCtrl:e===`alt`?r|=le.Alt:e===`shift`&&(r|=le.Shift);let i=ue[/^Key[A-Z]$/.test(n)?`Key${n.slice(3)}`:/^Digit[0-9]$/.test(n)?`Digit${n.slice(5)}`:n];return typeof i==`number`?r|i:null}function Ve(e,t){let n=Be(a(`editor.save`));n!==null&&e.addCommand(n,()=>t.onSave());let r=Be(a(`editor.wordWrap`));e.addAction({id:`puddle.toggleWordWrap`,label:`Toggle Word Wrap`,keybindings:r===null?[]:[r],run:()=>se({editorWordWrap:ze(re().editorWordWrap)})})}function He(e,t,n,i,a){let o=a?.passive===!0,s=E(e,t,i),l=d(e,t,{root:i,live:a?.live}),f=u(e,i),[p,m]=(0,D.useState)(null),[h,g]=(0,D.useState)(!1),_=(0,D.useRef)(!1),b=(0,D.useRef)(null),x=(0,D.useRef)(null),S=(0,D.useRef)(n);S.current=n;let C=(0,D.useRef)(!1),ee=(0,D.useCallback)((e,t)=>{x.current?.cancel(),C.current=!0;try{_e(s,e,t)}finally{C.current=!1}},[s]),te=(0,D.useSyncExternalStore)((0,D.useCallback)(e=>he(s,e),[s]),()=>ve(s)),w=(0,D.useSyncExternalStore)((0,D.useCallback)(e=>Ee(s,e),[s]),()=>xe(s)),ne=(0,D.useSyncExternalStore)((0,D.useCallback)(e=>Re(s,e),[s]),()=>Le(s));(0,D.useEffect)(()=>{let n=l.data;if(!n||n.binary||n.content===null||_.current)return;_.current=!0;let a=de(s)!==void 0,o=ge(e,t,n.content,n.mtime_ms,i);m(o),!a&&we(e,t,i).then(e=>{e&&(e.base_mtime_ms===n.mtime_ms?ke(o,e.content)&&g(!0):r(`This file has an unsaved draft from an earlier version.`,{description:`The file changed on disk since the draft was saved.`,duration:12e3,action:{label:`Restore draft`,onClick:()=>{ke(o,e.content)&&g(!0)}}}))})},[l.data,s,e,t,i]),(0,D.useEffect)(()=>{if(!p||o)return;let n=Se(e,t,i);x.current=n;let r=p.onDidChangeContent(()=>{C.current||(n(p.getValue(),de(s)??0),Te(e,t,i))});return()=>{n.flush(),r.dispose(),x.current=null}},[p,s,e,t,i,o]),(0,D.useEffect)(()=>{!p||!w.savedElsewhere||ve(s)||l.refetch().then(e=>{ve(s)||(e.data&&e.data.content!==null&&ee(e.data.content,e.data.mtime_ms),Ce(s))})},[w.savedElsewhere,p,s]),(0,D.useEffect)(()=>{let e=l.data;!p||!e||e.content===null||!ve(s)&&e.mtime_ms!==de(s)&&ee(e.content,e.mtime_ms)},[l.data,p,s]);let re=(0,D.useCallback)((n,r)=>{me(s,n,r),x.current?.cancel(),Oe(e,t,i),De(e,t,r,i),g(!1),Ie(s)},[s,e,t,i]),ie=(0,D.useCallback)(()=>{l.refetch().then(n=>{n.data&&n.data.content!==null&&ee(n.data.content,n.data.mtime_ms),Oe(e,t,i),g(!1),Ie(s)})},[s,e,t,ee]),ae=(0,D.useCallback)((e,n)=>{f.mutate({path:t,content:e},{onSuccess:e=>re(n,e.mtime_ms),onError:e=>r.error(e instanceof Error?e.message:`Overwrite failed`)})},[f,t,re]),oe=(0,D.useCallback)(()=>{if(!p||!ve(s))return;let e=p.getValue(),n=p.getAlternativeVersionId(),i=Le(s)?.mtimeMs??de(s);f.mutate({path:t,content:e,expected_mtime_ms:i},{onSuccess:e=>re(n,e.mtime_ms),onError:t=>{t instanceof c&&t.status===409&&t.code===`stale_file`?(l.refetch().then(e=>{e.data&&e.data.content!==null&&Fe(s,{content:e.data.content,mtimeMs:e.data.mtime_ms})}),r.error(`File changed on disk (probably the agent)`,{description:`Nothing was written — your unsaved version is intact.`,duration:1/0,action:{label:`Reload`,onClick:()=>ie()},cancel:{label:`Overwrite`,onClick:()=>ae(e,n)}})):r.error(t instanceof Error?t.message:`Save failed`)}})},[p,s,f,t,re,ie,ae]),se=(0,D.useRef)(oe);se.current=oe,(0,D.useEffect)(()=>y(v(e,t,i),()=>se.current()),[e,t,i]);let ce=(0,D.useCallback)(()=>{let n=b.current,r=S.current;i===void 0&&(!n||!r||r.session!==e||r.path!==t||(n.revealLineInCenter(r.line),n.setPosition({lineNumber:r.line,column:r.column??1}),n.focus()))},[e,t,i]),le=(0,D.useCallback)(e=>{b.current=e,Ve(e,{onSave:()=>se.current()}),ce()},[ce]);(0,D.useEffect)(()=>{ce()},[n,p,ce]);let ue=(0,D.useCallback)(()=>{ie()},[ie]),T=(0,D.useCallback)(()=>{p&&ae(p.getValue(),p.getAlternativeVersionId())},[p,ae]),fe,pe=null;l.data?.binary?fe=`binary`:l.error?l.error instanceof c&&l.error.status===413?fe=`too-large`:(fe=`error`,pe=l.error instanceof Error?l.error.message:`Failed to load file`):fe=p?`ready`:`loading`;let ye=te&&w.savedElsewhere?`saved-elsewhere`:te&&w.dirtyElsewhere?`dirty-elsewhere`:null;return{status:fe,errorMessage:pe,model:p,dirty:te,restoredNotice:h,discardRestore:ue,peerBadge:ye,conflict:ne,takeDisk:ie,keepMine:T,save:oe,onMount:le}}function Ue({message:e,session:t,path:n,root:i,download:a}){return(0,O.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 bg-ground text-sm text-fg-muted`,children:[(0,O.jsx)(`span`,{children:e}),a&&(0,O.jsxs)(`button`,{type:`button`,onClick:()=>void h(t,n,i).catch(e=>r.error(e instanceof Error?e.message:`Download failed`)),className:`flex items-center gap-1.5 text-fg-secondary transition-colors hover:text-fg`,children:[(0,O.jsx)(Ae,{className:`size-4`}),`Download`]})]})}function We({session:e,path:t,reveal:n,root:r}){let i=oe(),a=He(e,t,n,r),o=(0,D.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if(a.status===`binary`)return(0,O.jsx)(Ue,{message:`Binary file — use Download`,session:e,path:t,root:r,download:!0});if(a.status===`too-large`)return(0,O.jsx)(Ue,{message:`File too large to edit — use Download`,session:e,path:t,root:r,download:!0});if(a.status===`error`)return(0,O.jsx)(Ue,{message:a.errorMessage??`Failed to load file`,session:e,path:t,root:r});if(a.conflict&&a.model)return(0,O.jsx)(je,{session:e,path:t,conflict:a.conflict,model:a.model,onTakeDisk:a.takeDisk,onKeepMine:a.keepMine,onSave:a.save});let s=a.peerBadge===`saved-elsewhere`?`Saved in another window`:a.peerBadge===`dirty-elsewhere`?`Also being edited in another window`:null;return(0,O.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[a.restoredNotice&&(0,O.jsxs)(`div`,{className:`flex items-center gap-3 bg-elevated px-3 py-1.5 text-xs text-fg-secondary`,children:[(0,O.jsx)(`span`,{children:`Restored unsaved changes`}),(0,O.jsx)(`button`,{type:`button`,onClick:a.discardRestore,className:`text-fg-muted transition-colors hover:text-fg`,children:`Discard`})]}),s&&(0,O.jsx)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:s}),(0,O.jsx)(`div`,{className:`min-h-0 flex-1`,children:a.model&&(0,O.jsx)(fe,{path:a.model.uri.toString(),defaultValue:a.model.getValue(),theme:`puddle`,keepCurrentModel:!0,onMount:e=>a.onMount(e),loading:(0,O.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),options:{automaticLayout:!0,fontFamily:o,fontSize:i.editorFontSize,tabSize:i.editorTabSize,wordWrap:i.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function k({children:e}){return(0,O.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-xs text-fg-muted`,children:e})}function Ge(e,t){let n=(0,D.useRef)(t);n.current=t,(0,D.useEffect)(()=>(ye(e),()=>{n.current?.(),T(e)}),[e])}function Ke(e,t,n,r){let i=r.split(`/`).map(encodeURIComponent).join(`/`);return`${e}://${encodeURIComponent(t)}/${encodeURIComponent(n)}/${i}`}function qe({session:e,refName:t,path:n,content:r}){let i=oe(),a=(0,D.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,O.jsx)(fe,{path:Ke(`puddle-view`,e,t,n),defaultValue:r,theme:be,loading:(0,O.jsx)(k,{children:`…`}),options:{readOnly:!0,automaticLayout:!0,fontFamily:a,fontSize:i.editorFontSize,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function Je({session:e,against:t,path:n,root:r}){let i=p(e,t,n,{root:r});return i.isPending?(0,O.jsx)(k,{children:`…`}):i.error?(0,O.jsx)(k,{children:i.error instanceof Error?i.error.message:`Failed to load`}):i.data.binary?(0,O.jsx)(k,{children:`Binary file — deleted`}):(0,O.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,O.jsx)(`div`,{className:`bg-surface px-4 py-1 text-xs text-fg-muted`,children:`Deleted`}),(0,O.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,O.jsx)(qe,{session:e,refName:t,path:n,content:i.data.content??``})})]})}function Ye({session:e,against:t,path:n,basePath:r,root:i}){let a=oe(),o=He(e,n,null,i),s=p(e,t,r,{root:i}),l=(0,D.useRef)(null);Ge(E(e,n),()=>{let e=l.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),l.current=null});let u=(0,D.useRef)(o.save);u.current=o.save;let d=(0,D.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),f=s.error instanceof c&&s.error.status===404;return o.status===`binary`||s.data?.binary?(0,O.jsx)(k,{children:`Binary file`}):o.status===`too-large`?(0,O.jsx)(k,{children:`File too large to show`}):o.status===`error`?(0,O.jsx)(k,{children:o.errorMessage??`Failed to load file`}):f?(0,O.jsx)(We,{session:e,path:n,reveal:null}):s.isPending||!o.model?(0,O.jsx)(k,{children:`…`}):s.error?(0,O.jsx)(k,{children:s.error instanceof Error?s.error.message:`Failed to load base`}):(0,O.jsx)(pe,{modifiedModelPath:o.model.uri.toString(),originalModelPath:Ke(`puddle-base`,e,t,r),original:s.data.content??``,language:o.model.getLanguageId(),theme:be,keepCurrentModifiedModel:!0,loading:(0,O.jsx)(k,{children:`…`}),onMount:e=>{l.current=e,e.onDidDispose(()=>{l.current=null}),e.getModifiedEditor().addCommand(le.CtrlCmd|ue.KeyS,()=>u.current())},options:{readOnly:!1,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:d,fontSize:a.editorFontSize,wordWrap:a.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function Xe({session:e,path:t,root:n}){return Ge(E(e,t,n)),(0,O.jsx)(We,{session:e,path:t,reveal:null,root:n})}function Ze({session:e,against:t,entry:n,root:r}){switch(n.status){case`added`:return(0,O.jsx)(Xe,{session:e,path:n.path,root:r});case`deleted`:return(0,O.jsx)(Je,{session:e,against:t,path:n.path,root:r});case`modified`:case`renamed`:return(0,O.jsx)(Ye,{session:e,against:t,path:n.path,basePath:n.old_path??n.path,root:r});default:return null}}function Qe({session:e,sha:t,path:n}){let r=p(e,t,n);return r.isPending?(0,O.jsx)(k,{children:`…`}):r.error?(0,O.jsx)(k,{children:r.error instanceof Error?r.error.message:`Failed to load file`}):r.data.binary?(0,O.jsx)(k,{children:`Binary file`}):(0,O.jsx)(qe,{session:e,refName:t,path:n,content:r.data.content??``})}function $e({session:e,originalRef:t,originalPath:n,originalContent:r,modifiedRef:i,modifiedPath:a,modifiedContent:o}){let s=oe(),c=(0,D.useRef)(null),l=(0,D.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,D.useEffect)(()=>()=>{let e=c.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),t?.modified.dispose(),c.current=null},[]),(0,O.jsx)(pe,{originalModelPath:Ke(`puddle-hist-orig`,e,t,n),modifiedModelPath:Ke(`puddle-hist-mod`,e,i,a),original:r,modified:o,theme:be,keepCurrentOriginalModel:!0,keepCurrentModifiedModel:!0,loading:(0,O.jsx)(k,{children:`…`}),onMount:e=>{c.current=e,e.onDidDispose(()=>{c.current=null})},options:{readOnly:!0,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:l,fontSize:s.editorFontSize,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function et({session:e,sha:t,path:n,basePath:r}){let i=p(e,`${t}^`,r),a=p(e,t,n);return i.error instanceof c&&i.error.status===404?(0,O.jsx)(Qe,{session:e,sha:t,path:n}):i.isPending||a.isPending?(0,O.jsx)(k,{children:`…`}):i.error?(0,O.jsx)(k,{children:i.error instanceof Error?i.error.message:`Failed to load original`}):a.error?(0,O.jsx)(k,{children:a.error instanceof Error?a.error.message:`Failed to load file`}):i.data.binary||a.data.binary?(0,O.jsx)(k,{children:`Binary file`}):(0,O.jsx)($e,{session:e,originalRef:`${t}^`,originalPath:r,originalContent:i.data.content??``,modifiedRef:t,modifiedPath:n,modifiedContent:a.data.content??``})}function tt({session:e,sha:t,entry:n,isRootCommit:r}){switch(_(n.status,r)){case`added`:return(0,O.jsx)(Qe,{session:e,sha:t,path:n.path});case`deleted`:return(0,O.jsx)(Je,{session:e,against:`${t}^`,path:n.path});case`modified`:case`renamed`:return(0,O.jsx)(et,{session:e,sha:t,path:n.path,basePath:n.old_path??n.path});default:return null}}function nt({session:e,sha:t,path:n,root:r}){let i=C(e,t,r);if(i.isPending)return(0,O.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading commit…`});if(i.error)return(0,O.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:i.error instanceof Error?i.error.message:`Failed to load commit`});let a=i.data.files.find(e=>e.path===n);return a?(0,O.jsx)(`div`,{className:`h-full`,children:(0,O.jsx)(tt,{session:e,sha:t,entry:a,isRootCommit:i.data.parents.length===0})}):(0,O.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[(0,O.jsx)(`span`,{className:`text-fg-secondary`,children:n}),` is not part of`,` `,(0,O.jsx)(`span`,{className:`font-mono`,children:t.slice(0,7)}),`.`]})}function rt({session:e,path:t,root:n}){let r=l(e,{root:n});if(r.isPending)return(0,O.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading diff…`});if(r.error)return(0,O.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:r.error instanceof Error?r.error.message:`Failed to load diff`});let i=r.data.entries.find(e=>e.path===t);return i?(0,O.jsx)(`div`,{className:`h-full`,children:(0,O.jsx)(Ze,{session:e,against:r.data.against,entry:i,root:n})}):(0,O.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[`No changes to `,(0,O.jsx)(`span`,{className:`mx-1 text-fg-secondary`,children:t}),` against the base.`]})}var it=800;function at({name:e}){let t=oe(),n=i(),a=g(n,e),s=o(`editor.save`),c=(0,D.useRef)(null),l=(0,D.useRef)(null),u=(0,D.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if((0,D.useEffect)(()=>{if(n===null)return;let t=ce(t=>{S(n,e,t).catch(e=>r.error(e instanceof Error?e.message:`Draft not saved`))},it);return l.current=t,()=>{t.flush(),l.current=null}},[n,e]),n===null)return null;if(a.error)return(0,O.jsx)(`div`,{className:`flex h-full items-center justify-center bg-ground text-sm text-fg-muted`,children:a.error instanceof Error?a.error.message:`Failed to load the draft`});if(a.data===void 0)return(0,O.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`});let d=()=>{let t=c.current;t&&(l.current?.flush(),x({name:e,content:t.getValue()}))};return(0,O.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[(0,O.jsxs)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:[`Draft — not in any worktree; `,s,` saves it into one`]}),(0,O.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,O.jsx)(fe,{path:`puddle-untitled://${n}/${e}`,defaultValue:a.data.content,theme:be,keepCurrentModel:!1,loading:(0,O.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),onMount:t=>{c.current=t,m(e,t.getValue()),Ve(t,{onSave:d})},onChange:t=>{let n=t??``;m(e,n),l.current?.(n)},options:{automaticLayout:!0,fontFamily:u,fontSize:t.editorFontSize,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1,wordWrap:t.editorWordWrap?`on`:`off`}})})]})}function ot(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function st(e){if(Array.isArray(e))return e}function ct(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function lt(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ut(e,t){return st(e)||ct(e,t)||dt(e,t)||lt()}function dt(e,t){if(e){if(typeof e==`string`)return ot(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ot(e,t):void 0}}var ft=Object.entries,pt=Object.setPrototypeOf,mt=Object.isFrozen,ht=Object.getPrototypeOf,gt=Object.getOwnPropertyDescriptor,_t=Object.freeze,vt=Object.seal,yt=Object.create,bt=typeof Reflect<`u`&&Reflect,xt=bt.apply,St=bt.construct;_t||=function(e){return e},vt||=function(e){return e},xt||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},St||=function(e){return new e(...[...arguments].slice(1))};var Ct=Ut(Array.prototype.forEach),wt=Ut(Array.prototype.lastIndexOf),Tt=Ut(Array.prototype.pop),Et=Ut(Array.prototype.push),Dt=Ut(Array.prototype.splice),Ot=Array.isArray,kt=Ut(String.prototype.toLowerCase),At=Ut(String.prototype.toString),jt=Ut(String.prototype.match),Mt=Ut(String.prototype.replace),Nt=Ut(String.prototype.indexOf),Pt=Ut(String.prototype.trim),Ft=Ut(Number.prototype.toString),It=Ut(Boolean.prototype.toString),Lt=typeof BigInt>`u`?null:Ut(BigInt.prototype.toString),Rt=typeof Symbol>`u`?null:Ut(Symbol.prototype.toString),zt=Ut(Object.prototype.hasOwnProperty),Bt=Ut(Object.prototype.toString),Vt=Ut(RegExp.prototype.test),Ht=Wt(TypeError);function Ut(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return xt(e,t,n)}}function Wt(e){return function(){return St(e,[...arguments])}}function A(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:kt;if(pt&&pt(e,null),!Ot(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(mt(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Gt(e){for(let t=0;t<e.length;t++)zt(e,t)||(e[t]=null);return e}function Kt(e){let t=yt(null);for(let r of ft(e)){var n=ut(r,2);let i=n[0],a=n[1];zt(e,i)&&(Ot(a)?t[i]=Gt(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=Kt(a):t[i]=a)}return t}function qt(e){switch(typeof e){case`string`:return e;case`number`:return Ft(e);case`boolean`:return It(e);case`bigint`:return Lt?Lt(e):`0`;case`symbol`:return Rt?Rt(e):`Symbol()`;case`undefined`:return Bt(e);case`function`:case`object`:{if(e===null)return Bt(e);let t=e,n=Jt(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Bt(e)}return Bt(e)}default:return Bt(e)}}function Jt(e,t){for(;e!==null;){let n=gt(e,t);if(n){if(n.get)return Ut(n.get);if(typeof n.value==`function`)return Ut(n.value)}e=ht(e)}function n(){return null}return n}function Yt(e){try{return Vt(e,``),!0}catch{return!1}}var Xt=_t(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Zt=_t(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Qt=_t([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),$t=_t([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),en=_t(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),tn=_t([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),nn=_t([`#text`]),rn=_t(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),an=_t(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),on=_t(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),sn=_t([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),cn=vt(/{{[\w\W]*|^[\w\W]*}}/g),ln=vt(/<%[\w\W]*|^[\w\W]*%>/g),un=vt(/\${[\w\W]*/g),dn=vt(/^data-[\-\w.\u00B7-\uFFFF]+$/),fn=vt(/^aria-[\-\w]+$/),pn=vt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),mn=vt(/^(?:\w+script|data):/i),hn=vt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),gn=vt(/^html$/i),_n=vt(/^[a-z][.\w]*(-[.\w]+)+$/i),vn=vt(/<[/\w!]/g),yn=vt(/<[/\w]/g),bn=vt(/<\/no(script|embed|frames)/i),xn=vt(/\/>/i),Sn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Cn=function(){return typeof window>`u`?null:window},wn=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Tn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},En=function(e,t,n,r){return zt(e,t)&&Ot(e[t])?A(r.base?Kt(r.base):{},e[t],r.transform):n};function Dn(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Cn(),t=e=>Dn(e);if(t.version=`3.4.12`,t.removed=[],!e||!e.document||e.document.nodeType!==Sn.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Jt(d,`cloneNode`),p=Jt(d,`remove`),m=Jt(d,`nextSibling`),h=Jt(d,`childNodes`),g=Jt(d,`parentNode`),_=Jt(d,`shadowRoot`),v=Jt(d,`attributes`),y=o&&o.prototype?Jt(o.prototype,`nodeType`):null,b=o&&o.prototype?Jt(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S=``,C,ee=!1,te=0,w=function(){if(te>0)throw Ht(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},ne=function(e){w(),te++;try{return x.createHTML(e)}finally{te--}},re=function(e){w(),te++;try{return x.createScriptURL(e)}finally{te--}},ie=function(){return ee||=(C=wn(u,i),!0),C},ae=n,oe=ae.implementation,se=ae.createNodeIterator,ce=ae.createDocumentFragment,le=ae.getElementsByTagName,ue=r.importNode,T=Tn();t.isSupported=typeof ft==`function`&&typeof g==`function`&&oe&&oe.createHTMLDocument!==void 0;let de=cn,fe=ln,pe=un,me=dn,he=fn,ge=mn,_e=hn,ve=_n,ye=pn,E=null,be=A({},[...Xt,...Zt,...Qt,...en,...nn]),xe=null,Se=A({},[...rn,...an,...on,...sn]),Ce=Object.seal(yt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),we=null,Te=null,Ee=Object.seal(yt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),De=!0,Oe=!0,ke=!1,Ae=!0,D=!1,O=!0,je=!1,Me=!1,Ne=null,Pe=null,Fe=!1,Ie=!1,Le=!1,Re=!1,ze=!0,Be=!1,Ve=`user-content-`,He=!0,Ue=!1,We={},k=null,Ge=A({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ke=null,qe=A({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Je=null,Ye=A({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Xe=`http://www.w3.org/1998/Math/MathML`,Ze=`http://www.w3.org/2000/svg`,Qe=`http://www.w3.org/1999/xhtml`,$e=Qe,et=!1,tt=null,nt=A({},[Xe,Ze,Qe],At),rt=_t([`mi`,`mo`,`mn`,`ms`,`mtext`]),it=A({},rt),at=_t([`annotation-xml`]),ot=A({},at),st=A({},[`title`,`style`,`font`,`a`,`script`]),ct=null,lt=[`application/xhtml+xml`,`text/html`],ut=null,dt=null,pt=n.createElement(`form`),mt=function(e){return e instanceof RegExp||e instanceof Function},ht=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(dt&&dt===e)return;(!e||typeof e!=`object`)&&(e={}),e=Kt(e),ct=lt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,ut=ct===`application/xhtml+xml`?At:kt,E=En(e,`ALLOWED_TAGS`,be,{transform:ut}),xe=En(e,`ALLOWED_ATTR`,Se,{transform:ut}),tt=En(e,`ALLOWED_NAMESPACES`,nt,{transform:At}),Je=En(e,`ADD_URI_SAFE_ATTR`,Ye,{transform:ut,base:Ye}),Ke=En(e,`ADD_DATA_URI_TAGS`,qe,{transform:ut,base:qe}),k=En(e,`FORBID_CONTENTS`,Ge,{transform:ut}),we=En(e,`FORBID_TAGS`,Kt({}),{transform:ut}),Te=En(e,`FORBID_ATTR`,Kt({}),{transform:ut}),We=zt(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Kt(e.USE_PROFILES):e.USE_PROFILES:!1,De=e.ALLOW_ARIA_ATTR!==!1,Oe=e.ALLOW_DATA_ATTR!==!1,ke=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ae=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,D=e.SAFE_FOR_TEMPLATES||!1,O=e.SAFE_FOR_XML!==!1,je=e.WHOLE_DOCUMENT||!1,Ie=e.RETURN_DOM||!1,Le=e.RETURN_DOM_FRAGMENT||!1,Re=e.RETURN_TRUSTED_TYPE||!1,Fe=e.FORCE_BODY||!1,ze=e.SANITIZE_DOM!==!1,Be=e.SANITIZE_NAMED_PROPS||!1,He=e.KEEP_CONTENT!==!1,Ue=e.IN_PLACE||!1,ye=Yt(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:pn,$e=typeof e.NAMESPACE==`string`?e.NAMESPACE:Qe,it=zt(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?Kt(e.MATHML_TEXT_INTEGRATION_POINTS):A({},rt),ot=zt(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?Kt(e.HTML_INTEGRATION_POINTS):A({},at);let t=zt(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?Kt(e.CUSTOM_ELEMENT_HANDLING):yt(null);if(Ce=yt(null),zt(t,`tagNameCheck`)&&mt(t.tagNameCheck)&&(Ce.tagNameCheck=t.tagNameCheck),zt(t,`attributeNameCheck`)&&mt(t.attributeNameCheck)&&(Ce.attributeNameCheck=t.attributeNameCheck),zt(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(Ce.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),vt(Ce),D&&(Oe=!1),Le&&(Ie=!0),We&&(E=A({},nn),xe=yt(null),We.html===!0&&(A(E,Xt),A(xe,rn)),We.svg===!0&&(A(E,Zt),A(xe,an),A(xe,sn)),We.svgFilters===!0&&(A(E,Qt),A(xe,an),A(xe,sn)),We.mathMl===!0&&(A(E,en),A(xe,on),A(xe,sn))),Ee.tagCheck=null,Ee.attributeCheck=null,zt(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?Ee.tagCheck=e.ADD_TAGS:Ot(e.ADD_TAGS)&&(E===be&&(E=Kt(E)),A(E,e.ADD_TAGS,ut))),zt(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?Ee.attributeCheck=e.ADD_ATTR:Ot(e.ADD_ATTR)&&(xe===Se&&(xe=Kt(xe)),A(xe,e.ADD_ATTR,ut))),zt(e,`ADD_URI_SAFE_ATTR`)&&Ot(e.ADD_URI_SAFE_ATTR)&&A(Je,e.ADD_URI_SAFE_ATTR,ut),zt(e,`FORBID_CONTENTS`)&&Ot(e.FORBID_CONTENTS)&&(k===Ge&&(k=Kt(k)),A(k,e.FORBID_CONTENTS,ut)),zt(e,`ADD_FORBID_CONTENTS`)&&Ot(e.ADD_FORBID_CONTENTS)&&(k===Ge&&(k=Kt(k)),A(k,e.ADD_FORBID_CONTENTS,ut)),He&&(E[`#text`]=!0),je&&A(E,[`html`,`head`,`body`]),E.table&&(A(E,[`tbody`]),delete we.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Ht(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Ht(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=x;x=e.TRUSTED_TYPES_POLICY;try{S=ne(``)}catch(e){throw x=t,e}}else e.TRUSTED_TYPES_POLICY===null?(x=void 0,S=``):(x===void 0&&(x=ie()),x&&typeof S==`string`&&(S=ne(``)));_t&&_t(e),dt=e},gt=A({},[...Zt,...Qt,...$t]),bt=A({},[...en,...tn]),xt=function(e,t,n){return t.namespaceURI===Qe?e===`svg`:t.namespaceURI===Xe?e===`svg`&&(n===`annotation-xml`||it[n]):!!gt[e]},St=function(e,t,n){return t.namespaceURI===Qe?e===`math`:t.namespaceURI===Ze?e===`math`&&ot[n]:!!bt[e]},Ft=function(e,t,n){return t.namespaceURI===Ze&&!ot[n]||t.namespaceURI===Xe&&!it[n]?!1:!bt[e]&&(st[e]||!gt[e])},It=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:$e,tagName:`template`});let n=kt(e.tagName),r=kt(t.tagName);return tt[e.namespaceURI]?e.namespaceURI===Ze?xt(n,t,r):e.namespaceURI===Xe?St(n,t,r):e.namespaceURI===Qe?Ft(n,t,r):!!(ct===`application/xhtml+xml`&&tt[e.namespaceURI]):!1},Lt=function(e){Et(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw Ht(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},Rt=function(e){Wt(e);let t=h(e);if(t){let e=[];Ct(t,t=>{Et(e,t)}),Ct(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},Bt=function(e,n){try{Et(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{Et(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(Ie||Le)try{Lt(n)}catch{}else try{n.setAttribute(e,``)}catch{}},Ut=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||xe[ut(i)]))try{e.removeAttribute(i)}catch{}}},Wt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===Sn.element&&Ut(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},Gt=function(e){if(!O)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=y?y(e):e.nodeType;if(n===Sn.processingInstruction||n===Sn.comment&&Vt(yn,e.data)){try{p(e)}catch{}continue}if(n===Sn.element){let t=e,n=ut(b?b(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&n!==`label`&&n!==`output`&&t.removeAttribute(`for`)}catch{}}let r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},On=function(e){let t=null,r=null;if(Fe)e=`<remove></remove>`+e;else{let t=jt(e,/^[\r\n\t ]+/);r=t&&t[0]}ct===`application/xhtml+xml`&&$e===Qe&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?ne(e):e;if($e===Qe)try{t=new l().parseFromString(i,ct)}catch{}if(!t||!t.documentElement){t=oe.createDocument($e,`template`,null);try{t.documentElement.innerHTML=et?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),$e===Qe?le.call(t,je?`html`:`body`)[0]:je?t.documentElement:a},kn=function(e){return se.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},An=function(e){return e=Mt(e,de,` `),e=Mt(e,fe,` `),e=Mt(e,pe,` `),e},jn=function(e){e.normalize();let t=se.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=An(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&Ct(r,e=>{Nn(e.content)&&jn(e.content)})},Mn=function(e){let t=b?b(e):null;return typeof t!=`string`||ut(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},Nn=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===Sn.documentFragment}catch{return!1}},j=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function Pn(e,n,r){e.length!==0&&Ct(e,e=>{e.call(t,n,r,dt)})}let Fn=function(e,t){return!!(O&&e.hasChildNodes()&&!j(e.firstElementChild)&&Vt(vn,e.textContent)&&Vt(vn,e.innerHTML)||O&&e.namespaceURI===Qe&&t===`style`&&j(e.firstElementChild)||e.nodeType===Sn.processingInstruction||O&&e.nodeType===Sn.comment&&Vt(yn,e.data))},In=function(e,t){if(!we[t]&&Bn(t)&&(Ce.tagNameCheck instanceof RegExp&&Vt(Ce.tagNameCheck,t)||Ce.tagNameCheck instanceof Function&&Ce.tagNameCheck(t)))return!1;if(He&&!k[t]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=Ue?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return Lt(e),!0},Ln=function(e,n){if(Pn(T.beforeSanitizeElements,e,null),e!==n&&g(e)===null)return!0;if(Mn(e))return Lt(e),!0;let r=ut(b?b(e):e.nodeName);if(Pn(T.uponSanitizeElement,e,{tagName:r,allowedTags:E}),e!==n&&g(e)===null)return!0;if(Fn(e,r))return Lt(e),!0;if(we[r]||!(Ee.tagCheck instanceof Function&&Ee.tagCheck(r))&&!E[r]){let t=In(e,r);return t===!1&&Pn(T.afterSanitizeElements,e,null),t}if((y?y(e):e.nodeType)===Sn.element&&!It(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Vt(bn,e.innerHTML))return Lt(e),!0;if(D&&e.nodeType===Sn.text){let n=An(e.textContent);e.textContent!==n&&(Et(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Pn(T.afterSanitizeElements,e,null),!1},Rn=function(e,t,r){if(Te[t]||O&&t===`patchsrc`||O&&t===`for`&&e!==`label`&&e!==`output`||ze&&(t===`id`||t===`name`)&&(r in n||r in pt))return!1;let i=xe[t]||Ee.attributeCheck instanceof Function&&Ee.attributeCheck(t,e);if(!(Oe&&Vt(me,t))&&!(De&&Vt(he,t))){if(!i){if(!(Bn(e)&&(Ce.tagNameCheck instanceof RegExp&&Vt(Ce.tagNameCheck,e)||Ce.tagNameCheck instanceof Function&&Ce.tagNameCheck(e))&&(Ce.attributeNameCheck instanceof RegExp&&Vt(Ce.attributeNameCheck,t)||Ce.attributeNameCheck instanceof Function&&Ce.attributeNameCheck(t,e))||t===`is`&&Ce.allowCustomizedBuiltInElements&&(Ce.tagNameCheck instanceof RegExp&&Vt(Ce.tagNameCheck,r)||Ce.tagNameCheck instanceof Function&&Ce.tagNameCheck(r))))return!1}else if(!Je[t]&&!Vt(ye,Mt(r,_e,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Nt(r,`data:`)===0&&Ke[e])&&!(ke&&!Vt(ge,Mt(r,_e,``)))&&r)return!1}return!0},zn=A({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Bn=function(e){return!zn[kt(e)]&&Vt(ve,e)},Vn=function(e,t,n,r){if(x&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return ne(r);case`TrustedScriptURL`:return re(r)}return r},Hn=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),Mn(e)?Lt(e):Tt(t.removed)}catch{Bt(n,e)}},Un=function(e){Pn(T.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||Mn(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:xe,forceKeepAttr:void 0},r=t.length,i=ut(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=ut(o),u=c,d=o===`value`?u:Pt(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,Pn(T.uponSanitizeAttribute,e,n),d=n.attrValue,Be&&(l===`id`||l===`name`)&&Nt(d,Ve)!==0&&(Bt(o,e),d=Ve+d),O&&Vt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){Bt(o,e);continue}if(l===`attributename`&&jt(d,`href`)){Bt(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){Bt(o,e);continue}if(!Ae&&Vt(xn,d)){Bt(o,e);continue}if(D&&(d=An(d)),!Rn(i,l,d)){Bt(o,e);continue}d=Vn(i,l,s,d),d!==u&&Hn(e,o,s,d)}}Pn(T.afterSanitizeAttributes,e,null)},Wn=function(e){let t=null,n=kn(e);for(Pn(T.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Pn(T.uponSanitizeShadowNode,t,null),Ln(t,e),Un(t),Nn(t.content)&&Wn(t.content),(y?y(t):t.nodeType)===Sn.element){let e=_(t);Nn(e)&&(Gn(e),Wn(e))}Pn(T.afterSanitizeShadowDOM,e,null)},Gn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Wn(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===Sn.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&ut(e)===`template`){let e=n.content;Nn(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);Nn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(et=!e,et&&(e=`<!-->`),typeof e!=`string`&&!j(e)&&(e=qt(e),typeof e!=`string`))throw Ht(`dirty is not a string, aborting`);if(!t.isSupported)return e;Me?(E=Ne,xe=Pe):ht(n),(T.uponSanitizeElement.length>0||T.uponSanitizeAttribute.length>0)&&(E=Kt(E)),T.uponSanitizeAttribute.length>0&&(xe=Kt(xe)),t.removed=[];let c=Ue&&typeof e!=`string`&&j(e);if(c){Gt(e);let t=b?b(e):e.nodeName;if(typeof t==`string`){let n=ut(t);if(!E[n]||we[n])throw Rt(e),Ht(`root node is forbidden and cannot be sanitized in-place`)}if(Mn(e))throw Rt(e),Ht(`root node is clobbered and cannot be sanitized in-place`);try{Gn(e)}catch(t){throw Rt(e),t}}else if(j(e))i=On(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Sn.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Gn(a);else{if(!Ie&&!D&&!je&&e.indexOf(`<`)===-1)return x&&Re?ne(e):e;if(i=On(e),!i)return Ie?null:Re?S:``}i&&Fe&&Lt(i.firstChild);let l=c?e:i,u=kn(l);try{for(;o=u.nextNode();)Ln(o,l),Un(o),Nn(o.content)&&Wn(o.content)}catch(n){throw c&&(Rt(e),Ct(t.removed,e=>{e.element&&Wt(e.element)})),n}if(c)return Ct(t.removed,e=>{e.element&&Wt(e.element)}),D&&jn(e),e;if(Ie){if(D&&jn(i),Le)for(s=ce.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(xe.shadowroot||xe.shadowrootmode)&&(s=ue.call(r,s,!0)),s}let d=je?i.outerHTML:i.innerHTML;return je&&E[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Vt(gn,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
3
3
  `+d),D&&(d=An(d)),x&&Re?ne(d):d},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ht(e),Me=!0,Ne=E,Pe=xe},t.clearConfig=function(){dt=null,Me=!1,Ne=null,Pe=null,x=C,S=``},t.isValidAttribute=function(e,t,n){dt||ht({});let r=ut(e),i=ut(t);return Rn(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&zt(T,e)&&Et(T[e],t)},t.removeHook=function(e,t){if(zt(T,e)){if(t!==void 0){let n=wt(T[e],t);return n===-1?void 0:Dt(T[e],n,1)[0]}return Tt(T[e])}},t.removeHooks=function(e){zt(T,e)&&(T[e]=[])},t.removeAllHooks=function(){T=Tn()},t}var On=Dn();function kn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var An=kn();function jn(e){An=e}var Mn={exec:()=>null};function Nn(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function j(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(Fn.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Pn=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),Fn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Nn(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Nn(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Nn(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Nn(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Nn(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:Nn(e=>RegExp(`^ {0,${e}}>`))},In=/^(?:[ \t]*(?:\n|$))+/,Ln=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Rn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,zn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Bn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Vn=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Hn=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Un=j(Hn).replace(/bull/g,Vn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Wn=j(Hn).replace(/bull/g,Vn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Gn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Kn=/^[^\n]+/,qn=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Jn=j(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,qn).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Yn=j(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Vn).getRegex(),Xn=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Zn=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Qn=j(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Zn).replace(`tag`,Xn).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),$n=e=>j(Gn).replace(`hr`,zn).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Xn).getRegex(),er=$n(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),tr=$n(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),nr={blockquote:j(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,tr).getRegex(),code:Ln,def:Jn,fences:Rn,heading:Bn,hr:zn,html:Qn,lheading:Un,list:Yn,newline:In,paragraph:er,table:Mn,text:Kn},rr=j(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,zn).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Xn).getRegex(),ir={...nr,lheading:Wn,table:rr,paragraph:j(Gn).replace(`hr`,zn).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,rr).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Xn).getRegex()},ar={...nr,html:j(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Zn).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Mn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:j(Gn).replace(`hr`,zn).replace(`heading`,` *#{1,6} *[^
4
4
  ]`).replace(`lheading`,Un).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},or=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,sr=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,cr=/^( {2,}|\\)\n(?!\s*$)/,lr=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ur=/[\p{P}\p{S}]/u,dr=/[\s\p{P}\p{S}]/u,fr=/[^\s\p{P}\p{S}]/u,pr=j(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,dr).getRegex(),mr=/(?!~)[\p{P}\p{S}]/u,hr=/(?!~)[\s\p{P}\p{S}]/u,gr=/(?:[^\s\p{P}\p{S}]|~)/u,_r=j(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Pn?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),vr=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,yr=j(vr,`u`).replace(/punct/g,ur).getRegex(),br=j(vr,`u`).replace(/punct/g,mr).getRegex(),xr=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Sr=j(xr,`gu`).replace(/notPunctSpace/g,fr).replace(/punctSpace/g,dr).replace(/punct/g,ur).getRegex(),Cr=j(xr,`gu`).replace(/notPunctSpace/g,gr).replace(/punctSpace/g,hr).replace(/punct/g,mr).getRegex(),wr=j(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,fr).replace(/punctSpace/g,dr).replace(/punct/g,ur).getRegex(),Tr=j(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,ur).getRegex(),Er=j(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,fr).replace(/punctSpace/g,dr).replace(/punct/g,ur).getRegex(),Dr=j(/\\(punct)/,`gu`).replace(/punct/g,ur).getRegex(),Or=j(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),kr=j(Zn).replace(`(?:-->|$)`,`-->`).getRegex(),Ar=j(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,kr).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),jr=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Mr=j(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,jr).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Nr=j(/^!?\[(label)\]\[(ref)\]/).replace(`label`,jr).replace(`ref`,qn).getRegex(),Pr=j(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,qn).getRegex(),Fr=j(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Nr).replace(`nolink`,Pr).getRegex(),Ir=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Lr={_backpedal:Mn,anyPunctuation:Dr,autolink:Or,blockSkip:_r,br:cr,code:sr,del:Mn,delLDelim:Mn,delRDelim:Mn,emStrongLDelim:yr,emStrongRDelimAst:Sr,emStrongRDelimUnd:wr,escape:or,link:Mr,nolink:Pr,punctuation:pr,reflink:Nr,reflinkSearch:Fr,tag:Ar,text:lr,url:Mn},Rr={...Lr,link:j(/^!?\[(label)\]\((.*?)\)/).replace(`label`,jr).getRegex(),reflink:j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,jr).getRegex()},zr={...Lr,emStrongRDelimAst:Cr,emStrongLDelim:br,delLDelim:Tr,delRDelim:Er,url:j(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Ir).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:j(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Ir).getRegex()},Br={...zr,br:j(cr).replace(`{2,}`,`*`).getRegex(),text:j(zr.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Vr={normal:nr,gfm:ir,pedantic:ar},Hr={normal:Lr,gfm:zr,breaks:Br,pedantic:Rr},Ur={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Wr=e=>Ur[e];function Gr(e,t){if(t){if(Fn.escapeTest.test(e))return e.replace(Fn.escapeReplace,Wr)}else if(Fn.escapeTestNoEncode.test(e))return e.replace(Fn.escapeReplaceNoEncode,Wr);return e}function Kr(e){try{e=encodeURI(e).replace(Fn.percentDecode,`%`)}catch{return null}return e}function qr(e,t){let n=e.replace(Fn.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Fn.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(Fn.slashPipe,`|`);return n}function Jr(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Yr(e){let t=e.split(`