@augmentd-labs/canvas-web 2.26.40 → 2.26.41
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.
- package/dist/assets/{CalendarApplet-Co0RKLQE.js → CalendarApplet-Bno3IDzO.js} +1 -1
- package/dist/assets/{FiltersApplet-DMoH8Y2S.js → FiltersApplet-PclPc7fz.js} +1 -1
- package/dist/assets/{HomeFab-CpgkP2jx.js → HomeFab-B3f-hO-p.js} +1 -1
- package/dist/assets/{LensApplet-BRvNa6QA.js → LensApplet-BnW7b0KX.js} +1 -1
- package/dist/assets/{NotesApplet-BUlo1AeT.js → NotesApplet-FjdHMWCV.js} +1 -1
- package/dist/assets/{_agentId_-DpUGhD0N.js → _agentId_-CW33ane1.js} +0 -0
- package/dist/assets/{_contextId_-BYACtvKh.js → _contextId_-wbu8w6OE.js} +1 -1
- package/dist/assets/_workspaceName_-Ck6op9kd.js +1 -0
- package/dist/assets/{about-he3_XqHw.js → about-DRzhyy-e.js} +1 -1
- package/dist/assets/{add-CPWQz9ZK.js → add-BeESP_fg.js} +1 -1
- package/dist/assets/{agents-e-nclilT.js → agents-BYNJHrPc.js} +1 -1
- package/dist/assets/{appearance-De5ieWdQ.js → appearance-DiQhAis2.js} +1 -1
- package/dist/assets/{apps-o8pk-feK.js → apps-C2mb0HML.js} +1 -1
- package/dist/assets/backend-sync-progress-CFe6JPuR.js +6 -0
- package/dist/assets/{document-list-J63eer10.js → document-list-CUmMhD6M.js} +1 -1
- package/dist/assets/{home-Cgt-SPAO.js → home-BRx1tOR-.js} +1 -1
- package/dist/assets/{index-B01BkfMJ.js → index-I9cslsRe.js} +2 -2
- package/dist/assets/{key-bindings-DbpenCz7.js → key-bindings-CvzGVYrr.js} +1 -1
- package/dist/assets/{registry-CPdMkdKq.js → registry-NAExJwr9.js} +2 -2
- package/dist/assets/{settings-D1g-5DNT.js → settings-CjKOuPew.js} +1 -1
- package/dist/assets/{settings-DX6t8wLi.js → settings-DMM8k_4o.js} +1 -1
- package/dist/assets/{settings-3y1P0NnU.js → settings-DrQdeEUS.js} +1 -1
- package/dist/assets/{settings-B25sRmAM.js → settings-HBpYbGPW.js} +1 -1
- package/dist/assets/{share-target-DAjpH4Qw.js → share-target-q77WkQhO.js} +1 -1
- package/dist/assets/{shared-BiquP0Yf.js → shared-DsgNtRuD.js} +1 -1
- package/dist/assets/{tree-folders-BMqMmyq7.js → tree-folders-CNu09uPg.js} +1 -1
- package/dist/assets/{use-canvas-pins-BV8AsYCE.js → use-canvas-pins-Bhd7_wde.js} +1 -1
- package/dist/assets/{useAgentModels-KcfEQ6u9.js → useAgentModels-B48KqDI7.js} +1 -1
- package/dist/assets/{workspace-area-menu-Y2-IWSxU.js → workspace-area-menu-B-bXURzn.js} +1 -1
- package/dist/assets/{workspaces-CWqg_P7W.js → workspaces-y3zARr9A.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/sw.js +1 -1
- package/package.json +2 -2
- package/dist/assets/_workspaceName_-V027dHb_.js +0 -1
- package/dist/assets/backend-sync-progress-DqI8zbnK.js +0 -6
|
@@ -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{h as r}from"./chunk-62JRHF6Z-vspAGgtK.js";import{t as i}from"./button-SeUZ_Pvi.js";import{t as a}from"./input-BOtCd4HP.js";import{t as o}from"./api-CA6WiiYM.js";import{n as s}from"./use-toast-BlLDqSUO.js";import{At as c}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{h as r}from"./chunk-62JRHF6Z-vspAGgtK.js";import{t as i}from"./button-SeUZ_Pvi.js";import{t as a}from"./input-BOtCd4HP.js";import{t as o}from"./api-CA6WiiYM.js";import{n as s}from"./use-toast-BlLDqSUO.js";import{At as c}from"./index-I9cslsRe.js";import{n as l}from"./page-header-DrDt1sQ2.js";import{t as u}from"./use-settings-back-DGmLAD63.js";var d=e(n(),1),f=t();function p(){let e=r(),{showToast:t}=s(),n=new URLSearchParams(e.search),p=e=>{try{let t=new URL(e);return t.pathname.includes(`/rest/v2/workspaces/`)&&!t.pathname.includes(`/rest/v2/pub/`)?t.pathname=t.pathname.replace(`/rest/v2/workspaces/`,`/rest/v2/pub/workspaces/`):t.pathname.includes(`/rest/v2/contexts/`)&&!t.pathname.includes(`/rest/v2/pub/`)&&(t.pathname=t.pathname.replace(`/rest/v2/contexts/`,`/rest/v2/pub/contexts/`)),t.toString()}catch{return e}},m=p(n.get(`url`)||``),h=sessionStorage.getItem(`sharedToken:last`)||``,[g,_]=(0,d.useState)(m),[v,y]=(0,d.useState)(h),[b,x]=(0,d.useState)(null),[S,C]=(0,d.useState)([]),[w,T]=(0,d.useState)(!1),E=(0,d.useMemo)(()=>{try{let e=new URL(g);return e.pathname.includes(`/pub/workspaces/`)?`workspace`:e.pathname.includes(`/pub/contexts/`)?`context`:`unknown`}catch{return`unknown`}},[g]),D=()=>({Authorization:`Bearer ${v.trim()}`}),O=async()=>{if(!(!g||!v)){T(!0);try{let e=p(g),t=await o.get(e,{skipAuth:!0,headers:D()});x(t);let n=await o.get(`${e}/documents`,{skipAuth:!0,headers:D()}),r=Array.isArray(n)?n:Array.isArray(n?.data)?n.data:[];C(Array.isArray(r)?r:[])}catch(e){let n=g.includes(`/rest/v2/workspaces/`)?`Ensure the URL uses /rest/v2/pub/workspaces/<workspace-id> and the token matches that workspace.`:g.includes(`/rest/v2/contexts/`)?`Ensure the URL uses /rest/v2/pub/contexts/<context-id>.`:void 0;t({title:`Error`,description:`${e instanceof Error?e.message:`Failed to load shared resource`}${n?`: ${n}`:``}`,variant:`destructive`}),x(null),C([])}finally{T(!1)}}},k=(0,d.useRef)(O);return(0,d.useEffect)(()=>{k.current()},[]),(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsx)(l,{onBack:u(),title:`Shared Resource Viewer`,description:`Open a resource someone shared with you.`}),(0,f.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,f.jsx)(a,{value:g,onChange:e=>_(e.target.value),placeholder:`Full pub URL`}),(0,f.jsx)(a,{value:v,onChange:e=>y(e.target.value),placeholder:`Access token (canvas-...)`}),(0,f.jsx)(i,{onClick:O,disabled:w||!g||!v,children:`Load`})]}),(0,f.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[`Type: `,E]}),w?(0,f.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`Loading...`}):(0,f.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,f.jsxs)(`div`,{className:`border rounded p-3`,children:[(0,f.jsx)(`h2`,{className:`font-semibold mb-2`,children:`Metadata`}),(0,f.jsx)(`pre`,{className:`text-xs overflow-auto max-h-80`,children:JSON.stringify(b,null,2)})]}),(0,f.jsxs)(`div`,{className:`border rounded p-3`,children:[(0,f.jsxs)(`h2`,{className:`font-semibold mb-2`,children:[`Documents (`,S.length,`)`]}),S.length===0?(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No documents`}):(0,f.jsx)(`ul`,{className:`space-y-2 text-sm`,children:S.slice(0,100).map((e,t)=>(0,f.jsxs)(`li`,{className:`border rounded p-2`,children:[(0,f.jsx)(`div`,{className:`font-mono text-xs`,children:e.id}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.schema})]},t))})]})]}),(0,f.jsx)(c,{className:`mt-8`})]})}export{p as default};
|
|
@@ -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{h as r}from"./chunk-62JRHF6Z-vspAGgtK.js";import{Ct as i,Er as a,G as o,Jr as s,L as c,Lt as l,Pt as u,Rt as d,St as f,Vr as p,Wt as ee,X as m,Zr as h,bn as g,ct as _,hn as v,it as y,mt as b,ri as x,tt as S,xn as C,yn as w}from"./ui-CDoK3F3U.js";import{t as T}from"./utils-2pl1SbIp.js";import{Dn as E,G as D,In as O,bn as te,zn as ne}from"./workspace-C5V-ZCOE.js";import{t as re}from"./TodosWidget-CNnfNk4L.js";import{d as ie,o as ae,u as oe}from"./ObjectPropertiesCard-D2lrTQqT.js";import{g as se,t as ce,w as le,y as ue}from"./document-list-J63eer10.js";import{n as de,r as fe}from"./use-toolbox-Ck_cLGgf.js";import{t as pe}from"./useToastHelpers-CRrpIIdY.js";import{n as me}from"./color-DFEH4BfK.js";import{t as k}from"./DocumentIcon-9i1uCMQa.js";import{r as he}from"./workspace-BydSRtST.js";import{t as ge}from"./registry-CPdMkdKq.js";import{t as _e}from"./FileForm-CDiVKvxq.js";import{t as ve}from"./applet-target-pLdP-R76.js";var A=e(n(),1);function j(e){let{pathname:t}=r(),n=fe()?.setAgentView,i=JSON.stringify(e);(0,A.useEffect)(()=>(n?.({pathname:t,view:JSON.parse(i)}),()=>n?.(null)),[t,i,n])}function M(e,t,n,r){return structuredClone({...e,query:he(t,n,r),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone})}var N=t();function ye({target:e,children:t}){let[n,r]=(0,A.useState)([]),i=(0,A.useRef)(!1),[a,o]=(0,A.useState)(!1),[s,c]=(0,A.useState)(!1),[l,u]=(0,A.useState)(null),{showErrorToast:d}=pe();return(0,N.jsxs)(`div`,{className:`relative flex flex-col h-full min-h-0 bg-background ${a?`ring-2 ring-inset ring-primary`:``}`,onDragOverCapture:t=>{s||!e||!Array.from(t.dataTransfer.types).includes(`Files`)||(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=i.current?`none`:`copy`,o(!i.current))},onDragLeaveCapture:e=>{e.currentTarget.contains(e.relatedTarget)||o(!1)},onDropCapture:t=>{if(s||!e||!Array.from(t.dataTransfer.types).includes(`Files`))return;if(t.preventDefault(),t.stopPropagation(),o(!1),i.current){d(`Wait for the current upload to finish`);return}let n=Array.from(t.dataTransfer.files);if(!n.length){d(`Drop files rather than folders`);return}r(n),u(e),c(!0)},children:[t,a&&(0,N.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 z-30 flex items-center justify-center bg-background/80 text-sm font-medium`,children:[`Drop files to upload to `,e?.mode===`workspace`?e.path:`this context`]}),s&&(0,N.jsxs)(ue,{label:`Import files`,onClose:()=>{i.current||c(!1)},children:[(0,N.jsx)(`h2`,{className:`border-b px-4 py-3 text-sm font-medium`,children:`Import files`}),(0,N.jsx)(_e,{target:l,initialFiles:n,onClose:()=>c(!1),onBusyChange:e=>{i.current=e}})]})]})}function P({navigationTabs:e,navigationActions:t,onBack:n,accentColor:r,frameContent:a=!0,urlType:s,urlDisplay:c,contextPath:u,treeName:f,workspaceId:p,workspaceLabel:ee,workspaceIcon:h,documentSchema:_,documents:v,isLoading:y,totalCount:S,currentPage:C,pageSize:w,onPageChange:T,onPageSizeChange:E,onRemoveDocument:D,onDeleteDocument:O,onDestroyDocument:ne,onRemoveDocuments:re,onDeleteDocuments:se,onDestroyDocuments:ue,onCopyDocuments:fe,onCutDocuments:pe,onPasteDocuments:me,onImportDocuments:k,onSelectionChange:he,pastedDocumentIds:ge,onPurgeDocuments:_e,disablePurgeDocuments:ve,canvasInfo:j,isCanvasPinned:M,onTogglePinCanvas:P,onSaveAsCanvas:F,onShareCanvas:I,onUnshareCanvas:L,onDeleteCanvas:R,isSharingCanvas:z,isDeletingCanvas:B,isCanvasShared:V,isCanvasLocked:H,backendSearchQueries:U,onBackendSearch:W,onRemoveBackendQuery:G,serverSort:be,onServerSortChange:xe,scope:K,onScopeChange:q,canSaveChanges:J,isSavingChanges:Y,onSaveChanges:X,onBrowseWorkspaces:Se,onBrowseTree:Ce,onNavigatePath:we,linkTree:Te,children:Z,contentBanner:Ee,folders:De,onOpenFolder:Oe}){let ke=s===`canvas`,Q=le(),{state:Ae,toggleView:je,hasActiveFilters:Me,openAddPicker:Ne}=de(),$=ae(),[Pe,Fe]=(0,A.useState)(``),Ie=JSON.stringify([p,f,u,_]),[Le,Re]=(0,A.useState)(Ie);Le!==Ie&&(Re(Ie),Fe(``));let ze=(0,N.jsxs)(N.Fragment,{children:[t,F&&(0,N.jsx)(`button`,{type:`button`,onClick:F,title:`Save as canvas`,"aria-label":`Save as canvas`,className:`flex h-control-sm w-control-sm shrink-0 items-center justify-center rounded-md border text-muted-foreground hover:bg-accent touch-target`,children:(0,N.jsx)(x,{className:`h-4 w-4`})})]});return(0,N.jsxs)(ye,{target:k&&p?{mode:`workspace`,workspaceName:p,path:u,treeName:f||`context`,treeType:te(f)}:null,children:[e&&!Q&&(0,N.jsx)(ie,{accentColor:r,children:e}),(0,N.jsxs)(`div`,{className:`canvas-surface-body${a&&!Q?` is-framed`:``}`,children:[(0,N.jsx)(oe,{workspaceIcon:h,workspace:ee||p||c.split(`://`)[0]||`Workspace`,actions:Q&&e?(0,N.jsxs)(`details`,{className:`relative shrink-0`,"aria-label":`Canvas views`,children:[(0,N.jsx)(`summary`,{className:`cursor-pointer rounded-md border px-2 py-1 text-xs`,title:`Choose or manage content views`,children:`Views`}),(0,N.jsx)(`div`,{className:`absolute right-0 top-full z-30 mt-2 min-w-64 max-w-[80vw] rounded-md border bg-background p-2 shadow-lg`,children:e})]}):void 0,tree:f?`${f}${s.endsWith(`-layer`)?`:layer`:``}`:s.replace(`-layer`,``),path:u,accentColor:r,onBack:$.location?$.location.section===`view`?$.close:()=>$.update?.({section:`view`}):n,section:$.location?`document/${$.location.documentId}/${$.location.section}`:void 0,onSection:$.location?()=>$.update?.({section:`view`}):void 0,onBrowseWorkspaces:Se,onBrowseTree:Ce,onNavigatePath:we,onFilter:()=>je(`tools`),filtersActive:Me,filtersOpen:Ae.t1Open&&Ae.t1View===`tools`,onAdd:e=>Ne({modal:e.shiftKey,fresh:!0}),search:W||!Z?{workspaceId:p,queries:U||[],onSearch:W??Fe,localOnly:!W,onRemoveQuery:G,scope:K,onScopeChange:q}:void 0,onDraftChange:Z?void 0:Fe}),ke&&j?(0,N.jsx)(N.Fragment,{children:(0,N.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2.5 border-b bg-muted/20 shrink-0 min-w-0`,children:[j.color&&(0,N.jsx)(`div`,{className:`w-1 h-6 rounded-full shrink-0`,style:{backgroundColor:j.color}}),(0,N.jsx)(g,{className:`w-4 h-4 shrink-0 text-primary`}),(0,N.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,N.jsx)(`span`,{className:`text-lg font-semibold leading-tight truncate`,children:j.label||c.split(`://`)[1]||`Canvas`}),j.description&&(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground truncate leading-tight`,children:j.description})]}),J&&X&&(0,N.jsxs)(`button`,{type:`button`,onClick:X,disabled:Y,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 text-xs border rounded-md hover:bg-accent transition-colors text-muted-foreground hover:text-foreground disabled:opacity-50`,title:`Save filters`,children:[(0,N.jsx)(i,{className:`w-3 h-3`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:Y?`Saving...`:`Save filters`})]}),P&&(0,N.jsxs)(`button`,{type:`button`,onClick:P,"aria-pressed":!!M,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 text-xs border rounded-md hover:bg-accent transition-colors text-muted-foreground hover:text-foreground`,title:M?`Unpin from home`:`Pin to home`,children:[M?(0,N.jsx)(d,{className:`w-3 h-3`}):(0,N.jsx)(l,{className:`w-3 h-3`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:M?`Unpin`:`Pin`})]}),I&&(0,N.jsxs)(`button`,{type:`button`,onClick:I,disabled:z||B,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 text-xs border rounded-md hover:bg-accent transition-colors text-muted-foreground hover:text-foreground disabled:opacity-50`,title:V?`Copy public link`:`Share canvas`,children:[(0,N.jsx)(b,{className:`w-3 h-3`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:z?`Sharing...`:V?`Copy link`:`Share`})]}),V&&L&&(0,N.jsxs)(`button`,{type:`button`,onClick:L,disabled:z||B,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 text-xs border rounded-md hover:bg-destructive/10 transition-colors text-muted-foreground hover:text-destructive disabled:opacity-50`,children:[(0,N.jsx)(o,{className:`w-3 h-3`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:`Unshare`})]}),R&&(0,N.jsxs)(`button`,{type:`button`,onClick:R,disabled:B||H&&!V,title:H&&!V?`Unlock this canvas before deleting it`:`Delete canvas`,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 text-xs border rounded-md hover:bg-destructive/10 transition-colors text-muted-foreground hover:text-destructive disabled:opacity-50`,children:[(0,N.jsx)(m,{className:`w-3 h-3`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:B?`Deleting…`:`Delete`})]})]})}):null,Z&&(F||t)&&(0,N.jsx)(`div`,{className:`flex items-center gap-2 border-b px-3 py-1`,children:ze}),(0,N.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:[Ee,Z||(0,N.jsx)(ce,{readingPane:!0,externalSearchQuery:Pe,toolbarActions:ze,documents:_?v.filter(e=>e.schema===_):v,isLoading:y,folders:_?void 0:De,onOpenFolder:Oe,contextPath:u,treeName:f,workspaceId:p,totalCount:S,viewMode:_?`card`:`table`,allowViewToggle:!0,currentPage:C,pageSize:w,onPageChange:T,onPageSizeChange:E,onRemoveDocument:D,onDeleteDocument:O,onDestroyDocument:ne,onRemoveDocuments:re,onDeleteDocuments:se,onDestroyDocuments:ue,onCopyDocuments:fe,onCutDocuments:pe,onPasteDocuments:me,onImportDocuments:k,onSelectionChange:he,pastedDocumentIds:ge,onPurgeDocuments:_?void 0:_e,disablePurgeDocuments:ve,backendSearchQueries:U,onBackendSearch:W,serverSort:be,onServerSortChange:xe,onRemoveBackendQuery:G,scope:K,onScopeChange:q,canSaveChanges:!ke&&J,isSavingChanges:Y,onSaveChanges:X,linkTree:Te},_??`documents`)]})]})]})}var F=[{id:`todos`,label:`Todo list`},{id:`todo-app`,label:`Todo App`},{id:`notes`,label:`Notes list`},{id:`notes-app`,label:`Notes App`},{id:`calendar`,label:`Calendar`},{id:`apps`,label:`Apps`},{id:`sketch`,label:`Sketch`},{id:`terminal`,label:`Terminal`}];function I(e){return e?.kind===`app`&&e.app===`notes`?`data/schema/note`:void 0}var L={id:`default`,name:`All`,kind:`documents`};function R(){return[{id:`emails`,label:`Emails`,schemas:[`data/schema/message`]},{id:`todos`,label:`Todos`,schemas:[`data/schema/task`]},{id:`notes`,label:`Notes`,schemas:[`data/schema/note`]},{id:`links`,label:`Links`,schemas:[`data/schema/tab`,`data/schema/link`]},{id:`files`,label:`Files`,schemas:[`data/schema/file`]}]}function z(e){let t=e?.views;if(!Array.isArray(t))return[L];let n=t.filter(e=>{let t=e;return!t||typeof t.id!=`string`||typeof t.name!=`string`?!1:t.kind===`documents`||t.kind===`columns`||t.kind===`app`&&(F.some(e=>e.id===t.app)||t.app===`filters`||t.app===`lens`)});return n.length>0?n:[L]}var B={todos:v,"todo-app":v,notes:S,"notes-app":S,calendar:s,filters:_,sketch:h,terminal:y,lens:f,apps:C};function V({views:e,activeId:t,onSelect:n,onSave:r,readOnly:i=!1,className:o,accentColor:s,onOpenToSide:l}){let[d,f]=(0,A.useState)(null),[p,m]=(0,A.useState)(``),[h,g]=(0,A.useState)(!1),[_,v]=(0,A.useState)(null),[y,b]=(0,A.useState)(null),x=(0,A.useRef)(null);(0,A.useEffect)(()=>{let e=x.current;if(!e)return;let t=t=>{if(t.ctrlKey||e.scrollWidth<=e.clientWidth)return;let n=Math.abs(t.deltaX)>Math.abs(t.deltaY)?t.deltaX:t.deltaY,r=t.deltaMode===1?16:t.deltaMode===2?e.clientWidth:1;t.preventDefault(),e.scrollLeft+=n*r};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]),(0,A.useEffect)(()=>{x.current?.querySelector(`[aria-pressed="true"], input`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[t,d]);let S=()=>{v(null),b(null)},C=()=>{if(_&&y&&_!==y.id){let t=e.find(e=>e.id===_),n=e.filter(e=>e.id!==_),i=n.findIndex(e=>e.id===y.id);t&&i>=0&&(n.splice(y.before?i:i+1,0,t),n.some((t,n)=>t.id!==e[n].id)&&r(n))}S()},E=()=>{if(!d)return;let t=p.trim();t&&r(e.map(e=>e.id===d?{...e,name:t}:e)),f(null)},D=(t,n)=>{g(!1);let i=`view-${Date.now().toString(36)}`,a=t===`columns`?`Board`:t===`app`?F.find(e=>e.id===n)?.label??`App`:`List`,o=t===`columns`?{id:i,name:a,kind:t,columns:R()}:t===`app`?{id:i,name:a,kind:t,app:n}:{id:i,name:a,kind:t};r([...e,o],i),f(i),m(a)},O=n=>{let i=e.filter(e=>e.id!==n);r(i.length>0?i:[L],n===t?i[0]?.id??L.id:void 0)};return(0,N.jsxs)(`div`,{className:T(`relative flex h-full min-w-0 items-end`,o),children:[(0,N.jsx)(`div`,{ref:x,className:`flex min-w-0 items-end gap-0.5 overflow-x-auto overscroll-x-contain pt-1 [scrollbar-width:none]`,children:e.map(r=>{let o=r.id===t,u=r.kind===`columns`?a:r.kind===`app`&&r.app?B[r.app]:w;return d===r.id?(0,N.jsx)(`input`,{autoFocus:!0,"aria-label":`Tab name`,value:p,onChange:e=>m(e.target.value),onBlur:E,onKeyDown:e=>{e.key===`Enter`&&E(),e.key===`Escape`&&f(null)},className:T(`relative h-[2.3rem] w-28 shrink-0 rounded-t-[.5rem] border-0 px-3 pb-1 text-xs outline-none ring-0`,o?T(`z-[2] bg-background font-medium`,s?me(s):`text-foreground`):`bg-muted text-muted-foreground`),style:{backgroundColor:o?s:void 0}},r.id):(0,N.jsxs)(`button`,{type:`button`,"aria-pressed":o,onClick:()=>n(r.id),onDoubleClick:()=>{i||(f(r.id),m(r.name))},title:i?r.name:`${r.name}: double-click to rename, drag to reorder`,draggable:!i,onDragStart:e=>{e.dataTransfer.setData(`text/plain`,r.name),e.dataTransfer.effectAllowed=`move`,v(r.id)},onDragOver:e=>{if(!_||_===r.id)return;e.preventDefault(),e.dataTransfer.dropEffect=`move`;let t=e.currentTarget.getBoundingClientRect(),n=e.clientX<t.left+t.width/2;b(e=>e?.id===r.id&&e.before===n?e:{id:r.id,before:n})},onDrop:e=>{e.preventDefault(),C()},onDragEnd:S,className:T(`group relative flex h-[2.3rem] shrink-0 items-center gap-1.5 rounded-t-[.5rem] border-0 px-3 pb-1 text-xs transition-colors`,o?T(`z-[2] bg-background font-medium`,s?me(s):`text-foreground`):`bg-muted text-muted-foreground hover:bg-accent hover:text-foreground`,_===r.id&&`opacity-50`),style:{backgroundColor:o?s:void 0,boxShadow:y?.id===r.id?`inset ${y.before?`2px`:`-2px`} 0 0 var(--primary)`:void 0},children:[(0,N.jsx)(u,{className:`h-3 w-3 shrink-0`}),(0,N.jsx)(`span`,{className:`max-w-32 truncate`,children:r.name}),l&&(0,N.jsx)(ee,{className:`h-3 w-3 shrink-0 opacity-0 transition-opacity hover:opacity-100 group-hover:opacity-60`,"aria-label":`Open to the side`,onClick:e=>{e.stopPropagation(),l(r.id)}}),!i&&e.length>1&&(0,N.jsx)(c,{className:T(`h-3 w-3 shrink-0 transition-opacity hover:text-destructive`,o?`opacity-60 hover:opacity-100`:`opacity-0 group-hover:opacity-100`),onClick:e=>{e.stopPropagation(),O(r.id)}})]},r.id)})}),!i&&(h?(0,N.jsxs)(`span`,{className:`absolute left-0 top-full z-30 flex w-full min-w-64 flex-wrap items-center gap-2 rounded-b-xl border bg-card p-2 shadow-lg`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>D(`documents`),className:`flex h-10 items-center gap-1.5 rounded-md border px-2 text-xs text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:[(0,N.jsx)(w,{className:`h-3 w-3`}),` List`]}),(0,N.jsxs)(`button`,{type:`button`,onClick:()=>D(`columns`),className:`flex h-10 items-center gap-1.5 rounded-md border px-2 text-xs text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:[(0,N.jsx)(a,{className:`h-3 w-3`}),` Board`]}),F.map(e=>{let t=B[e.id];return(0,N.jsxs)(`button`,{type:`button`,onClick:()=>D(`app`,e.id),className:`flex h-10 items-center gap-1.5 rounded-md border px-2 text-xs text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:[(0,N.jsx)(t,{className:`h-3 w-3`}),` `,e.label]},e.id)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>g(!1),className:`p-1 text-muted-foreground hover:text-foreground`,"aria-label":`Cancel`,children:(0,N.jsx)(c,{className:`h-3 w-3`})})]}):(0,N.jsx)(`button`,{type:`button`,onClick:()=>g(!0),title:`Add view`,"aria-label":`Add view`,className:`relative ml-1 flex h-[2.3rem] w-10 shrink-0 items-center justify-center rounded-md pb-1 text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:(0,N.jsx)(u,{className:`h-3.5 w-3.5`})}))]})}var H=[{id:`emails`,label:`Emails`,schemas:[`data/schema/message`]},{id:`todos`,label:`Todos`,schemas:[`data/schema/task`]},{id:`notes`,label:`Notes`,schemas:[`data/schema/note`]},{id:`links`,label:`Links`,schemas:[`data/schema/tab`,`data/schema/link`]},{id:`files`,label:`Files`,schemas:[`data/schema/file`]}];function U(e,t){return t.some(t=>e.schema===t||e.schema.startsWith(`${t}/`))}function W({documents:e,workspaceId:t,columns:n,onColumnsChange:r,readOnly:i=!1}){let[a,o]=(0,A.useState)(null),[s,l]=(0,A.useState)(!1),[d,f]=(0,A.useState)({}),[ee,m]=(0,A.useState)({}),h=(0,A.useRef)(null),[g,_]=(0,A.useState)(!1),v=(0,A.useCallback)(()=>{let e=h.current;e&&_(e.scrollWidth-e.clientWidth-e.scrollLeft>8)},[]);(0,A.useEffect)(()=>{let e=h.current;if(!e)return;let t=new ResizeObserver(()=>v());return t.observe(e),()=>t.disconnect()},[v]);let y=(e,t)=>{e.preventDefault();let i=e.currentTarget.parentElement;if(!i)return;let a=e.clientX,o=i.getBoundingClientRect().width,s=o,c=e=>{s=Math.min(900,Math.max(220,o+e.clientX-a)),m(e=>({...e,[t]:s}))},l=()=>{window.removeEventListener(`pointermove`,c),window.removeEventListener(`pointerup`,l),r(n.map(e=>e.id===t?{...e,width:Math.round(s)}:e))};window.addEventListener(`pointermove`,c),window.addEventListener(`pointerup`,l)},b=e=>{m(t=>{let n={...t};return delete n[e],n}),r(n.map(t=>t.id===e?{...t,width:void 0}:t))},x=e=>{let t=d[e];if(t===void 0)return;let i=n.find(t=>t.id===e);i&&(i.filter||``)!==t&&r(n.map(n=>n.id===e?{...n,filter:t||void 0}:n))},S=H.filter(e=>!n.some(t=>t.id===e.id));return(0,N.jsxs)(`div`,{className:`relative h-full`,children:[(0,N.jsx)(`div`,{ref:h,onScroll:v,className:`flex h-full snap-x snap-mandatory gap-3 overflow-x-auto overscroll-x-contain p-2`,"data-testid":`schema-columns-board`,children:n.map(t=>{let a=(d[t.id]??t.filter??``).toLowerCase(),s=e.filter(e=>U(e,t.schemas)).filter(e=>{if(!a)return!0;let t=E(e);return`${t.title}\n${t.preview}\n${t.subtitle}`.toLowerCase().includes(a)}),l=ee[t.id]??t.width;return(0,N.jsxs)(`div`,{className:`relative flex h-full min-h-0 min-w-0 shrink-0 grow-0 basis-full snap-start flex-col rounded-(--card-radius) border bg-muted/20 ${l?`sm:basis-[var(--col-w)]`:`sm:basis-[48%] lg:basis-[32%] xl:basis-[24%]`}`,style:l?{"--col-w":`${l}px`}:void 0,children:[!i&&(0,N.jsx)(`div`,{onPointerDown:e=>y(e,t.id),onDoubleClick:()=>b(t.id),title:`Drag to resize; double-click to reset`,className:`absolute right-0 inset-y-0 z-10 w-2 cursor-col-resize touch-none rounded-r-lg transition-colors hover:bg-primary/25 active:bg-primary/40 max-sm:hidden`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2 px-3 pb-1 pt-2.5 max-sm:pr-10`,children:[(0,N.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t.label}),(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s.length}),(0,N.jsx)(`span`,{className:`flex-1`}),!i&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>r(n.filter(e=>e.id!==t.id)),title:`Remove column`,className:`rounded-sm p-0.5 text-muted-foreground hover:text-destructive`,children:(0,N.jsx)(c,{className:`h-3.5 w-3.5`})})]}),(0,N.jsx)(`div`,{className:`px-3 pb-2`,children:(0,N.jsx)(`input`,{value:d[t.id]??t.filter??``,onChange:e=>f(n=>({...n,[t.id]:e.target.value})),onBlur:()=>x(t.id),onKeyDown:e=>{e.key===`Enter`&&x(t.id)},placeholder:`Filter…`,readOnly:i,className:`h-7 w-full rounded-md border border-input bg-background px-2 text-xs placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`})}),(0,N.jsxs)(`div`,{className:`flex-1 space-y-1.5 overflow-y-auto px-2 pb-2`,children:[s.map(e=>{let t=E(e);return(0,N.jsxs)(`button`,{type:`button`,onClick:()=>o(e),className:`w-full min-w-0 rounded-md border bg-card px-2.5 py-2 text-left transition-colors hover:bg-accent/50`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(k,{document:e,size:3.5}),(0,N.jsx)(`span`,{className:`truncate text-xs font-medium`,title:t.title,children:t.title})]}),t.preview&&(0,N.jsx)(`p`,{className:`mt-1 line-clamp-2 break-words text-[11px] leading-snug text-muted-foreground`,children:t.preview}),(0,N.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground/70`,children:new Date(e.updatedAt||e.createdAt).toLocaleDateString()})]},e.id)}),s.length===0&&(0,N.jsx)(`p`,{className:`px-2 py-3 text-center text-xs text-muted-foreground/60`,children:`Empty`})]})]},t.id)})}),(!i&&S.length>0||g)&&(0,N.jsxs)(`div`,{className:`pointer-events-none absolute inset-y-0 right-0 z-20 flex w-7 flex-col items-end bg-gradient-to-l from-background via-background/60 to-transparent py-2`,children:[!i&&S.length>0&&(0,N.jsxs)(`div`,{className:`pointer-events-auto relative`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),title:`Add column`,"aria-label":`Add column`,className:`flex h-7 w-6 items-center justify-center rounded-l-md border border-r-0 bg-background text-muted-foreground shadow-elevation-1 hover:bg-accent hover:text-foreground`,children:(0,N.jsx)(u,{className:`h-3.5 w-3.5`})}),s&&(0,N.jsxs)(`div`,{className:`absolute right-0 top-8 w-44 rounded-lg border bg-background p-2 shadow-elevation-2`,children:[(0,N.jsx)(`p`,{className:`px-2 pb-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:`Add column`}),S.map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>{l(!1),r([...n,{...e}])},className:`w-full rounded-md px-2 py-1.5 text-left text-xs text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:e.label},e.id)),(0,N.jsx)(`button`,{type:`button`,onClick:()=>l(!1),className:`mt-1 w-full rounded-md px-2 py-1.5 text-left text-xs text-muted-foreground/60 hover:bg-accent/50`,children:`Cancel`})]})]}),g&&(0,N.jsx)(p,{className:`my-auto h-4 w-4 self-center text-muted-foreground/70`,"aria-label":`More columns`})]}),(0,N.jsx)(se,{document:a,isOpen:a!==null,onClose:()=>o(null),workspaceId:t})]})}function G(e,t,n,r,i){let a=`${e}\0${t}\0${n}\0${r.join(`,`)}\0${i??``}`,[o,s]=(0,A.useState)(0),[c,l]=(0,A.useState)(null);(0,A.useEffect)(()=>{let o=!1;return D(e,n,t,{limit:200,allOf:r,...i?{sortBy:i,order:`asc`}:{}}).then(e=>{o||l({key:a,docs:e.payload||[]})}).catch(()=>{o||l({key:a,docs:[]})}),()=>{o=!0}},[a,o]);let u=c?.key===a?c.docs:[],d=c?.key!==a;return(0,A.useEffect)(()=>{let e=()=>s(e=>e+1);return window.addEventListener(`workspace:documents:refresh`,e),()=>window.removeEventListener(`workspace:documents:refresh`,e)},[]),{docs:u,isLoading:d,refresh:(0,A.useCallback)(()=>s(e=>e+1),[])}}function be({workspaceId:e,treeName:t,path:n}){let{docs:r,isLoading:i,refresh:a}=G(e,t,n,[ne],`tasks`),[o,s]=(0,A.useState)(!1),c=o?r.filter(e=>e.data?.status!==`completed`):r,l=r.filter(e=>{let t=e.data?.status;return t!==`completed`&&t!==`cancelled`}).length;return(0,N.jsxs)(`div`,{className:`mx-auto flex h-full w-full max-w-3xl flex-col p-4`,children:[(0,N.jsxs)(`div`,{className:`mb-2 flex shrink-0 items-center justify-between gap-2`,children:[(0,N.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[l,` open`]}),(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),`hide done`]})]}),(0,N.jsx)(`div`,{className:`min-h-0 flex-1 space-y-1 overflow-y-auto`,children:i?(0,N.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`Loading…`}):c.length===0?(0,N.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`No todos here.`}):c.map(t=>(0,N.jsx)(re,{doc:t,workspaceId:e,readOnly:!1,onChanged:a},t.id))})]})}var xe=[O,`data/type/webapp`],K=`Other`;function q({workspaceId:e,treeName:t,path:n}){let{docs:r,isLoading:i}=G(e,t,n,xe),a=(0,A.useMemo)(()=>{let e=new Map;for(let t of r){let n=String(t.data?.category??``).trim(),r=n?n.toLowerCase():``,i=e.get(r)??[];i.push(t),e.set(r,i)}return[...e.entries()].map(([e,t])=>({key:e,label:e?String(t[0].data.category).trim():K,items:t.sort((e,t)=>Y(e).localeCompare(Y(t)))})).sort((e,t)=>!e.key-+!t.key||e.label.localeCompare(t.label))},[r]);return(0,N.jsx)(`div`,{className:`mx-auto h-full w-full max-w-5xl overflow-y-auto p-4`,children:i?(0,N.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`Loading…`}):a.length===0?(0,N.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`No web apps here. Add a link and tick “Web app”.`}):a.map(e=>(0,N.jsxs)(`section`,{className:`mb-6`,children:[(0,N.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:e.label}),(0,N.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(7rem,1fr))] gap-3`,children:e.items.map(e=>(0,N.jsx)(X,{doc:e},e.id))})]},e.key||K))})}function J(e){return String(e.data?.uri??``)}function Y(e){let t=String(e.data?.label??``).trim();if(t)return t;try{return new URL(J(e)).hostname.replace(/^www\./,``)}catch{return J(e)}}function X({doc:e}){let t=Y(e);return(0,N.jsxs)(`a`,{href:J(e),target:`_blank`,rel:`noopener noreferrer`,title:J(e),className:`flex flex-col items-center gap-2 rounded-lg border border-border bg-card p-3 text-center outline-none transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,N.jsx)(`span`,{className:`flex h-10 w-10 items-center justify-center rounded-md bg-primary/10 text-lg font-semibold text-primary`,children:t.charAt(0).toUpperCase()}),(0,N.jsx)(`span`,{className:`w-full truncate text-xs text-foreground`,children:t})]})}function Se({app:e,contextId:t,...n}){let r=t&&e!==`lens`?{mode:`context`,contextId:t}:{mode:`workspace`,workspaceName:n.workspaceId,treeName:n.treeName,path:n.path,treeType:te(n.treeName)},i=e===`todo-app`?`todo`:e===`notes-app`?`notes`:e,a=ge.find(e=>e.id===i);return(0,N.jsx)(ve,{target:r,children:e===`todos`?(0,N.jsx)(be,{...n}):e===`apps`?(0,N.jsx)(q,{...n}):a?(0,N.jsx)(a.Component,{}):null})}function Ce(e,t){if(!e)return[];let n=t.split(`/`).filter(Boolean),r=e;for(let e of n)if(r=r?.children?.find(t=>t.name===e)??null,!r)return[];let i=n.length?`/${n.join(`/`)}`:``,a=(r.children??[]).filter(e=>e.type!==`canvas`).map(e=>({name:e.name,path:`${i}/${e.name}`,label:e.label,color:e.color,childCount:e.children?.length??0})).sort((e,t)=>(e.label||e.name).localeCompare(t.label||t.name,void 0,{numeric:!0,sensitivity:`base`}));return n.length>0&&a.unshift({name:`..`,path:n.length>1?`/${n.slice(0,-1).join(`/`)}`:`/`,isParent:!0}),a}export{L as a,P as c,V as i,M as l,Se as n,I as o,W as r,z as s,Ce as t,j as u};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{h as r}from"./chunk-62JRHF6Z-vspAGgtK.js";import{Ct as i,Er as a,G as o,Jr as s,L as c,Lt as l,Pt as u,Rt as d,St as f,Vr as p,Wt as ee,X as m,Zr as h,bn as g,ct as _,hn as v,it as y,mt as b,ri as x,tt as S,xn as C,yn as w}from"./ui-CDoK3F3U.js";import{t as T}from"./utils-2pl1SbIp.js";import{Dn as E,G as D,In as O,bn as te,zn as ne}from"./workspace-C5V-ZCOE.js";import{t as re}from"./TodosWidget-CNnfNk4L.js";import{d as ie,o as ae,u as oe}from"./ObjectPropertiesCard-D2lrTQqT.js";import{g as se,t as ce,w as le,y as ue}from"./document-list-CUmMhD6M.js";import{n as de,r as fe}from"./use-toolbox-Ck_cLGgf.js";import{t as pe}from"./useToastHelpers-CRrpIIdY.js";import{n as me}from"./color-DFEH4BfK.js";import{t as k}from"./DocumentIcon-9i1uCMQa.js";import{r as he}from"./workspace-BydSRtST.js";import{t as ge}from"./registry-NAExJwr9.js";import{t as _e}from"./FileForm-CDiVKvxq.js";import{t as ve}from"./applet-target-pLdP-R76.js";var A=e(n(),1);function j(e){let{pathname:t}=r(),n=fe()?.setAgentView,i=JSON.stringify(e);(0,A.useEffect)(()=>(n?.({pathname:t,view:JSON.parse(i)}),()=>n?.(null)),[t,i,n])}function M(e,t,n,r){return structuredClone({...e,query:he(t,n,r),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone})}var N=t();function ye({target:e,children:t}){let[n,r]=(0,A.useState)([]),i=(0,A.useRef)(!1),[a,o]=(0,A.useState)(!1),[s,c]=(0,A.useState)(!1),[l,u]=(0,A.useState)(null),{showErrorToast:d}=pe();return(0,N.jsxs)(`div`,{className:`relative flex flex-col h-full min-h-0 bg-background ${a?`ring-2 ring-inset ring-primary`:``}`,onDragOverCapture:t=>{s||!e||!Array.from(t.dataTransfer.types).includes(`Files`)||(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=i.current?`none`:`copy`,o(!i.current))},onDragLeaveCapture:e=>{e.currentTarget.contains(e.relatedTarget)||o(!1)},onDropCapture:t=>{if(s||!e||!Array.from(t.dataTransfer.types).includes(`Files`))return;if(t.preventDefault(),t.stopPropagation(),o(!1),i.current){d(`Wait for the current upload to finish`);return}let n=Array.from(t.dataTransfer.files);if(!n.length){d(`Drop files rather than folders`);return}r(n),u(e),c(!0)},children:[t,a&&(0,N.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 z-30 flex items-center justify-center bg-background/80 text-sm font-medium`,children:[`Drop files to upload to `,e?.mode===`workspace`?e.path:`this context`]}),s&&(0,N.jsxs)(ue,{label:`Import files`,onClose:()=>{i.current||c(!1)},children:[(0,N.jsx)(`h2`,{className:`border-b px-4 py-3 text-sm font-medium`,children:`Import files`}),(0,N.jsx)(_e,{target:l,initialFiles:n,onClose:()=>c(!1),onBusyChange:e=>{i.current=e}})]})]})}function P({navigationTabs:e,navigationActions:t,onBack:n,accentColor:r,frameContent:a=!0,urlType:s,urlDisplay:c,contextPath:u,treeName:f,workspaceId:p,workspaceLabel:ee,workspaceIcon:h,documentSchema:_,documents:v,isLoading:y,totalCount:S,currentPage:C,pageSize:w,onPageChange:T,onPageSizeChange:E,onRemoveDocument:D,onDeleteDocument:O,onDestroyDocument:ne,onRemoveDocuments:re,onDeleteDocuments:se,onDestroyDocuments:ue,onCopyDocuments:fe,onCutDocuments:pe,onPasteDocuments:me,onImportDocuments:k,onSelectionChange:he,pastedDocumentIds:ge,onPurgeDocuments:_e,disablePurgeDocuments:ve,canvasInfo:j,isCanvasPinned:M,onTogglePinCanvas:P,onSaveAsCanvas:F,onShareCanvas:I,onUnshareCanvas:L,onDeleteCanvas:R,isSharingCanvas:z,isDeletingCanvas:B,isCanvasShared:V,isCanvasLocked:H,backendSearchQueries:U,onBackendSearch:W,onRemoveBackendQuery:G,serverSort:be,onServerSortChange:xe,scope:K,onScopeChange:q,canSaveChanges:J,isSavingChanges:Y,onSaveChanges:X,onBrowseWorkspaces:Se,onBrowseTree:Ce,onNavigatePath:we,linkTree:Te,children:Z,contentBanner:Ee,folders:De,onOpenFolder:Oe}){let ke=s===`canvas`,Q=le(),{state:Ae,toggleView:je,hasActiveFilters:Me,openAddPicker:Ne}=de(),$=ae(),[Pe,Fe]=(0,A.useState)(``),Ie=JSON.stringify([p,f,u,_]),[Le,Re]=(0,A.useState)(Ie);Le!==Ie&&(Re(Ie),Fe(``));let ze=(0,N.jsxs)(N.Fragment,{children:[t,F&&(0,N.jsx)(`button`,{type:`button`,onClick:F,title:`Save as canvas`,"aria-label":`Save as canvas`,className:`flex h-control-sm w-control-sm shrink-0 items-center justify-center rounded-md border text-muted-foreground hover:bg-accent touch-target`,children:(0,N.jsx)(x,{className:`h-4 w-4`})})]});return(0,N.jsxs)(ye,{target:k&&p?{mode:`workspace`,workspaceName:p,path:u,treeName:f||`context`,treeType:te(f)}:null,children:[e&&!Q&&(0,N.jsx)(ie,{accentColor:r,children:e}),(0,N.jsxs)(`div`,{className:`canvas-surface-body${a&&!Q?` is-framed`:``}`,children:[(0,N.jsx)(oe,{workspaceIcon:h,workspace:ee||p||c.split(`://`)[0]||`Workspace`,actions:Q&&e?(0,N.jsxs)(`details`,{className:`relative shrink-0`,"aria-label":`Canvas views`,children:[(0,N.jsx)(`summary`,{className:`cursor-pointer rounded-md border px-2 py-1 text-xs`,title:`Choose or manage content views`,children:`Views`}),(0,N.jsx)(`div`,{className:`absolute right-0 top-full z-30 mt-2 min-w-64 max-w-[80vw] rounded-md border bg-background p-2 shadow-lg`,children:e})]}):void 0,tree:f?`${f}${s.endsWith(`-layer`)?`:layer`:``}`:s.replace(`-layer`,``),path:u,accentColor:r,onBack:$.location?$.location.section===`view`?$.close:()=>$.update?.({section:`view`}):n,section:$.location?`document/${$.location.documentId}/${$.location.section}`:void 0,onSection:$.location?()=>$.update?.({section:`view`}):void 0,onBrowseWorkspaces:Se,onBrowseTree:Ce,onNavigatePath:we,onFilter:()=>je(`tools`),filtersActive:Me,filtersOpen:Ae.t1Open&&Ae.t1View===`tools`,onAdd:e=>Ne({modal:e.shiftKey,fresh:!0}),search:W||!Z?{workspaceId:p,queries:U||[],onSearch:W??Fe,localOnly:!W,onRemoveQuery:G,scope:K,onScopeChange:q}:void 0,onDraftChange:Z?void 0:Fe}),ke&&j?(0,N.jsx)(N.Fragment,{children:(0,N.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2.5 border-b bg-muted/20 shrink-0 min-w-0`,children:[j.color&&(0,N.jsx)(`div`,{className:`w-1 h-6 rounded-full shrink-0`,style:{backgroundColor:j.color}}),(0,N.jsx)(g,{className:`w-4 h-4 shrink-0 text-primary`}),(0,N.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,N.jsx)(`span`,{className:`text-lg font-semibold leading-tight truncate`,children:j.label||c.split(`://`)[1]||`Canvas`}),j.description&&(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground truncate leading-tight`,children:j.description})]}),J&&X&&(0,N.jsxs)(`button`,{type:`button`,onClick:X,disabled:Y,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 text-xs border rounded-md hover:bg-accent transition-colors text-muted-foreground hover:text-foreground disabled:opacity-50`,title:`Save filters`,children:[(0,N.jsx)(i,{className:`w-3 h-3`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:Y?`Saving...`:`Save filters`})]}),P&&(0,N.jsxs)(`button`,{type:`button`,onClick:P,"aria-pressed":!!M,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 text-xs border rounded-md hover:bg-accent transition-colors text-muted-foreground hover:text-foreground`,title:M?`Unpin from home`:`Pin to home`,children:[M?(0,N.jsx)(d,{className:`w-3 h-3`}):(0,N.jsx)(l,{className:`w-3 h-3`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:M?`Unpin`:`Pin`})]}),I&&(0,N.jsxs)(`button`,{type:`button`,onClick:I,disabled:z||B,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 text-xs border rounded-md hover:bg-accent transition-colors text-muted-foreground hover:text-foreground disabled:opacity-50`,title:V?`Copy public link`:`Share canvas`,children:[(0,N.jsx)(b,{className:`w-3 h-3`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:z?`Sharing...`:V?`Copy link`:`Share`})]}),V&&L&&(0,N.jsxs)(`button`,{type:`button`,onClick:L,disabled:z||B,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 text-xs border rounded-md hover:bg-destructive/10 transition-colors text-muted-foreground hover:text-destructive disabled:opacity-50`,children:[(0,N.jsx)(o,{className:`w-3 h-3`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:`Unshare`})]}),R&&(0,N.jsxs)(`button`,{type:`button`,onClick:R,disabled:B||H&&!V,title:H&&!V?`Unlock this canvas before deleting it`:`Delete canvas`,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 text-xs border rounded-md hover:bg-destructive/10 transition-colors text-muted-foreground hover:text-destructive disabled:opacity-50`,children:[(0,N.jsx)(m,{className:`w-3 h-3`}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:B?`Deleting…`:`Delete`})]})]})}):null,Z&&(F||t)&&(0,N.jsx)(`div`,{className:`flex items-center gap-2 border-b px-3 py-1`,children:ze}),(0,N.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:[Ee,Z||(0,N.jsx)(ce,{readingPane:!0,externalSearchQuery:Pe,toolbarActions:ze,documents:_?v.filter(e=>e.schema===_):v,isLoading:y,folders:_?void 0:De,onOpenFolder:Oe,contextPath:u,treeName:f,workspaceId:p,totalCount:S,viewMode:_?`card`:`table`,allowViewToggle:!0,currentPage:C,pageSize:w,onPageChange:T,onPageSizeChange:E,onRemoveDocument:D,onDeleteDocument:O,onDestroyDocument:ne,onRemoveDocuments:re,onDeleteDocuments:se,onDestroyDocuments:ue,onCopyDocuments:fe,onCutDocuments:pe,onPasteDocuments:me,onImportDocuments:k,onSelectionChange:he,pastedDocumentIds:ge,onPurgeDocuments:_?void 0:_e,disablePurgeDocuments:ve,backendSearchQueries:U,onBackendSearch:W,serverSort:be,onServerSortChange:xe,onRemoveBackendQuery:G,scope:K,onScopeChange:q,canSaveChanges:!ke&&J,isSavingChanges:Y,onSaveChanges:X,linkTree:Te},_??`documents`)]})]})]})}var F=[{id:`todos`,label:`Todo list`},{id:`todo-app`,label:`Todo App`},{id:`notes`,label:`Notes list`},{id:`notes-app`,label:`Notes App`},{id:`calendar`,label:`Calendar`},{id:`apps`,label:`Apps`},{id:`sketch`,label:`Sketch`},{id:`terminal`,label:`Terminal`}];function I(e){return e?.kind===`app`&&e.app===`notes`?`data/schema/note`:void 0}var L={id:`default`,name:`All`,kind:`documents`};function R(){return[{id:`emails`,label:`Emails`,schemas:[`data/schema/message`]},{id:`todos`,label:`Todos`,schemas:[`data/schema/task`]},{id:`notes`,label:`Notes`,schemas:[`data/schema/note`]},{id:`links`,label:`Links`,schemas:[`data/schema/tab`,`data/schema/link`]},{id:`files`,label:`Files`,schemas:[`data/schema/file`]}]}function z(e){let t=e?.views;if(!Array.isArray(t))return[L];let n=t.filter(e=>{let t=e;return!t||typeof t.id!=`string`||typeof t.name!=`string`?!1:t.kind===`documents`||t.kind===`columns`||t.kind===`app`&&(F.some(e=>e.id===t.app)||t.app===`filters`||t.app===`lens`)});return n.length>0?n:[L]}var B={todos:v,"todo-app":v,notes:S,"notes-app":S,calendar:s,filters:_,sketch:h,terminal:y,lens:f,apps:C};function V({views:e,activeId:t,onSelect:n,onSave:r,readOnly:i=!1,className:o,accentColor:s,onOpenToSide:l}){let[d,f]=(0,A.useState)(null),[p,m]=(0,A.useState)(``),[h,g]=(0,A.useState)(!1),[_,v]=(0,A.useState)(null),[y,b]=(0,A.useState)(null),x=(0,A.useRef)(null);(0,A.useEffect)(()=>{let e=x.current;if(!e)return;let t=t=>{if(t.ctrlKey||e.scrollWidth<=e.clientWidth)return;let n=Math.abs(t.deltaX)>Math.abs(t.deltaY)?t.deltaX:t.deltaY,r=t.deltaMode===1?16:t.deltaMode===2?e.clientWidth:1;t.preventDefault(),e.scrollLeft+=n*r};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]),(0,A.useEffect)(()=>{x.current?.querySelector(`[aria-pressed="true"], input`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[t,d]);let S=()=>{v(null),b(null)},C=()=>{if(_&&y&&_!==y.id){let t=e.find(e=>e.id===_),n=e.filter(e=>e.id!==_),i=n.findIndex(e=>e.id===y.id);t&&i>=0&&(n.splice(y.before?i:i+1,0,t),n.some((t,n)=>t.id!==e[n].id)&&r(n))}S()},E=()=>{if(!d)return;let t=p.trim();t&&r(e.map(e=>e.id===d?{...e,name:t}:e)),f(null)},D=(t,n)=>{g(!1);let i=`view-${Date.now().toString(36)}`,a=t===`columns`?`Board`:t===`app`?F.find(e=>e.id===n)?.label??`App`:`List`,o=t===`columns`?{id:i,name:a,kind:t,columns:R()}:t===`app`?{id:i,name:a,kind:t,app:n}:{id:i,name:a,kind:t};r([...e,o],i),f(i),m(a)},O=n=>{let i=e.filter(e=>e.id!==n);r(i.length>0?i:[L],n===t?i[0]?.id??L.id:void 0)};return(0,N.jsxs)(`div`,{className:T(`relative flex h-full min-w-0 items-end`,o),children:[(0,N.jsx)(`div`,{ref:x,className:`flex min-w-0 items-end gap-0.5 overflow-x-auto overscroll-x-contain pt-1 [scrollbar-width:none]`,children:e.map(r=>{let o=r.id===t,u=r.kind===`columns`?a:r.kind===`app`&&r.app?B[r.app]:w;return d===r.id?(0,N.jsx)(`input`,{autoFocus:!0,"aria-label":`Tab name`,value:p,onChange:e=>m(e.target.value),onBlur:E,onKeyDown:e=>{e.key===`Enter`&&E(),e.key===`Escape`&&f(null)},className:T(`relative h-[2.3rem] w-28 shrink-0 rounded-t-[.5rem] border-0 px-3 pb-1 text-xs outline-none ring-0`,o?T(`z-[2] bg-background font-medium`,s?me(s):`text-foreground`):`bg-muted text-muted-foreground`),style:{backgroundColor:o?s:void 0}},r.id):(0,N.jsxs)(`button`,{type:`button`,"aria-pressed":o,onClick:()=>n(r.id),onDoubleClick:()=>{i||(f(r.id),m(r.name))},title:i?r.name:`${r.name}: double-click to rename, drag to reorder`,draggable:!i,onDragStart:e=>{e.dataTransfer.setData(`text/plain`,r.name),e.dataTransfer.effectAllowed=`move`,v(r.id)},onDragOver:e=>{if(!_||_===r.id)return;e.preventDefault(),e.dataTransfer.dropEffect=`move`;let t=e.currentTarget.getBoundingClientRect(),n=e.clientX<t.left+t.width/2;b(e=>e?.id===r.id&&e.before===n?e:{id:r.id,before:n})},onDrop:e=>{e.preventDefault(),C()},onDragEnd:S,className:T(`group relative flex h-[2.3rem] shrink-0 items-center gap-1.5 rounded-t-[.5rem] border-0 px-3 pb-1 text-xs transition-colors`,o?T(`z-[2] bg-background font-medium`,s?me(s):`text-foreground`):`bg-muted text-muted-foreground hover:bg-accent hover:text-foreground`,_===r.id&&`opacity-50`),style:{backgroundColor:o?s:void 0,boxShadow:y?.id===r.id?`inset ${y.before?`2px`:`-2px`} 0 0 var(--primary)`:void 0},children:[(0,N.jsx)(u,{className:`h-3 w-3 shrink-0`}),(0,N.jsx)(`span`,{className:`max-w-32 truncate`,children:r.name}),l&&(0,N.jsx)(ee,{className:`h-3 w-3 shrink-0 opacity-0 transition-opacity hover:opacity-100 group-hover:opacity-60`,"aria-label":`Open to the side`,onClick:e=>{e.stopPropagation(),l(r.id)}}),!i&&e.length>1&&(0,N.jsx)(c,{className:T(`h-3 w-3 shrink-0 transition-opacity hover:text-destructive`,o?`opacity-60 hover:opacity-100`:`opacity-0 group-hover:opacity-100`),onClick:e=>{e.stopPropagation(),O(r.id)}})]},r.id)})}),!i&&(h?(0,N.jsxs)(`span`,{className:`absolute left-0 top-full z-30 flex w-full min-w-64 flex-wrap items-center gap-2 rounded-b-xl border bg-card p-2 shadow-lg`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>D(`documents`),className:`flex h-10 items-center gap-1.5 rounded-md border px-2 text-xs text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:[(0,N.jsx)(w,{className:`h-3 w-3`}),` List`]}),(0,N.jsxs)(`button`,{type:`button`,onClick:()=>D(`columns`),className:`flex h-10 items-center gap-1.5 rounded-md border px-2 text-xs text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:[(0,N.jsx)(a,{className:`h-3 w-3`}),` Board`]}),F.map(e=>{let t=B[e.id];return(0,N.jsxs)(`button`,{type:`button`,onClick:()=>D(`app`,e.id),className:`flex h-10 items-center gap-1.5 rounded-md border px-2 text-xs text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:[(0,N.jsx)(t,{className:`h-3 w-3`}),` `,e.label]},e.id)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>g(!1),className:`p-1 text-muted-foreground hover:text-foreground`,"aria-label":`Cancel`,children:(0,N.jsx)(c,{className:`h-3 w-3`})})]}):(0,N.jsx)(`button`,{type:`button`,onClick:()=>g(!0),title:`Add view`,"aria-label":`Add view`,className:`relative ml-1 flex h-[2.3rem] w-10 shrink-0 items-center justify-center rounded-md pb-1 text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:(0,N.jsx)(u,{className:`h-3.5 w-3.5`})}))]})}var H=[{id:`emails`,label:`Emails`,schemas:[`data/schema/message`]},{id:`todos`,label:`Todos`,schemas:[`data/schema/task`]},{id:`notes`,label:`Notes`,schemas:[`data/schema/note`]},{id:`links`,label:`Links`,schemas:[`data/schema/tab`,`data/schema/link`]},{id:`files`,label:`Files`,schemas:[`data/schema/file`]}];function U(e,t){return t.some(t=>e.schema===t||e.schema.startsWith(`${t}/`))}function W({documents:e,workspaceId:t,columns:n,onColumnsChange:r,readOnly:i=!1}){let[a,o]=(0,A.useState)(null),[s,l]=(0,A.useState)(!1),[d,f]=(0,A.useState)({}),[ee,m]=(0,A.useState)({}),h=(0,A.useRef)(null),[g,_]=(0,A.useState)(!1),v=(0,A.useCallback)(()=>{let e=h.current;e&&_(e.scrollWidth-e.clientWidth-e.scrollLeft>8)},[]);(0,A.useEffect)(()=>{let e=h.current;if(!e)return;let t=new ResizeObserver(()=>v());return t.observe(e),()=>t.disconnect()},[v]);let y=(e,t)=>{e.preventDefault();let i=e.currentTarget.parentElement;if(!i)return;let a=e.clientX,o=i.getBoundingClientRect().width,s=o,c=e=>{s=Math.min(900,Math.max(220,o+e.clientX-a)),m(e=>({...e,[t]:s}))},l=()=>{window.removeEventListener(`pointermove`,c),window.removeEventListener(`pointerup`,l),r(n.map(e=>e.id===t?{...e,width:Math.round(s)}:e))};window.addEventListener(`pointermove`,c),window.addEventListener(`pointerup`,l)},b=e=>{m(t=>{let n={...t};return delete n[e],n}),r(n.map(t=>t.id===e?{...t,width:void 0}:t))},x=e=>{let t=d[e];if(t===void 0)return;let i=n.find(t=>t.id===e);i&&(i.filter||``)!==t&&r(n.map(n=>n.id===e?{...n,filter:t||void 0}:n))},S=H.filter(e=>!n.some(t=>t.id===e.id));return(0,N.jsxs)(`div`,{className:`relative h-full`,children:[(0,N.jsx)(`div`,{ref:h,onScroll:v,className:`flex h-full snap-x snap-mandatory gap-3 overflow-x-auto overscroll-x-contain p-2`,"data-testid":`schema-columns-board`,children:n.map(t=>{let a=(d[t.id]??t.filter??``).toLowerCase(),s=e.filter(e=>U(e,t.schemas)).filter(e=>{if(!a)return!0;let t=E(e);return`${t.title}\n${t.preview}\n${t.subtitle}`.toLowerCase().includes(a)}),l=ee[t.id]??t.width;return(0,N.jsxs)(`div`,{className:`relative flex h-full min-h-0 min-w-0 shrink-0 grow-0 basis-full snap-start flex-col rounded-(--card-radius) border bg-muted/20 ${l?`sm:basis-[var(--col-w)]`:`sm:basis-[48%] lg:basis-[32%] xl:basis-[24%]`}`,style:l?{"--col-w":`${l}px`}:void 0,children:[!i&&(0,N.jsx)(`div`,{onPointerDown:e=>y(e,t.id),onDoubleClick:()=>b(t.id),title:`Drag to resize; double-click to reset`,className:`absolute right-0 inset-y-0 z-10 w-2 cursor-col-resize touch-none rounded-r-lg transition-colors hover:bg-primary/25 active:bg-primary/40 max-sm:hidden`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2 px-3 pb-1 pt-2.5 max-sm:pr-10`,children:[(0,N.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t.label}),(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s.length}),(0,N.jsx)(`span`,{className:`flex-1`}),!i&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>r(n.filter(e=>e.id!==t.id)),title:`Remove column`,className:`rounded-sm p-0.5 text-muted-foreground hover:text-destructive`,children:(0,N.jsx)(c,{className:`h-3.5 w-3.5`})})]}),(0,N.jsx)(`div`,{className:`px-3 pb-2`,children:(0,N.jsx)(`input`,{value:d[t.id]??t.filter??``,onChange:e=>f(n=>({...n,[t.id]:e.target.value})),onBlur:()=>x(t.id),onKeyDown:e=>{e.key===`Enter`&&x(t.id)},placeholder:`Filter…`,readOnly:i,className:`h-7 w-full rounded-md border border-input bg-background px-2 text-xs placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`})}),(0,N.jsxs)(`div`,{className:`flex-1 space-y-1.5 overflow-y-auto px-2 pb-2`,children:[s.map(e=>{let t=E(e);return(0,N.jsxs)(`button`,{type:`button`,onClick:()=>o(e),className:`w-full min-w-0 rounded-md border bg-card px-2.5 py-2 text-left transition-colors hover:bg-accent/50`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(k,{document:e,size:3.5}),(0,N.jsx)(`span`,{className:`truncate text-xs font-medium`,title:t.title,children:t.title})]}),t.preview&&(0,N.jsx)(`p`,{className:`mt-1 line-clamp-2 break-words text-[11px] leading-snug text-muted-foreground`,children:t.preview}),(0,N.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground/70`,children:new Date(e.updatedAt||e.createdAt).toLocaleDateString()})]},e.id)}),s.length===0&&(0,N.jsx)(`p`,{className:`px-2 py-3 text-center text-xs text-muted-foreground/60`,children:`Empty`})]})]},t.id)})}),(!i&&S.length>0||g)&&(0,N.jsxs)(`div`,{className:`pointer-events-none absolute inset-y-0 right-0 z-20 flex w-7 flex-col items-end bg-gradient-to-l from-background via-background/60 to-transparent py-2`,children:[!i&&S.length>0&&(0,N.jsxs)(`div`,{className:`pointer-events-auto relative`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),title:`Add column`,"aria-label":`Add column`,className:`flex h-7 w-6 items-center justify-center rounded-l-md border border-r-0 bg-background text-muted-foreground shadow-elevation-1 hover:bg-accent hover:text-foreground`,children:(0,N.jsx)(u,{className:`h-3.5 w-3.5`})}),s&&(0,N.jsxs)(`div`,{className:`absolute right-0 top-8 w-44 rounded-lg border bg-background p-2 shadow-elevation-2`,children:[(0,N.jsx)(`p`,{className:`px-2 pb-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:`Add column`}),S.map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>{l(!1),r([...n,{...e}])},className:`w-full rounded-md px-2 py-1.5 text-left text-xs text-muted-foreground hover:bg-accent/50 hover:text-foreground`,children:e.label},e.id)),(0,N.jsx)(`button`,{type:`button`,onClick:()=>l(!1),className:`mt-1 w-full rounded-md px-2 py-1.5 text-left text-xs text-muted-foreground/60 hover:bg-accent/50`,children:`Cancel`})]})]}),g&&(0,N.jsx)(p,{className:`my-auto h-4 w-4 self-center text-muted-foreground/70`,"aria-label":`More columns`})]}),(0,N.jsx)(se,{document:a,isOpen:a!==null,onClose:()=>o(null),workspaceId:t})]})}function G(e,t,n,r,i){let a=`${e}\0${t}\0${n}\0${r.join(`,`)}\0${i??``}`,[o,s]=(0,A.useState)(0),[c,l]=(0,A.useState)(null);(0,A.useEffect)(()=>{let o=!1;return D(e,n,t,{limit:200,allOf:r,...i?{sortBy:i,order:`asc`}:{}}).then(e=>{o||l({key:a,docs:e.payload||[]})}).catch(()=>{o||l({key:a,docs:[]})}),()=>{o=!0}},[a,o]);let u=c?.key===a?c.docs:[],d=c?.key!==a;return(0,A.useEffect)(()=>{let e=()=>s(e=>e+1);return window.addEventListener(`workspace:documents:refresh`,e),()=>window.removeEventListener(`workspace:documents:refresh`,e)},[]),{docs:u,isLoading:d,refresh:(0,A.useCallback)(()=>s(e=>e+1),[])}}function be({workspaceId:e,treeName:t,path:n}){let{docs:r,isLoading:i,refresh:a}=G(e,t,n,[ne],`tasks`),[o,s]=(0,A.useState)(!1),c=o?r.filter(e=>e.data?.status!==`completed`):r,l=r.filter(e=>{let t=e.data?.status;return t!==`completed`&&t!==`cancelled`}).length;return(0,N.jsxs)(`div`,{className:`mx-auto flex h-full w-full max-w-3xl flex-col p-4`,children:[(0,N.jsxs)(`div`,{className:`mb-2 flex shrink-0 items-center justify-between gap-2`,children:[(0,N.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[l,` open`]}),(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),`hide done`]})]}),(0,N.jsx)(`div`,{className:`min-h-0 flex-1 space-y-1 overflow-y-auto`,children:i?(0,N.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`Loading…`}):c.length===0?(0,N.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`No todos here.`}):c.map(t=>(0,N.jsx)(re,{doc:t,workspaceId:e,readOnly:!1,onChanged:a},t.id))})]})}var xe=[O,`data/type/webapp`],K=`Other`;function q({workspaceId:e,treeName:t,path:n}){let{docs:r,isLoading:i}=G(e,t,n,xe),a=(0,A.useMemo)(()=>{let e=new Map;for(let t of r){let n=String(t.data?.category??``).trim(),r=n?n.toLowerCase():``,i=e.get(r)??[];i.push(t),e.set(r,i)}return[...e.entries()].map(([e,t])=>({key:e,label:e?String(t[0].data.category).trim():K,items:t.sort((e,t)=>Y(e).localeCompare(Y(t)))})).sort((e,t)=>!e.key-+!t.key||e.label.localeCompare(t.label))},[r]);return(0,N.jsx)(`div`,{className:`mx-auto h-full w-full max-w-5xl overflow-y-auto p-4`,children:i?(0,N.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`Loading…`}):a.length===0?(0,N.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`No web apps here. Add a link and tick “Web app”.`}):a.map(e=>(0,N.jsxs)(`section`,{className:`mb-6`,children:[(0,N.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:e.label}),(0,N.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(7rem,1fr))] gap-3`,children:e.items.map(e=>(0,N.jsx)(X,{doc:e},e.id))})]},e.key||K))})}function J(e){return String(e.data?.uri??``)}function Y(e){let t=String(e.data?.label??``).trim();if(t)return t;try{return new URL(J(e)).hostname.replace(/^www\./,``)}catch{return J(e)}}function X({doc:e}){let t=Y(e);return(0,N.jsxs)(`a`,{href:J(e),target:`_blank`,rel:`noopener noreferrer`,title:J(e),className:`flex flex-col items-center gap-2 rounded-lg border border-border bg-card p-3 text-center outline-none transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,N.jsx)(`span`,{className:`flex h-10 w-10 items-center justify-center rounded-md bg-primary/10 text-lg font-semibold text-primary`,children:t.charAt(0).toUpperCase()}),(0,N.jsx)(`span`,{className:`w-full truncate text-xs text-foreground`,children:t})]})}function Se({app:e,contextId:t,...n}){let r=t&&e!==`lens`?{mode:`context`,contextId:t}:{mode:`workspace`,workspaceName:n.workspaceId,treeName:n.treeName,path:n.path,treeType:te(n.treeName)},i=e===`todo-app`?`todo`:e===`notes-app`?`notes`:e,a=ge.find(e=>e.id===i);return(0,N.jsx)(ve,{target:r,children:e===`todos`?(0,N.jsx)(be,{...n}):e===`apps`?(0,N.jsx)(q,{...n}):a?(0,N.jsx)(a.Component,{}):null})}function Ce(e,t){if(!e)return[];let n=t.split(`/`).filter(Boolean),r=e;for(let e of n)if(r=r?.children?.find(t=>t.name===e)??null,!r)return[];let i=n.length?`/${n.join(`/`)}`:``,a=(r.children??[]).filter(e=>e.type!==`canvas`).map(e=>({name:e.name,path:`${i}/${e.name}`,label:e.label,color:e.color,childCount:e.children?.length??0})).sort((e,t)=>(e.label||e.name).localeCompare(t.label||t.name,void 0,{numeric:!0,sensitivity:`base`}));return n.length>0&&a.unshift({name:`..`,path:n.length>1?`/${n.slice(0,-1).join(`/`)}`:`/`,isParent:!0}),a}export{L as a,P as c,V as i,M as l,Se as n,I as o,W as r,z as s,Ce as t,j as u};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as e,n as t,o as n,r,t as i}from"./rolldown-runtime-C0FnF6B9.js";import{l as a,u as o}from"./code-editor-BOIngd5F.js";import{_t as s,yt as c}from"./react-BHzhHVTZ.js";import{r as l}from"./chunk-62JRHF6Z-vspAGgtK.js";import{$ as u,Bt as d,Ct as f,Hr as p,It as m,J as h,K as g,L as _,Lt as v,Pt as y,Qt as b,Vr as x,an as S,bn as C,jn as w,kr as T,kt as E,q as D,sr as O,tn as k,tt as A,yt as j}from"./ui-CDoK3F3U.js";import{n as M}from"./utils-BxVxyehK.js";import{t as N}from"./utils-2pl1SbIp.js";import{t as P}from"./button-SeUZ_Pvi.js";import{t as F}from"./socket-CtH3EU9m.js";import{o as I}from"./auth-Bx9fAZmz.js";import{_ as L,c as ee}from"./LinkToCard-CKVi4Nrg.js";import{$t as te,Dn as R,En as z,G as B,Tt as ne,Z as V,kn as re}from"./workspace-C5V-ZCOE.js";import{a as H,i as ie,n as ae,r as oe}from"./TodosWidget-CNnfNk4L.js";import{y as se}from"./ObjectPropertiesCard-D2lrTQqT.js";import{h as ce,m as le,t as ue,v as de}from"./document-list-J63eer10.js";import{i as fe}from"./public-share-CXR25Q1X.js";import{o as U,s as pe}from"./text-documents-Cdb3U63i.js";import{t as me}from"./useDocumentThumbnail-Cj4UYyhC.js";import{t as he}from"./useEscapeClose-DR_xKT_k.js";import"./layer-style-Byl5LNFR.js";import{i as ge}from"./color-DFEH4BfK.js";import{c as W}from"./workspace-BydSRtST.js";import{t as _e}from"./url-params-n7kU_WZ-.js";var G=i(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n[`fast-equals`]={}))})(e,(function(e){function t(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function n(e){return function(t,n,r,i){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r,i);var a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);var s=e(t,n,r,i);return i.delete(t),i.delete(n),s}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function i(e){return e.constructor===Object||e.constructor==null}function a(e){return typeof e.then==`function`}function o(e,t){return e===t||e!==e&&t!==t}var s=Object.prototype.toString;function c(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,c=e.areObjectsEqual,l=e.areRegExpsEqual,u=e.areSetsEqual,d=e.createIsNestedEqual,f=d(p);function p(e,d,p){if(e===d)return!0;if(!e||!d||typeof e!=`object`||typeof d!=`object`)return e!==e&&d!==d;if(i(e)&&i(d))return c(e,d,f,p);var m=Array.isArray(e),h=Array.isArray(d);if(m||h)return m===h&&t(e,d,f,p);var g=s.call(e);return g===s.call(d)?g===`[object Date]`?n(e,d,f,p):g===`[object RegExp]`?l(e,d,f,p):g===`[object Map]`?r(e,d,f,p):g===`[object Set]`?u(e,d,f,p):g===`[object Object]`||g===`[object Arguments]`?a(e)||a(d)?!1:c(e,d,f,p):g===`[object Boolean]`||g===`[object Number]`||g===`[object String]`?o(e.valueOf(),d.valueOf()):!1:!1}return p}function l(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-->0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var u=n(l);function d(e,t){return o(e.valueOf(),t.valueOf())}function f(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={},o=0;return e.forEach(function(s,c){if(i){var l=!1,u=0;t.forEach(function(i,d){!l&&!a[u]&&(l=n(c,d,o,u,e,t,r)&&n(s,i,c,d,e,t,r))&&(a[u]=!0),u++}),o++,i=l}}),i}var p=n(f),m=`_owner`,h=Object.prototype.hasOwnProperty;function g(e,t,n,r){var i=Object.keys(e),a=i.length;if(Object.keys(t).length!==a)return!1;for(var o;a-->0;){if(o=i[a],o===m){var s=!!e.$$typeof,c=!!t.$$typeof;if((s||c)&&s!==c)return!1}if(!h.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var _=n(g);function v(e,t){return e.source===t.source&&e.flags===t.flags}function y(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={};return e.forEach(function(o,s){if(i){var c=!1,l=0;t.forEach(function(i,u){!c&&!a[l]&&(c=n(o,i,s,u,e,t,r))&&(a[l]=!0),l++}),i=c}}),i}var b=n(y),x=Object.freeze({areArraysEqual:l,areDatesEqual:d,areMapsEqual:f,areObjectsEqual:g,areRegExpsEqual:v,areSetsEqual:y,createIsNestedEqual:t}),S=Object.freeze({areArraysEqual:u,areDatesEqual:d,areMapsEqual:p,areObjectsEqual:_,areRegExpsEqual:v,areSetsEqual:b,createIsNestedEqual:t}),C=c(x);function w(e,t){return C(e,t,void 0)}var T=c(r(x,{createIsNestedEqual:function(){return o}}));function E(e,t){return T(e,t,void 0)}var D=c(S);function O(e,t){return D(e,t,new WeakMap)}var k=c(r(S,{createIsNestedEqual:function(){return o}}));function A(e,t){return k(e,t,new WeakMap)}function j(e){return c(r(x,e(x)))}function M(e){var t=c(r(S,e(S)));return(function(e,n,r){return r===void 0&&(r=new WeakMap),t(e,n,r)})}e.circularDeepEqual=O,e.circularShallowEqual=A,e.createCustomCircularEqual=M,e.createCustomEqual=j,e.deepEqual=w,e.sameValueZeroEqual=o,e.shallowEqual=E,Object.defineProperty(e,"__esModule",{value:!0})}))})),K=i(((e,t)=>{t.exports=function(e,t,n){return e===t||e.className===t.className&&n(e.style,t.style)&&e.width===t.width&&e.autoSize===t.autoSize&&e.cols===t.cols&&e.draggableCancel===t.draggableCancel&&e.draggableHandle===t.draggableHandle&&n(e.verticalCompact,t.verticalCompact)&&n(e.compactType,t.compactType)&&n(e.layout,t.layout)&&n(e.margin,t.margin)&&n(e.containerPadding,t.containerPadding)&&e.rowHeight===t.rowHeight&&e.maxRows===t.maxRows&&e.isBounded===t.isBounded&&e.isDraggable===t.isDraggable&&e.isResizable===t.isResizable&&e.allowOverlap===t.allowOverlap&&e.preventCollision===t.preventCollision&&e.useCSSTransforms===t.useCSSTransforms&&e.transformScale===t.transformScale&&e.isDroppable===t.isDroppable&&n(e.resizeHandles,t.resizeHandles)&&n(e.resizeHandle,t.resizeHandle)&&e.onLayoutChange===t.onLayoutChange&&e.onDragStart===t.onDragStart&&e.onDrag===t.onDrag&&e.onDragStop===t.onDragStop&&e.onResizeStart===t.onResizeStart&&e.onResize===t.onResize&&e.onResizeStop===t.onResizeStop&&e.onDrop===t.onDrop&&n(e.droppingItem,t.droppingItem)&&n(e.innerRef,t.innerRef)}})),q=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bottom=u,e.childrenEqual=h,e.cloneLayout=d,e.cloneLayoutItem=m,e.collides=_,e.compact=v,e.compactItem=x,e.compactType=ie,e.correctBounds=S,e.fastPositionEqual=g,e.fastRGLPropsEqual=void 0,e.getAllCollisions=T,e.getFirstCollision=w,e.getLayoutItem=C,e.getStatics=E,e.modifyLayout=f,e.moveElement=D,e.moveElementAwayFromCollision=O,e.noop=void 0,e.perc=k,e.resizeItemInDirection=te,e.setTopLeft=z,e.setTransform=R,e.sortLayoutItems=B,e.sortLayoutItemsByColRow=V,e.sortLayoutItemsByRowCol=ne,e.synchronizeLayoutWithChildren=re,e.validateLayout=H,e.withLayoutItem=p;var t=G(),n=r(o());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?i(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function s(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){var t=l(e,`string`);return typeof t==`symbol`?t:t+``}function l(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function u(e){let t=0,n;for(let r=0,i=e.length;r<i;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function d(e){let t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=m(e[n]);return t}function f(e,t){let n=Array(e.length);for(let r=0,i=e.length;r<i;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function p(e,t,n){let r=C(e,t);return r?(r=n(m(r)),e=f(e,r),[e,r]):[e,null]}function m(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function h(e,r){return(0,t.deepEqual)(n.default.Children.map(e,e=>e?.key),n.default.Children.map(r,e=>e?.key))&&(0,t.deepEqual)(n.default.Children.map(e,e=>e?.props[`data-grid`]),n.default.Children.map(r,e=>e?.props[`data-grid`]))}e.fastRGLPropsEqual=K();function g(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function _(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function v(e,t,n,r){let i=E(e),a=u(i),o=B(e,t),s=Array(e.length);for(let c=0,l=o.length;c<l;c++){let l=m(o[c]);l.static||(l=x(i,l,t,n,o,r,a),a=Math.max(a,l.y+l.h),i.push(l)),s[e.indexOf(o[c])]=l,l.moved=!1}return s}var y={x:`w`,y:`h`};function b(e,t,n,r){let i=y[r];t[r]+=1;let a=e.map(e=>e.i).indexOf(t.i);for(let o=a+1;o<e.length;o++){let a=e[o];if(!a.static){if(a.y>t.y+t.h)break;_(t,a)&&b(e,a,n+t[i],r)}}t[r]=n}function x(e,t,n,r,i,a,o){let s=n===`vertical`,c=n===`horizontal`;if(s)for(t.y=Math.min(typeof o==`number`?o:u(e),t.y);t.y>0&&!w(e,t);)t.y--;else if(c)for(;t.x>0&&!w(e,t);)t.x--;let l;for(;(l=w(e,t))&&!(n===null&&a);)if(c?b(i,t,l.x+l.w,`x`):b(i,t,l.y+l.h,`y`),c&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!w(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function S(e,t){let n=E(e);for(let r=0,i=e.length;r<i;r++){let i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;w(n,i);)i.y++}return e}function C(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function w(e,t){for(let n=0,r=e.length;n<r;n++)if(_(e[n],t))return e[n]}function T(e,t){return e.filter(e=>_(e,t))}function E(e){return e.filter(e=>e.static)}function D(e,t,n,r,i,a,o,s,c){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;`${t.i}${String(n)}${String(r)}${t.x}${t.y}`;let l=t.x,u=t.y;typeof n==`number`&&(t.x=n),typeof r==`number`&&(t.y=r),t.moved=!0;let f=B(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(f=f.reverse());let p=T(f,t),m=p.length>0;if(m&&c)return d(e);if(m&&a)return`${t.i}`,t.x=l,t.y=u,t.moved=!1,e;for(let n=0,r=p.length;n<r;n++){let r=p[n];`${t.i}${t.x}${t.y}${r.i}${r.x}${r.y}`,!r.moved&&(e=r.static?O(e,r,t,i,o,s):O(e,t,r,i,o,s))}return e}function O(e,t,n,r,i,a){let o=i===`horizontal`,s=i===`vertical`,c=t.static;if(r){r=!1;let l={x:o?Math.max(t.x-n.w,0):n.x,y:s?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:`-1`},u=w(e,l),d=u&&u.y+u.h>t.y,f=u&&t.x+t.w>u.x;if(!u)return`${n.i}${l.x}${l.y}`,D(e,n,o?l.x:void 0,s?l.y:void 0,r,c,i,a);if(d&&s)return D(e,n,void 0,n.y+1,r,c,i,a);if(d&&i==null)return t.y=n.y,n.y+=n.h,e;if(f&&o)return D(e,t,n.x,void 0,r,c,i,a)}let l=o?n.x+1:void 0,u=s?n.y+1:void 0;return l==null&&u==null?e:D(e,n,o?n.x+1:void 0,s?n.y+1:void 0,r,c,i,a)}function k(e){return e*100+`%`}var A=(e,t,n,r)=>e+n>r?t:n,j=(e,t,n)=>e<0?t:n,M=e=>Math.max(0,e),N=e=>Math.max(0,e),P=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:j(o,e.height,i),top:N(o)}},F=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:A(e.left,e.width,o,n),left:M(i)}},I=(e,t,n)=>{let{top:r,height:i,width:a}=t,o=e.left-(a-e.width);return{height:i,width:o<0?e.width:A(e.left,e.width,a,n),top:N(r),left:M(o)}},L=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:j(r,e.height,a),top:N(r)}},ee={n:P,ne:function(){return P(arguments.length<=0?void 0:arguments[0],F(...arguments),arguments.length<=2?void 0:arguments[2])},e:F,se:function(){return L(arguments.length<=0?void 0:arguments[0],F(...arguments),arguments.length<=2?void 0:arguments[2])},s:L,sw:function(){return L(arguments.length<=0?void 0:arguments[0],I(...arguments),arguments.length<=2?void 0:arguments[2])},w:I,nw:function(){return P(arguments.length<=0?void 0:arguments[0],I(...arguments),arguments.length<=2?void 0:arguments[2])}};function te(e,t,n,r){let i=ee[e];return i?i(t,a(a({},t),n),r):n}function R(e){let{top:t,left:n,width:r,height:i}=e,a=`translate(${n}px,${t}px)`;return{transform:a,WebkitTransform:a,MozTransform:a,msTransform:a,OTransform:a,width:`${r}px`,height:`${i}px`,position:`absolute`}}function z(e){let{top:t,left:n,width:r,height:i}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${i}px`,position:`absolute`}}function B(e,t){return t===`horizontal`?V(e):t===`vertical`?ne(e):e}function ne(e){return e.slice(0).sort(function(e,t){return e.y>t.y||e.y===t.y&&e.x>t.x?1:e.y===t.y&&e.x===t.x?0:-1})}function V(e){return e.slice(0).sort(function(e,t){return e.x>t.x||e.x===t.x&&e.y>t.y?1:-1})}function re(e,t,r,i,o){e||=[];let s=[];n.default.Children.forEach(t,t=>{if(t?.key==null)return;let n=C(e,String(t.key)),r=t.props[`data-grid`];n&&r==null?s.push(m(n)):r?s.push(m(a(a({},r),{},{i:t.key}))):s.push(m({w:1,h:1,x:0,y:u(s),i:String(t.key)}))});let c=S(s,{cols:r});return o?c:v(c,i,r)}function H(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Layout`,n=[`x`,`y`,`w`,`h`];if(!Array.isArray(e))throw Error(t+` must be an array!`);for(let r=0,i=e.length;r<i;r++){let i=e[r];for(let e=0;e<n.length;e++){let a=n[e],o=i[a];if(typeof o!=`number`||Number.isNaN(o))throw Error(`ReactGridLayout: ${t}[${r}].${a} must be a number! Received: ${o} (${typeof o})`)}if(i.i!==void 0&&typeof i.i!=`string`)throw Error(`ReactGridLayout: ${t}[${r}].i must be a string! Received: ${i.i} (${typeof i.i})`)}}function ie(e){let{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}e.noop=()=>{}})),J=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.calcGridColWidth=t,e.calcGridItemPosition=r,e.calcGridItemWHPx=n,e.calcWH=a,e.calcXY=i,e.clamp=o;function t(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function n(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function r(e,r,i,a,o,s){let{margin:c,containerPadding:l,rowHeight:u}=e,d=t(e),f={};return s&&s.resizing?(f.width=Math.round(s.resizing.width),f.height=Math.round(s.resizing.height)):(f.width=n(a,d,c[0]),f.height=n(o,u,c[1])),s&&s.dragging?(f.top=Math.round(s.dragging.top),f.left=Math.round(s.dragging.left)):s&&s.resizing&&typeof s.resizing.top==`number`&&typeof s.resizing.left==`number`?(f.top=Math.round(s.resizing.top),f.left=Math.round(s.resizing.left)):(f.top=Math.round((u+c[1])*i+l[1]),f.left=Math.round((d+c[0])*r+l[0])),f}function i(e,n,r,i,a){let{margin:s,containerPadding:c,cols:l,rowHeight:u,maxRows:d}=e,f=t(e),p=Math.round((r-c[0])/(f+s[0])),m=Math.round((n-c[1])/(u+s[1]));return p=o(p,0,l-i),m=o(m,0,d-a),{x:p,y:m}}function a(e,n,r,i,a,s){let{margin:c,maxRows:l,cols:u,rowHeight:d}=e,f=t(e),p=Math.round((n+c[0])/(f+c[0])),m=Math.round((r+c[1])/(d+c[1])),h=o(p,0,u-i),g=o(m,0,l-a);return[`sw`,`w`,`nw`].indexOf(s)!==-1&&(h=o(p,0,u)),[`nw`,`n`,`ne`].indexOf(s)!==-1&&(g=o(m,0,l)),{w:h,h:g}}function o(e,t,n){return Math.max(Math.min(e,n),t)}})),ve=i(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),ye=i(((e,t)=>{var n=ve();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),Y=i(((e,t)=>{t.exports=ye()()})),be=i(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,s=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of a(t))!l.call(e,s)&&s!==n&&r(e,s,{get:()=>t[s],enumerable:!(o=i(t,s))||o.enumerable});return e},f=(e,t,i)=>(i=e==null?{}:n(s(e)),d(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),p=e=>d(r({},`__esModule`,{value:!0}),e),m={};u(m,{DraggableCore:()=>J,default:()=>ve}),t.exports=p(m);var h=f(o()),g=f(Y()),_=f(c()),v=M();function y(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function b(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function x(e){return typeof e==`number`&&!isNaN(e)}function S(e){return parseInt(e,10)}function C(e,t,n){if(e[t])return Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}var w=[`Moz`,`Webkit`,`O`,`ms`];function T(e=`transform`){if(typeof window>`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;n<w.length;n++)if(E(e,w[n])in t)return w[n];return``}function E(e,t){return t?`${t}${D(e)}`:e}function D(e){let t=``,n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]===`-`?n=!0:t+=e[r];return t}var O=T(),k=``;function A(e,t){k||=y([`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`],function(t){return b(e[t])})??``;let n=e[k];return b(n)?!!n.call(e,t):!1}function j(e,t,n){let r=e;do{if(A(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function N(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.addEventListener?e.addEventListener(t,a,i):e.attachEvent?e.attachEvent(`on`+t,a):e[`on`+t]=a}function P(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.removeEventListener?e.removeEventListener(t,a,i):e.detachEvent?e.detachEvent(`on`+t,a):e[`on`+t]=null}function F(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=S(n.borderTopWidth),t+=S(n.borderBottomWidth),t}function I(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=S(n.borderLeftWidth),t+=S(n.borderRightWidth),t}function L(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=S(n.paddingTop),t-=S(n.paddingBottom),t}function ee(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=S(n.paddingLeft),t-=S(n.paddingRight),t}function te(e,t,n){let r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-r.left)/n,y:(e.clientY+t.scrollTop-r.top)/n}}function R(e,t){let n=B(e,t,`px`);return{[E(`transform`,O)]:n}}function z(e,t){return B(e,t,``)}function B({x:e,y:t},n,r){let i=`translate(${e}${r},${t}${r})`;return n&&(i=`translate(${`${typeof n.x==`string`?n.x:n.x+r}`}, ${`${typeof n.y==`string`?n.y:n.y+r}`})`+i),i}function ne(e,t){return e.targetTouches&&y(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&y(e.changedTouches,e=>t===e.identifier)}function V(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function re(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function H(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??re();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
1
|
+
import{a as e,n as t,o as n,r,t as i}from"./rolldown-runtime-C0FnF6B9.js";import{l as a,u as o}from"./code-editor-BOIngd5F.js";import{_t as s,yt as c}from"./react-BHzhHVTZ.js";import{r as l}from"./chunk-62JRHF6Z-vspAGgtK.js";import{$ as u,Bt as d,Ct as f,Hr as p,It as m,J as h,K as g,L as _,Lt as v,Pt as y,Qt as b,Vr as x,an as S,bn as C,jn as w,kr as T,kt as E,q as D,sr as O,tn as k,tt as A,yt as j}from"./ui-CDoK3F3U.js";import{n as M}from"./utils-BxVxyehK.js";import{t as N}from"./utils-2pl1SbIp.js";import{t as P}from"./button-SeUZ_Pvi.js";import{t as F}from"./socket-CtH3EU9m.js";import{o as I}from"./auth-Bx9fAZmz.js";import{_ as L,c as ee}from"./LinkToCard-CKVi4Nrg.js";import{$t as te,Dn as R,En as z,G as B,Tt as ne,Z as V,kn as re}from"./workspace-C5V-ZCOE.js";import{a as H,i as ie,n as ae,r as oe}from"./TodosWidget-CNnfNk4L.js";import{y as se}from"./ObjectPropertiesCard-D2lrTQqT.js";import{h as ce,m as le,t as ue,v as de}from"./document-list-CUmMhD6M.js";import{i as fe}from"./public-share-CXR25Q1X.js";import{o as U,s as pe}from"./text-documents-Cdb3U63i.js";import{t as me}from"./useDocumentThumbnail-Cj4UYyhC.js";import{t as he}from"./useEscapeClose-DR_xKT_k.js";import"./layer-style-Byl5LNFR.js";import{i as ge}from"./color-DFEH4BfK.js";import{c as W}from"./workspace-BydSRtST.js";import{t as _e}from"./url-params-n7kU_WZ-.js";var G=i(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n[`fast-equals`]={}))})(e,(function(e){function t(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function n(e){return function(t,n,r,i){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r,i);var a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);var s=e(t,n,r,i);return i.delete(t),i.delete(n),s}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function i(e){return e.constructor===Object||e.constructor==null}function a(e){return typeof e.then==`function`}function o(e,t){return e===t||e!==e&&t!==t}var s=Object.prototype.toString;function c(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,c=e.areObjectsEqual,l=e.areRegExpsEqual,u=e.areSetsEqual,d=e.createIsNestedEqual,f=d(p);function p(e,d,p){if(e===d)return!0;if(!e||!d||typeof e!=`object`||typeof d!=`object`)return e!==e&&d!==d;if(i(e)&&i(d))return c(e,d,f,p);var m=Array.isArray(e),h=Array.isArray(d);if(m||h)return m===h&&t(e,d,f,p);var g=s.call(e);return g===s.call(d)?g===`[object Date]`?n(e,d,f,p):g===`[object RegExp]`?l(e,d,f,p):g===`[object Map]`?r(e,d,f,p):g===`[object Set]`?u(e,d,f,p):g===`[object Object]`||g===`[object Arguments]`?a(e)||a(d)?!1:c(e,d,f,p):g===`[object Boolean]`||g===`[object Number]`||g===`[object String]`?o(e.valueOf(),d.valueOf()):!1:!1}return p}function l(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-->0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var u=n(l);function d(e,t){return o(e.valueOf(),t.valueOf())}function f(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={},o=0;return e.forEach(function(s,c){if(i){var l=!1,u=0;t.forEach(function(i,d){!l&&!a[u]&&(l=n(c,d,o,u,e,t,r)&&n(s,i,c,d,e,t,r))&&(a[u]=!0),u++}),o++,i=l}}),i}var p=n(f),m=`_owner`,h=Object.prototype.hasOwnProperty;function g(e,t,n,r){var i=Object.keys(e),a=i.length;if(Object.keys(t).length!==a)return!1;for(var o;a-->0;){if(o=i[a],o===m){var s=!!e.$$typeof,c=!!t.$$typeof;if((s||c)&&s!==c)return!1}if(!h.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var _=n(g);function v(e,t){return e.source===t.source&&e.flags===t.flags}function y(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={};return e.forEach(function(o,s){if(i){var c=!1,l=0;t.forEach(function(i,u){!c&&!a[l]&&(c=n(o,i,s,u,e,t,r))&&(a[l]=!0),l++}),i=c}}),i}var b=n(y),x=Object.freeze({areArraysEqual:l,areDatesEqual:d,areMapsEqual:f,areObjectsEqual:g,areRegExpsEqual:v,areSetsEqual:y,createIsNestedEqual:t}),S=Object.freeze({areArraysEqual:u,areDatesEqual:d,areMapsEqual:p,areObjectsEqual:_,areRegExpsEqual:v,areSetsEqual:b,createIsNestedEqual:t}),C=c(x);function w(e,t){return C(e,t,void 0)}var T=c(r(x,{createIsNestedEqual:function(){return o}}));function E(e,t){return T(e,t,void 0)}var D=c(S);function O(e,t){return D(e,t,new WeakMap)}var k=c(r(S,{createIsNestedEqual:function(){return o}}));function A(e,t){return k(e,t,new WeakMap)}function j(e){return c(r(x,e(x)))}function M(e){var t=c(r(S,e(S)));return(function(e,n,r){return r===void 0&&(r=new WeakMap),t(e,n,r)})}e.circularDeepEqual=O,e.circularShallowEqual=A,e.createCustomCircularEqual=M,e.createCustomEqual=j,e.deepEqual=w,e.sameValueZeroEqual=o,e.shallowEqual=E,Object.defineProperty(e,"__esModule",{value:!0})}))})),K=i(((e,t)=>{t.exports=function(e,t,n){return e===t||e.className===t.className&&n(e.style,t.style)&&e.width===t.width&&e.autoSize===t.autoSize&&e.cols===t.cols&&e.draggableCancel===t.draggableCancel&&e.draggableHandle===t.draggableHandle&&n(e.verticalCompact,t.verticalCompact)&&n(e.compactType,t.compactType)&&n(e.layout,t.layout)&&n(e.margin,t.margin)&&n(e.containerPadding,t.containerPadding)&&e.rowHeight===t.rowHeight&&e.maxRows===t.maxRows&&e.isBounded===t.isBounded&&e.isDraggable===t.isDraggable&&e.isResizable===t.isResizable&&e.allowOverlap===t.allowOverlap&&e.preventCollision===t.preventCollision&&e.useCSSTransforms===t.useCSSTransforms&&e.transformScale===t.transformScale&&e.isDroppable===t.isDroppable&&n(e.resizeHandles,t.resizeHandles)&&n(e.resizeHandle,t.resizeHandle)&&e.onLayoutChange===t.onLayoutChange&&e.onDragStart===t.onDragStart&&e.onDrag===t.onDrag&&e.onDragStop===t.onDragStop&&e.onResizeStart===t.onResizeStart&&e.onResize===t.onResize&&e.onResizeStop===t.onResizeStop&&e.onDrop===t.onDrop&&n(e.droppingItem,t.droppingItem)&&n(e.innerRef,t.innerRef)}})),q=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bottom=u,e.childrenEqual=h,e.cloneLayout=d,e.cloneLayoutItem=m,e.collides=_,e.compact=v,e.compactItem=x,e.compactType=ie,e.correctBounds=S,e.fastPositionEqual=g,e.fastRGLPropsEqual=void 0,e.getAllCollisions=T,e.getFirstCollision=w,e.getLayoutItem=C,e.getStatics=E,e.modifyLayout=f,e.moveElement=D,e.moveElementAwayFromCollision=O,e.noop=void 0,e.perc=k,e.resizeItemInDirection=te,e.setTopLeft=z,e.setTransform=R,e.sortLayoutItems=B,e.sortLayoutItemsByColRow=V,e.sortLayoutItemsByRowCol=ne,e.synchronizeLayoutWithChildren=re,e.validateLayout=H,e.withLayoutItem=p;var t=G(),n=r(o());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?i(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function s(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){var t=l(e,`string`);return typeof t==`symbol`?t:t+``}function l(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function u(e){let t=0,n;for(let r=0,i=e.length;r<i;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function d(e){let t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=m(e[n]);return t}function f(e,t){let n=Array(e.length);for(let r=0,i=e.length;r<i;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function p(e,t,n){let r=C(e,t);return r?(r=n(m(r)),e=f(e,r),[e,r]):[e,null]}function m(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function h(e,r){return(0,t.deepEqual)(n.default.Children.map(e,e=>e?.key),n.default.Children.map(r,e=>e?.key))&&(0,t.deepEqual)(n.default.Children.map(e,e=>e?.props[`data-grid`]),n.default.Children.map(r,e=>e?.props[`data-grid`]))}e.fastRGLPropsEqual=K();function g(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function _(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function v(e,t,n,r){let i=E(e),a=u(i),o=B(e,t),s=Array(e.length);for(let c=0,l=o.length;c<l;c++){let l=m(o[c]);l.static||(l=x(i,l,t,n,o,r,a),a=Math.max(a,l.y+l.h),i.push(l)),s[e.indexOf(o[c])]=l,l.moved=!1}return s}var y={x:`w`,y:`h`};function b(e,t,n,r){let i=y[r];t[r]+=1;let a=e.map(e=>e.i).indexOf(t.i);for(let o=a+1;o<e.length;o++){let a=e[o];if(!a.static){if(a.y>t.y+t.h)break;_(t,a)&&b(e,a,n+t[i],r)}}t[r]=n}function x(e,t,n,r,i,a,o){let s=n===`vertical`,c=n===`horizontal`;if(s)for(t.y=Math.min(typeof o==`number`?o:u(e),t.y);t.y>0&&!w(e,t);)t.y--;else if(c)for(;t.x>0&&!w(e,t);)t.x--;let l;for(;(l=w(e,t))&&!(n===null&&a);)if(c?b(i,t,l.x+l.w,`x`):b(i,t,l.y+l.h,`y`),c&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!w(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function S(e,t){let n=E(e);for(let r=0,i=e.length;r<i;r++){let i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;w(n,i);)i.y++}return e}function C(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function w(e,t){for(let n=0,r=e.length;n<r;n++)if(_(e[n],t))return e[n]}function T(e,t){return e.filter(e=>_(e,t))}function E(e){return e.filter(e=>e.static)}function D(e,t,n,r,i,a,o,s,c){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;`${t.i}${String(n)}${String(r)}${t.x}${t.y}`;let l=t.x,u=t.y;typeof n==`number`&&(t.x=n),typeof r==`number`&&(t.y=r),t.moved=!0;let f=B(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(f=f.reverse());let p=T(f,t),m=p.length>0;if(m&&c)return d(e);if(m&&a)return`${t.i}`,t.x=l,t.y=u,t.moved=!1,e;for(let n=0,r=p.length;n<r;n++){let r=p[n];`${t.i}${t.x}${t.y}${r.i}${r.x}${r.y}`,!r.moved&&(e=r.static?O(e,r,t,i,o,s):O(e,t,r,i,o,s))}return e}function O(e,t,n,r,i,a){let o=i===`horizontal`,s=i===`vertical`,c=t.static;if(r){r=!1;let l={x:o?Math.max(t.x-n.w,0):n.x,y:s?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:`-1`},u=w(e,l),d=u&&u.y+u.h>t.y,f=u&&t.x+t.w>u.x;if(!u)return`${n.i}${l.x}${l.y}`,D(e,n,o?l.x:void 0,s?l.y:void 0,r,c,i,a);if(d&&s)return D(e,n,void 0,n.y+1,r,c,i,a);if(d&&i==null)return t.y=n.y,n.y+=n.h,e;if(f&&o)return D(e,t,n.x,void 0,r,c,i,a)}let l=o?n.x+1:void 0,u=s?n.y+1:void 0;return l==null&&u==null?e:D(e,n,o?n.x+1:void 0,s?n.y+1:void 0,r,c,i,a)}function k(e){return e*100+`%`}var A=(e,t,n,r)=>e+n>r?t:n,j=(e,t,n)=>e<0?t:n,M=e=>Math.max(0,e),N=e=>Math.max(0,e),P=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:j(o,e.height,i),top:N(o)}},F=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:A(e.left,e.width,o,n),left:M(i)}},I=(e,t,n)=>{let{top:r,height:i,width:a}=t,o=e.left-(a-e.width);return{height:i,width:o<0?e.width:A(e.left,e.width,a,n),top:N(r),left:M(o)}},L=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:j(r,e.height,a),top:N(r)}},ee={n:P,ne:function(){return P(arguments.length<=0?void 0:arguments[0],F(...arguments),arguments.length<=2?void 0:arguments[2])},e:F,se:function(){return L(arguments.length<=0?void 0:arguments[0],F(...arguments),arguments.length<=2?void 0:arguments[2])},s:L,sw:function(){return L(arguments.length<=0?void 0:arguments[0],I(...arguments),arguments.length<=2?void 0:arguments[2])},w:I,nw:function(){return P(arguments.length<=0?void 0:arguments[0],I(...arguments),arguments.length<=2?void 0:arguments[2])}};function te(e,t,n,r){let i=ee[e];return i?i(t,a(a({},t),n),r):n}function R(e){let{top:t,left:n,width:r,height:i}=e,a=`translate(${n}px,${t}px)`;return{transform:a,WebkitTransform:a,MozTransform:a,msTransform:a,OTransform:a,width:`${r}px`,height:`${i}px`,position:`absolute`}}function z(e){let{top:t,left:n,width:r,height:i}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${i}px`,position:`absolute`}}function B(e,t){return t===`horizontal`?V(e):t===`vertical`?ne(e):e}function ne(e){return e.slice(0).sort(function(e,t){return e.y>t.y||e.y===t.y&&e.x>t.x?1:e.y===t.y&&e.x===t.x?0:-1})}function V(e){return e.slice(0).sort(function(e,t){return e.x>t.x||e.x===t.x&&e.y>t.y?1:-1})}function re(e,t,r,i,o){e||=[];let s=[];n.default.Children.forEach(t,t=>{if(t?.key==null)return;let n=C(e,String(t.key)),r=t.props[`data-grid`];n&&r==null?s.push(m(n)):r?s.push(m(a(a({},r),{},{i:t.key}))):s.push(m({w:1,h:1,x:0,y:u(s),i:String(t.key)}))});let c=S(s,{cols:r});return o?c:v(c,i,r)}function H(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Layout`,n=[`x`,`y`,`w`,`h`];if(!Array.isArray(e))throw Error(t+` must be an array!`);for(let r=0,i=e.length;r<i;r++){let i=e[r];for(let e=0;e<n.length;e++){let a=n[e],o=i[a];if(typeof o!=`number`||Number.isNaN(o))throw Error(`ReactGridLayout: ${t}[${r}].${a} must be a number! Received: ${o} (${typeof o})`)}if(i.i!==void 0&&typeof i.i!=`string`)throw Error(`ReactGridLayout: ${t}[${r}].i must be a string! Received: ${i.i} (${typeof i.i})`)}}function ie(e){let{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}e.noop=()=>{}})),J=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.calcGridColWidth=t,e.calcGridItemPosition=r,e.calcGridItemWHPx=n,e.calcWH=a,e.calcXY=i,e.clamp=o;function t(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function n(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function r(e,r,i,a,o,s){let{margin:c,containerPadding:l,rowHeight:u}=e,d=t(e),f={};return s&&s.resizing?(f.width=Math.round(s.resizing.width),f.height=Math.round(s.resizing.height)):(f.width=n(a,d,c[0]),f.height=n(o,u,c[1])),s&&s.dragging?(f.top=Math.round(s.dragging.top),f.left=Math.round(s.dragging.left)):s&&s.resizing&&typeof s.resizing.top==`number`&&typeof s.resizing.left==`number`?(f.top=Math.round(s.resizing.top),f.left=Math.round(s.resizing.left)):(f.top=Math.round((u+c[1])*i+l[1]),f.left=Math.round((d+c[0])*r+l[0])),f}function i(e,n,r,i,a){let{margin:s,containerPadding:c,cols:l,rowHeight:u,maxRows:d}=e,f=t(e),p=Math.round((r-c[0])/(f+s[0])),m=Math.round((n-c[1])/(u+s[1]));return p=o(p,0,l-i),m=o(m,0,d-a),{x:p,y:m}}function a(e,n,r,i,a,s){let{margin:c,maxRows:l,cols:u,rowHeight:d}=e,f=t(e),p=Math.round((n+c[0])/(f+c[0])),m=Math.round((r+c[1])/(d+c[1])),h=o(p,0,u-i),g=o(m,0,l-a);return[`sw`,`w`,`nw`].indexOf(s)!==-1&&(h=o(p,0,u)),[`nw`,`n`,`ne`].indexOf(s)!==-1&&(g=o(m,0,l)),{w:h,h:g}}function o(e,t,n){return Math.max(Math.min(e,n),t)}})),ve=i(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),ye=i(((e,t)=>{var n=ve();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),Y=i(((e,t)=>{t.exports=ye()()})),be=i(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,s=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of a(t))!l.call(e,s)&&s!==n&&r(e,s,{get:()=>t[s],enumerable:!(o=i(t,s))||o.enumerable});return e},f=(e,t,i)=>(i=e==null?{}:n(s(e)),d(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),p=e=>d(r({},`__esModule`,{value:!0}),e),m={};u(m,{DraggableCore:()=>J,default:()=>ve}),t.exports=p(m);var h=f(o()),g=f(Y()),_=f(c()),v=M();function y(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function b(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function x(e){return typeof e==`number`&&!isNaN(e)}function S(e){return parseInt(e,10)}function C(e,t,n){if(e[t])return Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}var w=[`Moz`,`Webkit`,`O`,`ms`];function T(e=`transform`){if(typeof window>`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;n<w.length;n++)if(E(e,w[n])in t)return w[n];return``}function E(e,t){return t?`${t}${D(e)}`:e}function D(e){let t=``,n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]===`-`?n=!0:t+=e[r];return t}var O=T(),k=``;function A(e,t){k||=y([`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`],function(t){return b(e[t])})??``;let n=e[k];return b(n)?!!n.call(e,t):!1}function j(e,t,n){let r=e;do{if(A(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function N(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.addEventListener?e.addEventListener(t,a,i):e.attachEvent?e.attachEvent(`on`+t,a):e[`on`+t]=a}function P(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.removeEventListener?e.removeEventListener(t,a,i):e.detachEvent?e.detachEvent(`on`+t,a):e[`on`+t]=null}function F(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=S(n.borderTopWidth),t+=S(n.borderBottomWidth),t}function I(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=S(n.borderLeftWidth),t+=S(n.borderRightWidth),t}function L(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=S(n.paddingTop),t-=S(n.paddingBottom),t}function ee(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=S(n.paddingLeft),t-=S(n.paddingRight),t}function te(e,t,n){let r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-r.left)/n,y:(e.clientY+t.scrollTop-r.top)/n}}function R(e,t){let n=B(e,t,`px`);return{[E(`transform`,O)]:n}}function z(e,t){return B(e,t,``)}function B({x:e,y:t},n,r){let i=`translate(${e}${r},${t}${r})`;return n&&(i=`translate(${`${typeof n.x==`string`?n.x:n.x+r}`}, ${`${typeof n.y==`string`?n.y:n.y+r}`})`+i),i}function ne(e,t){return e.targetTouches&&y(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&y(e.changedTouches,e=>t===e.identifier)}function V(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function re(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function H(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??re();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
2
2
|
`,n.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
3
3
|
`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&oe(e.body,`react-draggable-transparent-selection`)}function ie(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{ae(e)}):ae(e)}function ae(e){if(e)try{e.body&&se(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function oe(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function se(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function ce(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:me(r);let i=he(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+S(s.paddingLeft)+S(o.marginLeft),top:-i.offsetTop+S(s.paddingTop)+S(o.marginTop),right:ee(a)-I(i)-i.offsetLeft+S(s.paddingRight)-S(o.marginRight),bottom:L(a)-F(i)-i.offsetTop+S(s.paddingBottom)-S(o.marginBottom)}}return x(r.right)&&(t=Math.min(t,r.right)),x(r.bottom)&&(n=Math.min(n,r.bottom)),x(r.left)&&(t=Math.max(t,r.left)),x(r.top)&&(n=Math.max(n,r.top)),[t,n]}function le(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function ue(e){return e.props.axis===`both`||e.props.axis===`x`}function de(e){return e.props.axis===`both`||e.props.axis===`y`}function fe(e,t,n){let r=typeof t==`number`?ne(e,t):null;if(typeof t==`number`&&!r)return null;let i=he(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return te(r||e,a,n.props.scale)}function U(e,t,n){let r=!x(e.lastX),i=he(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function pe(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function me(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function he(e){let t=e.findDOMNode();if(!t)throw Error(`<DraggableCore>: Unmounted during event!`);return t}var ge=f(o()),W=f(Y()),_e=f(c()),G=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},K={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},q=K.mouse,J=class extends ge.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(`<DraggableCore> not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!j(e.target,this.props.handle,t)||this.props.cancel&&j(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=V(e);this.touchIdentifier=r;let i=fe(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=U(this,a,o);G(`DraggableCore: handleDragStart: %j`,s),G(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&H(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,N(n,q.move,this.handleDrag),N(n,q.stop,this.handleDragStop))},this.handleDrag=e=>{let t=fe(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=le(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=U(this,n,r);if(G(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=fe(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=le(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=U(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&ie(a.ownerDocument),G(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(G(`DraggableCore: Removing handlers`),P(a.ownerDocument,q.move,this.handleDrag),P(a.ownerDocument,q.stop,this.handleDragStop))},this.onMouseDown=e=>(q=K.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(q=K.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(q=K.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(q=K.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&N(e,K.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;P(t,K.mouse.move,this.handleDrag),P(t,K.touch.move,this.handleDrag),P(t,K.mouse.stop,this.handleDragStop),P(t,K.touch.stop,this.handleDragStop),P(e,K.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&ie(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=_e.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(G(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return ge.cloneElement(ge.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};J.displayName=`DraggableCore`,J.propTypes={allowAnyClick:W.default.bool,allowMobileScroll:W.default.bool,children:W.default.node.isRequired,disabled:W.default.bool,enableUserSelectHack:W.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:W.default.arrayOf(W.default.number),handle:W.default.string,cancel:W.default.string,nodeRef:W.default.object,nonce:W.default.string,onStart:W.default.func,onDrag:W.default.func,onStop:W.default.func,onMouseDown:W.default.func,scale:W.default.number,className:C,style:C,transform:C},J.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var ve=class extends h.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(G(`Draggable: onDragStart: %j`,t),this.props.onStart(e,pe(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;G(`Draggable: onDrag: %j`,t);let n=pe(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=ce(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,pe(this,t))===!1)return!1;G(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(G(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=_.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,m=s||r,g={x:ue(this)&&p?this.state.x:m.x,y:de(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=z(g,c):d=R(g,c);let _=h.Children.only(n),y=(0,v.clsx)(_.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return h.createElement(J,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},h.cloneElement(_,{className:y,style:{..._.props.style,...d},transform:f}))}};ve.displayName=`Draggable`,ve.propTypes={...J.propTypes,axis:g.default.oneOf([`both`,`x`,`y`,`none`]),bounds:g.default.oneOfType([g.default.shape({left:g.default.number,right:g.default.number,top:g.default.number,bottom:g.default.number}),g.default.string,g.default.oneOf([!1])]),defaultClassName:g.default.string,defaultClassNameDragging:g.default.string,defaultClassNameDragged:g.default.string,defaultPosition:g.default.shape({x:g.default.number,y:g.default.number}),positionOffset:g.default.shape({x:g.default.oneOfType([g.default.number,g.default.string]),y:g.default.oneOfType([g.default.number,g.default.string])}),position:g.default.shape({x:g.default.number,y:g.default.number}),className:C,style:C,transform:C},ve.defaultProps={...J.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1},0&&(t.exports={DraggableCore:J})})),xe=i(((e,t)=>{var n=be(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),Se=i((e=>{e.__esModule=!0,e.cloneElement=l;var t=n(o());function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?r(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function a(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e){var t=c(e,`string`);return typeof t==`symbol`?t:t+``}function c(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function l(e,n){return n.style&&e.props.style&&(n.style=i(i({},e.props.style),n.style)),n.className&&e.props.className&&(n.className=e.props.className+` `+n.className),t.default.cloneElement(e,n)}})),Ce=i((e=>{e.__esModule=!0,e.resizableProps=void 0;var t=n(Y());xe();function n(e){return e&&e.__esModule?e:{default:e}}e.resizableProps={axis:t.default.oneOf([`both`,`x`,`y`,`none`]),className:t.default.string,children:t.default.element.isRequired,draggableOpts:t.default.shape({allowAnyClick:t.default.bool,cancel:t.default.string,children:t.default.node,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:typeof Element<`u`?t.default.instanceOf(Element):t.default.any,grid:t.default.arrayOf(t.default.number),handle:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number}),height:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`y`?t.default.number.isRequired(...e):t.default.number(...e)},handle:t.default.oneOfType([t.default.node,t.default.func]),handleSize:t.default.arrayOf(t.default.number),lockAspectRatio:t.default.bool,maxConstraints:t.default.arrayOf(t.default.number),minConstraints:t.default.arrayOf(t.default.number),onResizeStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,resizeHandles:t.default.arrayOf(t.default.oneOf([`s`,`w`,`e`,`n`,`sw`,`nw`,`se`,`ne`])),transformScale:t.default.number,width:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`x`?t.default.number.isRequired(...e):t.default.number(...e)}}})),we=i((e=>{e.__esModule=!0,e.default=void 0;var t=s(o()),n=xe(),r=Se(),i=Ce(),a=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function s(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(s=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(null,arguments)}function l(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?u(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){var t=m(e,`string`);return typeof t==`symbol`?t:t+``}function m(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var h=class extends t.Component{constructor(){super(...arguments),this.handleRefs={},this.lastHandleRect=null,this.slack=null,this.lastSize=null}componentWillUnmount(){this.resetData()}resetData(){this.lastHandleRect=this.slack=this.lastSize=null}runConstraints(e,t){let n=this.props,r=n.minConstraints,i=n.maxConstraints,a=n.lockAspectRatio;if(!r&&!i&&!a)return[e,t];if(a){let n=this.props.width/this.props.height,r=e-this.props.width,i=t-this.props.height;Math.abs(r)>Math.abs(i*n)?t=e/n:e=t*n}let o=e,s=t,c=this.slack||[0,0],l=c[0],u=c[1];return e+=l,t+=u,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),i&&(e=Math.min(i[0],e),t=Math.min(i[1],t)),this.slack=[l+(o-e),u+(s-t)],[e,t]}resizeHandler(e,t){return(n,r)=>{let i=r.node,a=r.deltaX,o=r.deltaY;e===`onResizeStart`&&this.resetData();let s=(this.props.axis===`both`||this.props.axis===`x`)&&t!==`n`&&t!==`s`,c=(this.props.axis===`both`||this.props.axis===`y`)&&t!==`e`&&t!==`w`;if(!s&&!c)return;let l=t[0],u=t[t.length-1],d=i.getBoundingClientRect();if(this.lastHandleRect!=null){if(u===`w`){let e=d.left-this.lastHandleRect.left;a+=e}if(l===`n`){let e=d.top-this.lastHandleRect.top;o+=e}}this.lastHandleRect=d,u===`w`&&(a=-a),l===`n`&&(o=-o);let f=this.lastSize?.width??this.props.width,p=this.lastSize?.height??this.props.height,m=f+(s?a/this.props.transformScale:0),h=p+(c?o/this.props.transformScale:0);var g=this.runConstraints(m,h);if(m=g[0],h=g[1],e===`onResizeStop`&&this.lastSize){var _=this.lastSize;m=_.width,h=_.height}let v=m!==f||h!==p;e!==`onResizeStop`&&(this.lastSize={width:m,height:h});let y=typeof this.props[e]==`function`?this.props[e]:null;y&&!(e===`onResize`&&!v)&&(n.persist==null||n.persist(),y(n,{node:i,size:{width:m,height:h},handle:t})),e===`onResizeStop`&&this.resetData()}}renderResizeHandle(e,n){let r=this.props.handle;if(!r)return t.createElement(`span`,{className:`react-resizable-handle react-resizable-handle-`+e,ref:n});if(typeof r==`function`)return r(e,n);let i=typeof r.type==`string`,a=d({ref:n},i?{}:{handleAxis:e});return t.cloneElement(r,a)}render(){let e=this.props,i=e.children,o=e.className,s=e.draggableOpts;e.width,e.height,e.handle,e.handleSize,e.lockAspectRatio,e.axis,e.minConstraints,e.maxConstraints,e.onResize,e.onResizeStop,e.onResizeStart;let u=e.resizeHandles;e.transformScale;let f=l(e,a);return(0,r.cloneElement)(i,d(d({},f),{},{className:(o?o+` `:``)+`react-resizable`,children:[...t.Children.toArray(i.props.children),...u.map(e=>{let r=this.handleRefs[e]??(this.handleRefs[e]=t.createRef());return t.createElement(n.DraggableCore,c({},s,{nodeRef:r,key:`resizableHandle-`+e,onStop:this.resizeHandler(`onResizeStop`,e),onStart:this.resizeHandler(`onResizeStart`,e),onDrag:this.resizeHandler(`onResize`,e)}),this.renderResizeHandle(e,r))})]}))}};e.default=h,h.propTypes=i.resizableProps,h.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),Te=i((e=>{e.__esModule=!0,e.default=void 0;var t=c(o()),n=s(Y()),r=s(we()),i=Ce(),a=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(c=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(null,arguments)}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?u(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){var t=m(e,`string`);return typeof t==`symbol`?t:t+``}function m(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function h(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var g=class extends t.Component{constructor(){super(...arguments),this.state={width:this.props.width,height:this.props.height,propsWidth:this.props.width,propsHeight:this.props.height},this.onResize=(e,t)=>{let n=t.size;this.props.onResize?(e.persist==null||e.persist(),this.setState(n,()=>this.props.onResize&&this.props.onResize(e,t))):this.setState(n)}}static getDerivedStateFromProps(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null}render(){let e=this.props,n=e.handle,i=e.handleSize;e.onResize;let o=e.onResizeStart,s=e.onResizeStop,c=e.draggableOpts,u=e.minConstraints,f=e.maxConstraints,p=e.lockAspectRatio,m=e.axis;e.width,e.height;let g=e.resizeHandles,_=e.style,v=e.transformScale,y=h(e,a);return t.createElement(r.default,{axis:m,draggableOpts:c,handle:n,handleSize:i,height:this.state.height,lockAspectRatio:p,maxConstraints:f,minConstraints:u,onResizeStart:o,onResize:this.onResize,onResizeStop:s,resizeHandles:g,transformScale:v,width:this.state.width},t.createElement(`div`,l({},y,{style:d(d({},_),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=g,g.propTypes=d(d({},i.resizableProps),{},{children:n.default.element})})),Ee=i(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=we().default,t.exports.ResizableBox=Te().default})),De=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resizeHandleType=e.resizeHandleAxesType=e.default=void 0;var t=r(Y()),n=r(o());function r(e){return e&&e.__esModule?e:{default:e}}var i=e.resizeHandleAxesType=t.default.arrayOf(t.default.oneOf([`s`,`w`,`e`,`n`,`sw`,`nw`,`se`,`ne`])),a=e.resizeHandleType=t.default.oneOfType([t.default.node,t.default.func]);e.default={className:t.default.string,style:t.default.object,width:t.default.number,autoSize:t.default.bool,cols:t.default.number,draggableCancel:t.default.string,draggableHandle:t.default.string,verticalCompact:function(e){e.verticalCompact},compactType:t.default.oneOf([`vertical`,`horizontal`]),layout:function(e){var t=e.layout;t!==void 0&&q().validateLayout(t,`layout`)},margin:t.default.arrayOf(t.default.number),containerPadding:t.default.arrayOf(t.default.number),rowHeight:t.default.number,maxRows:t.default.number,isBounded:t.default.bool,isDraggable:t.default.bool,isResizable:t.default.bool,allowOverlap:t.default.bool,preventCollision:t.default.bool,useCSSTransforms:t.default.bool,transformScale:t.default.number,isDroppable:t.default.bool,resizeHandles:i,resizeHandle:a,onLayoutChange:t.default.func,onDragStart:t.default.func,onDrag:t.default.func,onDragStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,onResizeStop:t.default.func,onDrop:t.default.func,droppingItem:t.default.shape({i:t.default.string.isRequired,w:t.default.number.isRequired,h:t.default.number.isRequired}),children:function(e,t){let r=e[t],i={};n.default.Children.forEach(r,function(e){if(e?.key!=null){if(i[e.key])throw Error(`Duplicate child key "`+e.key+`" found! This will cause problems in ReactGridLayout.`);i[e.key]=!0}})},innerRef:t.default.any}})),Oe=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=f(o()),n=c(),r=f(Y()),i=xe(),a=Ee(),s=q(),l=J(),u=De(),d=f(M());function f(e){return e&&e.__esModule?e:{default:e}}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function m(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?p(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function h(e,t,n){return(t=g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){var t=_(e,`string`);return typeof t==`symbol`?t:t+``}function _(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var v=class extends t.default.Component{constructor(){super(...arguments),h(this,`state`,{resizing:null,dragging:null,className:``}),h(this,`elementRef`,t.default.createRef()),h(this,`onDragStart`,(e,t)=>{let{node:n}=t,{onDragStart:r,transformScale:i}=this.props;if(!r)return;let a={top:0,left:0},{offsetParent:o}=n;if(!o)return;let s=o.getBoundingClientRect(),c=n.getBoundingClientRect(),u=c.left/i,d=s.left/i,f=c.top/i,p=s.top/i;a.left=u-d+o.scrollLeft,a.top=f-p+o.scrollTop,this.setState({dragging:a});let{x:m,y:h}=(0,l.calcXY)(this.getPositionParams(),a.top,a.left,this.props.w,this.props.h);return r.call(this,this.props.i,m,h,{e,node:n,newPosition:a})}),h(this,`onDrag`,(e,t,r)=>{let{node:i,deltaX:a,deltaY:o}=t,{onDrag:s}=this.props;if(!s)return;if(!this.state.dragging)throw Error(`onDrag called before onDragStart.`);let c=this.state.dragging.top+o,u=this.state.dragging.left+a,{isBounded:d,i:f,w:p,h:m,containerWidth:h}=this.props,g=this.getPositionParams();if(d){let{offsetParent:e}=i;if(e){let{margin:t,rowHeight:n}=this.props,r=e.clientHeight-(0,l.calcGridItemWHPx)(m,n,t[1]);c=(0,l.clamp)(c,0,r);let i=(0,l.calcGridColWidth)(g),a=h-(0,l.calcGridItemWHPx)(p,i,t[0]);u=(0,l.clamp)(u,0,a)}}let _={top:c,left:u};r?this.setState({dragging:_}):(0,n.flushSync)(()=>{this.setState({dragging:_})});let{x:v,y}=(0,l.calcXY)(g,c,u,p,m);return s.call(this,f,v,y,{e,node:i,newPosition:_})}),h(this,`onDragStop`,(e,t)=>{let{node:n}=t,{onDragStop:r}=this.props;if(!r)return;if(!this.state.dragging)throw Error(`onDragEnd called before onDragStart.`);let{w:i,h:a,i:o}=this.props,{left:s,top:c}=this.state.dragging,u={top:c,left:s};this.setState({dragging:null});let{x:d,y:f}=(0,l.calcXY)(this.getPositionParams(),c,s,i,a);return r.call(this,o,d,f,{e,node:n,newPosition:u})}),h(this,`onResizeStop`,(e,t,n)=>this.onResizeHandler(e,t,n,`onResizeStop`)),h(this,`onResizeStart`,(e,t,n)=>this.onResizeHandler(e,t,n,`onResizeStart`)),h(this,`onResize`,(e,t,n)=>this.onResizeHandler(e,t,n,`onResize`))}shouldComponentUpdate(e,t){if(this.props.children!==e.children||this.props.droppingPosition!==e.droppingPosition)return!0;let n=(0,l.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),r=(0,l.calcGridItemPosition)(this.getPositionParams(e),e.x,e.y,e.w,e.h,t);return!(0,s.fastPositionEqual)(n,r)||this.props.useCSSTransforms!==e.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(e){this.moveDroppingItem(e)}moveDroppingItem(e){let{droppingPosition:t}=this.props;if(!t)return;let n=this.elementRef.current;if(!n)return;let r=e.droppingPosition||{left:0,top:0},{dragging:i}=this.state,a=i&&t.left!==r.left||t.top!==r.top;if(!i)this.onDragStart(t.e,{node:n,deltaX:t.left,deltaY:t.top});else if(a){let e=t.left-i.left,r=t.top-i.top;this.onDrag(t.e,{node:n,deltaX:e,deltaY:r},!0)}}getPositionParams(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:e.cols,containerPadding:e.containerPadding,containerWidth:e.containerWidth,margin:e.margin,maxRows:e.maxRows,rowHeight:e.rowHeight}}createStyle(e){let{usePercentages:t,containerWidth:n,useCSSTransforms:r}=this.props,i;return r?i=(0,s.setTransform)(e):(i=(0,s.setTopLeft)(e),t&&(i.left=(0,s.perc)(e.left/n),i.width=(0,s.perc)(e.width/n))),i}mixinDraggable(e,n){return t.default.createElement(i.DraggableCore,{disabled:!n,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:`.react-resizable-handle`+(this.props.cancel?`,`+this.props.cancel:``),scale:this.props.transformScale,nodeRef:this.elementRef},e)}curryResizeHandler(e,t){return(n,r)=>t(n,r,e)}mixinResizable(e,n,r){let{cols:i,minW:o,minH:s,maxW:c,maxH:u,transformScale:d,resizeHandles:f,resizeHandle:p}=this.props,m=this.getPositionParams(),h=(0,l.calcGridItemPosition)(m,0,0,i,0).width,g=(0,l.calcGridItemPosition)(m,0,0,o,s),_=(0,l.calcGridItemPosition)(m,0,0,c,u),v=[g.width,g.height],y=[Math.min(_.width,h),Math.min(_.height,1/0)];return t.default.createElement(a.Resizable,{draggableOpts:{disabled:!r},className:r?void 0:`react-resizable-hide`,width:n.width,height:n.height,minConstraints:v,maxConstraints:y,onResizeStop:this.curryResizeHandler(n,this.onResizeStop),onResizeStart:this.curryResizeHandler(n,this.onResizeStart),onResize:this.curryResizeHandler(n,this.onResize),transformScale:d,resizeHandles:f,handle:p},e)}onResizeHandler(e,t,r,i){let{node:a,size:o,handle:c}=t,u=this.props[i];if(!u)return;let{x:d,y:f,i:p,maxH:m,minH:h,containerWidth:g}=this.props,{minW:_,maxW:v}=this.props,y=o;a&&(y=(0,s.resizeItemInDirection)(c,r,o,g),(0,n.flushSync)(()=>{this.setState({resizing:i===`onResizeStop`?null:y})}));let{w:b,h:x}=(0,l.calcWH)(this.getPositionParams(),y.width,y.height,d,f,c);b=(0,l.clamp)(b,Math.max(_,1),v),x=(0,l.clamp)(x,h,m),u.call(this,p,b,x,{e,node:a,size:y,handle:c})}render(){let{x:e,y:n,w:r,h:i,isDraggable:a,isResizable:o,droppingPosition:s,useCSSTransforms:c}=this.props,u=(0,l.calcGridItemPosition)(this.getPositionParams(),e,n,r,i,this.state),f=t.default.Children.only(this.props.children),p=t.default.cloneElement(f,{ref:this.elementRef,className:(0,d.default)(`react-grid-item`,f.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":a,"react-draggable-dragging":!!this.state.dragging,dropping:!!s,cssTransforms:c}),style:m(m(m({},this.props.style),f.props.style),this.createStyle(u))});return p=this.mixinResizable(p,u,o),p=this.mixinDraggable(p,a),p}};e.default=v,h(v,`propTypes`,{children:r.default.element,cols:r.default.number.isRequired,containerWidth:r.default.number.isRequired,rowHeight:r.default.number.isRequired,margin:r.default.array.isRequired,maxRows:r.default.number.isRequired,containerPadding:r.default.array.isRequired,x:r.default.number.isRequired,y:r.default.number.isRequired,w:r.default.number.isRequired,h:r.default.number.isRequired,minW:function(e,t){let n=e[t];if(typeof n!=`number`)return Error(`minWidth not Number`);if(n>e.w||n>e.maxW)return Error(`minWidth larger than item width/maxWidth`)},maxW:function(e,t){let n=e[t];if(typeof n!=`number`)return Error(`maxWidth not Number`);if(n<e.w||n<e.minW)return Error(`maxWidth smaller than item width/minWidth`)},minH:function(e,t){let n=e[t];if(typeof n!=`number`)return Error(`minHeight not Number`);if(n>e.h||n>e.maxH)return Error(`minHeight larger than item height/maxHeight`)},maxH:function(e,t){let n=e[t];if(typeof n!=`number`)return Error(`maxHeight not Number`);if(n<e.h||n<e.minH)return Error(`maxHeight smaller than item height/minHeight`)},i:r.default.string.isRequired,resizeHandles:u.resizeHandleAxesType,resizeHandle:u.resizeHandleType,onDragStop:r.default.func,onDragStart:r.default.func,onDrag:r.default.func,onResizeStop:r.default.func,onResizeStart:r.default.func,onResize:r.default.func,isDraggable:r.default.bool.isRequired,isResizable:r.default.bool.isRequired,isBounded:r.default.bool.isRequired,static:r.default.bool,useCSSTransforms:r.default.bool.isRequired,transformScale:r.default.number,className:r.default.string,handle:r.default.string,cancel:r.default.string,droppingPosition:r.default.shape({e:r.default.object.isRequired,left:r.default.number.isRequired,top:r.default.number.isRequired})}),h(v,`defaultProps`,{className:``,cancel:``,handle:``,minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1})})),ke=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=u(o()),n=G(),r=l(M()),i=q(),a=J(),s=l(Oe()),c=l(De());function l(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(u=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?d(Object(n),!0).forEach(function(t){p(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function p(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e){var t=h(e,`string`);return typeof t==`symbol`?t:t+``}function h(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var g=`react-grid-layout`,_=!1;try{_=/firefox/i.test(navigator.userAgent)}catch{}var v=class extends t.Component{constructor(){super(...arguments),p(this,`state`,{activeDrag:null,layout:(0,i.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,i.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),p(this,`dragEnterCounter`,0),p(this,`onDragStart`,(e,t,n,r)=>{let{e:a,node:o}=r,{layout:s}=this.state,c=(0,i.getLayoutItem)(s,e);if(!c)return;let l={w:c.w,h:c.h,x:c.x,y:c.y,placeholder:!0,i:e};return this.setState({oldDragItem:(0,i.cloneLayoutItem)(c),oldLayout:s,activeDrag:l}),this.props.onDragStart(s,c,c,null,a,o)}),p(this,`onDrag`,(e,t,n,r)=>{let{e:a,node:o}=r,{oldDragItem:s}=this.state,{layout:c}=this.state,{cols:l,allowOverlap:u,preventCollision:d}=this.props,f=(0,i.getLayoutItem)(c,e);if(!f)return;let p={w:f.w,h:f.h,x:f.x,y:f.y,placeholder:!0,i:e};c=(0,i.moveElement)(c,f,t,n,!0,d,(0,i.compactType)(this.props),l,u),this.props.onDrag(c,s,f,p,a,o),this.setState({layout:u?c:(0,i.compact)(c,(0,i.compactType)(this.props),l),activeDrag:p})}),p(this,`onDragStop`,(e,t,n,r)=>{let{e:a,node:o}=r;if(!this.state.activeDrag)return;let{oldDragItem:s}=this.state,{layout:c}=this.state,{cols:l,preventCollision:u,allowOverlap:d}=this.props,f=(0,i.getLayoutItem)(c,e);if(!f)return;c=(0,i.moveElement)(c,f,t,n,!0,u,(0,i.compactType)(this.props),l,d);let p=d?c:(0,i.compact)(c,(0,i.compactType)(this.props),l);this.props.onDragStop(p,s,f,null,a,o);let{oldLayout:m}=this.state;this.setState({activeDrag:null,layout:p,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(p,m)}),p(this,`onResizeStart`,(e,t,n,r)=>{let{e:a,node:o}=r,{layout:s}=this.state,c=(0,i.getLayoutItem)(s,e);c&&(this.setState({oldResizeItem:(0,i.cloneLayoutItem)(c),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(s,c,c,null,a,o))}),p(this,`onResize`,(e,t,n,r)=>{let{e:a,node:o,size:s,handle:c}=r,{oldResizeItem:l}=this.state,{layout:u}=this.state,{cols:d,preventCollision:p,allowOverlap:m}=this.props,h=!1,g,_,v,[y,b]=(0,i.withLayoutItem)(u,e,e=>{let r;return _=e.x,v=e.y,[`sw`,`w`,`nw`,`n`,`ne`].indexOf(c)!==-1&&([`sw`,`nw`,`w`].indexOf(c)!==-1&&(_=e.x+(e.w-t),t=e.x!==_&&_<0?e.w:t,_=_<0?0:_),[`ne`,`n`,`nw`].indexOf(c)!==-1&&(v=e.y+(e.h-n),n=e.y!==v&&v<0?e.h:n,v=v<0?0:v),h=!0),p&&!m&&(r=(0,i.getAllCollisions)(u,f(f({},e),{},{w:t,h:n,x:_,y:v})).filter(t=>t.i!==e.i).length>0,r&&(v=e.y,n=e.h,_=e.x,t=e.w,h=!1)),e.w=t,e.h=n,e});if(!b)return;g=y,h&&(g=(0,i.moveElement)(y,b,_,v,!0,this.props.preventCollision,(0,i.compactType)(this.props),d,m));let x={w:b.w,h:b.h,x:b.x,y:b.y,static:!0,i:e};this.props.onResize(g,l,b,x,a,o),this.setState({layout:m?g:(0,i.compact)(g,(0,i.compactType)(this.props),d),activeDrag:x})}),p(this,`onResizeStop`,(e,t,n,r)=>{let{e:a,node:o}=r,{layout:s,oldResizeItem:c}=this.state,{cols:l,allowOverlap:u}=this.props,d=(0,i.getLayoutItem)(s,e),f=u?s:(0,i.compact)(s,(0,i.compactType)(this.props),l);this.props.onResizeStop(f,c,d,null,a,o);let{oldLayout:p}=this.state;this.setState({activeDrag:null,layout:f,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(f,p)}),p(this,`onDragOver`,e=>{var n;if(e.preventDefault(),e.stopPropagation(),_&&!((n=e.nativeEvent.target)!=null&&n.classList.contains(g)))return!1;let{droppingItem:r,onDropDragOver:i,margin:o,cols:s,rowHeight:c,maxRows:l,width:u,containerPadding:d,transformScale:p}=this.props,m=i?.(e);if(m===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;let h=f(f({},r),m),{layout:v}=this.state,y=e.currentTarget.getBoundingClientRect(),b=e.clientX-y.left,x=e.clientY-y.top,S={left:b/p,top:x/p,e};if(!this.state.droppingDOMNode){let e={cols:s,margin:o,maxRows:l,rowHeight:c,containerWidth:u,containerPadding:d||o},n=(0,a.calcXY)(e,x,b,h.w,h.h);this.setState({droppingDOMNode:t.createElement(`div`,{key:h.i}),droppingPosition:S,layout:[...v,f(f({},h),{},{x:n.x,y:n.y,static:!1,isDraggable:!0})]})}else if(this.state.droppingPosition){let{left:e,top:t}=this.state.droppingPosition;(e!=b||t!=x)&&this.setState({droppingPosition:S})}}),p(this,`removeDroppingPlaceholder`,()=>{let{droppingItem:e,cols:t}=this.props,{layout:n}=this.state,r=(0,i.compact)(n.filter(t=>t.i!==e.i),(0,i.compactType)(this.props),t,this.props.allowOverlap);this.setState({layout:r,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),p(this,`onDragLeave`,e=>{e.preventDefault(),e.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),p(this,`onDragEnter`,e=>{e.preventDefault(),e.stopPropagation(),this.dragEnterCounter++}),p(this,`onDrop`,e=>{e.preventDefault(),e.stopPropagation();let{droppingItem:t}=this.props,{layout:n}=this.state,r=n.find(e=>e.i===t.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(n,r,e)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(e,t){let r;return t.activeDrag?null:(!(0,n.deepEqual)(e.layout,t.propsLayout)||e.compactType!==t.compactType?r=e.layout:(0,i.childrenEqual)(e.children,t.children)||(r=t.layout),r?{layout:(0,i.synchronizeLayoutWithChildren)(r,e.children,e.cols,(0,i.compactType)(e),e.allowOverlap),compactType:e.compactType,children:e.children,propsLayout:e.layout}:null)}shouldComponentUpdate(e,t){return this.props.children!==e.children||!(0,i.fastRGLPropsEqual)(this.props,e,n.deepEqual)||this.state.activeDrag!==t.activeDrag||this.state.mounted!==t.mounted||this.state.droppingPosition!==t.droppingPosition}componentDidUpdate(e,t){if(!this.state.activeDrag){let e=this.state.layout,n=t.layout;this.onLayoutMaybeChanged(e,n)}}containerHeight(){if(!this.props.autoSize)return;let e=(0,i.bottom)(this.state.layout),t=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return e*this.props.rowHeight+(e-1)*this.props.margin[1]+t*2+`px`}onLayoutMaybeChanged(e,t){t||=this.state.layout,(0,n.deepEqual)(t,e)||this.props.onLayoutChange(e)}placeholder(){let{activeDrag:e}=this.state;if(!e)return null;let{width:n,cols:r,margin:i,containerPadding:a,rowHeight:o,maxRows:c,useCSSTransforms:l,transformScale:u}=this.props;return t.createElement(s.default,{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,className:`react-grid-placeholder ${this.state.resizing?`placeholder-resizing`:``}`,containerWidth:n,cols:r,margin:i,containerPadding:a||i,maxRows:c,rowHeight:o,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:l,transformScale:u},t.createElement(`div`,null))}processGridItem(e,n){if(!e||!e.key)return;let r=(0,i.getLayoutItem)(this.state.layout,String(e.key));if(!r)return null;let{width:a,cols:o,margin:c,containerPadding:l,rowHeight:u,maxRows:d,isDraggable:f,isResizable:p,isBounded:m,useCSSTransforms:h,transformScale:g,draggableCancel:_,draggableHandle:v,resizeHandles:y,resizeHandle:b}=this.props,{mounted:x,droppingPosition:S}=this.state,C=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&f,w=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&p,T=r.resizeHandles||y,E=C&&m&&r.isBounded!==!1;return t.createElement(s.default,{containerWidth:a,cols:o,margin:c,containerPadding:l||c,maxRows:d,rowHeight:u,cancel:_,handle:v,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:C,isResizable:w,isBounded:E,useCSSTransforms:h&&x,usePercentages:!x,transformScale:g,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:n?S:void 0,resizeHandles:T,resizeHandle:b},e)}render(){let{className:e,style:n,isDroppable:a,innerRef:o}=this.props,s=(0,r.default)(g,e),c=f({height:this.containerHeight()},n);return t.createElement(`div`,{ref:o,className:s,style:c,onDrop:a?this.onDrop:i.noop,onDragLeave:a?this.onDragLeave:i.noop,onDragEnter:a?this.onDragEnter:i.noop,onDragOver:a?this.onDragOver:i.noop},t.Children.map(this.props.children,e=>this.processGridItem(e)),a&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}};e.default=v,p(v,`displayName`,`ReactGridLayout`),p(v,`propTypes`,c.default),p(v,`defaultProps`,{autoSize:!0,cols:12,className:``,style:{},draggableHandle:``,draggableCancel:``,containerPadding:null,rowHeight:150,maxRows:1/0,layout:[],margin:[10,10],isBounded:!1,isDraggable:!0,isResizable:!0,allowOverlap:!1,isDroppable:!1,useCSSTransforms:!0,transformScale:1,verticalCompact:!0,compactType:`vertical`,preventCollision:!1,droppingItem:{i:`__dropping-elem__`,h:1,w:1},resizeHandles:[`se`],onLayoutChange:i.noop,onDragStart:i.noop,onDrag:i.noop,onDragStop:i.noop,onResizeStart:i.noop,onResize:i.noop,onResizeStop:i.noop,onDrop:i.noop,onDropDragOver:i.noop})})),Ae=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.findOrGenerateResponsiveLayout=i,e.getBreakpointFromWidth=n,e.getColsFromBreakpoint=r,e.sortBreakpoints=a;var t=q();function n(e,t){let n=a(e),r=n[0];for(let i=1,a=n.length;i<a;i++){let a=n[i];t>e[a]&&(r=a)}return r}function r(e,t){if(!t[e])throw Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+` is missing!`);return t[e]}function i(e,n,r,i,o,s){if(e[r])return(0,t.cloneLayout)(e[r]);let c=e[i],l=a(n),u=l.slice(l.indexOf(r));for(let t=0,n=u.length;t<n;t++){let n=u[t];if(e[n]){c=e[n];break}}return c=(0,t.cloneLayout)(c||[]),(0,t.compact)((0,t.correctBounds)(c,{cols:o}),s,o)}function a(e){return Object.keys(e).sort(function(t,n){return e[t]-e[n]})}})),je=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=u(o()),n=l(Y()),r=G(),i=q(),a=Ae(),s=l(ke()),c=[`breakpoint`,`breakpoints`,`cols`,`layouts`,`margin`,`containerPadding`,`onBreakpointChange`,`onLayoutChange`,`onWidthChange`];function l(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(u=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},d.apply(null,arguments)}function f(e,t){if(e==null)return{};var n,r,i=p(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function p(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?m(Object(n),!0).forEach(function(t){g(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function g(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(e){var t=v(e,`string`);return typeof t==`symbol`?t:t+``}function v(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var y=e=>Object.prototype.toString.call(e);function b(e,t){return e==null?null:Array.isArray(e)?e:e[t]}var x=class extends t.Component{constructor(){super(...arguments),g(this,`state`,this.generateInitialState()),g(this,`onLayoutChange`,e=>{this.props.onLayoutChange(e,h(h({},this.props.layouts),{},{[this.state.breakpoint]:e}))})}generateInitialState(){let{width:e,breakpoints:t,layouts:n,cols:r}=this.props,i=(0,a.getBreakpointFromWidth)(t,e),o=(0,a.getColsFromBreakpoint)(i,r),s=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,a.findOrGenerateResponsiveLayout)(n,t,i,i,o,s),breakpoint:i,cols:o}}static getDerivedStateFromProps(e,t){if(!(0,r.deepEqual)(e.layouts,t.layouts)){let{breakpoint:n,cols:r}=t;return{layout:(0,a.findOrGenerateResponsiveLayout)(e.layouts,e.breakpoints,n,n,r,e.compactType),layouts:e.layouts}}return null}componentDidUpdate(e){(this.props.width!=e.width||this.props.breakpoint!==e.breakpoint||!(0,r.deepEqual)(this.props.breakpoints,e.breakpoints)||!(0,r.deepEqual)(this.props.cols,e.cols))&&this.onWidthChange(e)}onWidthChange(e){let{breakpoints:t,cols:n,layouts:r,compactType:o}=this.props,s=this.props.breakpoint||(0,a.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),c=this.state.breakpoint,l=(0,a.getColsFromBreakpoint)(s,n),u=h({},r);if(c!==s||e.breakpoints!==t||e.cols!==n){c in u||(u[c]=(0,i.cloneLayout)(this.state.layout));let e=(0,a.findOrGenerateResponsiveLayout)(u,t,s,c,l,o);e=(0,i.synchronizeLayoutWithChildren)(e,this.props.children,l,o,this.props.allowOverlap),u[s]=e,this.props.onBreakpointChange(s,l),this.props.onLayoutChange(e,u),this.setState({breakpoint:s,layout:e,cols:l})}let d=b(this.props.margin,s),f=b(this.props.containerPadding,s);this.props.onWidthChange(this.props.width,d,l,f)}render(){let e=this.props,{breakpoint:n,breakpoints:r,cols:i,layouts:a,margin:o,containerPadding:l,onBreakpointChange:u,onLayoutChange:p,onWidthChange:m}=e,h=f(e,c);return t.createElement(s.default,d({},h,{margin:b(o,this.state.breakpoint),containerPadding:b(l,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}};e.default=x,g(x,`propTypes`,{breakpoint:n.default.string,breakpoints:n.default.object,allowOverlap:n.default.bool,cols:n.default.object,margin:n.default.oneOfType([n.default.array,n.default.object]),containerPadding:n.default.oneOfType([n.default.array,n.default.object]),layouts(e,t){if(y(e[t])!==`[object Object]`)throw Error(`Layout property must be an object. Received: `+y(e[t]));Object.keys(e[t]).forEach(t=>{if(!(t in e.breakpoints))throw Error(`Each key in layouts must align with a key in breakpoints.`);(0,i.validateLayout)(e.layouts[t],`layouts.`+t)})},width:n.default.number.isRequired,onBreakpointChange:n.default.func,onLayoutChange:n.default.func,onWidthChange:n.default.func}),g(x,`defaultProps`,{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],allowOverlap:!1,onBreakpointChange:i.noop,onLayoutChange:i.noop,onWidthChange:i.noop})})),Me=r({default:()=>ot});function Ne(e,t){var n=!1,r=!1,i=0;function a(){n&&(n=!1,e()),r&&s()}function o(){Ke(a)}function s(){var e=Date.now();if(n){if(e-i<qe)return;r=!0}else n=!0,r=!1,setTimeout(o,t);i=e}return s}function Pe(e){return parseFloat(e)||0}function Fe(e){return[...arguments].slice(1).reduce(function(t,n){var r=e[`border-`+n+`-width`];return t+Pe(r)},0)}function Ie(e){for(var t=[`top`,`right`,`bottom`,`left`],n={},r=0,i=t;r<i.length;r++){var a=i[r],o=e[`padding-`+a];n[a]=Pe(o)}return n}function Le(e){var t=e.getBBox();return He(0,0,t.width,t.height)}function Re(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return $e;var r=X(e).getComputedStyle(e),i=Ie(r),a=i.left+i.right,o=i.top+i.bottom,s=Pe(r.width),c=Pe(r.height);if(r.boxSizing===`border-box`&&(Math.round(s+a)!==t&&(s-=Fe(r,`left`,`right`)+a),Math.round(c+o)!==n&&(c-=Fe(r,`top`,`bottom`)+o)),!ze(e)){var l=Math.round(s+a)-t,u=Math.round(c+o)-n;Math.abs(l)!==1&&(s-=l),Math.abs(u)!==1&&(c-=u)}return He(i.left,i.top,s,c)}function ze(e){return e===X(e).document.documentElement}function Be(e){return We?et(e)?Le(e):Re(e):$e}function Ve(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=Object.create((typeof DOMRectReadOnly<`u`?DOMRectReadOnly:Object).prototype);return Qe(a,{x:t,y:n,width:r,height:i,top:n,right:t+r,bottom:i+n,left:t}),a}function He(e,t,n,r){return{x:e,y:t,width:n,height:r}}var Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe,X,$e,et,tt,nt,rt,it,at,ot,st=t((()=>{Ue=(function(){if(typeof Map<`u`)return Map;function e(e,t){var n=-1;return e.some(function(e,r){return e[0]===t&&(n=r,!0)}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var n=e(this.__entries__,t),r=this.__entries__[n];return r&&r[1]},t.prototype.set=function(t,n){var r=e(this.__entries__,t);~r?this.__entries__[r][1]=n:this.__entries__.push([t,n])},t.prototype.delete=function(t){var n=this.__entries__,r=e(n,t);~r&&n.splice(r,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){t===void 0&&(t=null);for(var n=0,r=this.__entries__;n<r.length;n++){var i=r[n];e.call(t,i[1],i[0])}},t}()})(),We=typeof window<`u`&&typeof document<`u`&&window.document===document,Ge=(function(){return typeof global<`u`&&global.Math===Math?global:typeof self<`u`&&self.Math===Math?self:typeof window<`u`&&window.Math===Math?window:Function(`return this`)()})(),Ke=(function(){return typeof requestAnimationFrame==`function`?requestAnimationFrame.bind(Ge):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}})(),qe=2,Je=20,Ye=[`top`,`right`,`bottom`,`left`,`width`,`height`,`size`,`weight`],Xe=typeof MutationObserver<`u`,Ze=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Ne(this.refresh.bind(this),Je)}return e.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},e.prototype.removeObserver=function(e){var t=this.observers_,n=t.indexOf(e);~n&&t.splice(n,1),!t.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},e.prototype.updateObservers_=function(){var e=this.observers_.filter(function(e){return e.gatherActive(),e.hasActive()});return e.forEach(function(e){return e.broadcastActive()}),e.length>0},e.prototype.connect_=function(){!We||this.connected_||(document.addEventListener(`transitionend`,this.onTransitionEnd_),window.addEventListener(`resize`,this.refresh),Xe?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener(`DOMSubtreeModified`,this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!We||!this.connected_||(document.removeEventListener(`transitionend`,this.onTransitionEnd_),window.removeEventListener(`resize`,this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener(`DOMSubtreeModified`,this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,n=t===void 0?``:t;Ye.some(function(e){return!!~n.indexOf(e)})&&this.refresh()},e.getInstance=function(){return this.instance_||=new e,this.instance_},e.instance_=null,e}(),Qe=(function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];Object.defineProperty(e,i,{value:t[i],enumerable:!1,writable:!1,configurable:!0})}return e}),X=(function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||Ge}),$e=He(0,0,0,0),et=(function(){return typeof SVGGraphicsElement<`u`?function(e){return e instanceof X(e).SVGGraphicsElement}:function(e){return e instanceof X(e).SVGElement&&typeof e.getBBox==`function`}})(),tt=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=He(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e=Be(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},e}(),nt=function(){function e(e,t){var n=Ve(t);Qe(this,{target:e,contentRect:n})}return e}(),rt=function(){function e(e,t,n){if(this.activeObservations_=[],this.observations_=new Ue,typeof e!=`function`)throw TypeError(`The callback provided as parameter 1 is not a function.`);this.callback_=e,this.controller_=t,this.callbackCtx_=n}return e.prototype.observe=function(e){if(!arguments.length)throw TypeError(`1 argument required, but only 0 present.`);if(!(typeof Element>`u`||!(Element instanceof Object))){if(!(e instanceof X(e).Element))throw TypeError(`parameter 1 is not of type "Element".`);var t=this.observations_;t.has(e)||(t.set(e,new tt(e)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(e){if(!arguments.length)throw TypeError(`1 argument required, but only 0 present.`);if(!(typeof Element>`u`||!(Element instanceof Object))){if(!(e instanceof X(e).Element))throw TypeError(`parameter 1 is not of type "Element".`);var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(t){t.isActive()&&e.activeObservations_.push(t)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map(function(e){return new nt(e.target,e.broadcastRect())});this.callback_.call(e,t,e),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),it=typeof WeakMap<`u`?new WeakMap:new Ue,at=function(){function e(t){if(!(this instanceof e))throw TypeError(`Cannot call a class as a function.`);if(!arguments.length)throw TypeError(`1 argument required, but only 0 present.`);var n=new rt(t,Ze.getInstance(),this);it.set(this,n)}return e}(),[`observe`,`unobserve`,`disconnect`].forEach(function(e){at.prototype[e]=function(){var t;return(t=it.get(this))[e].apply(t,arguments)}}),ot=(function(){return Ge.ResizeObserver===void 0?at:Ge.ResizeObserver})()})),ct=i((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=_;var n=l(o()),r=c(Y()),i=c((st(),e(Me))),a=c(M()),s=[`measureBeforeMount`];function c(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(l=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u.apply(null,arguments)}function d(e,t){if(e==null)return{};var n,r,i=f(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function f(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function p(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e){var t=h(e,`string`);return typeof t==`symbol`?t:t+``}function h(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var g=`react-grid-layout`;function _(e){var t;return t=class extends n.Component{constructor(){super(...arguments),p(this,`state`,{width:1280}),p(this,`elementRef`,n.createRef()),p(this,`mounted`,!1),p(this,`resizeObserver`,void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new i.default(e=>{if(this.elementRef.current instanceof HTMLElement){let t=e[0].contentRect.width;this.setState({width:t})}});let e=this.elementRef.current;e instanceof HTMLElement&&this.resizeObserver.observe(e)}componentWillUnmount(){this.mounted=!1;let e=this.elementRef.current;e instanceof HTMLElement&&this.resizeObserver.unobserve(e),this.resizeObserver.disconnect()}render(){let t=this.props,{measureBeforeMount:r}=t,i=d(t,s);return r&&!this.mounted?n.createElement(`div`,{className:(0,a.default)(this.props.className,g),style:this.props.style,ref:this.elementRef}):n.createElement(e,u({innerRef:this.elementRef},i,this.state))}},p(t,`defaultProps`,{measureBeforeMount:!1}),p(t,`propTypes`,{measureBeforeMount:r.default.bool}),t}})),lt=i(((e,t)=>{t.exports=ke().default,t.exports.utils=q(),t.exports.calculateUtils=J(),t.exports.Responsive=je().default,t.exports.Responsive.utils=Ae(),t.exports.WidthProvider=ct().default})),Z=n(o(),1),ut=n(lt(),1);function dt(e,t){let n=typeof e.setCanvasQueries==`function`,[r,i]=(0,Z.useState)(e.canvasQueries??[]),a=(0,Z.useMemo)(()=>n?e.canvasQueries??[]:r,[n,e.canvasQueries,r]),o=(0,Z.useCallback)(r=>{n?e.setCanvasQueries(r):i(r),t?.()},[n,e,t]);return{queries:a,runSearch:(0,Z.useCallback)(e=>{let t=e.trim();!t||a.includes(t)||o([...a,t])},[a,o]),removeQuery:(0,Z.useCallback)(e=>{o(e<0?[]:a.filter((t,n)=>n!==e))},[a,o]),clearSearch:(0,Z.useCallback)(()=>o([]),[o])}}var Q=a();function ft({config:e,canvas:t}){let n=typeof e.pageSize==`number`?e.pageSize:50,r=e.viewMode===`card`||e.viewMode===`tile`||e.viewMode===`table`?e.viewMode:`table`,[i,a]=(0,Z.useState)([]),[o,s]=(0,Z.useState)(0),[c,l]=(0,Z.useState)(1),[u,d]=(0,Z.useState)(!0),f=t.canvasSort??ce,{queries:p,runSearch:m,removeQuery:h}=dt(t,()=>l(1));(0,Z.useEffect)(()=>{let e=!1;return(async()=>{d(!0);try{let r=await t.fetchDocuments({limit:n,page:c,sortBy:f.sortBy,order:f.order,queries:p.length?p:void 0});if(e)return;a(r.payload||[]),s(r.totalCount||r.count||0)}catch{e||(a([]),s(0))}finally{e||d(!1)}})(),()=>{e=!0}},[t,n,c,f.sortBy,f.order,p]);let g=(0,Z.useCallback)(e=>{t.setCanvasSort?.(e),l(1)},[t]),_=t.readOnly===!0;return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!_&&(0,Q.jsxs)(`div`,{className:`canvas-no-drag flex items-center gap-2 border-b px-1 pb-2`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Sort`}),(0,Q.jsx)(le,{workspaceId:t.workspaceId,value:f,onChange:g})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,Q.jsx)(ue,{documents:i,isLoading:u,contextPath:t.path,treeName:t.treeName,workspaceId:t.workspaceId,totalCount:o,serverSort:f,viewMode:r,allowViewToggle:!0,currentPage:c,pageSize:n,onPageChange:l,backendSearchQueries:p,onBackendSearch:_?void 0:m,onRemoveBackendQuery:_?void 0:h})})]})}H({type:`documents-table`,name:`Documents`,icon:u,defaultSize:{w:8,h:6,minW:4,minH:3},mobileHeight:.9,defaultConfig:{pageSize:50,viewMode:`table`},component:ft});function pt({config:e,setConfig:t,canvas:n}){let[r,i]=(0,Z.useState)(()=>new Date),a=e.format!==`24`;return(0,Z.useEffect)(()=>{let e=setInterval(()=>i(new Date),1e3);return()=>clearInterval(e)},[]),(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-1`,children:[(0,Q.jsx)(`div`,{className:`text-3xl font-semibold tabular-nums`,children:r.toLocaleTimeString(void 0,{hour12:a,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}),(0,Q.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:r.toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`})}),!n.readOnly&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>t({...e,format:a?`24`:`12`}),className:`mt-1 px-2 py-0.5 text-[10px] border rounded-md text-muted-foreground hover:bg-accent`,children:a?`12h`:`24h`})]})}H({type:`clock`,name:`Clock`,icon:T,defaultSize:{w:3,h:2,minW:2,minH:2},defaultConfig:{format:`24`},component:pt});function mt({doc:e,workspaceId:t}){let n=R(e),{activationProps:r}=ae(e,t);return(0,Q.jsxs)(`li`,{...r,title:`Open details`,className:`canvas-no-drag cursor-pointer py-1.5 min-w-0 rounded px-1 transition-colors hover:bg-accent/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,Q.jsx)(`div`,{className:`truncate font-medium`,children:n.title}),n.preview&&(0,Q.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:n.preview})]})}function ht({config:e,canvas:t}){let n=typeof e.limit==`number`?e.limit:10,[r,i]=(0,Z.useState)([]),[a,o]=(0,Z.useState)(!0),[s,c]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{let e=!1;return(async()=>{o(!0);try{let r=await t.fetchDocuments({limit:n});if(e)return;i(r.payload||[]),c(null)}catch(t){if(e)return;c(t instanceof Error?t.message:`Failed to load documents`),i([])}finally{e||o(!1)}})(),()=>{e=!0}},[t,n]),a?(0,Q.jsx)(`div`,{className:`text-xs text-muted-foreground p-1`,children:`Loading…`}):s?(0,Q.jsx)(`div`,{className:`text-xs text-destructive p-1`,children:s}):r.length===0?(0,Q.jsx)(`div`,{className:`text-xs text-muted-foreground p-1`,children:`No documents on this canvas.`}):(0,Q.jsx)(`ul`,{className:`divide-y text-sm`,children:r.map(e=>(0,Q.jsx)(mt,{doc:e,workspaceId:t.workspaceId},e.id))})}H({type:`recent-documents`,name:`Recent documents`,icon:O,defaultSize:{w:4,h:4,minW:3,minH:2},mobileHeight:.5,defaultConfig:{limit:10},component:ht});function gt({config:e,setConfig:t,canvas:n}){let r=typeof e.text==`string`?e.text:``;return(0,Q.jsx)(`textarea`,{value:r,readOnly:n.readOnly,onChange:n=>t({...e,text:n.target.value}),placeholder:n.readOnly?``:`Jot something down…`,className:`canvas-no-drag w-full h-full resize-none bg-transparent text-sm leading-6 outline-none`})}H({type:`note`,name:`Note`,icon:A,defaultSize:{w:3,h:3,minW:2,minH:2},defaultConfig:{text:``},component:gt});var _t=`data/schema/file`,vt=`data/schema/drawing`;function yt(e){return(e.schema===_t||e.schema===vt)&&String(e.metadata?.contentType||``).startsWith(`image/`)}function bt(e){return e.schema===_t&&String(e.metadata?.contentType||``).startsWith(`video/`)}var xt=`data/mime/image`;function St(e,t,n=!1){let[r,i]=(0,Z.useState)([]),[a,o]=(0,Z.useState)(0),[s,c]=(0,Z.useState)(1),[l,u]=(0,Z.useState)(!0),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(``),{queries:h,runSearch:g,removeQuery:_,clearSearch:v}=dt(e,()=>c(1)),y=e.canvasSort??ce;(0,Z.useEffect)(()=>{let r=!1,a=async()=>{u(!0),f(null);try{let a=await e.fetchDocuments({limit:t,page:s,queries:h.length?h:void 0,sortBy:y.sortBy,order:y.order,...n?{anyOf:[xt,`data/mime/video`]}:{allOf:[xt]}});if(r)return;i((a.payload||[]).filter(e=>yt(e)||n&&bt(e))),o(a.totalCount||a.count||0)}catch(e){if(r)return;i([]),o(0),f(e instanceof Error?e.message:`Failed to load images`)}finally{r||u(!1)}};return a(),window.addEventListener(`workspace:documents:refresh`,a),()=>{r=!0,window.removeEventListener(`workspace:documents:refresh`,a)}},[e,t,s,h,y.sortBy,y.order,n]);let b=(0,Z.useCallback)(()=>{let e=p.trim();m(``),g(e)},[p,g]),x=(0,Z.useCallback)(()=>{m(``),v()},[v]),S=(0,Z.useCallback)(e=>{_(e)},[_]),C=(0,Z.useCallback)(t=>{e.setCanvasSort?.(t),c(1)},[e]);return{images:r,isLoading:l,error:d,page:s,setPage:c,totalCount:a,totalPages:(0,Z.useMemo)(()=>Math.max(1,Math.ceil(a/t)),[a,t]),input:p,setInput:m,submit:b,clearSearch:x,removeQuery:S,activeQueries:h,sort:y,setSort:C}}var Ct=n(c(),1);function wt({workspaceId:e,doc:t,onClick:n,className:r=`aspect-square`,comments:i=`off`}){let{blobUrl:a,error:o,loading:s}=me(e,t.id,512,{blobFallback:!bt(t),version:t.checksumArray?.[0]??null}),c=re(t)||`image-${t.id}`,l=z(t),u=l!==``&&i!==`off`;return(0,Q.jsxs)(`button`,{type:`button`,onClick:n,title:l||c,className:`canvas-no-drag group relative block w-full overflow-hidden rounded-(--card-radius) border bg-muted/40 shadow-elevation-1 transition-shadow hover:shadow-elevation-2 hover:ring-2 hover:ring-primary/30 ${r}`,children:[s&&(0,Q.jsx)(`div`,{className:`absolute inset-0 animate-pulse bg-muted/60`}),o&&!bt(t)&&(0,Q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center p-1 text-[10px] text-destructive`,children:o}),a&&(0,Q.jsx)(`img`,{src:a,alt:c,loading:`lazy`,className:`h-full w-full object-cover transition-transform duration-normal group-hover:scale-105`}),bt(t)&&(0,Q.jsxs)(`span`,{className:`absolute inset-0 flex items-center justify-center`,children:[(0,Q.jsx)(m,{className:`h-10 w-10 rounded-full bg-black/60 p-2 text-white`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Play video`})]}),u&&(0,Q.jsx)(`span`,{className:`pointer-events-none absolute inset-x-0 bottom-0 px-1.5 pb-1 pt-4 text-left text-[11px] leading-snug text-white bg-gradient-to-t from-black/75 via-black/45 to-transparent ${i===`reveal`?`caption-reveal`:``}`,children:(0,Q.jsx)(`span`,{className:`line-clamp-2`,children:l})}),l!==``&&i!==`caption`&&(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-1 top-1 rounded-full bg-black/55 p-1 text-white transition-opacity ${i===`reveal`?`hidden [@media(hover:hover)]:block [@media(hover:hover)]:group-hover:opacity-0`:``}`,title:`Has a comment`,children:(0,Q.jsx)(k,{className:`h-3 w-3`})})]})}function Tt({workspaceId:e,docs:t,index:n,onClose:r,onNavigate:i}){let a=t[n],{blobUrl:o,error:s,loading:c}=U(e,a.id,{version:a.checksumArray?.[0]??null,enabled:!bt(a)}),l=re(a)||`image-${a.id}`,u=z(a),[d,f]=(0,Z.useState)(!1);return he(r),(0,Z.useEffect)(()=>{let e=e=>{e.target?.closest(`video`)||(e.key===`ArrowLeft`&&n>0&&i(n-1),e.key===`ArrowRight`&&n<t.length-1&&i(n+1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,t.length,i]),(0,Ct.createPortal)((0,Q.jsxs)(`div`,{"data-scheme":`dark`,className:`fixed inset-0 z-fullscreen flex flex-col bg-scrim p-0 sm:p-4`,onClick:r,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:r,className:`canvas-no-drag absolute right-2 top-2 z-10 rounded-full bg-foreground/10 p-2 text-foreground hover:bg-foreground/20 touch-target sm:right-4 sm:top-4`,title:`Close`,children:(0,Q.jsx)(_,{className:`h-5 w-5`})}),n>0&&!d&&(0,Q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),i(n-1)},className:`canvas-no-drag absolute left-3 top-1/2 -translate-y-1/2 rounded-full bg-foreground/10 p-2 text-foreground hover:bg-foreground/20`,title:`Previous`,children:(0,Q.jsx)(p,{className:`h-6 w-6 touch-target`})}),n<t.length-1&&!d&&(0,Q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),i(n+1)},className:`canvas-no-drag absolute right-3 top-1/2 -translate-y-1/2 rounded-full bg-foreground/10 p-2 text-foreground hover:bg-foreground/20`,title:`Next`,children:(0,Q.jsx)(x,{className:`h-6 w-6 touch-target`})}),(0,Q.jsxs)(`figure`,{className:`flex min-h-0 flex-1 flex-col`,onClick:e=>e.stopPropagation(),children:[(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:[c&&(0,Q.jsx)(`div`,{className:`text-sm text-foreground/70`,children:`Loading…`}),s&&(0,Q.jsx)(`div`,{className:`text-sm text-destructive`,children:s}),bt(a)&&(0,Q.jsx)(Dt,{workspaceId:e,doc:a},a.id),o&&(0,Q.jsx)(se,{src:o,alt:l,onZoomChange:f,className:`max-h-full max-w-full rounded object-contain`})]}),(0,Q.jsxs)(`figcaption`,{className:`shrink-0 px-4 py-2 text-center text-xs text-foreground/70`,children:[u&&(0,Q.jsx)(`span`,{className:`mx-auto mb-1 block max-w-2xl whitespace-pre-wrap text-sm text-foreground`,children:u}),l,` · `,n+1,`/`,t.length,!d&&!bt(a)&&(0,Q.jsx)(`span`,{className:`ml-2 opacity-70`,children:`· double-tap to zoom`})]})]})]}),document.body)}function Et({workspaceId:e,state:t,comments:n,onToggleComments:r}){let{input:i,setInput:a,submit:o,clearSearch:s,removeQuery:c,activeQueries:l,sort:u,setSort:d,page:f,setPage:m,totalPages:h,totalCount:g,isLoading:v}=t,y=l.length>0;return(0,Q.jsxs)(`div`,{className:`canvas-no-drag flex flex-wrap items-center gap-x-2 gap-y-1.5 border-b px-1 pb-1.5`,children:[(0,Q.jsxs)(`div`,{className:`relative min-w-[9rem] flex-1 basis-full sm:basis-auto`,children:[(0,Q.jsx)(j,{className:`pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,Q.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&o()},placeholder:y?`Refine: add another query (Enter)…`:`Search media (Enter)…`,className:`h-7 w-full rounded-md border bg-background pl-7 pr-7 text-xs`}),y&&(0,Q.jsx)(`button`,{type:`button`,onClick:s,title:`Clear search`,className:`absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-muted-foreground hover:text-foreground touch-target`,children:(0,Q.jsx)(_,{className:`h-3.5 w-3.5`})})]}),y&&(0,Q.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-1 order-last`,children:l.map((e,t)=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[t>0&&(0,Q.jsx)(`span`,{className:`text-[10px] uppercase text-muted-foreground`,children:`then`}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border bg-accent/50 px-2 py-0.5 text-xs`,children:[(0,Q.jsx)(`span`,{className:`max-w-[10rem] truncate`,children:e}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>c(t),title:`Remove "${e}"`,className:`rounded p-0.5 text-muted-foreground hover:text-foreground touch-target`,children:(0,Q.jsx)(_,{className:`h-3 w-3`})})]})]},`${e}-${t}`))}),(0,Q.jsxs)(`div`,{className:`flex flex-1 basis-full items-center justify-between gap-2 sm:basis-auto sm:justify-end`,children:[r&&(0,Q.jsx)(`button`,{type:`button`,onClick:r,"aria-pressed":n!==`off`,title:n===`off`?`Show comments on tiles`:`Hide comments on tiles`,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border touch-target ${n===`off`?`text-muted-foreground hover:bg-accent`:`border-primary/30 bg-primary/15 text-primary hover:bg-primary/25`}`,children:(0,Q.jsx)(k,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(le,{workspaceId:e,value:u,onChange:d}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[v&&(0,Q.jsx)(L,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`shrink-0 whitespace-nowrap tabular-nums text-xs text-muted-foreground`,children:[g.toLocaleString(),(0,Q.jsxs)(`span`,{className:`hidden sm:inline`,children:[` item`,g===1?``:`s`]})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>m(Math.max(1,f-1)),disabled:f<=1,title:`Previous page`,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-muted-foreground hover:bg-accent disabled:opacity-40 touch-target`,children:(0,Q.jsx)(p,{className:`h-3.5 w-3.5`})}),(0,Q.jsxs)(`span`,{className:`shrink-0 tabular-nums text-xs text-muted-foreground`,children:[f,`/`,h]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>m(Math.min(h,f+1)),disabled:f>=h,title:`Next page`,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-muted-foreground hover:bg-accent disabled:opacity-40 touch-target`,children:(0,Q.jsx)(x,{className:`h-3.5 w-3.5`})})]})]})]})}function Dt({workspaceId:e,doc:t}){let{src:n,loading:r,error:i}=pe(e,t.id);return(0,Q.jsxs)(Q.Fragment,{children:[r&&(0,Q.jsx)(`span`,{children:`Loading video…`}),i&&(0,Q.jsx)(`span`,{role:`alert`,children:i}),n&&(0,Q.jsx)(`video`,{src:n,controls:!0,playsInline:!0,preload:`metadata`,className:`max-h-full max-w-full`})]})}function Ot({config:e,setConfig:t,canvas:n}){let r=St(n,typeof e.pageSize==`number`?e.pageSize:60,!0),i=fe()==null&&(n.interactive??!n.readOnly),[a,o]=(0,Z.useState)(new Set),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(null),m=e=>o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[h,g]=(0,Z.useState)(null),{images:_,isLoading:v,error:y,activeQueries:b}=r,x=e.showComments===!1?`off`:`caption`;return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!n.readOnly&&(0,Q.jsx)(Et,{workspaceId:n.workspaceId,state:r,comments:x,onToggleComments:()=>t({...e,showComments:x===`off`})}),i&&(0,Q.jsxs)(`div`,{className:`canvas-no-drag flex items-center gap-2 py-1`,children:[(0,Q.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{c(!s),o(new Set)},children:s?`Done selecting`:`Select`}),s&&(0,Q.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>o(new Set(_.map(e=>e.id))),children:`Select page`}),a.size>0&&(0,Q.jsxs)(P,{size:`sm`,variant:`outline`,onClick:()=>u([...a]),children:[`Bulk Edit… (`,a.size,`)`]})]}),(0,Q.jsx)(`div`,{className:`flex-1 overflow-y-auto p-1`,children:y?(0,Q.jsx)(`div`,{className:`p-4 text-sm text-destructive`,children:y}):_.length===0?(0,Q.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:v?`Loading media…`:b.length?`No images or videos match your search.`:`No images or videos in this canvas' context.`}):(0,Q.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(min(120px,100%),1fr))] gap-2 sm:grid-cols-[repeat(auto-fill,minmax(min(200px,100%),1fr))] sm:gap-3`,children:_.map((e,t)=>(0,Q.jsxs)(`div`,{className:`relative`,onContextMenu:t=>{i&&(t.preventDefault(),t.stopPropagation(),p({x:t.clientX,y:t.clientY,ids:a.has(e.id)?[...a]:[e.id]}))},children:[(0,Q.jsx)(wt,{workspaceId:n.workspaceId,doc:e,onClick:()=>s?m(e.id):g(t),comments:x}),s&&(0,Q.jsx)(`input`,{type:`checkbox`,"aria-label":`Select document ${e.id}`,checked:a.has(e.id),onChange:()=>m(e.id),className:`canvas-no-drag absolute left-2 top-2 h-4 w-4 accent-primary`})]},e.id))})}),f&&(0,Q.jsx)(ee,{anchor:f,onClose:()=>p(null),label:`${f.ids.length} image${f.ids.length===1?``:`s`}`,items:[{id:`bulk-edit`,label:`Bulk edit… (${f.ids.length})`,icon:d,run:()=>u(f.ids)}]}),l&&(0,Q.jsx)(de,{workspaceId:n.workspaceId,documentIds:l,onClose:()=>u(null)}),h!=null&&_[h]&&(0,Q.jsx)(Tt,{workspaceId:n.workspaceId,docs:_,index:h,onClose:()=>g(null),onNavigate:g})]})}H({type:`gallery`,name:`Gallery`,icon:w,defaultSize:{w:8,h:6,minW:3,minH:3},mobileHeight:.9,defaultConfig:{pageSize:60,showComments:!0},component:Ot});var kt=150;function $(e){let t=typeof e==`string`?parseFloat(e):e;return Number.isFinite(t)&&t>0?t:0}function At(e){let t=e.metadata??{},n=e.data??{};return{w:$(t.width)||$(t.imageWidth)||$(n.width)||$(n.imageWidth),h:$(t.height)||$(t.imageHeight)||$(n.height)||$(n.imageHeight)}}function jt(e,t){if(t%9==0)return{cols:2,rows:2};let{w:n,h:r}=At(e),i=n&&r?n/r:0;return i>=1.5?{cols:2,rows:1}:i>0&&i<=.66?{cols:1,rows:2}:!i&&t%7==3?{cols:2,rows:1}:{cols:1,rows:1}}function Mt({config:e,setConfig:t,canvas:n}){let r=St(n,typeof e.pageSize==`number`?e.pageSize:60),[i,a]=(0,Z.useState)(null),{images:o,isLoading:s,error:c,activeQueries:l}=r,u=e.showComments===!1?`off`:`reveal`;return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!n.readOnly&&(0,Q.jsx)(Et,{workspaceId:n.workspaceId,state:r,comments:u,onToggleComments:()=>t({...e,showComments:u===`off`})}),(0,Q.jsx)(`div`,{className:`flex-1 overflow-y-auto p-1`,children:c?(0,Q.jsx)(`div`,{className:`p-4 text-sm text-destructive`,children:c}):o.length===0?(0,Q.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:s?`Loading images…`:l.length?`No images match your search.`:`No images in this canvas' context.`}):(0,Q.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(${kt}px, 1fr))`,gridAutoRows:`${kt}px`,gridAutoFlow:`dense`},children:o.map((e,t)=>{let{cols:r,rows:i}=jt(e,t);return(0,Q.jsx)(`div`,{style:{gridColumn:`span ${r}`,gridRow:`span ${i}`},children:(0,Q.jsx)(wt,{workspaceId:n.workspaceId,doc:e,onClick:()=>a(t),className:`h-full`,comments:u})},e.id)})})}),i!=null&&o[i]&&(0,Q.jsx)(Tt,{workspaceId:n.workspaceId,docs:o,index:i,onClose:()=>a(null),onNavigate:a})]})}H({type:`mosaic`,name:`Mosaic`,icon:C,defaultSize:{w:8,h:7,minW:4,minH:4},mobileHeight:.9,defaultConfig:{pageSize:60,showComments:!0},component:Mt});function Nt({canvas:e}){return fe()!=null||!I()?(0,Q.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:`Workspace pins are available in the signed-in workspace view.`}):(0,Q.jsx)(Pt,{workspaceId:e.workspaceId},e.workspaceId)}function Pt({workspaceId:e}){let[t,n]=(0,Z.useState)([]),[r,i]=(0,Z.useState)(`Workspace`),[a,o]=(0,Z.useState)(!0),[c,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(0);return(0,Z.useEffect)(()=>{let t=!1,r=0,a=async()=>{let a=++r;o(!0);try{let[o,s]=await Promise.all([V(e),ne(e)]);if(t||a!==r)return;i(o.label||o.name||`Workspace`),n(s),u(null)}catch{if(t||a!==r)return;n([]),u(`Workspace pins are unavailable. Check your workspace access or try again.`)}finally{!t&&a===r&&o(!1)}},s=()=>{document.visibilityState===`visible`&&a()};a(),window.addEventListener(`focus`,s),document.addEventListener(`visibilitychange`,s);let c=F.on(`pins.changed`,s),l=window.setInterval(s,6e4);return()=>{t=!0,window.removeEventListener(`focus`,s),document.removeEventListener(`visibilitychange`,s),c?.(),window.clearInterval(l)}},[e,d]),(0,Q.jsxs)(`div`,{className:`canvas-no-drag flex h-full min-h-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b px-2 pb-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-sm font-medium`,children:r}),(0,Q.jsx)(`button`,{type:`button`,title:`Refresh pins`,"aria-label":`Refresh pins`,disabled:a,onClick:()=>f(e=>e+1),className:`rounded p-1.5 text-muted-foreground hover:bg-accent disabled:opacity-40`,children:(0,Q.jsx)(E,{className:`h-3.5 w-3.5 ${a?`animate-spin`:``}`})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-1`,children:c?(0,Q.jsx)(`p`,{role:`alert`,className:`p-2 text-sm text-muted-foreground`,children:c}):t.length?(0,Q.jsx)(`ul`,{className:`space-y-2`,children:t.map(t=>{let n=t.resolvable===!1,r=ge(t.color),i=(0,Q.jsxs)(Q.Fragment,{children:[n?(0,Q.jsx)(h,{className:`h-5 w-5 shrink-0 text-warning`}):(0,Q.jsx)(s,{icon:t.icon||(t.type===`canvas`?`ph:squares-four-fill`:`ph:folder-fill`),width:22,height:22,color:r,className:`shrink-0`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium`,children:t.label||t.name||t.path}),(0,Q.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[t.tree,`:`,t.path]}),t.description&&(0,Q.jsx)(`p`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:t.description}),n&&(0,Q.jsx)(`p`,{className:`text-xs text-warning`,children:`Folder no longer exists`})]})]}),a=`flex items-center gap-3 rounded-(--card-radius) border border-l-4 bg-card p-3`,o={borderLeftColor:r||`transparent`};return(0,Q.jsx)(`li`,{children:n?(0,Q.jsx)(`div`,{className:`${a} opacity-60`,style:o,children:i}):(0,Q.jsx)(l,{to:_e(e,t.path,t.tree),title:`Open ${t.tree}:${t.path}`,className:`${a} transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,style:o,children:i})},t.id)})}):(0,Q.jsx)(`p`,{className:`p-2 text-sm text-muted-foreground`,children:a?`Loading pins…`:`No workspace pins yet. Pin a folder from the workspace tree menu.`})})]})}H({type:`workspace-pins`,name:`Workspace pins`,icon:v,defaultSize:{w:4,h:6,minW:3,minH:2},mobileHeight:.6,defaultConfig:{},component:Nt});function Ft({title:e,icon:t,onRemove:n,fill:r,onToggleFill:i,readOnly:a=!1,stacked:o=!1,children:s}){let[c,l]=(0,Z.useState)(!1),u=c?document.getElementById(`content-area`):null,d=(0,Q.jsxs)(`div`,{className:c?u?`absolute inset-0 z-40 flex flex-col bg-background`:`fixed inset-0 z-50 flex flex-col bg-background`:`flex flex-col h-full rounded-(--card-radius) border bg-background overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`canvas-drag-handle flex items-center gap-2 px-2 py-1 border-b bg-muted/30 select-none ${o?``:`cursor-move`}`,children:[t&&(0,Q.jsx)(t,{className:`w-3.5 h-3.5 text-muted-foreground shrink-0`}),(0,Q.jsx)(`span`,{className:`text-xs font-medium truncate flex-1`,children:e}),!a&&i&&!c&&!o&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(It,{on:r?.w===!0,onClick:()=>i(`w`),label:`Fill width`,icon:D}),(0,Q.jsx)(It,{on:r?.h===!0,onClick:()=>i(`h`),label:`Fill height`,icon:g})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`canvas-no-drag shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent touch-target`,title:c?`Restore`:`Full screen`,children:c?(0,Q.jsx)(b,{className:`w-3.5 h-3.5`}):(0,Q.jsx)(S,{className:`w-3.5 h-3.5`})}),!a&&n&&(0,Q.jsx)(`button`,{type:`button`,onClick:n,className:`canvas-no-drag shrink-0 p-0.5 rounded text-muted-foreground hover:text-destructive hover:bg-destructive/10 touch-target`,title:`Remove widget`,children:(0,Q.jsx)(_,{className:`w-3.5 h-3.5`})})]}),(0,Q.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto p-2`,children:s})]});return c?(0,Ct.createPortal)(d,u??document.body):d}function It({on:e,onClick:t,label:n,icon:r}){return(0,Q.jsx)(`button`,{type:`button`,onClick:t,"aria-pressed":e,title:e?`${n} (on)`:n,className:`canvas-no-drag shrink-0 p-0.5 rounded touch-target ${e?`bg-primary/15 text-primary hover:bg-primary/25`:`text-muted-foreground hover:text-foreground hover:bg-accent`}`,children:(0,Q.jsx)(r,{className:`w-3.5 h-3.5`})})}var Lt=(0,ut.WidthProvider)(ut.default),Rt=12,zt=80,Bt=40,Vt=[12,12],Ht=[8,8],Ut={w:!1,h:!1};function Wt(e){return Math.max(1,...e.map(e=>e.y+e.h).filter(Number.isFinite))}function Gt(e){return Math.max(0,...e.map(e=>e.y+e.h).filter(Number.isFinite))}function Kt(e){let t=(e,t)=>typeof e==`number`&&Number.isFinite(e)?e:t;return{...e,x:t(e.x,0),y:t(e.y,0),w:t(e.w,1),h:t(e.h,1)}}function qt(e,t,n=0){let r=n>0?n:Wt(e);return e.map(e=>{let n=t[e.i]??Ut;return!n.w&&!n.h?e:{...e,x:n.w?0:e.x,w:n.w?Rt:e.w,y:n.h?0:e.y,h:n.h?Math.max(e.minH??1,r):e.h}})}var Jt=4;function Yt(e,t,n=Vt[1]){return Math.max(1,Math.ceil((e-n-Jt)/(t+n)))}var Xt=45,Zt=640;function Qt(e,t,n=0,r){let i=[...qt(e,t,n)].sort((e,t)=>e.y-t.y||e.x-t.x),a=0;return i.map(e=>{let t=r?.(e.i)??0,n=Math.max(e.h,e.minH??1,t),i={...e,x:0,w:Rt,y:a,h:n};return a+=n,i})}var $t=e=>e&&e.trim()?[e]:[];function en(e){let t=e?.ui??{},n=Array.isArray(t.layout)?t.layout.map(Kt):[],r={};for(let e of n)r[e.i]={w:e.fillW??e.w>=Rt,h:e.fillH===!0};return{layout:n,fills:r,widgets:t.widgets&&typeof t.widgets==`object`?t.widgets:{}}}function tn({workspaceId:e,treeName:t,path:n,layerId:r,querySpec:i,metadata:a,isLocked:o=!1,readOnly:s=!1,interactive:c=!0,fetchDocuments:l,onSaved:u}){let d=!s,p=(0,Z.useMemo)(()=>en(a),[a]),[m,h]=(0,Z.useState)(p.layout),[g,_]=(0,Z.useState)(p.widgets),[v,b]=(0,Z.useState)(p.fills),x=(0,Z.useRef)(p.fills),[S,C]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(null),[A,j]=(0,Z.useState)(!1),[M,P]=(0,Z.useState)(0),F=(0,Z.useRef)(0),I=(0,Z.useCallback)(e=>{x.current=e,b(e)},[]),[L,ee]=(0,Z.useState)(()=>W(i?.sort)),R=(0,Z.useRef)(!1),[z,ne]=(0,Z.useState)(()=>$t(i?.query)),V=(0,Z.useRef)(!1),re=(0,Z.useRef)(null),H=(0,Z.useRef)(p),ae=(0,Z.useCallback)(e=>{let t=oe(g[e]?.type??``)?.mobileHeight;if(!(!t||M<=0))return Math.max(1,Math.round(M*t))},[g,M]),se=(0,Z.useMemo)(()=>A?Qt(m,v,M,ae):qt(m,v,M),[m,v,A,M,ae]),ce=A?Bt:zt,le=(0,Z.useMemo)(()=>JSON.stringify(a?.ui??null),[a?.ui]);(0,Z.useEffect)(()=>{let e=en(a);h(e.layout),_(e.widgets),I(e.fills),H.current=e,ee(W(i?.sort)),R.current=!1,ne($t(i?.query)),V.current=!1,T(!1)},[n,r]),(0,Z.useEffect)(()=>{if(!s)return;let e=en(a);h(e.layout),_(e.widgets),I(e.fills),H.current=e},[s,le,a,I]),(0,Z.useEffect)(()=>{let e=re.current;if(!e)return;let t=()=>{let t=e.clientHeight,n=e.clientWidth>0&&e.clientWidth<Zt;j(n),F.current=t,e.style.setProperty(`--canvas-host-h`,`${t}px`);let r=n?Ht:Vt;e.style.setProperty(`--canvas-grid-gutter`,`${r[1]}px`),t>0&&P(Yt(t,n?Bt:zt,r[1]))};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[m]);let ue=(0,Z.useCallback)(e=>{ee(e),R.current=!0,T(!0)},[]),de=(0,Z.useCallback)(e=>{ne(e),V.current=!0,T(!0)},[]),fe=(0,Z.useMemo)(()=>({workspaceId:e,treeName:t,path:n,layerId:r,querySpec:i,readOnly:!d,interactive:c,canvasSort:L,setCanvasSort:d?ue:void 0,canvasQueries:z,setCanvasQueries:d?de:void 0,fetchDocuments:l??(async r=>{let i;if(r?.anyOf?.length&&(i=((await B(e,n,t,{anyOf:r.anyOf,limit:0,applyCanvasSpec:!1})).payload||[]).map(e=>e.id),!i.length))return{payload:[],count:0,totalCount:0};let a=await B(e,n,t,{...r,anyOf:void 0,ids:i});return{payload:a.payload||[],count:a.count??void 0,totalCount:a.totalCount??void 0}})}),[e,t,n,r,i,d,c,l,L,ue,z,de]),U=(0,Z.useCallback)((e,t,n)=>{H.current={layout:e,widgets:t,fills:n??x.current},T(!0)},[]),pe=(0,Z.useCallback)(async()=>{if(!(!d||E)){D(!0),k(null);try{let r={widgets:H.current.widgets,layout:H.current.layout.map(e=>({...e,fillW:x.current[e.i]?.w===!0,fillH:x.current[e.i]?.h===!0}))};H.current={...r,fills:x.current};let o=R.current||V.current?{...i||{},...R.current?{sort:L.sortBy?L:null}:{},...V.current?{query:z.join(` `).trim()||null}:{}}:void 0;await te(e,n,t,{...a||{},ui:r},o),R.current=!1,V.current=!1,T(!1),window.dispatchEvent(new CustomEvent(`workspace:tree:refresh`,{detail:{workspaceName:e,treeName:t}})),u?.()}catch(e){let t=e instanceof Error?e.message:`Save failed`;k(t),console.error(`Failed to save canvas layout:`,e)}finally{D(!1)}}},[d,E,e,n,t,a,u,i,L,z]),me=(0,Z.useCallback)(e=>{!d||A||h(t=>{let n=e.map(e=>{let n=t.find(t=>t.i===e.i),r=x.current[e.i];return n?{...e,x:r?.w?n.x:e.x,w:r?.w?n.w:e.w,y:r?.h?n.y:e.y,h:r?.h?n.h:e.h}:e});return U(n,g),n})},[d,A,U,g]),he=(0,Z.useCallback)((e,t,n)=>{if(!d)return;let r=x.current[n.i]??Ut,i=Vt[1]+(n.y+n.h)*(zt+Vt[1]),a={w:n.x+n.w>=Rt,h:F.current>0&&i>=F.current-Xt};if(a.w||=r.w&&n.w===t.w,a.h||=r.h&&n.h===t.h,a.w===r.w&&a.h===r.h)return;let o={...x.current,[n.i]:a};I(o),U(H.current.layout,g,o)},[d,I,U,g]),ge=(0,Z.useCallback)((e,t)=>{if(!d)return;let n=x.current[e]??Ut,r={...x.current,[e]:{...n,[t]:!n[t]}};I(r),U(m,g,r)},[d,I,U,m,g]),_e=(0,Z.useCallback)(e=>{let t=oe(e);if(!t)return;let n=crypto.randomUUID(),{w:r,h:i,minW:a,minH:o,maxW:s,maxH:c}=t.defaultSize,l=[...m,{i:n,x:0,y:Gt(se),w:r,h:i,minW:a,minH:o,maxW:s,maxH:c}],u={...g,[n]:{type:e,config:{...t.defaultConfig||{}}}},d={...x.current,[n]:{w:r>=Rt,h:!1}};h(l),_(u),I(d),C(!1),U(l,u,d)},[m,se,g,I,U]),G=(0,Z.useCallback)(e=>{let t=m.filter(t=>t.i!==e),n={...g};delete n[e];let r={...x.current};delete r[e],h(t),_(n),I(r),U(t,n,r)},[m,g,I,U]),K=(0,Z.useCallback)((e,t)=>{_(n=>{let r={...n,[e]:{...n[e],config:t}};return U(m,r),r})},[m,U]),q=Object.keys(g);return(0,Q.jsxs)(`div`,{className:`flex flex-col h-full min-h-0`,children:[d&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 border-b shrink-0 sm:px-3`,children:[(0,Q.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>C(e=>!e),className:`flex items-center gap-1.5 whitespace-nowrap px-2.5 py-1 text-xs border rounded-md hover:bg-accent`,children:[(0,Q.jsx)(y,{className:`w-3.5 h-3.5`}),`Add`,(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:` widget`})]}),S&&(0,Q.jsx)(`div`,{className:`absolute left-0 top-full mt-1 z-20 w-48 rounded-md border bg-popover shadow-elevation-2 py-1`,children:ie().map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>_e(e.type),className:`flex items-center gap-2 w-full px-3 py-1.5 text-xs text-left hover:bg-accent`,children:[(0,Q.jsx)(e.icon,{className:`w-3.5 h-3.5 text-muted-foreground`}),e.name]},e.type))})]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:pe,disabled:!w||E,className:N(`flex shrink-0 items-center gap-1.5 whitespace-nowrap px-2.5 py-1 text-xs rounded-md transition-colors disabled:opacity-50`,w?`bg-primary text-primary-foreground hover:bg-primary`:`border hover:bg-accent`),children:[(0,Q.jsx)(f,{className:`w-3.5 h-3.5`}),E?`Saving…`:`Save`]}),(0,Q.jsxs)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,children:[q.length,` widget`,q.length===1?``:`s`,w?` · unsaved`:``,O?` · ${O}`:``]})]}),(0,Q.jsx)(`div`,{ref:re,className:`canvas-grid-host flex-1 min-h-0 bg-muted/10 overflow-y-auto overflow-x-hidden`,children:q.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 text-sm text-muted-foreground`,children:[(0,Q.jsx)(`p`,{children:`No widgets yet.`}),d&&(0,Q.jsx)(`p`,{className:`text-xs`,children:`Use “Add widget” to place one on the canvas.`})]}):(0,Q.jsx)(Lt,{className:`layout`,layout:se,cols:Rt,rowHeight:ce,margin:A?Ht:Vt,isDraggable:d&&!A,isResizable:d&&!A,resizeHandles:[`s`,`e`,`se`],draggableHandle:`.canvas-drag-handle`,draggableCancel:`.canvas-no-drag`,onLayoutChange:me,onResizeStop:he,compactType:`vertical`,children:q.map(e=>{let t=g[e],n=oe(t.type),r=v[e]??Ut,i=[r.w?`w`:``,r.h?`h`:``].filter(Boolean).join(` `);return(0,Q.jsx)(`div`,{"data-fill":i||void 0,children:n?(0,Q.jsx)(Ft,{title:n.name,icon:n.icon,readOnly:!d,stacked:A,onRemove:()=>G(e),fill:v[e]??Ut,onToggleFill:d?t=>ge(e,t):void 0,children:(0,Q.jsx)(n.component,{config:t.config??{...n.defaultConfig||{}},setConfig:t=>K(e,t),canvas:fe})}):(0,Q.jsx)(Ft,{title:`Unknown: ${t.type}`,readOnly:!d,stacked:A,onRemove:()=>G(e),children:(0,Q.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`This widget type is not available.`})})},e)})})})]})}var nn=(0,Z.createContext)(null);function rn(){let e=(0,Z.useContext)(nn);if(!e)throw Error(`useCanvasPins must be used within a CanvasPinsProvider`);return e}export{rn as n,tn as r,nn as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{t as r}from"./button-SeUZ_Pvi.js";import{t as i}from"./input-BOtCd4HP.js";import{B as a}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{t as r}from"./button-SeUZ_Pvi.js";import{t as i}from"./input-BOtCd4HP.js";import{B as a}from"./index-I9cslsRe.js";function o(e,t,n){return[e.trim()?`## Role\n${e.trim()}`:``,t.trim()?`## Identity\n${t.trim()}`:``,n.trim()?`## Instructions\n${n.trim()}`:``].filter(Boolean).join(`
|
|
2
2
|
|
|
3
3
|
`)}var s=e(n(),1),c=t();function l({value:e,onChange:t,models:n,loading:a,error:o,refresh:l,disabled:u,id:d}){let f=(0,s.useId)(),p=n.find(t=>t.id===e);return(0,c.jsxs)(`div`,{className:`space-y-2`,children:[(0,c.jsxs)(`div`,{className:`flex gap-2`,children:[(0,c.jsx)(i,{id:d,"aria-label":`Model`,list:f,value:e,onChange:e=>t(e.target.value,n.find(t=>t.id===e.target.value)),placeholder:`Choose or enter a model ID`,disabled:u}),(0,c.jsx)(r,{type:`button`,variant:`outline`,disabled:u||a,onClick:l,children:`Refresh models`})]}),(0,c.jsx)(`datalist`,{id:f,children:n.map(e=>(0,c.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,c.jsx)(`p`,{className:`text-xs text-muted-foreground`,role:`status`,children:a?`Loading models…`:o||(n.length?`${n.length} models available`:`Enter provider credentials to load available models. You can also enter a model ID.`)}),p&&(0,c.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Context: `,p.contextWindow?.toLocaleString()??`not reported`,` · Max output: `,p.maxTokens?.toLocaleString()??`not reported`,` tokens`,p.limitsSource===`runtime`?` (runtime catalogue)`:p.limitsSource===`provider`?` (provider)`:``]})]})}function u(e,t,n,r){let[i,o]=(0,s.useState)(0),c=JSON.stringify([e,t,n,r,i]),[l,u]=(0,s.useState)({key:``,models:[],loading:!1,error:``}),d=!!t.trim()||!!r||[`ollama`,`lm-studio`,`vllm`,`custom`].includes(e);return(0,s.useEffect)(()=>{if(!d)return;let i=new AbortController,o=setTimeout(()=>{u({key:c,models:[],loading:!0,error:``}),a({provider:e,apiKey:t.trim()||void 0,baseUrl:n.trim()||void 0,agentIdentifier:r},i.signal).then(e=>{i.signal.aborted||u({key:c,models:e,loading:!1,error:``})}).catch(e=>{i.signal.aborted||u({key:c,models:[],loading:!1,error:e instanceof Error?e.message:`Unable to load models`})})},700);return()=>{clearTimeout(o),i.abort()}},[c,d,e,t,n,r]),{...l.key===c?l:{models:[],loading:d,error:``},refresh:()=>o(e=>e+1)}}export{l as n,o as r,u 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{g as r}from"./chunk-62JRHF6Z-vspAGgtK.js";import{h as i}from"./LinkToCard-CKVi4Nrg.js";import{n as a}from"./document-list-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{g as r}from"./chunk-62JRHF6Z-vspAGgtK.js";import{h as i}from"./LinkToCard-CKVi4Nrg.js";import{n as a}from"./document-list-CUmMhD6M.js";import{t as o}from"./url-params-n7kU_WZ-.js";var s=e(n(),1),c=t();function l({workspaceId:e,treeName:t=`context`,path:n=`/`,children:l,className:u,headerOnly:d=!1,readOnly:f=!1}){let[p,m]=(0,s.useState)(null),h=r(),g=a({workspaceId:e,treeName:t}),_=[...!f&&t!==`backends`?[{label:`New folder…`,run:async()=>{let e=prompt(`New folder name:`)?.trim();if(e){if(/[\\/]/.test(e)||e===`.`||e===`..`)throw Error(`Enter a folder name without slashes`);await g.onInsertPath(`${n===`/`?``:n}/${e}`)}}},{label:`New canvas…`,run:async()=>{h(`${o(e,n,t)}?createCanvas=1`)}}]:[],...!f&&g.onImportDocuments?[{label:`Import documents…`,run:()=>g.onImportDocuments(n)}]:[],{label:`Export documents…`,run:()=>g.onExportDocuments(n)}];return(0,c.jsxs)(`div`,{className:u,onContextMenu:e=>{e.defaultPrevented||d&&!e.target.closest(`.canvas-navigation`)||(e.preventDefault(),m({x:e.clientX,y:e.clientY}))},children:[l,p&&(0,c.jsx)(i,{...p,onClose:()=>m(null),className:`min-w-44 rounded-md border bg-popover p-1 shadow-elevation-3`,children:_.map(e=>(0,c.jsx)(`button`,{type:`button`,className:`block w-full rounded-sm px-3 py-1.5 text-left text-xs hover:bg-accent`,onClick:()=>{m(null),e.run().catch(e=>alert(e instanceof Error?e.message:String(e)))},children:e.label},e.label))})]})}export{l as t};
|