@augmentd-labs/canvas-web 2.26.33 → 2.26.35

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 (111) hide show
  1. package/dist/assets/CalendarApplet-gN_A0sQe.js +2 -0
  2. package/dist/assets/{DocumentBodyEditor-DRFQgBNB.js → DocumentBodyEditor-CVO5KPCs.js} +1 -1
  3. package/dist/assets/{DocumentIcon-ByDAILhm.js → DocumentIcon-9i1uCMQa.js} +1 -1
  4. package/dist/assets/{EditorOverlay-DpQKmxkR.js → EditorOverlay-D5t3xg4w.js} +1 -1
  5. package/dist/assets/{FileForm-B6eFRKG-.js → FileForm-C35drQ_R.js} +1 -1
  6. package/dist/assets/{FiltersApplet-Bh-Ti230.js → FiltersApplet-NltVCRY8.js} +1 -1
  7. package/dist/assets/{HomeFab-DjDhl9Kx.js → HomeFab-Cc33x4F2.js} +1 -1
  8. package/dist/assets/{IdentityFields-CEDxU-Hd.js → IdentityFields-DZRqtnIG.js} +1 -1
  9. package/dist/assets/{LensApplet-CTRYyg4u.js → LensApplet-D-E4YyKz.js} +1 -1
  10. package/dist/assets/{LinkToCard-VXpoeMDH.js → LinkToCard-BQ1yoFDr.js} +1 -1
  11. package/dist/assets/{MarkdownEditor-Dnyez7VT.js → MarkdownEditor-DbpRWbO6.js} +2 -2
  12. package/dist/assets/{MessageComposerDialog-BKGlI7jO.js → MessageComposerDialog-CdPp-3GR.js} +1 -1
  13. package/dist/assets/{NextShell-BvKyH2Oj.js → NextShell-BfQHKEKO.js} +1 -1
  14. package/dist/assets/{NotesApplet-DShxjAo_.js → NotesApplet-DZ7lSkfC.js} +1 -1
  15. package/dist/assets/ObjectPropertiesCard-BTTwYnN9.js +8 -0
  16. package/dist/assets/{ObjectPropertiesCard-JArcZXXv.css → ObjectPropertiesCard-Docu7O5V.css} +1 -1
  17. package/dist/assets/{PathPickerField-B58yeJGw.js → PathPickerField-B4yFUjgD.js} +1 -1
  18. package/dist/assets/{PickDocumentsCard-B72XNYh3.js → PickDocumentsCard-CFDQL70e.js} +1 -1
  19. package/dist/assets/{SketchApplet-BHee4eKG.js → SketchApplet-14xrogy3.js} +1 -1
  20. package/dist/assets/{SketchEditor-Knj-HA0P.js → SketchEditor-B2LYe_MO.js} +1 -1
  21. package/dist/assets/{TerminalApplet-Djk4l1Jm.js → TerminalApplet-BNeLmNFF.js} +1 -1
  22. package/dist/assets/{TextDocumentEditor-rgHsbLCL.js → TextDocumentEditor-CU5ersd_.js} +1 -1
  23. package/dist/assets/{TodosApplet-DZVcRHmh.js → TodosApplet-ASG9wXjL.js} +1 -1
  24. package/dist/assets/{TodosWidget-CX4lgk-9.js → TodosWidget-CYK5RbYD.js} +1 -1
  25. package/dist/assets/{UploadProgressList-CHQ-Kn-e.js → UploadProgressList-Ci1akl_D.js} +1 -1
  26. package/dist/assets/{_agentId_-D9i9ZJWV.js → _agentId_-BuZ9wBek.js} +0 -0
  27. package/dist/assets/{_contextId_-C6KmQgsY.js → _contextId_-DURo7ANU.js} +1 -1
  28. package/dist/assets/{_workspaceName_-DOmVjYen.js → _workspaceName_-JpQwQGvI.js} +1 -1
  29. package/dist/assets/{about-BzJi5UDC.js → about-BpN8_1bC.js} +1 -1
  30. package/dist/assets/{add-DJ45m1Gq.js → add-B7zdhw47.js} +1 -1
  31. package/dist/assets/{agents-mnY8dZIT.js → agents-ChD6m_5J.js} +1 -1
  32. package/dist/assets/{agents-DEJU4O1Z.js → agents-DxqAi3vk.js} +1 -1
  33. package/dist/assets/{alert-dialog-CShuAcnP.js → alert-dialog-CFeuDt0T.js} +1 -1
  34. package/dist/assets/{api-tokens-CmHhwd58.js → api-tokens-drrVuCYc.js} +1 -1
  35. package/dist/assets/{appearance-CRoFdA6E.js → appearance-DEL04cKR.js} +1 -1
  36. package/dist/assets/{applet-target-Bl9Je1N-.js → applet-target-I8w6EPj0.js} +1 -1
  37. package/dist/assets/{apps-4xGIx_KA.js → apps-BYrwwspU.js} +1 -1
  38. package/dist/assets/{auth-_bmIEN02.js → auth-PqttD05H.js} +1 -1
  39. package/dist/assets/backend-sync-progress-tUU2XWtW.js +7 -0
  40. package/dist/assets/{button-Bum-POPT.js → button-SeUZ_Pvi.js} +1 -1
  41. package/dist/assets/{content-app-view-3BCpYf7m.js → content-app-view-Dcknmau8.js} +1 -1
  42. package/dist/assets/{context-BGgz0Y_q.js → context-DZ1Hn7tt.js} +1 -1
  43. package/dist/assets/{contexts-Dtl9oERX.js → contexts-DDJagU4j.js} +1 -1
  44. package/dist/assets/{contexts-CwGdjtXy2.js → contexts-Df-cWUlj2.js} +1 -1
  45. package/dist/assets/date-time-picker-txVhlNO0.js +1 -0
  46. package/dist/assets/{devices-CmVlYbam.js → devices-BwU9M8-W.js} +1 -1
  47. package/dist/assets/{document-Ds_P5v-f.js → document-CTvT2Qa5.js} +1 -1
  48. package/dist/assets/document-list-CQ1_7Sja.js +2 -0
  49. package/dist/assets/{embedding-2EjzoVFT.js → embedding-BvXcVfij.js} +1 -1
  50. package/dist/assets/{embedding-BqI3l5RB.js → embedding-D-I_ygUZ.js} +1 -1
  51. package/dist/assets/{form-panel-DZj3WZ3z.js → form-panel-3p-ncEVK.js} +1 -1
  52. package/dist/assets/{home-DB-ohpoi.js → home-Bg5pLpIh.js} +1 -1
  53. package/dist/assets/index-C51Jk0Xq.css +2 -0
  54. package/dist/assets/index-VAgMESOp.js +16 -0
  55. package/dist/assets/{inferd-config-editor-CyDCQJRs.js → inferd-config-editor-B8x_XPOt.js} +1 -1
  56. package/dist/assets/{key-bindings-BYwqkLkk.js → key-bindings--OI4Iz7e.js} +1 -1
  57. package/dist/assets/{label-DJc8-3CQ.js → label-BSTdjCWU.js} +1 -1
  58. package/dist/assets/{lazy-editor-Bdm5JEXv.js → lazy-editor-BUFAkTGl.js} +2 -2
  59. package/dist/assets/{logs-DUeiDqCX.js → logs-DjG8_wJ2.js} +1 -1
  60. package/dist/assets/{offline-yfQ63Zr7.js → offline-sNCjxnp-.js} +1 -1
  61. package/dist/assets/{page-header-BoCaZiqu.js → page-header-DrDt1sQ2.js} +1 -1
  62. package/dist/assets/{public-share-D2S8DEsv.js → public-share-D5yz-Pmo.js} +1 -1
  63. package/dist/assets/{query-debug-CZacGe0M.js → query-debug-CQ0I3cXX.js} +1 -1
  64. package/dist/assets/registry-DQPkddij.js +2 -0
  65. package/dist/assets/{remotes-BjjlqN_M.js → remotes-RPGcw6fH.js} +1 -1
  66. package/dist/assets/{roles-CuqCEPC7.js → roles-DoR2drD1.js} +1 -1
  67. package/dist/assets/{roles-BHJYWaBs.js → roles-p2cRajz-.js} +1 -1
  68. package/dist/assets/{settings-BjieBx_W.js → settings-B6TQfRMQ.js} +1 -1
  69. package/dist/assets/{settings-DAwqsOhZ.js → settings-BQmgBTa-.js} +1 -1
  70. package/dist/assets/settings-BgqCRJzb.js +16 -0
  71. package/dist/assets/{settings-BGCP2DRw.js → settings-CljJz3ui.js} +1 -1
  72. package/dist/assets/{share-target-BhCMpdxU.js → share-target-BZmiLt2r.js} +1 -1
  73. package/dist/assets/{shared-C-uHNNY8.js → shared-BnpwVpxG.js} +1 -1
  74. package/dist/assets/{shared-Dnd9GFGT.js → shared-qweQ1MKt.js} +1 -1
  75. package/dist/assets/sketch-lazy-BbNgGbR3.js +2 -0
  76. package/dist/assets/{subtree-transfer-dialog-BN9xBB9n.js → subtree-transfer-dialog-DQM5zfx2.js} +1 -1
  77. package/dist/assets/{text-documents-CFW8MWES.js → text-documents-BaXhu3ra.js} +1 -1
  78. package/dist/assets/ui-CDoK3F3U.js +41 -0
  79. package/dist/assets/{use-applet-docs-DBshA7yq.js → use-applet-docs-B2dk__vk.js} +1 -1
  80. package/dist/assets/{use-applet-target-DmIdCxa_.js → use-applet-target-ffIGaAqT.js} +1 -1
  81. package/dist/assets/{use-canvas-pins-D-zi5fqQ.js → use-canvas-pins-DkWN9oEd.js} +1 -1
  82. package/dist/assets/{use-menu-CaiLyPdw.js → use-menu-DIP1zh7I.js} +1 -1
  83. package/dist/assets/use-settings-back-DGmLAD63.js +1 -0
  84. package/dist/assets/{use-sortable-data-W2inLcb5.js → use-sortable-data-BBKmqs79.js} +1 -1
  85. package/dist/assets/{use-workspace-identity-KxY9injc.js → use-workspace-identity-B8gOMGj4.js} +1 -1
  86. package/dist/assets/{useAddTarget-D4ra50Am.js → useAddTarget-B3b6TyZr.js} +1 -1
  87. package/dist/assets/{useAgentModels-CTCpJy1M.js → useAgentModels-Bda5ilvQ.js} +1 -1
  88. package/dist/assets/{useDocumentThumbnail-Bs2Ju0eb.js → useDocumentThumbnail-wW0lSOEy.js} +1 -1
  89. package/dist/assets/{useEditNoteFields-CKYMBf8V.js → useEditNoteFields-DXLTFEqL.js} +1 -1
  90. package/dist/assets/{users-DInwKAxz.js → users-DuVk-TEd.js} +1 -1
  91. package/dist/assets/{workspace-46EFyEKZ.js → workspace-BJELPCNs.js} +1 -1
  92. package/dist/assets/{workspace-area-menu-DtsodEXC.js → workspace-area-menu-BFw2yUHk.js} +1 -1
  93. package/dist/assets/{workspace-content-gate-CGZmT2kw.js → workspace-content-gate-NLuRPvbm.js} +1 -1
  94. package/dist/assets/{workspace-import-form-Bu1nlv8u.js → workspace-import-form-Bb6z42nw.js} +1 -1
  95. package/dist/assets/{workspaces-BzAZpTMK.js → workspaces-BK7Rj72s.js} +1 -1
  96. package/dist/assets/{workspaces-p959p9BR.js → workspaces-CqHYstZv.js} +1 -1
  97. package/dist/index.html +37 -37
  98. package/dist/sw.js +1 -1
  99. package/package.json +2 -2
  100. package/dist/assets/CalendarApplet-CG6XE01c.js +0 -1
  101. package/dist/assets/ObjectPropertiesCard-CFZ_LqzX.js +0 -8
  102. package/dist/assets/backend-sync-progress-BJsLP7o5.js +0 -7
  103. package/dist/assets/date-time-picker-Bzu8H_Oa.js +0 -1
  104. package/dist/assets/document-list-CwStaizB.js +0 -2
  105. package/dist/assets/index-BG5J93SO.js +0 -16
  106. package/dist/assets/index-XDD8pFI_.css +0 -2
  107. package/dist/assets/registry-CtnhH0si.js +0 -2
  108. package/dist/assets/settings-Id06aU1g.js +0 -16
  109. package/dist/assets/sketch-lazy-BOFTGGTA.js +0 -2
  110. package/dist/assets/ui-76Hw0NU_.js +0 -41
  111. package/dist/assets/use-settings-back-DE0SPb7h.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{qn as r}from"./ui-76Hw0NU_.js";import{t as i}from"./utils-2pl1SbIp.js";import{t as a}from"./button-Bum-POPT.js";import{t as o}from"./input-BOtCd4HP.js";import{o as s,s as c,t as l}from"./LinkToCard-VXpoeMDH.js";import{n as u}from"./LinkToSidePanel-eCy3nW4R.js";var d=e(n(),1),f=t();function p({value:e,onChange:t,onPickTarget:n,fixedWorkspaceName:p,format:m=`url`,tabs:h=[`context`,`directory`],pickerTitle:g=`Pick a path…`,placeholder:_,id:v,disabled:y,className:b,inputClassName:x,presentation:S=`input`}){let[C,w]=(0,d.useState)(!1),T=e.match(/^(.*?):\/\//)?.[0]||``,E=T?e.slice(T.length):e;return(0,f.jsxs)(`div`,{className:i(`flex gap-2`,b),children:[S===`breadcrumbs`?(0,f.jsx)(c,{items:s(E,T.replace(`://`,``)||p||`Workspace`),onNavigate:e=>t(T?`${T}${e.replace(/^\/+/,``)}`:e),disabled:y,className:i(`rounded border px-1`,x)}):(0,f.jsx)(o,{id:v,value:e,onChange:e=>t(e.target.value),placeholder:_,disabled:y,className:i(`font-mono`,x)}),(0,f.jsx)(a,{type:`button`,variant:`outline`,size:`icon`,onClick:()=>w(!0),disabled:y,"aria-label":`Browse tree paths`,title:`Browse…`,className:`shrink-0`,children:(0,f.jsx)(r,{className:`h-4 w-4`})}),C&&(0,f.jsx)(u,{onClose:()=>w(!1),children:(0,f.jsx)(l,{sizeClassName:`h-full w-[380px] max-w-[90vw] max-md:w-full`,multiple:!1,tabs:h,fixedWorkspaceName:p,title:g,confirmLabel:`Use path`,onConfirm:(e,r)=>{w(!1);let i=e[0];if(i){if(n){n(i,r);return}t(m===`url`?`${r.workspaceName}://${i.replace(/^\/+/,``)}`:i)}},onClose:()=>w(!1)})})]})}export{p as t};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{qn as r}from"./ui-CDoK3F3U.js";import{t as i}from"./utils-2pl1SbIp.js";import{t as a}from"./button-SeUZ_Pvi.js";import{t as o}from"./input-BOtCd4HP.js";import{o as s,s as c,t as l}from"./LinkToCard-BQ1yoFDr.js";import{n as u}from"./LinkToSidePanel-eCy3nW4R.js";var d=e(n(),1),f=t();function p({value:e,onChange:t,onPickTarget:n,fixedWorkspaceName:p,format:m=`url`,tabs:h=[`context`,`directory`],pickerTitle:g=`Pick a path…`,placeholder:_,id:v,disabled:y,className:b,inputClassName:x,presentation:S=`input`}){let[C,w]=(0,d.useState)(!1),T=e.match(/^(.*?):\/\//)?.[0]||``,E=T?e.slice(T.length):e;return(0,f.jsxs)(`div`,{className:i(`flex gap-2`,b),children:[S===`breadcrumbs`?(0,f.jsx)(c,{items:s(E,T.replace(`://`,``)||p||`Workspace`),onNavigate:e=>t(T?`${T}${e.replace(/^\/+/,``)}`:e),disabled:y,className:i(`rounded border px-1`,x)}):(0,f.jsx)(o,{id:v,value:e,onChange:e=>t(e.target.value),placeholder:_,disabled:y,className:i(`font-mono`,x)}),(0,f.jsx)(a,{type:`button`,variant:`outline`,size:`icon`,onClick:()=>w(!0),disabled:y,"aria-label":`Browse tree paths`,title:`Browse…`,className:`shrink-0`,children:(0,f.jsx)(r,{className:`h-4 w-4`})}),C&&(0,f.jsx)(u,{onClose:()=>w(!1),children:(0,f.jsx)(l,{sizeClassName:`h-full w-[380px] max-w-[90vw] max-md:w-full`,multiple:!1,tabs:h,fixedWorkspaceName:p,title:g,confirmLabel:`Use path`,onConfirm:(e,r)=>{w(!1);let i=e[0];if(i){if(n){n(i,r);return}t(m===`url`?`${r.workspaceName}://${i.replace(/^\/+/,``)}`:i)}},onClose:()=>w(!1)})})]})}export{p as t};
@@ -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{yt as r}from"./react-BHzhHVTZ.js";import{g as i}from"./chunk-62JRHF6Z-vspAGgtK.js";import{L as a,Qt as o,Vr as s,an as c,cr as l,vn as u,wt as d}from"./ui-76Hw0NU_.js";import{t as f}from"./utils-2pl1SbIp.js";import{t as p}from"./button-Bum-POPT.js";import{_ as m,a as h,i as g,n as _,r as v,t as y}from"./LinkToCard-VXpoeMDH.js";import{Nt as b,Sn as x,g as S,zt as C}from"./workspace-46EFyEKZ.js";import{t as w}from"./use-mobile-Db-vWu9Y.js";import{c as T}from"./IdentityFields-CEDxU-Hd.js";import{n as E}from"./relation-events-CKio19hE.js";import{t as D}from"./useEscapeClose-DR_xKT_k.js";import{t as O}from"./useToastHelpers-CRrpIIdY.js";var k=e(n(),1);function A(e){let t=`/workspaces/${encodeURIComponent(e.workspaceName)}`,n=e.path.replace(/^\/+/,``).split(`/`).map(encodeURIComponent).join(`/`);return e.treeName===`context`?`${t}/path/${n}`:`${t}/trees/${encodeURIComponent(e.treeName)}/path/${n}`}var j=e(r(),1),M=t();function N({title:e,icon:t,onClose:n,onSave:r,navigateAfterSave:s=!1,canSave:l=!1,saving:m=!1,saveProgress:h,successMessage:g=`Saved`,lockedWorkspaceName:_,fillParent:v=!1,fullWidthContent:b=!1,relationSubjectId:x,frame:N,children:P,maximized:ee,onMaximizedChange:F}){let te=i(),[ne,re]=(0,k.useState)(`portrait`),[ie,ae]=(0,k.useState)(!1),I=ee??ie,L=e=>{ae(e),F?.(e)},[R,z]=(0,k.useState)(!1),[oe,B]=(0,k.useState)(!1),[se,V]=(0,k.useState)(!1),H=m||se;D(()=>z(!1),R&&!H),D(()=>L(!1),I&&!R);let U=(0,k.useRef)(null),W=w(),{showSuccessToast:G,showErrorToast:K}=O(),q=W&&!v&&!I,[ce,le]=(0,k.useState)(!1),J=!v&&!I&&!N&&!ce;(0,k.useEffect)(()=>{R&&U.current?.scrollIntoView({behavior:`smooth`,inline:`end`,block:`nearest`})},[R]);let ue=async(e,t)=>{if(!(!r||H)){V(!0);try{let i=await r({...t,path:e[0]}),a=e.slice(1);i.length&&a.length&&await Promise.all(a.map(e=>C(t.workspaceName,e,i,t.treeName,t.treeType))),G(g),n?.(),s&&te(A({...t,path:e[0]}),{replace:!0})}catch(e){K(e instanceof Error?e.message:`Failed to save`)}finally{V(!1)}}},Y=async e=>{if(!(!x||!_||e.targetIds.length===0)){B(!0);try{await S(_,x,e.predicate,e.targetIds,e.direction),G(`Created ${e.targetIds.length} relation${e.targetIds.length===1?``:`s`}`),E(),z(!1)}catch(e){K(e instanceof Error?e.message:`Failed to create relations`)}finally{B(!1)}}},de=I?R?{flex:`1 1 auto`,minWidth:0,height:`100%`}:{width:`100%`,height:`100%`}:v?{height:`100%`,flexShrink:0}:q?void 0:ne===`portrait`?{aspectRatio:`0.707 / 1`,height:`calc(var(--viewport-h) * 0.85)`,width:`auto`,maxWidth:`min(90vw, 100%)`,flexShrink:0}:{aspectRatio:`1 / 0.707`,width:`min(90vw, 900px)`,maxWidth:`100%`,height:`auto`,maxHeight:`calc(var(--viewport-h) * 0.85)`,flexShrink:0},X=!!(x&&_),Z=r&&R&&(0,M.jsx)(y,{onClose:()=>z(!1),onConfirm:ue,fixedWorkspaceName:_,saving:H||oe,savingContent:h,tabs:X?[`context`,`directory`,`relations`]:[`context`,`directory`],onConfirmRelation:X?Y:void 0,relationWorkspaceName:_,relationExcludeIds:X?new Set([x]):void 0,sizeClassName:N?`h-full max-h-full w-full min-w-0 rounded-none border-0 shadow-none`:v?`h-full max-h-full w-[min(380px,90vw)] max-md:h-full max-md:w-full max-md:shadow-elevation-5`:void 0}),Q=(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[!v&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>re(e=>e===`portrait`?`landscape`:`portrait`),className:`rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground max-md:hidden touch-target`,"aria-label":`Toggle orientation`,title:`Toggle orientation`,children:(0,M.jsx)(d,{className:`h-4 w-4`})}),r&&(typeof P==`function`?(0,M.jsx)(`button`,{type:`button`,onClick:()=>z(!0),disabled:!l||H,className:`flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 touch-target`,"aria-label":H?`Saving…`:`Add relations / Link to…`,title:`Add relations / Link to…`,children:(0,M.jsx)(u,{className:`h-4 w-4`})}):(0,M.jsx)(p,{size:`sm`,variant:`outline`,onClick:()=>z(!0),disabled:!l||H,children:H?`Saving…`:`Save / Link to…`})),(0,M.jsx)(`button`,{type:`button`,onClick:()=>N&&!I?N.onToggleExpanded():L(!I),className:f(`rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,typeof P==`function`&&`flex h-8 w-8 items-center justify-center`,!I&&!N&&`max-md:hidden`),"aria-label":N&&!I?N.expanded?`Card size`:`Expand to full width`:I?`Restore`:`Maximize`,title:N&&!I?N.expanded?`Card size`:`Expand to full width`:I?`Restore`:`Maximize`,children:I||N?.expanded?(0,M.jsx)(o,{className:`h-4 w-4`}):(0,M.jsx)(c,{className:`h-4 w-4`})}),n&&(0,M.jsx)(`button`,{type:`button`,onClick:n,disabled:H,className:f(`rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 touch-target`,typeof P==`function`&&`flex h-8 w-8 items-center justify-center`),"aria-label":`Close`,children:(0,M.jsx)(a,{className:`h-4 w-4`})})]}),$=(0,M.jsxs)(`div`,{style:{...N&&!I?{width:`100%`,height:`100%`,minWidth:0}:de,"--document-reading-width":I&&!b?`48rem`:`100%`},onAnimationEnd:e=>{J&&e.target===e.currentTarget&&le(!0)},className:f(`flex flex-col overflow-hidden`,N&&!I?`strip-document-card`:`rounded-(--card-radius) border bg-card shadow-elevation-4 transition-[width,height]`,v&&!I&&!N&&`w-full`,q&&`fixed inset-2 z-40 shadow-elevation-5`,J&&`animate-card-in`),children:[typeof P!=`function`&&(0,M.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center justify-between gap-2 border-b px-4`,children:[(0,M.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 truncate text-sm font-medium`,children:[(0,M.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,M.jsx)(`span`,{className:`truncate`,children:e})]}),Q]}),(0,M.jsx)(T.Provider,{value:()=>L(!I),children:(0,M.jsx)(`div`,{className:f(`min-h-0 flex-1 overflow-y-auto`,I&&!b&&typeof P!=`function`&&`mx-auto w-full max-w-3xl`),children:N&&Z?Z:typeof P==`function`?P(Q):P})})]});return I?(0,j.createPortal)((0,M.jsxs)(`div`,{className:`fixed inset-0 z-picker flex items-center justify-center gap-4 bg-scrim p-4 max-md:p-2`,children:[$,Z&&(0,M.jsx)(`div`,{className:`flex max-md:absolute max-md:inset-2 max-md:z-10`,children:Z})]}),document.body):(0,M.jsxs)(M.Fragment,{children:[$,!N&&Z&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:`fixed inset-0 z-card bg-scrim animate-fade-in md:hidden`,onClick:()=>!H&&z(!1),"aria-hidden":!0}),(0,M.jsx)(`div`,{ref:U,className:`relative shrink-0 md:z-panel md:ml-2 md:pr-2 max-md:fixed max-md:bottom-2 max-md:left-2 max-md:right-2 max-md:top-2 max-md:z-card-overlay max-md:animate-fade-in`,children:Z})]})]})}function P({onClose:e,onConfirm:t,fixedWorkspaceName:n,saving:r=!1,sizeClassName:i}){let[o,c]=(0,k.useState)(n?`browse`:`workspace`),[u,d]=(0,k.useState)([]),[y,S]=(0,k.useState)(!n),[C,w]=(0,k.useState)(n??null),[T,E]=(0,k.useState)(`context`),[D,O]=(0,k.useState)(new Set),[A,j]=(0,k.useState)(n);return n!==A&&(j(n),n||S(!0)),(0,k.useEffect)(()=>{n||b().then(d).catch(()=>d([])).finally(()=>S(!1))},[n]),(0,M.jsxs)(`div`,{className:f(`flex flex-col overflow-hidden rounded-(--panel-radius) border bg-card shadow-elevation-4`,i||`h-viewport-card max-h-full w-[min(420px,90vw)] max-md:h-full max-md:w-full max-md:shadow-elevation-5`),children:[(0,M.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center justify-between border-b px-4`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,M.jsx)(l,{className:`h-4 w-4`}),o===`workspace`?`Add existing documents…`:`Pick documents…`]}),(0,M.jsx)(`button`,{type:`button`,onClick:e,disabled:r,className:`text-muted-foreground transition-colors hover:text-foreground disabled:opacity-40`,"aria-label":`Close`,children:(0,M.jsx)(a,{className:`h-4 w-4`})})]}),(0,M.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,M.jsxs)(`div`,{className:`grid h-full w-[200%] grid-cols-2 transition-transform duration-normal`,style:{transform:o===`workspace`?`translateX(0)`:`translateX(-50%)`},children:[(0,M.jsx)(`div`,{className:`flex min-w-0 flex-col overflow-y-auto p-2`,children:(0,M.jsx)(v,{workspaces:u,loading:y,onPick:e=>{w(e),O(new Set),c(`browse`)}})}),(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-col overflow-hidden`,children:[(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 border-b px-2 pt-2`,children:[!n&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>c(`workspace`),className:`mr-1 rounded p-1.5 text-muted-foreground hover:bg-muted hover:text-foreground touch-target`,"aria-label":`Back to workspaces`,children:(0,M.jsx)(s,{className:`h-4 w-4 rotate-180`})}),[`context`,`directory`].map(e=>(0,M.jsxs)(`button`,{type:`button`,onClick:()=>{E(e),O(new Set)},className:f(`flex items-center gap-1.5 rounded-t-md border-b-2 px-3 py-2 text-xs font-medium transition-colors`,T===e?`border-primary text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:[g[e],h[e]]},e))]}),C&&(0,M.jsx)(_,{workspaceName:C,treeTab:T,onTreeTabChange:E,selectedDocIds:D,onToggleDoc:e=>{O(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},onNavigate:()=>O(new Set)})]})]})}),o===`browse`&&(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-t px-4 py-3`,children:[(0,M.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[D.size,` document`,D.size===1?``:`s`,` selected`]}),(0,M.jsx)(p,{size:`sm`,onClick:async()=>{!C||D.size===0||r||await t(Array.from(D),{workspaceName:C,treeName:T===`directory`?`directory`:x,treeType:T})},disabled:D.size===0||r,children:r?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(m,{className:`mr-1.5 h-3.5 w-3.5`}),`Adding…`]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(l,{className:`mr-1 h-3.5 w-3.5`}),`Add`]})})]})]})}export{N as n,P as t};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{yt as r}from"./react-BHzhHVTZ.js";import{g as i}from"./chunk-62JRHF6Z-vspAGgtK.js";import{L as a,Qt as o,Vr as s,an as c,cr as l,vn as u,wt as d}from"./ui-CDoK3F3U.js";import{t as f}from"./utils-2pl1SbIp.js";import{t as p}from"./button-SeUZ_Pvi.js";import{_ as m,a as h,i as g,n as _,r as v,t as y}from"./LinkToCard-BQ1yoFDr.js";import{Nt as b,Sn as x,g as S,zt as C}from"./workspace-BJELPCNs.js";import{t as w}from"./use-mobile-Db-vWu9Y.js";import{c as T}from"./IdentityFields-DZRqtnIG.js";import{n as E}from"./relation-events-CKio19hE.js";import{t as D}from"./useEscapeClose-DR_xKT_k.js";import{t as O}from"./useToastHelpers-CRrpIIdY.js";var k=e(n(),1);function A(e){let t=`/workspaces/${encodeURIComponent(e.workspaceName)}`,n=e.path.replace(/^\/+/,``).split(`/`).map(encodeURIComponent).join(`/`);return e.treeName===`context`?`${t}/path/${n}`:`${t}/trees/${encodeURIComponent(e.treeName)}/path/${n}`}var j=e(r(),1),M=t();function N({title:e,icon:t,onClose:n,onSave:r,navigateAfterSave:s=!1,canSave:l=!1,saving:m=!1,saveProgress:h,successMessage:g=`Saved`,lockedWorkspaceName:_,fillParent:v=!1,fullWidthContent:b=!1,relationSubjectId:x,frame:N,children:P,maximized:ee,onMaximizedChange:F}){let te=i(),[ne,re]=(0,k.useState)(`portrait`),[ie,ae]=(0,k.useState)(!1),I=ee??ie,L=e=>{ae(e),F?.(e)},[R,z]=(0,k.useState)(!1),[oe,B]=(0,k.useState)(!1),[se,V]=(0,k.useState)(!1),H=m||se;D(()=>z(!1),R&&!H),D(()=>L(!1),I&&!R);let U=(0,k.useRef)(null),W=w(),{showSuccessToast:G,showErrorToast:K}=O(),q=W&&!v&&!I,[ce,le]=(0,k.useState)(!1),J=!v&&!I&&!N&&!ce;(0,k.useEffect)(()=>{R&&U.current?.scrollIntoView({behavior:`smooth`,inline:`end`,block:`nearest`})},[R]);let ue=async(e,t)=>{if(!(!r||H)){V(!0);try{let i=await r({...t,path:e[0]}),a=e.slice(1);i.length&&a.length&&await Promise.all(a.map(e=>C(t.workspaceName,e,i,t.treeName,t.treeType))),G(g),n?.(),s&&te(A({...t,path:e[0]}),{replace:!0})}catch(e){K(e instanceof Error?e.message:`Failed to save`)}finally{V(!1)}}},Y=async e=>{if(!(!x||!_||e.targetIds.length===0)){B(!0);try{await S(_,x,e.predicate,e.targetIds,e.direction),G(`Created ${e.targetIds.length} relation${e.targetIds.length===1?``:`s`}`),E(),z(!1)}catch(e){K(e instanceof Error?e.message:`Failed to create relations`)}finally{B(!1)}}},de=I?R?{flex:`1 1 auto`,minWidth:0,height:`100%`}:{width:`100%`,height:`100%`}:v?{height:`100%`,flexShrink:0}:q?void 0:ne===`portrait`?{aspectRatio:`0.707 / 1`,height:`calc(var(--viewport-h) * 0.85)`,width:`auto`,maxWidth:`min(90vw, 100%)`,flexShrink:0}:{aspectRatio:`1 / 0.707`,width:`min(90vw, 900px)`,maxWidth:`100%`,height:`auto`,maxHeight:`calc(var(--viewport-h) * 0.85)`,flexShrink:0},X=!!(x&&_),Z=r&&R&&(0,M.jsx)(y,{onClose:()=>z(!1),onConfirm:ue,fixedWorkspaceName:_,saving:H||oe,savingContent:h,tabs:X?[`context`,`directory`,`relations`]:[`context`,`directory`],onConfirmRelation:X?Y:void 0,relationWorkspaceName:_,relationExcludeIds:X?new Set([x]):void 0,sizeClassName:N?`h-full max-h-full w-full min-w-0 rounded-none border-0 shadow-none`:v?`h-full max-h-full w-[min(380px,90vw)] max-md:h-full max-md:w-full max-md:shadow-elevation-5`:void 0}),Q=(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[!v&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>re(e=>e===`portrait`?`landscape`:`portrait`),className:`rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground max-md:hidden touch-target`,"aria-label":`Toggle orientation`,title:`Toggle orientation`,children:(0,M.jsx)(d,{className:`h-4 w-4`})}),r&&(typeof P==`function`?(0,M.jsx)(`button`,{type:`button`,onClick:()=>z(!0),disabled:!l||H,className:`flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 touch-target`,"aria-label":H?`Saving…`:`Add relations / Link to…`,title:`Add relations / Link to…`,children:(0,M.jsx)(u,{className:`h-4 w-4`})}):(0,M.jsx)(p,{size:`sm`,variant:`outline`,onClick:()=>z(!0),disabled:!l||H,children:H?`Saving…`:`Save / Link to…`})),(0,M.jsx)(`button`,{type:`button`,onClick:()=>N&&!I?N.onToggleExpanded():L(!I),className:f(`rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,typeof P==`function`&&`flex h-8 w-8 items-center justify-center`,!I&&!N&&`max-md:hidden`),"aria-label":N&&!I?N.expanded?`Card size`:`Expand to full width`:I?`Restore`:`Maximize`,title:N&&!I?N.expanded?`Card size`:`Expand to full width`:I?`Restore`:`Maximize`,children:I||N?.expanded?(0,M.jsx)(o,{className:`h-4 w-4`}):(0,M.jsx)(c,{className:`h-4 w-4`})}),n&&(0,M.jsx)(`button`,{type:`button`,onClick:n,disabled:H,className:f(`rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 touch-target`,typeof P==`function`&&`flex h-8 w-8 items-center justify-center`),"aria-label":`Close`,children:(0,M.jsx)(a,{className:`h-4 w-4`})})]}),$=(0,M.jsxs)(`div`,{style:{...N&&!I?{width:`100%`,height:`100%`,minWidth:0}:de,"--document-reading-width":I&&!b?`48rem`:`100%`},onAnimationEnd:e=>{J&&e.target===e.currentTarget&&le(!0)},className:f(`flex flex-col overflow-hidden`,N&&!I?`strip-document-card`:`rounded-(--card-radius) border bg-card shadow-elevation-4 transition-[width,height]`,v&&!I&&!N&&`w-full`,q&&`fixed inset-2 z-40 shadow-elevation-5`,J&&`animate-card-in`),children:[typeof P!=`function`&&(0,M.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center justify-between gap-2 border-b px-4`,children:[(0,M.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 truncate text-sm font-medium`,children:[(0,M.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,M.jsx)(`span`,{className:`truncate`,children:e})]}),Q]}),(0,M.jsx)(T.Provider,{value:()=>L(!I),children:(0,M.jsx)(`div`,{className:f(`min-h-0 flex-1 overflow-y-auto`,I&&!b&&typeof P!=`function`&&`mx-auto w-full max-w-3xl`),children:N&&Z?Z:typeof P==`function`?P(Q):P})})]});return I?(0,j.createPortal)((0,M.jsxs)(`div`,{className:`fixed inset-0 z-picker flex items-center justify-center gap-4 bg-scrim p-4 max-md:p-2`,children:[$,Z&&(0,M.jsx)(`div`,{className:`flex max-md:absolute max-md:inset-2 max-md:z-10`,children:Z})]}),document.body):(0,M.jsxs)(M.Fragment,{children:[$,!N&&Z&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:`fixed inset-0 z-card bg-scrim animate-fade-in md:hidden`,onClick:()=>!H&&z(!1),"aria-hidden":!0}),(0,M.jsx)(`div`,{ref:U,className:`relative shrink-0 md:z-panel md:ml-2 md:pr-2 max-md:fixed max-md:bottom-2 max-md:left-2 max-md:right-2 max-md:top-2 max-md:z-card-overlay max-md:animate-fade-in`,children:Z})]})]})}function P({onClose:e,onConfirm:t,fixedWorkspaceName:n,saving:r=!1,sizeClassName:i}){let[o,c]=(0,k.useState)(n?`browse`:`workspace`),[u,d]=(0,k.useState)([]),[y,S]=(0,k.useState)(!n),[C,w]=(0,k.useState)(n??null),[T,E]=(0,k.useState)(`context`),[D,O]=(0,k.useState)(new Set),[A,j]=(0,k.useState)(n);return n!==A&&(j(n),n||S(!0)),(0,k.useEffect)(()=>{n||b().then(d).catch(()=>d([])).finally(()=>S(!1))},[n]),(0,M.jsxs)(`div`,{className:f(`flex flex-col overflow-hidden rounded-(--panel-radius) border bg-card shadow-elevation-4`,i||`h-viewport-card max-h-full w-[min(420px,90vw)] max-md:h-full max-md:w-full max-md:shadow-elevation-5`),children:[(0,M.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center justify-between border-b px-4`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,M.jsx)(l,{className:`h-4 w-4`}),o===`workspace`?`Add existing documents…`:`Pick documents…`]}),(0,M.jsx)(`button`,{type:`button`,onClick:e,disabled:r,className:`text-muted-foreground transition-colors hover:text-foreground disabled:opacity-40`,"aria-label":`Close`,children:(0,M.jsx)(a,{className:`h-4 w-4`})})]}),(0,M.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,M.jsxs)(`div`,{className:`grid h-full w-[200%] grid-cols-2 transition-transform duration-normal`,style:{transform:o===`workspace`?`translateX(0)`:`translateX(-50%)`},children:[(0,M.jsx)(`div`,{className:`flex min-w-0 flex-col overflow-y-auto p-2`,children:(0,M.jsx)(v,{workspaces:u,loading:y,onPick:e=>{w(e),O(new Set),c(`browse`)}})}),(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-col overflow-hidden`,children:[(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 border-b px-2 pt-2`,children:[!n&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>c(`workspace`),className:`mr-1 rounded p-1.5 text-muted-foreground hover:bg-muted hover:text-foreground touch-target`,"aria-label":`Back to workspaces`,children:(0,M.jsx)(s,{className:`h-4 w-4 rotate-180`})}),[`context`,`directory`].map(e=>(0,M.jsxs)(`button`,{type:`button`,onClick:()=>{E(e),O(new Set)},className:f(`flex items-center gap-1.5 rounded-t-md border-b-2 px-3 py-2 text-xs font-medium transition-colors`,T===e?`border-primary text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:[g[e],h[e]]},e))]}),C&&(0,M.jsx)(_,{workspaceName:C,treeTab:T,onTreeTabChange:E,selectedDocIds:D,onToggleDoc:e=>{O(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},onNavigate:()=>O(new Set)})]})]})}),o===`browse`&&(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-t px-4 py-3`,children:[(0,M.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[D.size,` document`,D.size===1?``:`s`,` selected`]}),(0,M.jsx)(p,{size:`sm`,onClick:async()=>{!C||D.size===0||r||await t(Array.from(D),{workspaceName:C,treeName:T===`directory`?`directory`:x,treeType:T})},disabled:D.size===0||r,children:r?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(m,{className:`mr-1.5 h-3.5 w-3.5`}),`Adding…`]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(l,{className:`mr-1 h-3.5 w-3.5`}),`Add`]})})]})]})}export{N as n,P as t};
@@ -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{Pt as r,X as i,Xr as a}from"./ui-76Hw0NU_.js";import{t as o}from"./button-Bum-POPT.js";import{Pn as s}from"./workspace-46EFyEKZ.js";import{t as c}from"./useDocumentThumbnail-Bs2Ju0eb.js";import{t as l}from"./useToastHelpers-CRrpIIdY.js";import{t as u}from"./sketch-lazy-BOFTGGTA.js";import{n as d}from"./use-applet-target-DmIdCxa_.js";import{n as f,r as p}from"./use-applet-docs-DBshA7yq.js";var m=e(n(),1),h=t();function g({doc:e,scope:t,onOpen:n,onRemove:r}){let{blobUrl:o,loading:s}=c(t.workspaceName,e.id,256,{version:e.checksumArray?.[0]??null}),l=String(e.data?.title??`Sketch`);return(0,h.jsxs)(`div`,{className:`group relative overflow-hidden rounded-(--card-radius) border bg-card shadow-elevation-2 transition-shadow hover:shadow-elevation-3`,children:[(0,h.jsxs)(`button`,{type:`button`,onClick:n,className:`block w-full text-left`,children:[(0,h.jsx)(`div`,{className:`flex aspect-[4/3] items-center justify-center overflow-hidden bg-muted/30`,children:o?(0,h.jsx)(`img`,{src:o,alt:l,className:`h-full w-full object-contain`}):(0,h.jsx)(a,{className:`h-6 w-6 text-muted-foreground ${s?`animate-pulse`:``}`})}),(0,h.jsxs)(`div`,{className:`px-2 py-1.5`,children:[(0,h.jsx)(`div`,{className:`truncate text-xs font-medium`,children:l}),(0,h.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:f(e.updatedAt||e.createdAt)})]})]}),(0,h.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Delete ${l}`,className:`absolute right-1.5 top-1.5 rounded-md bg-background/80 p-1 opacity-0 transition-opacity hover:text-destructive group-hover:opacity-100`,children:(0,h.jsx)(i,{className:`h-3.5 w-3.5`})})]})}function _({autoAdd:e}){let t=d(),{docs:n,loading:i,error:a,scope:c,reload:f,removeDoc:_}=p(t,s),[v,y]=(0,m.useState)(e?`new`:null),{showErrorToast:b}=l();return t?(0,h.jsxs)(`div`,{className:`flex flex-col gap-3 p-3`,children:[(0,h.jsxs)(o,{size:`sm`,variant:`outline`,className:`self-start`,onClick:()=>y(`new`),children:[(0,h.jsx)(r,{className:`mr-1.5 h-4 w-4`}),`New sketch`]}),a&&(0,h.jsx)(`p`,{className:`text-sm text-destructive`,children:a}),i&&!n.length&&(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading sketches…`}),!i&&!n.length&&!a&&(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No sketches here yet.`}),c&&n.length>0&&(0,h.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4`,children:n.map(e=>(0,h.jsx)(g,{doc:e,scope:c,onOpen:()=>y(e),onRemove:()=>{confirm(`Delete "${String(e.data?.title??`Sketch`)}"?`)&&_(e.id).catch(e=>b(e instanceof Error?e.message:`Failed to delete sketch`))}},`${e.id}:${e.checksumArray?.[0]??``}`))}),v&&c&&(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(`div`,{className:`fixed inset-0 z-fullscreen flex items-center justify-center bg-background surface-glass`,children:(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading sketch editor…`})}),children:(0,h.jsx)(u,{doc:v===`new`?null:v,workspaceName:c.workspaceName,target:t,onSaved:()=>{y(null),f()},onClose:()=>y(null)})}),v&&!c&&(0,h.jsx)(`div`,{className:`fixed inset-0 z-fullscreen flex items-center justify-center bg-background surface-glass`,children:(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Resolving destination…`})})]}):(0,h.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`Select a context or workspace path first.`})}export{_ as SketchApplet};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{Pt as r,X as i,Zr as a}from"./ui-CDoK3F3U.js";import{t as o}from"./button-SeUZ_Pvi.js";import{Pn as s}from"./workspace-BJELPCNs.js";import{t as c}from"./useDocumentThumbnail-wW0lSOEy.js";import{t as l}from"./useToastHelpers-CRrpIIdY.js";import{t as u}from"./sketch-lazy-BbNgGbR3.js";import{n as d}from"./use-applet-target-ffIGaAqT.js";import{n as f,r as p}from"./use-applet-docs-B2dk__vk.js";var m=e(n(),1),h=t();function g({doc:e,scope:t,onOpen:n,onRemove:r}){let{blobUrl:o,loading:s}=c(t.workspaceName,e.id,256,{version:e.checksumArray?.[0]??null}),l=String(e.data?.title??`Sketch`);return(0,h.jsxs)(`div`,{className:`group relative overflow-hidden rounded-(--card-radius) border bg-card shadow-elevation-2 transition-shadow hover:shadow-elevation-3`,children:[(0,h.jsxs)(`button`,{type:`button`,onClick:n,className:`block w-full text-left`,children:[(0,h.jsx)(`div`,{className:`flex aspect-[4/3] items-center justify-center overflow-hidden bg-muted/30`,children:o?(0,h.jsx)(`img`,{src:o,alt:l,className:`h-full w-full object-contain`}):(0,h.jsx)(a,{className:`h-6 w-6 text-muted-foreground ${s?`animate-pulse`:``}`})}),(0,h.jsxs)(`div`,{className:`px-2 py-1.5`,children:[(0,h.jsx)(`div`,{className:`truncate text-xs font-medium`,children:l}),(0,h.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:f(e.updatedAt||e.createdAt)})]})]}),(0,h.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Delete ${l}`,className:`absolute right-1.5 top-1.5 rounded-md bg-background/80 p-1 opacity-0 transition-opacity hover:text-destructive group-hover:opacity-100`,children:(0,h.jsx)(i,{className:`h-3.5 w-3.5`})})]})}function _({autoAdd:e}){let t=d(),{docs:n,loading:i,error:a,scope:c,reload:f,removeDoc:_}=p(t,s),[v,y]=(0,m.useState)(e?`new`:null),{showErrorToast:b}=l();return t?(0,h.jsxs)(`div`,{className:`flex flex-col gap-3 p-3`,children:[(0,h.jsxs)(o,{size:`sm`,variant:`outline`,className:`self-start`,onClick:()=>y(`new`),children:[(0,h.jsx)(r,{className:`mr-1.5 h-4 w-4`}),`New sketch`]}),a&&(0,h.jsx)(`p`,{className:`text-sm text-destructive`,children:a}),i&&!n.length&&(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading sketches…`}),!i&&!n.length&&!a&&(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No sketches here yet.`}),c&&n.length>0&&(0,h.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4`,children:n.map(e=>(0,h.jsx)(g,{doc:e,scope:c,onOpen:()=>y(e),onRemove:()=>{confirm(`Delete "${String(e.data?.title??`Sketch`)}"?`)&&_(e.id).catch(e=>b(e instanceof Error?e.message:`Failed to delete sketch`))}},`${e.id}:${e.checksumArray?.[0]??``}`))}),v&&c&&(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(`div`,{className:`fixed inset-0 z-fullscreen flex items-center justify-center bg-background surface-glass`,children:(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading sketch editor…`})}),children:(0,h.jsx)(u,{doc:v===`new`?null:v,workspaceName:c.workspaceName,target:t,onSaved:()=>{y(null),f()},onClose:()=>y(null)})}),v&&!c&&(0,h.jsx)(`div`,{className:`fixed inset-0 z-fullscreen flex items-center justify-center bg-background surface-glass`,children:(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Resolving destination…`})})]}):(0,h.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`Select a context or workspace path first.`})}export{_ as SketchApplet};