@augmentd-labs/canvas-web 2.26.21 → 2.26.22

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 (108) hide show
  1. package/dist/assets/{DocumentBodyEditor-CE2S2X6g.js → DocumentBodyEditor-8DNmOBS0.js} +1 -1
  2. package/dist/assets/{DocumentIcon-BS10SIP6.js → DocumentIcon-x299QNu_.js} +1 -1
  3. package/dist/assets/{EditorOverlay-BUToR_av.js → EditorOverlay-Cv1MaTok.js} +1 -1
  4. package/dist/assets/{FileForm-BxTixeDm.js → FileForm-DhQhVnoi.js} +1 -1
  5. package/dist/assets/{FiltersApplet-DNYAQP5F.js → FiltersApplet-gbu4I1fK.js} +1 -1
  6. package/dist/assets/{HomeFab-CpTZdNyY.js → HomeFab-CXaEEzXy.js} +2 -2
  7. package/dist/assets/{IdentityFields-C2MPM-Ab.js → IdentityFields-OPEWPlZs.js} +1 -1
  8. package/dist/assets/{LensApplet-CRa1j2WP.js → LensApplet-FifF2RUs.js} +1 -1
  9. package/dist/assets/LinkToCard-nR7Lal_o.js +1 -0
  10. package/dist/assets/{MarkdownEditor-7OqSDr7E.js → MarkdownEditor-CNY-VmKb.js} +2 -2
  11. package/dist/assets/{MessageComposerDialog-DzLhkHyh.js → MessageComposerDialog-gbD0Gu_b.js} +1 -1
  12. package/dist/assets/{NextShell-D9gvlKY2.js → NextShell-BIYs9fCL.js} +1 -1
  13. package/dist/assets/{NotesApplet-CFK86JYj.js → NotesApplet-D94iQKg6.js} +1 -1
  14. package/dist/assets/ObjectPropertiesCard-ChvWbOpZ.js +8 -0
  15. package/dist/assets/{ObjectPropertiesCard-C3jt40tM.css → ObjectPropertiesCard-JArcZXXv.css} +1 -1
  16. package/dist/assets/{PathPickerField-cVs5sZuG.js → PathPickerField-DBe7jykL.js} +1 -1
  17. package/dist/assets/{PickDocumentsCard-BlicxMqC.js → PickDocumentsCard-Bo224P4q.js} +1 -1
  18. package/dist/assets/{SketchApplet-D8mkYmK9.js → SketchApplet-ADVOnSLI.js} +1 -1
  19. package/dist/assets/{SketchEditor-zMrm1npg.js → SketchEditor-CkgRysCG.js} +5 -5
  20. package/dist/assets/{TerminalApplet-BO2HRp0z.js → TerminalApplet-CkO4uaE3.js} +1 -1
  21. package/dist/assets/{TextDocumentEditor-7V4aFL8i.js → TextDocumentEditor-COvsHJXH.js} +1 -1
  22. package/dist/assets/{TodosApplet-swdaBT-2.js → TodosApplet-Bpf1OIH4.js} +1 -1
  23. package/dist/assets/{TodosWidget-BXF8fYer.js → TodosWidget-BIYqPXUp.js} +1 -1
  24. package/dist/assets/{UploadProgressList-B2xCVzFR.js → UploadProgressList-BXJr87lI.js} +1 -1
  25. package/dist/assets/{_agentId_-CHdTYJFu.js → _agentId_-wN8YJoTZ.js} +0 -0
  26. package/dist/assets/{_contextId_-m9zn5qav.js → _contextId_-CoJraYnP.js} +1 -1
  27. package/dist/assets/{_workspaceName_-D0z9E9Uy.js → _workspaceName_-CXuIfG46.js} +1 -1
  28. package/dist/assets/{about-pl0DXTEt.js → about-CT6Ghfkb.js} +1 -1
  29. package/dist/assets/{add-B30V-yHb.js → add-BzgCpo5S.js} +1 -1
  30. package/dist/assets/{agents-Bc7_wscP.js → agents-DIJpWCkc.js} +1 -1
  31. package/dist/assets/{agents-ClK3Y2x0.js → agents-DlLq0q2s.js} +1 -1
  32. package/dist/assets/{alert-dialog-DIA-tAP5.js → alert-dialog-izlVMXfa.js} +1 -1
  33. package/dist/assets/{api-tokens-O5iFESo0.js → api-tokens-DDH7LMJ7.js} +1 -1
  34. package/dist/assets/{appearance-DLo_2WH0.js → appearance-D1EpKWaK.js} +1 -1
  35. package/dist/assets/{applet-target-DnTa2VAT.js → applet-target-ChiiXVdC.js} +1 -1
  36. package/dist/assets/{apps-DzFFo5D0.js → apps-DX8oWukQ.js} +1 -1
  37. package/dist/assets/{auth-CUdpxbLV.js → auth-HZNJB4wv.js} +1 -1
  38. package/dist/assets/backend-sync-progress-BeI9mDEX.js +7 -0
  39. package/dist/assets/{button-Bv4zA1qr.js → button-SgR3GVvV.js} +1 -1
  40. package/dist/assets/content-app-view-DS6Nrz6M.js +1 -0
  41. package/dist/assets/{context-D_K4g9SQ.js → context-mfIOB8dN.js} +1 -1
  42. package/dist/assets/{contexts-CgydYDn-2.js → contexts-CRWqFXzJ2.js} +1 -1
  43. package/dist/assets/{contexts-B6d6Axza.js → contexts-Ef3fHwv6.js} +1 -1
  44. package/dist/assets/{date-time-picker-BZaA3M9_.js → date-time-picker-B6mkWt-g.js} +1 -1
  45. package/dist/assets/{devices-D3-_UWM0.js → devices-C3gLuNDv.js} +1 -1
  46. package/dist/assets/{document-BG_mODBn.js → document-CX543Kcz.js} +1 -1
  47. package/dist/assets/document-list-SsF3jmuq.js +2 -0
  48. package/dist/assets/{embedding-m8SZH4oN.js → embedding-BHnBCyUx.js} +1 -1
  49. package/dist/assets/{embedding-Cjrxh6MN.js → embedding-CEGjemkq.js} +1 -1
  50. package/dist/assets/{form-panel-Dz96K7Lv.js → form-panel-C34lByEH.js} +1 -1
  51. package/dist/assets/{home-C5IxNq_5.js → home-3vhobmCu.js} +1 -1
  52. package/dist/assets/index-CiBgHujl.js +16 -0
  53. package/dist/assets/{inferd-config-editor-DagMmwW4.js → inferd-config-editor-BHUUFArV.js} +1 -1
  54. package/dist/assets/{key-bindings-DomR6ZNC.js → key-bindings-BNeY-GEg.js} +1 -1
  55. package/dist/assets/{label-CNoJOoe0.js → label-Dn4gCMcc.js} +1 -1
  56. package/dist/assets/{lazy-editor-Cbva8Pe2.js → lazy-editor-BSRnneOo.js} +2 -2
  57. package/dist/assets/{logs-CdbfY8_H.js → logs-Czn2sPeP.js} +1 -1
  58. package/dist/assets/{offline-BjMpUv3N.js → offline-CsRyFUg7.js} +1 -1
  59. package/dist/assets/{page-header-GtTr9Ff_.js → page-header-DkOHw0g-.js} +1 -1
  60. package/dist/assets/{public-share-DT9Tgn_Y.js → public-share-DXxVwHKT.js} +1 -1
  61. package/dist/assets/{query-debug-tVbB_8Z6.js → query-debug-BUUG3jpK.js} +1 -1
  62. package/dist/assets/{registry-BgnkvPjl.js → registry-DTWAywyJ.js} +2 -2
  63. package/dist/assets/{remotes-DR_iJClb.js → remotes-CdEU1Y5l.js} +1 -1
  64. package/dist/assets/{roles-DERIgujv.js → roles-BYHLwWCD.js} +1 -1
  65. package/dist/assets/roles-BpVWTMmp.js +2 -0
  66. package/dist/assets/settings-DH3ZiQLR.js +14 -0
  67. package/dist/assets/{settings-DhoHM9AU.js → settings-DNhy58i9.js} +1 -1
  68. package/dist/assets/{settings-BXOyceZ3.js → settings-DjnFAqIe.js} +1 -1
  69. package/dist/assets/{settings-B4LC1yCH.js → settings-jWfP7CP8.js} +1 -1
  70. package/dist/assets/{share-target-CpjVaYVl.js → share-target-CgHlnZLH.js} +1 -1
  71. package/dist/assets/{shared-B824Ibpc.js → shared-BMoiShd9.js} +1 -1
  72. package/dist/assets/{shared-1dpCuibu.js → shared-D2uRUNdC.js} +1 -1
  73. package/dist/assets/sketch-lazy-pbG2cCpW.js +2 -0
  74. package/dist/assets/{subtree-transfer-dialog-B7s4r78T.js → subtree-transfer-dialog-ChBI5llU.js} +1 -1
  75. package/dist/assets/{text-documents-D_zDMyhB.js → text-documents-BvDFBVnC.js} +1 -1
  76. package/dist/assets/ui-Byg1cZDr.js +41 -0
  77. package/dist/assets/{use-applet-docs-Cry2SFsG.js → use-applet-docs-o5NAUFBk.js} +1 -1
  78. package/dist/assets/{use-applet-target-mkjQujx6.js → use-applet-target-cO-FiyPQ.js} +1 -1
  79. package/dist/assets/{use-canvas-pins-CZBfEB5E.js → use-canvas-pins-Bth_Q--t.js} +2 -2
  80. package/dist/assets/{use-menu-BVkqNEIx.js → use-menu-BiJ8N7sS.js} +1 -1
  81. package/dist/assets/use-settings-back-CQauYjQ4.js +1 -0
  82. package/dist/assets/{use-sortable-data-DYIDDI8c.js → use-sortable-data-BW_0sXBs.js} +1 -1
  83. package/dist/assets/{use-workspace-identity-BVpGHkZq.js → use-workspace-identity-mgaofjsD.js} +1 -1
  84. package/dist/assets/{useAddTarget-CVRPElxz.js → useAddTarget-DUjaZdBQ.js} +1 -1
  85. package/dist/assets/{useAgentModels-ndLotMWH.js → useAgentModels-Sa4N8WFd.js} +1 -1
  86. package/dist/assets/{useDocumentThumbnail-C_rq2rXs.js → useDocumentThumbnail-DYLCC63L.js} +1 -1
  87. package/dist/assets/{useEditNoteFields-Bigs9ZG8.js → useEditNoteFields-zHEWwDfB.js} +1 -1
  88. package/dist/assets/{users-C9N-O1QA.js → users-CKz9kOoR.js} +1 -1
  89. package/dist/assets/{workspace-CJ1PWQ29.js → workspace-DvxC7pw1.js} +1 -1
  90. package/dist/assets/{workspace-area-menu-Ba_9bGKs.js → workspace-area-menu-UamvRNfd.js} +1 -1
  91. package/dist/assets/{workspace-content-gate-D8bzGD9i.js → workspace-content-gate-Be4tLYiB.js} +1 -1
  92. package/dist/assets/{workspace-import-form-D5JA8gzx.js → workspace-import-form-BRwc_oVg.js} +1 -1
  93. package/dist/assets/{workspaces-Dx5_N57M.js → workspaces-Da_hUIj3.js} +1 -1
  94. package/dist/assets/{workspaces-BBgdfAM_.js → workspaces-gQY1mczH.js} +1 -1
  95. package/dist/index.html +36 -36
  96. package/dist/sw.js +1 -1
  97. package/package.json +2 -2
  98. package/dist/assets/LinkToCard-BZwwE-Dv.js +0 -1
  99. package/dist/assets/ObjectPropertiesCard-DDcRLpsW.js +0 -8
  100. package/dist/assets/backend-sync-progress-DWR42uQV.js +0 -7
  101. package/dist/assets/content-app-view-BUi8HG1r.js +0 -1
  102. package/dist/assets/document-list-BiogH4tf.js +0 -2
  103. package/dist/assets/index-DtZS4JJ4.js +0 -16
  104. package/dist/assets/roles-DswT1Lv0.js +0 -2
  105. package/dist/assets/settings-CUzf6xEQ.js +0 -14
  106. package/dist/assets/sketch-lazy-Q58-vPF-.js +0 -2
  107. package/dist/assets/ui-BSqPn1LJ.js +0 -41
  108. package/dist/assets/use-settings-back-Dk-DJEUO.js +0 -1
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{r}from"./chunk-62JRHF6Z-vspAGgtK.js";import{Bn as i,It as a,Xt as o,Yt as s,fr as c,rn as l,vn as u}from"./ui-BSqPn1LJ.js";import{H as d,ct as f}from"./workspace-CJ1PWQ29.js";import{n as p,r as m}from"./use-canvas-pins-CZBfEB5E.js";import{t as h}from"./useToastHelpers-CRrpIIdY.js";import{h as g}from"./index-DtZS4JJ4.js";import{t as _}from"./HomeFab-CpTZdNyY.js";var v=e(n(),1),y=t();function b(e){let t=`${e.workspaceName}\0${e.treeName}\0${e.path}`,[n,r]=(0,v.useState)(null);return(0,v.useEffect)(()=>{let n=!1;return f(e.workspaceName,e.treeName).then(i=>{n||r({key:t,node:d(i,e.path)})}).catch(()=>{n||r({key:t,node:null})}),()=>{n=!0}},[t,e.workspaceName,e.treeName,e.path]),!n||n.key!==t?{state:`loading`}:n.node?{state:`ready`,node:n.node}:{state:`missing`}}function x(e){let t=`/workspaces/${encodeURIComponent(e.workspaceName)}`,n=e.path.replace(/^\//,``);return e.treeName===`context`?`${t}/path/${n}`:`${t}/trees/${encodeURIComponent(e.treeName)}/path/${n}`}var S=`application/x-canvas-pin`;function C({pin:e,onUnpin:t,onMinimize:n,onDropPin:d}){let f=b(e),[p,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(null),C=!!d&&!p,w=e=>{let t=e.currentTarget.getBoundingClientRect();return e.clientX>t.left+t.width/2?`after`:`before`},T=C?{onDragOver:e=>{e.dataTransfer.types.includes(`application/x-canvas-pin`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,_(w(e)))},onDragLeave:()=>_(null),onDrop:t=>{let n=t.dataTransfer.getData(S);_(null),!(!n||n===e.id)&&(t.preventDefault(),d?.(n,w(t)===`after`))}}:{},E=f.state===`ready`?f.node:null,D=E?.label||e.label||e.path.split(`/`).filter(Boolean).pop()||`Canvas`,O=E?.color;return(0,v.useEffect)(()=>{if(!p)return;let e=e=>{e.key===`Escape`&&h(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p]),(0,y.jsxs)(`section`,{...T,className:p?`fixed inset-0 z-picker flex flex-col bg-background`:`flex flex-col rounded-(--card-radius) border bg-background overflow-hidden min-h-0 min-w-0 ${g?`ring-2 ring-primary/60`:``}`,children:[(0,y.jsxs)(`header`,{draggable:C,onDragStart:C?t=>{t.dataTransfer.setData(S,e.id),t.dataTransfer.effectAllowed=`move`}:void 0,className:`flex items-center gap-2 px-3 py-2 border-b bg-muted/20 shrink-0 min-w-0 ${C?`cursor-grab active:cursor-grabbing`:``}`,children:[C&&(0,y.jsx)(i,{className:`w-3.5 h-3.5 shrink-0 text-muted-foreground/60`,"aria-hidden":!0}),O&&(0,y.jsx)(`div`,{className:`w-1 h-5 rounded-full shrink-0`,style:{backgroundColor:O}}),(0,y.jsx)(u,{className:`w-4 h-4 shrink-0 text-primary`}),(0,y.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,y.jsx)(`span`,{className:`text-sm font-semibold leading-tight truncate`,children:D}),(0,y.jsxs)(`span`,{className:`text-[11px] text-muted-foreground truncate leading-tight font-mono`,children:[e.workspaceName,`://`,e.path.replace(/^\//,``)]})]}),n&&(0,y.jsx)(`button`,{type:`button`,onClick:n,title:`Minimize to tab bar`,"aria-label":`Minimize to tab bar`,className:`shrink-0 flex items-center justify-center w-7 h-7 rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:(0,y.jsx)(s,{className:`w-3.5 h-3.5`})}),(0,y.jsx)(`button`,{type:`button`,onClick:()=>h(e=>!e),"aria-pressed":p,title:p?`Restore tile (Esc)`:`Fill view area`,"aria-label":p?`Restore tile`:`Fill view area`,className:`shrink-0 flex items-center justify-center w-7 h-7 rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:p?(0,y.jsx)(o,{className:`w-3.5 h-3.5`}):(0,y.jsx)(l,{className:`w-3.5 h-3.5`})}),(0,y.jsx)(r,{to:x(e),title:`Open in workspace`,"aria-label":`Open in workspace`,className:`shrink-0 flex items-center justify-center w-7 h-7 rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:(0,y.jsx)(c,{className:`w-3.5 h-3.5`})}),(0,y.jsx)(`button`,{type:`button`,onClick:t,title:`Unpin from home`,"aria-label":`Unpin from home`,className:`shrink-0 flex items-center justify-center w-7 h-7 rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive transition-colors`,children:(0,y.jsx)(a,{className:`w-3.5 h-3.5`})})]}),(0,y.jsxs)(`div`,{className:`flex-1 min-h-0`,children:[f.state===`loading`&&(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:`Loading…`}),f.state===`missing`&&(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 px-4 text-center`,children:[(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This canvas is no longer available.`}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`It may have been renamed, moved or deleted.`}),(0,y.jsx)(`button`,{type:`button`,onClick:t,className:`mt-1 px-2.5 py-1 text-xs border rounded-md hover:bg-accent`,children:`Remove pin`})]}),f.state===`ready`&&(0,y.jsx)(m,{workspaceId:e.workspaceName,treeName:e.treeName,path:e.path,layerId:f.node.id,querySpec:f.node.querySpec,metadata:f.node.metadata,readOnly:!0})]})]})}function w(e){return e.label||e.path.split(`/`).filter(Boolean).pop()||`Canvas`}function T({pins:e,onRestore:t}){let[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(e.length);return i!==e.length&&(a(e.length),e.length===0&&r(!1)),e.length===0?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`pointer-events-none absolute bottom-0 left-0 right-0 z-40 max-md:hidden`,children:(0,y.jsx)(`div`,{className:`pointer-events-auto flex items-end gap-1 overflow-x-auto px-3 pr-28 pb-safe-bottom`,children:e.map(e=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id),title:`Restore ${w(e)}`,className:`flex max-w-[180px] shrink-0 items-center gap-1.5 rounded-t-lg border border-b-0 bg-background px-3 py-1.5 text-xs shadow-elevation-1 hover:bg-accent`,children:[(0,y.jsx)(u,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,y.jsx)(`span`,{className:`truncate`,children:w(e)})]},e.id))})}),n&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`fixed inset-0 z-drawer md:hidden`,onClick:()=>r(!1),"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`fixed bottom-rail-stack left-2 z-rail w-60 max-w-[calc(100vw-1rem)] rounded-xl border bg-card p-1.5 shadow-elevation-5 animate-fade-in md:hidden touch-target`,children:e.map(e=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id),className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm hover:bg-accent`,children:[(0,y.jsx)(u,{className:`h-4 w-4 shrink-0 text-primary`}),(0,y.jsx)(`span`,{className:`truncate`,children:w(e)})]},e.id))})]}),(0,y.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),"aria-label":n?`Close minimized canvases`:`Minimized canvases (${e.length})`,className:`fixed bottom-rail-inset left-16 z-nav flex h-12 w-12 items-center justify-center rounded-full bg-foreground text-background shadow-elevation-4 md:hidden`,children:[(0,y.jsx)(u,{className:`h-5 w-5`}),(0,y.jsx)(`span`,{className:`absolute -top-1 -right-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold`,children:e.length})]})]})}function E(){let{pins:e,unpin:t,movePin:n,setMinimized:r,isLoading:i}=p(),{showErrorToast:a}=h(),[o,s]=(0,v.useState)(new Set),c=(0,v.useRef)(e);(0,v.useEffect)(()=>{c.current=e},[e]);let l=e=>{r(e,!0).catch(()=>a(`Could not save minimized state`))},u=t=>{s(e=>{let n=new Set(e);return n.delete(t),n}),e.find(e=>e.id===t)?.minimized&&r(t,!1).catch(()=>a(`Could not save restored state`))},d=(0,v.useCallback)(e=>{s(e?new Set(c.current.filter(e=>!e.minimized).map(e=>e.id)):new Set)},[]),f=e.filter(e=>!g(e,o)),m=e.filter(e=>g(e,o)),b=(t,r,i)=>{let a=e.findIndex(e=>e.id===r.id);if(a===-1)return;let o=i?e[a+1]?.id??null:r.id;n(t,o)};return(0,y.jsxs)(`div`,{className:`relative h-full`,children:[(0,y.jsx)(`div`,{className:`h-full overflow-y-auto`,children:i?(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:`Loading…`}):(0,y.jsx)(`div`,{className:`grid gap-4 p-4 h-full grid-cols-[repeat(auto-fit,minmax(min(640px,100%),1fr))] auto-rows-fr ${m.length>0?`md:pb-12`:``}`,children:f.map(e=>(0,y.jsx)(C,{pin:e,onUnpin:()=>{t(e.id)},onMinimize:()=>l(e.id),onDropPin:(t,n)=>b(t,e,n)},e.id))})}),(0,y.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,children:(0,y.jsx)(_,{onCardsOpenChange:d})}),(0,y.jsx)(T,{pins:m,onRestore:u})]})}export{E as default};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{r}from"./chunk-62JRHF6Z-vspAGgtK.js";import{Lt as i,Vn as a,Xt as o,Zt as s,in as c,pr as l,yn as u}from"./ui-Byg1cZDr.js";import{H as d,ct as f}from"./workspace-DvxC7pw1.js";import{n as p,r as m}from"./use-canvas-pins-Bth_Q--t.js";import{t as h}from"./useToastHelpers-CRrpIIdY.js";import{h as g}from"./index-CiBgHujl.js";import{t as _}from"./HomeFab-CXaEEzXy.js";var v=e(n(),1),y=t();function b(e){let t=`${e.workspaceName}\0${e.treeName}\0${e.path}`,[n,r]=(0,v.useState)(null);return(0,v.useEffect)(()=>{let n=!1;return f(e.workspaceName,e.treeName).then(i=>{n||r({key:t,node:d(i,e.path)})}).catch(()=>{n||r({key:t,node:null})}),()=>{n=!0}},[t,e.workspaceName,e.treeName,e.path]),!n||n.key!==t?{state:`loading`}:n.node?{state:`ready`,node:n.node}:{state:`missing`}}function x(e){let t=`/workspaces/${encodeURIComponent(e.workspaceName)}`,n=e.path.replace(/^\//,``);return e.treeName===`context`?`${t}/path/${n}`:`${t}/trees/${encodeURIComponent(e.treeName)}/path/${n}`}var S=`application/x-canvas-pin`;function C({pin:e,onUnpin:t,onMinimize:n,onDropPin:d}){let f=b(e),[p,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(null),C=!!d&&!p,w=e=>{let t=e.currentTarget.getBoundingClientRect();return e.clientX>t.left+t.width/2?`after`:`before`},T=C?{onDragOver:e=>{e.dataTransfer.types.includes(`application/x-canvas-pin`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,_(w(e)))},onDragLeave:()=>_(null),onDrop:t=>{let n=t.dataTransfer.getData(S);_(null),!(!n||n===e.id)&&(t.preventDefault(),d?.(n,w(t)===`after`))}}:{},E=f.state===`ready`?f.node:null,D=E?.label||e.label||e.path.split(`/`).filter(Boolean).pop()||`Canvas`,O=E?.color;return(0,v.useEffect)(()=>{if(!p)return;let e=e=>{e.key===`Escape`&&h(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p]),(0,y.jsxs)(`section`,{...T,className:p?`fixed inset-0 z-picker flex flex-col bg-background`:`flex flex-col rounded-(--card-radius) border bg-background overflow-hidden min-h-0 min-w-0 ${g?`ring-2 ring-primary/60`:``}`,children:[(0,y.jsxs)(`header`,{draggable:C,onDragStart:C?t=>{t.dataTransfer.setData(S,e.id),t.dataTransfer.effectAllowed=`move`}:void 0,className:`flex items-center gap-2 px-3 py-2 border-b bg-muted/20 shrink-0 min-w-0 ${C?`cursor-grab active:cursor-grabbing`:``}`,children:[C&&(0,y.jsx)(a,{className:`w-3.5 h-3.5 shrink-0 text-muted-foreground/60`,"aria-hidden":!0}),O&&(0,y.jsx)(`div`,{className:`w-1 h-5 rounded-full shrink-0`,style:{backgroundColor:O}}),(0,y.jsx)(u,{className:`w-4 h-4 shrink-0 text-primary`}),(0,y.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,y.jsx)(`span`,{className:`text-sm font-semibold leading-tight truncate`,children:D}),(0,y.jsxs)(`span`,{className:`text-[11px] text-muted-foreground truncate leading-tight font-mono`,children:[e.workspaceName,`://`,e.path.replace(/^\//,``)]})]}),n&&(0,y.jsx)(`button`,{type:`button`,onClick:n,title:`Minimize to tab bar`,"aria-label":`Minimize to tab bar`,className:`shrink-0 flex items-center justify-center w-7 h-7 rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:(0,y.jsx)(o,{className:`w-3.5 h-3.5`})}),(0,y.jsx)(`button`,{type:`button`,onClick:()=>h(e=>!e),"aria-pressed":p,title:p?`Restore tile (Esc)`:`Fill view area`,"aria-label":p?`Restore tile`:`Fill view area`,className:`shrink-0 flex items-center justify-center w-7 h-7 rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:p?(0,y.jsx)(s,{className:`w-3.5 h-3.5`}):(0,y.jsx)(c,{className:`w-3.5 h-3.5`})}),(0,y.jsx)(r,{to:x(e),title:`Open in workspace`,"aria-label":`Open in workspace`,className:`shrink-0 flex items-center justify-center w-7 h-7 rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:(0,y.jsx)(l,{className:`w-3.5 h-3.5`})}),(0,y.jsx)(`button`,{type:`button`,onClick:t,title:`Unpin from home`,"aria-label":`Unpin from home`,className:`shrink-0 flex items-center justify-center w-7 h-7 rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive transition-colors`,children:(0,y.jsx)(i,{className:`w-3.5 h-3.5`})})]}),(0,y.jsxs)(`div`,{className:`flex-1 min-h-0`,children:[f.state===`loading`&&(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:`Loading…`}),f.state===`missing`&&(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 px-4 text-center`,children:[(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This canvas is no longer available.`}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`It may have been renamed, moved or deleted.`}),(0,y.jsx)(`button`,{type:`button`,onClick:t,className:`mt-1 px-2.5 py-1 text-xs border rounded-md hover:bg-accent`,children:`Remove pin`})]}),f.state===`ready`&&(0,y.jsx)(m,{workspaceId:e.workspaceName,treeName:e.treeName,path:e.path,layerId:f.node.id,querySpec:f.node.querySpec,metadata:f.node.metadata,readOnly:!0})]})]})}function w(e){return e.label||e.path.split(`/`).filter(Boolean).pop()||`Canvas`}function T({pins:e,onRestore:t}){let[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(e.length);return i!==e.length&&(a(e.length),e.length===0&&r(!1)),e.length===0?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`pointer-events-none absolute bottom-0 left-0 right-0 z-40 max-md:hidden`,children:(0,y.jsx)(`div`,{className:`pointer-events-auto flex items-end gap-1 overflow-x-auto px-3 pr-28 pb-safe-bottom`,children:e.map(e=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id),title:`Restore ${w(e)}`,className:`flex max-w-[180px] shrink-0 items-center gap-1.5 rounded-t-lg border border-b-0 bg-background px-3 py-1.5 text-xs shadow-elevation-1 hover:bg-accent`,children:[(0,y.jsx)(u,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,y.jsx)(`span`,{className:`truncate`,children:w(e)})]},e.id))})}),n&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`fixed inset-0 z-drawer md:hidden`,onClick:()=>r(!1),"aria-hidden":!0}),(0,y.jsx)(`div`,{className:`fixed bottom-rail-stack left-2 z-rail w-60 max-w-[calc(100vw-1rem)] rounded-xl border bg-card p-1.5 shadow-elevation-5 animate-fade-in md:hidden touch-target`,children:e.map(e=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id),className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm hover:bg-accent`,children:[(0,y.jsx)(u,{className:`h-4 w-4 shrink-0 text-primary`}),(0,y.jsx)(`span`,{className:`truncate`,children:w(e)})]},e.id))})]}),(0,y.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),"aria-label":n?`Close minimized canvases`:`Minimized canvases (${e.length})`,className:`fixed bottom-rail-inset left-16 z-nav flex h-12 w-12 items-center justify-center rounded-full bg-foreground text-background shadow-elevation-4 md:hidden`,children:[(0,y.jsx)(u,{className:`h-5 w-5`}),(0,y.jsx)(`span`,{className:`absolute -top-1 -right-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold`,children:e.length})]})]})}function E(){let{pins:e,unpin:t,movePin:n,setMinimized:r,isLoading:i}=p(),{showErrorToast:a}=h(),[o,s]=(0,v.useState)(new Set),c=(0,v.useRef)(e);(0,v.useEffect)(()=>{c.current=e},[e]);let l=e=>{r(e,!0).catch(()=>a(`Could not save minimized state`))},u=t=>{s(e=>{let n=new Set(e);return n.delete(t),n}),e.find(e=>e.id===t)?.minimized&&r(t,!1).catch(()=>a(`Could not save restored state`))},d=(0,v.useCallback)(e=>{s(e?new Set(c.current.filter(e=>!e.minimized).map(e=>e.id)):new Set)},[]),f=e.filter(e=>!g(e,o)),m=e.filter(e=>g(e,o)),b=(t,r,i)=>{let a=e.findIndex(e=>e.id===r.id);if(a===-1)return;let o=i?e[a+1]?.id??null:r.id;n(t,o)};return(0,y.jsxs)(`div`,{className:`relative h-full`,children:[(0,y.jsx)(`div`,{className:`h-full overflow-y-auto`,children:i?(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:`Loading…`}):(0,y.jsx)(`div`,{className:`grid gap-4 p-4 h-full grid-cols-[repeat(auto-fit,minmax(min(640px,100%),1fr))] auto-rows-fr ${m.length>0?`md:pb-12`:``}`,children:f.map(e=>(0,y.jsx)(C,{pin:e,onUnpin:()=>{t(e.id)},onMinimize:()=>l(e.id),onDropPin:(t,n)=>b(t,e,n)},e.id))})}),(0,y.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,children:(0,y.jsx)(_,{onCardsOpenChange:d})}),(0,y.jsx)(T,{pins:m,onRestore:u})]})}export{E as default};