@augmentd-labs/canvas-web 2.26.33 → 2.26.34
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-CG6XE01c.js → CalendarApplet-CVcB6nT5.js} +1 -1
- package/dist/assets/{FiltersApplet-Bh-Ti230.js → FiltersApplet-B3UrkkQk.js} +1 -1
- package/dist/assets/{HomeFab-DjDhl9Kx.js → HomeFab-D83jf0To.js} +1 -1
- package/dist/assets/{LensApplet-CTRYyg4u.js → LensApplet-BvgmmKLC.js} +1 -1
- package/dist/assets/{NotesApplet-DShxjAo_.js → NotesApplet-BJwWkYe_.js} +1 -1
- package/dist/assets/{ObjectPropertiesCard-CFZ_LqzX.js → ObjectPropertiesCard-B9gkyowI.js} +3 -3
- package/dist/assets/{ObjectPropertiesCard-JArcZXXv.css → ObjectPropertiesCard-Docu7O5V.css} +1 -1
- package/dist/assets/{TodosWidget-CX4lgk-9.js → TodosWidget-DdN3vJfS.js} +1 -1
- package/dist/assets/{_agentId_-D9i9ZJWV.js → _agentId_-Ctolhe8r.js} +0 -0
- package/dist/assets/{_contextId_-C6KmQgsY.js → _contextId_-Cj78rDep.js} +1 -1
- package/dist/assets/{_workspaceName_-DOmVjYen.js → _workspaceName_-CU9Y7Zvt.js} +1 -1
- package/dist/assets/{about-BzJi5UDC.js → about-OY_bpfUf.js} +1 -1
- package/dist/assets/{add-DJ45m1Gq.js → add-D7ysLgO3.js} +1 -1
- package/dist/assets/{agents-mnY8dZIT.js → agents-DgJX7Rbh.js} +1 -1
- package/dist/assets/{appearance-CRoFdA6E.js → appearance-D3YShC7g.js} +1 -1
- package/dist/assets/{apps-4xGIx_KA.js → apps-CJ5g43ts.js} +1 -1
- package/dist/assets/{content-app-view-3BCpYf7m.js → content-app-view-CH0wMWqu.js} +1 -1
- package/dist/assets/{document-Ds_P5v-f.js → document-CdrNjy0Z.js} +1 -1
- package/dist/assets/{document-list-CwStaizB.js → document-list-BX13fcRu.js} +1 -1
- package/dist/assets/{home-DB-ohpoi.js → home-BYUM64nU.js} +1 -1
- package/dist/assets/index-CJapDuPp.js +16 -0
- package/dist/assets/{index-XDD8pFI_.css → index-lwdPSalm.css} +1 -1
- package/dist/assets/{key-bindings-BYwqkLkk.js → key-bindings-BhC3zpgE.js} +1 -1
- package/dist/assets/{registry-CtnhH0si.js → registry-C7aVPPMW.js} +2 -2
- package/dist/assets/{settings-Id06aU1g.js → settings-HUPOeACw.js} +1 -1
- package/dist/assets/{settings-BjieBx_W.js → settings-_xaqx07q.js} +1 -1
- package/dist/assets/{settings-BGCP2DRw.js → settings-e2lvFtNs.js} +1 -1
- package/dist/assets/{settings-DAwqsOhZ.js → settings-j7fHuCH-.js} +1 -1
- package/dist/assets/{share-target-BhCMpdxU.js → share-target-BNWYelcQ.js} +1 -1
- package/dist/assets/{shared-Dnd9GFGT.js → shared-td0TEahe.js} +1 -1
- package/dist/assets/{use-canvas-pins-D-zi5fqQ.js → use-canvas-pins-BfT9xMi5.js} +1 -1
- package/dist/assets/{useAgentModels-CTCpJy1M.js → useAgentModels-C9Qu2rhq.js} +1 -1
- package/dist/assets/{workspace-area-menu-DtsodEXC.js → workspace-area-menu-DEyR7-bZ.js} +1 -1
- package/dist/assets/{workspaces-BzAZpTMK.js → workspaces-BryjR7k9.js} +1 -1
- package/dist/index.html +9 -9
- package/dist/sw.js +1 -1
- package/package.json +2 -2
- package/dist/assets/index-BG5J93SO.js +0 -16
|
@@ -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-Bum-POPT.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{kt 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-Bum-POPT.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{kt as c}from"./index-CJapDuPp.js";import{n as l}from"./page-header-BoCaZiqu.js";import{t as u}from"./use-settings-back-DE0SPb7h.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,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-76Hw0NU_.js";import{n as M}from"./utils-BxVxyehK.js";import{t as N}from"./utils-2pl1SbIp.js";import{t as P}from"./button-Bum-POPT.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-VXpoeMDH.js";import{An as R,Dt as z,K as te,Mn as B,Q as V,kn as H,nn as ne}from"./workspace-46EFyEKZ.js";import{a as U,i as re,n as ie,r as ae}from"./TodosWidget-CX4lgk-9.js";import{y as oe}from"./ObjectPropertiesCard-CFZ_LqzX.js";import{a as se,l as ce,o as le,t as ue}from"./document-list-CwStaizB.js";import{i as de}from"./public-share-D2S8DEsv.js";import{o as W,s as fe}from"./text-documents-CFW8MWES.js";import{t as pe}from"./useDocumentThumbnail-Bs2Ju0eb.js";import{t as me}from"./useEscapeClose-DR_xKT_k.js";import"./layer-style-Byl5LNFR.js";import{i as he}from"./color-DFEH4BfK.js";import{c as G}from"./workspace-BydSRtST.js";import{t as ge}from"./url-params-n7kU_WZ-.js";var K=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})}))})),q=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)}})),J=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=re,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=R,e.setTopLeft=te,e.setTransform=z,e.sortLayoutItems=B,e.sortLayoutItemsByColRow=H,e.sortLayoutItemsByRowCol=V,e.synchronizeLayoutWithChildren=ne,e.validateLayout=U,e.withLayoutItem=p;var t=K(),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=q();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 R(e,t,n,r){let i=ee[e];return i?i(t,a(a({},t),n),r):n}function z(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 te(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`?H(e):t===`vertical`?V(e):e}function V(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 H(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 ne(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 U(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 re(e){let{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}e.noop=()=>{}})),Y=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)}})),_e=i(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),ve=i(((e,t)=>{var n=_e();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}})),X=i(((e,t)=>{t.exports=ve()()})),ye=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:()=>Y,default:()=>_e}),t.exports=p(m);var h=f(o()),g=f(X()),_=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 R(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 z(e,t){let n=B(e,t,`px`);return{[E(`transform`,O)]:n}}function te(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 V(e,t){return e.targetTouches&&y(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&y(e.changedTouches,e=>t===e.identifier)}function H(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function ne(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function U(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??ne();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-76Hw0NU_.js";import{n as M}from"./utils-BxVxyehK.js";import{t as N}from"./utils-2pl1SbIp.js";import{t as P}from"./button-Bum-POPT.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-VXpoeMDH.js";import{An as R,Dt as z,K as te,Mn as B,Q as V,kn as H,nn as ne}from"./workspace-46EFyEKZ.js";import{a as U,i as re,n as ie,r as ae}from"./TodosWidget-DdN3vJfS.js";import{y as oe}from"./ObjectPropertiesCard-B9gkyowI.js";import{a as se,l as ce,o as le,t as ue}from"./document-list-BX13fcRu.js";import{i as de}from"./public-share-D2S8DEsv.js";import{o as W,s as fe}from"./text-documents-CFW8MWES.js";import{t as pe}from"./useDocumentThumbnail-Bs2Ju0eb.js";import{t as me}from"./useEscapeClose-DR_xKT_k.js";import"./layer-style-Byl5LNFR.js";import{i as he}from"./color-DFEH4BfK.js";import{c as G}from"./workspace-BydSRtST.js";import{t as ge}from"./url-params-n7kU_WZ-.js";var K=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})}))})),q=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)}})),J=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=re,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=R,e.setTopLeft=te,e.setTransform=z,e.sortLayoutItems=B,e.sortLayoutItemsByColRow=H,e.sortLayoutItemsByRowCol=V,e.synchronizeLayoutWithChildren=ne,e.validateLayout=U,e.withLayoutItem=p;var t=K(),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=q();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 R(e,t,n,r){let i=ee[e];return i?i(t,a(a({},t),n),r):n}function z(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 te(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`?H(e):t===`vertical`?V(e):e}function V(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 H(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 ne(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 U(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 re(e){let{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}e.noop=()=>{}})),Y=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)}})),_e=i(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),ve=i(((e,t)=>{var n=_e();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}})),X=i(((e,t)=>{t.exports=ve()()})),ye=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:()=>Y,default:()=>_e}),t.exports=p(m);var h=f(o()),g=f(X()),_=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 R(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 z(e,t){let n=B(e,t,`px`);return{[E(`transform`,O)]:n}}function te(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 V(e,t){return e.targetTouches&&y(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&y(e.changedTouches,e=>t===e.identifier)}function H(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function ne(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function U(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??ne();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&&ae(e.body,`react-draggable-transparent-selection`)}function re(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{ie(e)}):ie(e)}function ie(e){if(e)try{e.body&&oe(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 ae(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function oe(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function se(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:pe(r);let i=me(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 ce(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function le(e){return e.props.axis===`both`||e.props.axis===`x`}function ue(e){return e.props.axis===`both`||e.props.axis===`y`}function de(e,t,n){let r=typeof t==`number`?V(e,t):null;if(typeof t==`number`&&!r)return null;let i=me(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return R(r||e,a,n.props.scale)}function W(e,t,n){let r=!x(e.lastX),i=me(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 fe(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 pe(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function me(e){let t=e.findDOMNode();if(!t)throw Error(`<DraggableCore>: Unmounted during event!`);return t}var he=f(o()),G=f(X()),ge=f(c()),K=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},q={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},J=q.mouse,Y=class extends he.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=H(e);this.touchIdentifier=r;let i=de(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=W(this,a,o);K(`DraggableCore: handleDragStart: %j`,s),K(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&U(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,N(n,J.move,this.handleDrag),N(n,J.stop,this.handleDragStop))},this.handleDrag=e=>{let t=de(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]=ce(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=W(this,n,r);if(K(`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=de(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]=ce(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=W(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&re(a.ownerDocument),K(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(K(`DraggableCore: Removing handlers`),P(a.ownerDocument,J.move,this.handleDrag),P(a.ownerDocument,J.stop,this.handleDragStop))},this.onMouseDown=e=>(J=q.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(J=q.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(J=q.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(J=q.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&N(e,q.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;P(t,q.mouse.move,this.handleDrag),P(t,q.touch.move,this.handleDrag),P(t,q.mouse.stop,this.handleDragStop),P(t,q.touch.stop,this.handleDragStop),P(e,q.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&re(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=ge.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(K(`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 he.cloneElement(he.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Y.displayName=`DraggableCore`,Y.propTypes={allowAnyClick:G.default.bool,allowMobileScroll:G.default.bool,children:G.default.node.isRequired,disabled:G.default.bool,enableUserSelectHack:G.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:G.default.arrayOf(G.default.number),handle:G.default.string,cancel:G.default.string,nodeRef:G.default.object,nonce:G.default.string,onStart:G.default.func,onDrag:G.default.func,onStop:G.default.func,onMouseDown:G.default.func,scale:G.default.number,className:C,style:C,transform:C},Y.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var _e=class extends h.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(K(`Draggable: onDragStart: %j`,t),this.props.onStart(e,fe(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;K(`Draggable: onDrag: %j`,t);let n=fe(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]=se(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,fe(this,t))===!1)return!1;K(`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)?(K(`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:le(this)&&p?this.state.x:m.x,y:ue(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=te(g,c):d=z(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(Y,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},h.cloneElement(_,{className:y,style:{..._.props.style,...d},transform:f}))}};_e.displayName=`Draggable`,_e.propTypes={...Y.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},_e.defaultProps={...Y.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:Y})})),be=i(((e,t)=>{var n=ye(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),xe=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)}})),Se=i((e=>{e.__esModule=!0,e.resizableProps=void 0;var t=n(X());be();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)}}})),Ce=i((e=>{e.__esModule=!0,e.default=void 0;var t=s(o()),n=be(),r=xe(),i=Se(),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}})),we=i((e=>{e.__esModule=!0,e.default=void 0;var t=c(o()),n=s(X()),r=s(Ce()),i=Se(),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})})),Te=i(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=Ce().default,t.exports.ResizableBox=we().default})),Ee=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resizeHandleType=e.resizeHandleAxesType=e.default=void 0;var t=r(X()),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&&J().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}})),De=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=f(o()),n=c(),r=f(X()),i=be(),a=Te(),s=J(),l=Y(),u=Ee(),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})})),Oe=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=u(o()),n=K(),r=l(M()),i=J(),a=Y(),s=l(De()),c=l(Ee());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})})),ke=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.findOrGenerateResponsiveLayout=i,e.getBreakpointFromWidth=n,e.getColsFromBreakpoint=r,e.sortBreakpoints=a;var t=J();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]})}})),Ae=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=u(o()),n=l(X()),r=K(),i=J(),a=ke(),s=l(Oe()),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})})),je=r({default:()=>ot});function Me(e,t){var n=!1,r=!1,i=0;function a(){n&&(n=!1,e()),r&&s()}function o(){Ge(a)}function s(){var e=Date.now();if(n){if(e-i<Ke)return;r=!0}else n=!0,r=!1,setTimeout(o,t);i=e}return s}function Ne(e){return parseFloat(e)||0}function Pe(e){return[...arguments].slice(1).reduce(function(t,n){var r=e[`border-`+n+`-width`];return t+Ne(r)},0)}function Fe(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]=Ne(o)}return n}function Ie(e){var t=e.getBBox();return Ve(0,0,t.width,t.height)}function Le(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return $e;var r=Qe(e).getComputedStyle(e),i=Fe(r),a=i.left+i.right,o=i.top+i.bottom,s=Ne(r.width),c=Ne(r.height);if(r.boxSizing===`border-box`&&(Math.round(s+a)!==t&&(s-=Pe(r,`left`,`right`)+a),Math.round(c+o)!==n&&(c-=Pe(r,`top`,`bottom`)+o)),!Re(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 Ve(i.left,i.top,s,c)}function Re(e){return e===Qe(e).document.documentElement}function ze(e){return Ue?et(e)?Ie(e):Le(e):$e}function Be(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=Object.create((typeof DOMRectReadOnly<`u`?DOMRectReadOnly:Object).prototype);return Ze(a,{x:t,y:n,width:r,height:i,top:n,right:t+r,bottom:i+n,left:t}),a}function Ve(e,t,n,r){return{x:e,y:t,width:n,height:r}}var He,Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot,st=t((()=>{He=(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}()})(),Ue=typeof window<`u`&&typeof document<`u`&&window.document===document,We=(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`)()})(),Ge=(function(){return typeof requestAnimationFrame==`function`?requestAnimationFrame.bind(We):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}})(),Ke=2,qe=20,Je=[`top`,`right`,`bottom`,`left`,`width`,`height`,`size`,`weight`],Ye=typeof MutationObserver<`u`,Xe=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Me(this.refresh.bind(this),qe)}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(){!Ue||this.connected_||(document.addEventListener(`transitionend`,this.onTransitionEnd_),window.addEventListener(`resize`,this.refresh),Ye?(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(){!Ue||!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;Je.some(function(e){return!!~n.indexOf(e)})&&this.refresh()},e.getInstance=function(){return this.instance_||=new e,this.instance_},e.instance_=null,e}(),Ze=(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}),Qe=(function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||We}),$e=Ve(0,0,0,0),et=(function(){return typeof SVGGraphicsElement<`u`?function(e){return e instanceof Qe(e).SVGGraphicsElement}:function(e){return e instanceof Qe(e).SVGElement&&typeof e.getBBox==`function`}})(),tt=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Ve(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e=ze(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=Be(t);Ze(this,{target:e,contentRect:n})}return e}(),rt=function(){function e(e,t,n){if(this.activeObservations_=[],this.observations_=new He,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 Qe(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 Qe(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 He,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,Xe.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 We.ResizeObserver===void 0?at:We.ResizeObserver})()})),ct=i((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=_;var n=l(o()),r=c(X()),i=c((st(),e(je))),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=Oe().default,t.exports.utils=J(),t.exports.calculateUtils=Y(),t.exports.Responsive=Ae().default,t.exports.Responsive.utils=ke(),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??le,{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)(se,{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})})]})}U({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`})]})}U({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}=ie(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))})}U({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`})}U({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??le;(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}=pe(e,t.id,512,{blobFallback:!bt(t),version:t.checksumArray?.[0]??null}),c=B(t)||`image-${t.id}`,l=H(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}=W(e,a.id,{version:a.checksumArray?.[0]??null,enabled:!bt(a)}),l=B(a)||`image-${a.id}`,u=H(a),[d,f]=(0,Z.useState)(!1);return me(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)(oe,{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)(se,{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}=fe(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=de()==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)(ce,{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})]})}U({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})]})}U({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 de()!=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),z(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=he(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:ge(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.`})})]})}U({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)(()=>G(i?.sort)),R=(0,Z.useRef)(!1),[z,B]=(0,Z.useState)(()=>$t(i?.query)),V=(0,Z.useRef)(!1),H=(0,Z.useRef)(null),U=(0,Z.useRef)(p),ie=(0,Z.useCallback)(e=>{let t=ae(g[e]?.type??``)?.mobileHeight;if(!(!t||M<=0))return Math.max(1,Math.round(M*t))},[g,M]),oe=(0,Z.useMemo)(()=>A?Qt(m,v,M,ie):qt(m,v,M),[m,v,A,M,ie]),se=A?Bt:zt,ce=(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),U.current=e,ee(G(i?.sort)),R.current=!1,B($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),U.current=e},[s,ce,a,I]),(0,Z.useEffect)(()=>{let e=H.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 le=(0,Z.useCallback)(e=>{ee(e),R.current=!0,T(!0)},[]),ue=(0,Z.useCallback)(e=>{B(e),V.current=!0,T(!0)},[]),de=(0,Z.useMemo)(()=>({workspaceId:e,treeName:t,path:n,layerId:r,querySpec:i,readOnly:!d,interactive:c,canvasSort:L,setCanvasSort:d?le:void 0,canvasQueries:z,setCanvasQueries:d?ue:void 0,fetchDocuments:l??(async r=>{let i;if(r?.anyOf?.length&&(i=((await te(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 te(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,le,z,ue]),W=(0,Z.useCallback)((e,t,n)=>{U.current={layout:e,widgets:t,fills:n??x.current},T(!0)},[]),fe=(0,Z.useCallback)(async()=>{if(!(!d||E)){D(!0),k(null);try{let r={widgets:U.current.widgets,layout:U.current.layout.map(e=>({...e,fillW:x.current[e.i]?.w===!0,fillH:x.current[e.i]?.h===!0}))};U.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 ne(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]),pe=(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 W(n,g),n})},[d,A,W,g]),me=(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),W(U.current.layout,g,o)},[d,I,W,g]),he=(0,Z.useCallback)((e,t)=>{if(!d)return;let n=x.current[e]??Ut,r={...x.current,[e]:{...n,[t]:!n[t]}};I(r),W(m,g,r)},[d,I,W,m,g]),ge=(0,Z.useCallback)(e=>{let t=ae(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(oe),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),W(l,u,d)},[m,oe,g,I,W]),K=(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),W(t,n,r)},[m,g,I,W]),q=(0,Z.useCallback)((e,t)=>{_(n=>{let r={...n,[e]:{...n[e],config:t}};return W(m,r),r})},[m,W]),J=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:re().map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ge(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:fe,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:[J.length,` widget`,J.length===1?``:`s`,w?` · unsaved`:``,O?` · ${O}`:``]})]}),(0,Q.jsx)(`div`,{ref:H,className:`canvas-grid-host flex-1 min-h-0 bg-muted/10 overflow-y-auto overflow-x-hidden`,children:J.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:oe,cols:Rt,rowHeight:se,margin:A?Ht:Vt,isDraggable:d&&!A,isResizable:d&&!A,resizeHandles:[`s`,`e`,`se`],draggableHandle:`.canvas-drag-handle`,draggableCancel:`.canvas-no-drag`,onLayoutChange:pe,onResizeStop:me,compactType:`vertical`,children:J.map(e=>{let t=g[e],n=ae(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:()=>K(e),fill:v[e]??Ut,onToggleFill:d?t=>he(e,t):void 0,children:(0,Q.jsx)(n.component,{config:t.config??{...n.defaultConfig||{}},setConfig:t=>q(e,t),canvas:de})}):(0,Q.jsx)(Ft,{title:`Unknown: ${t.type}`,readOnly:!d,stacked:A,onRemove:()=>K(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-Bum-POPT.js";import{t as i}from"./input-BOtCd4HP.js";import{z 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-Bum-POPT.js";import{t as i}from"./input-BOtCd4HP.js";import{z as a}from"./index-CJapDuPp.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-VXpoeMDH.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-VXpoeMDH.js";import{n as a}from"./document-list-BX13fcRu.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};
|
|
@@ -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{_t as r}from"./react-BHzhHVTZ.js";import{g as i}from"./chunk-62JRHF6Z-vspAGgtK.js";import{Bn as a,Hn as o,It as s,Pt as c,X as l,at as u,ht as d,qn as f,rt as p,yr as m}from"./ui-76Hw0NU_.js";import{t as h}from"./button-Bum-POPT.js";import{t as g}from"./input-BOtCd4HP.js";import{t as _}from"./api-CA6WiiYM.js";import{n as v}from"./use-toast-BlLDqSUO.js";import{Gt as y,Kt as b,Nt as x,_n as S,bt as C,i as w,on as T,pt as E,sn as D,t as O,v as ee}from"./workspace-46EFyEKZ.js";import{a as k,c as A,i as j,l as M,n as N,o as P,r as F,s as I,t as L}from"./alert-dialog-CShuAcnP.js";import{t as te}from"./use-mobile-Db-vWu9Y.js";import"./layer-style-Byl5LNFR.js";import{i as R,r as ne,t as z}from"./color-DFEH4BfK.js";import{t as B}from"./workspace-access-C9nZlBBZ.js";import{i as re}from"./use-menu-CaiLyPdw.js";import{r as ie}from"./last-path-BbXWC3b3.js";import{At as V,Ct as ae,Dt as oe,Et as H,Mt as se,Nt as ce,Ot as le,Pt as U,Tt as ue,jt as W,pt as G,wt as de}from"./index-BG5J93SO.js";import{n as fe}from"./page-header-BoCaZiqu.js";import{t as K}from"./form-panel-DZj3WZ3z.js";import{t as pe}from"./use-create-panel-DhSNIGtr.js";import{n as me,t as he}from"./useSocketSubscription-ifW-vnlb.js";import{a as ge,i as _e,n as ve,r as ye,t as be}from"./workspace-import-form-Bu1nlv8u.js";var q=e(n(),1),J=t();function xe({workspace:e,onStart:t,onStop:n,onEnter:r,onEdit:i,onSettings:a,onDestroy:o}){let[c,f]=(0,q.useState)(!1),g=e.status===`active`,_=e.type===`universe`||e.name===`universe`,v=e.status===`error`,y=e.status===`not_found`,b=e.isShared===!0||e.type===`shared`,x=e.ownerEmail||e.owner,S=typeof e.sharedVia==`object`&&e.sharedVia?e.sharedVia:null,C=S?.permissions||[],w=C.includes(`admin`)?`admin`:C.includes(`write`)?`read/write`:`read-only`,T=S?.type===`group`?`via group ${S.principal}`:S?.type===`user`?`shared with you`:``,E=e.origin===`remote`,D=e.status===`offline`,O=R(e.color),ee=O?``:`border-border`,te=O?{borderLeftColor:O,borderLeftWidth:`4px`}:{borderLeftWidth:`4px`};return(0,J.jsx)(J.Fragment,{children:(0,J.jsxs)(V,{className:`relative ${ee}`,style:te,children:[(0,J.jsx)(ce,{children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 basis-40`,children:[(0,J.jsx)(U,{className:`truncate`,children:e.label||e.name}),(0,J.jsx)(se,{children:b?`Shared from ${x}`:e.description||``})]}),(0,J.jsxs)(`div`,{className:`flex w-full shrink-0 flex-wrap items-center gap-2 sm:w-auto`,children:[g?(0,J.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>n(G(e)),title:`Stop Workspace`,disabled:v||y,children:(0,J.jsx)(p,{className:`h-4 w-4`})}):(0,J.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>t(G(e)),title:D?`Remote unreachable${e.statusMessage?`: ${e.statusMessage}`:``}`:`Start Workspace`,disabled:v||y||D,children:(0,J.jsx)(s,{className:`h-4 w-4`})}),g&&(0,J.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>r(G(e)),title:`Enter Workspace`,disabled:v||y,children:(0,J.jsx)(m,{className:`h-4 w-4`})}),a&&(0,J.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>a(e),title:B(e)?`Workspace settings`:`Workspace settings require admin access`,"aria-label":`Workspace settings`,disabled:y||!B(e),children:(0,J.jsx)(d,{className:`h-4 w-4`})}),i&&!_&&!b&&(0,J.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>i(e),title:`Edit Workspace`,disabled:v||y,children:(0,J.jsx)(u,{className:`h-4 w-4`})}),o&&!_&&!b&&(0,J.jsxs)(L,{open:c,onOpenChange:f,children:[(0,J.jsx)(M,{asChild:!0,children:(0,J.jsx)(h,{variant:`outline`,size:`icon`,title:E?`Remove remote workspace reference`:`Delete Workspace`,disabled:g&&!E,className:`text-destructive hover:text-destructive hover:bg-destructive/10`,children:(0,J.jsx)(l,{className:`h-4 w-4`})})}),(0,J.jsxs)(j,{children:[(0,J.jsxs)(I,{children:[(0,J.jsx)(A,{children:E?`Remove remote workspace`:`Delete Workspace`}),(0,J.jsx)(k,{children:E?(0,J.jsxs)(J.Fragment,{children:[`Remove the reference to "`,e.label||e.name,`" from this server?`,(0,J.jsx)(`br`,{}),(0,J.jsx)(`br`,{}),`The workspace itself stays untouched on `,e.remote?.url||e.host,`; only the stored share token and the local cache entry are dropped.`]}):(0,J.jsxs)(J.Fragment,{children:[`Are you sure you want to delete the workspace "`,e.label||e.name,`"?`,(0,J.jsx)(`br`,{}),(0,J.jsx)(`br`,{}),(0,J.jsx)(`strong`,{children:`This action cannot be undone.`}),` All data associated with this workspace, including documents, contexts, and configurations will be permanently removed.`]})})]}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{children:`Cancel`}),(0,J.jsx)(N,{onClick:()=>{o(e),f(!1)},className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:E?`Remove reference`:`Delete Workspace`})]})]})]})]})]})}),(0,J.jsx)(W,{children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`h-3 w-3 rounded-full ${(()=>{switch(e.status){case`active`:return`bg-success`;case`inactive`:case`available`:return`bg-muted-foreground`;case`error`:case`offline`:return`bg-destructive`;case`not_found`:return`bg-muted-foreground`;default:return`bg-accent`}})()}`}),(0,J.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:(()=>{switch(e.status){case`active`:return`Active`;case`inactive`:return`Inactive`;case`error`:return`Error`;case`not_found`:return`Not Found`;case`available`:return`Available`;case`removed`:return`Removed`;case`destroyed`:return`Destroyed`;case`offline`:return`Offline`;default:return e.status}})()}),_&&(0,J.jsx)(`span`,{className:`ml-2 rounded-full bg-primary/10 px-2 py-1 text-xs text-primary`,children:`Universe`}),E&&(0,J.jsxs)(`span`,{className:`ml-2 rounded-full bg-info/10 px-2 py-1 text-xs text-info`,title:e.remote?.url?`${e.remote.url} (${(e.remote.permissions||[]).join(`, `)||`no permissions`})`:void 0,children:[`Remote · `,e.host]}),b&&(0,J.jsxs)(`span`,{className:`ml-2 rounded-full bg-info/10 px-2 py-1 text-xs text-info`,title:[T,`${w} access`].filter(Boolean).join(` · `),children:[`Shared · `,w]})]})})]})})}var Y=[{value:`full`,icon:f,title:`Standard`,blurb:`Everything in one folder: your files in home/, alongside db/, data/, git/.`,tree:[`workspace.json`,`home/ ← your files`,`db/ data/ cache/ Git/`]},{value:`home`,icon:a,title:`Roaming home`,blurb:`The workspace folder IS your drive. Mount it over WebDAV and it looks like a plain home directory. Canvas keeps its files in a hidden .workspace/.`,tree:[`your files, at the top level`,`.workspace/ ← hidden, ignored`]}];function Se({value:e,onChange:t,disabled:n=!1,idPrefix:r=`workspace-layout`,compact:i=!1}){return(0,J.jsx)(`div`,{className:i?`space-y-1.5`:`grid gap-2 sm:grid-cols-2`,children:Y.map(i=>{let a=e===i.value,o=i.icon;return(0,J.jsxs)(`button`,{id:`${r}-${i.value}`,type:`button`,role:`radio`,"aria-checked":a,disabled:n,onClick:()=>t(i.value),className:`flex w-full gap-2 rounded-md border p-2.5 text-left transition-colors disabled:opacity-50 ${a?`border-primary bg-accent/40`:`hover:bg-accent/20`}`,children:[(0,J.jsx)(o,{className:`mt-0.5 h-4 w-4 shrink-0 ${a?`text-primary`:`text-muted-foreground`}`}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block text-xs font-medium`,children:i.title}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-[11px] leading-snug text-muted-foreground`,children:i.blurb}),(0,J.jsx)(`span`,{className:`mt-1 block font-mono text-[10px] leading-relaxed text-muted-foreground/80`,children:i.tree.map(e=>(0,J.jsx)(`span`,{className:`block truncate`,children:e},e))})]})]},i.value)})})}function Ce(){let[e,t]=(0,q.useState)(`full`),[n,r]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{let e=!0;return _.get(`/ping`,{skipAuth:!0}).then(r=>{let i=r?.defaults?.workspaceLayout;e&&!n&&(i===`home`||i===`full`)&&t(i)}).catch(()=>{}),()=>{e=!1}},[]),[e,e=>{r(!0),t(e)}]}function we(){let[e,t]=(0,q.useState)([]),[n,a]=(0,q.useState)(!0),[s,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(``),[m,_]=(0,q.useState)(z()),[y,C]=(0,q.useState)(null),[w,E]=(0,q.useState)(``),[O,k]=Ce(),[A,j]=(0,q.useState)(null),[M,N]=(0,q.useState)(null),[P,F]=(0,q.useState)(!1),I=le(),[L,B]=pe(),V=ge(),[se,ce]=(0,q.useState)(!1),[U,W]=(0,q.useState)(!1),[ve,Y]=(0,q.useState)(!1),[we,X]=(0,q.useState)(!1),[Z,Q]=(0,q.useState)(null),{showToast:$}=v(),Oe=i(),ke=te(),{openM2Drawer:Ae}=re(),je=me();he(je,`workspace`,{"workspace:status:changed":e=>t(t=>t.map(t=>t.id===e.workspaceId?{...t,status:e.status}:t)),"workspace:created":e=>t(t=>[...t,e.workspace]),"workspace:deleted":e=>t(t=>t.filter(t=>t.id!==e.workspaceId)),"workspaces.scanned":({report:e})=>{!e.discovered.length&&!e.adopted.length&&!e.updated.length&&!e.missing.length||x().then(e=>t(H(e))).catch(()=>{})}}),(0,q.useEffect)(()=>{let e=async()=>{try{a(!0);let e=await x();t(H(e)),l(null)}catch(e){console.error(`Workspace fetch error:`,e);let t=`Failed to fetch workspaces`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to fetch workspaces`}l(t),$({title:`Error`,description:t,variant:`destructive`})}finally{a(!1)}};e();let n=()=>{e()};return window.addEventListener(`workspaces:refresh`,n),()=>{window.removeEventListener(`workspaces:refresh`,n)}},[je,$]);let Me=async e=>{if(e.preventDefault(),u.trim()){F(!0);try{let e=await ee({name:u,description:f||void 0,color:m,icon:y,label:w||u,layout:O});if(t(t=>[...t,e]),window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),V.selected.size>0){try{await T(e.name);let{ok:t,failed:n}=await _e(e.name,Array.from(V.selected),V.tree);n&&$({title:`Folders`,description:`${t} folder(s) created, ${n} failed`,variant:`destructive`})}catch(e){console.error(`Default folder creation failed:`,e),$({title:`Folders`,description:`Workspace created, but default folders failed`,variant:`destructive`})}V.setSelected(new Set)}d(``),p(``),_(z()),C(null),E(``),$({title:`Success`,description:`Workspace '${e.label||e.name}' created.`}),B(!1)}catch(e){console.error(`Workspace creation error:`,e);let t=`Failed to create workspace`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to create workspace`}$({title:`Error`,description:t,variant:`destructive`})}finally{F(!1)}}},Ne=async e=>{if(e.preventDefault(),Z)try{let e={label:Z.label,description:Z.description,color:Z.color,icon:Z.icon??null};await S(Z.name,e),t(t=>t.map(t=>t.id===Z.id?{...t,...e}:t)),window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),$({title:`Success`,description:`Workspace '${Z.label}' details updated.`}),Q(null)}catch(e){let t=e instanceof Error?e.message:`Failed to update workspace`;$({title:`Error`,description:t,variant:`destructive`})}},Pe=e=>{Q(e)},Fe=async e=>{try{await b(e.name),t(t=>t.filter(t=>t.id!==e.id)),$({title:`Success`,description:`Workspace '${e.label||e.name}' has been destroyed.`})}catch(e){let t=e instanceof Error?e.message:`Failed to destroy workspace`;$({title:`Error`,description:t,variant:`destructive`})}},Ie=async e=>{try{let n=await T(e);t(e=>e.map(e=>e.id===n.id?{...e,...n}:e)),$({title:`Success`,description:`Workspace '${n.label||n.name}' started.`}),window.dispatchEvent(new CustomEvent(`workspaces:refresh`))}catch(e){console.error(`Workspace start error:`,e);let t=`Failed to start workspace`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to start workspace`}$({title:`Error`,description:t,variant:`destructive`})}},Le=async e=>{try{let n=await D(e);t(e=>e.map(e=>e.id===n.id?{...e,...n}:e)),$({title:`Success`,description:`Workspace '${n.label||n.name}' stopped.`}),window.dispatchEvent(new CustomEvent(`workspaces:refresh`))}catch(e){console.error(`Workspace stop error:`,e);let t=`Failed to stop workspace`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to stop workspace`}$({title:`Error`,description:t,variant:`destructive`})}},Re=e=>{Oe(ie(e))},{rowProps:ze,handleProps:Be,draggingIndex:Ve,insertLineClass:He}=oe((n,r)=>{let i=de(e,n,r);t(i),ue(i,(e,t)=>S(G(e),{order:t})).then(({failed:e})=>{window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),e&&$({title:`Partial reorder`,description:`${e} workspace(s) could not be reordered`,variant:`destructive`})})});return(0,J.jsxs)(`div`,{className:`space-y-6`,children:[(0,J.jsx)(fe,{title:`Workspaces`,description:`Divide your Universe into self-contained workspaces`,actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(h,{variant:`outline`,onClick:()=>ce(e=>!e),className:`max-sm:hidden`,children:`Open shared Workspace (local)…`}),(0,J.jsx)(h,{variant:`outline`,onClick:()=>Y(e=>!e),children:`Import workspace`}),(0,J.jsx)(h,{variant:`outline`,onClick:()=>W(e=>!e),className:`max-sm:hidden`,children:`Import remote…`}),(0,J.jsx)(h,{variant:`outline`,onClick:()=>X(e=>!e),className:`max-sm:hidden`,children:`Open remote…`}),!I.local&&!L&&(0,J.jsxs)(h,{onClick:()=>B(!0),className:`max-sm:h-9 max-sm:w-9 max-sm:p-0`,"aria-label":`Create workspace`,title:`Create workspace`,children:[(0,J.jsx)(c,{className:`h-4 w-4 sm:mr-2`}),(0,J.jsx)(`span`,{className:`max-sm:hidden`,children:`Create Workspace`})]})]})}),!I.local&&L&&(0,J.jsx)(K,{title:`Create New Workspace`,onClose:()=>B(!1),children:(0,J.jsxs)(`form`,{onSubmit:Me,className:`space-y-4`,children:[(0,J.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,J.jsx)(g,{value:u,onChange:e=>d(e.target.value),placeholder:`Workspace Name (e.g., 'my-project')`,disabled:P}),(0,J.jsx)(g,{value:w,onChange:e=>E(e.target.value),placeholder:`Workspace Label (display name, optional)`,disabled:P})]}),(0,J.jsx)(g,{value:f,onChange:e=>p(e.target.value),placeholder:`Description (optional)`,disabled:P}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`label`,{htmlFor:`workspace-color`,className:`text-sm font-medium`,children:`Icon & Color`}),(0,J.jsx)(`button`,{type:`button`,title:`Pick icon & color`,disabled:P,onClick:e=>j({x:Math.min(e.clientX,window.innerWidth-290),y:Math.min(e.clientY,window.innerHeight-360)}),className:`flex h-10 w-10 items-center justify-center rounded-md border hover:bg-accent`,children:(0,J.jsx)(r,{icon:y||`ph:stack-fill`,width:22,height:22,color:R(m)})}),(0,J.jsx)(g,{id:`workspace-color`,type:`color`,value:m,onChange:e=>_(e.target.value),className:`h-10 w-16 p-1`,disabled:P}),(0,J.jsx)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>_(z()),disabled:P,children:`Randomize`})]}),A&&(0,J.jsx)(ae,{x:A.x,y:A.y,current:{icon:y??void 0,color:m},onChange:e=>{`icon`in e&&C(e.icon??null),`color`in e&&e.color&&_(e.color)},onClose:()=>j(null)}),(0,J.jsxs)(`div`,{className:`rounded-lg border p-3`,children:[(0,J.jsx)(`p`,{className:`text-sm font-medium`,children:`Folder structure`}),(0,J.jsx)(`p`,{className:`mb-3 mt-0.5 text-xs text-muted-foreground`,children:`How the workspace directory is laid out on disk. Fixed once created.`}),(0,J.jsx)(Se,{value:O,onChange:k,disabled:P,idPrefix:`create-workspace-layout`})]}),(0,J.jsxs)(`div`,{className:`rounded-lg border p-3`,children:[(0,J.jsxs)(`p`,{className:`text-sm font-medium`,children:[`Default folders `,(0,J.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`})]}),(0,J.jsx)(`p`,{className:`mb-3 mt-0.5 text-xs text-muted-foreground`,children:`Ticked folders are created right after the workspace, with matching icons and colors.`}),(0,J.jsx)(ye,{selected:V.selected,onToggle:V.toggle,tree:V.tree,onTreeChange:V.setTree,disabled:P,idPrefix:`create-default-folders`})]}),(0,J.jsxs)(h,{type:`submit`,disabled:P||!u.trim(),children:[(0,J.jsx)(c,{className:`mr-2 h-4 w-4`}),`Create Workspace`]})]})}),se&&(0,J.jsx)(Ee,{}),we&&(0,J.jsx)(De,{onClose:()=>X(!1),onChanged:async()=>{try{t(H(await x()))}catch{}window.dispatchEvent(new CustomEvent(`workspaces:refresh`))}}),ve&&(0,J.jsx)(K,{title:`Import workspace`,onClose:()=>Y(!1),children:(0,J.jsx)(be,{onImported:()=>Y(!1)})}),U&&(0,J.jsx)(Te,{onImported:e=>{t(t=>t.some(t=>t.id===e.id)?t:[...t,e]),window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),W(!1)},onClose:()=>W(!1)}),(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Your Workspaces`}),n&&(0,J.jsx)(`p`,{className:`text-center text-muted-foreground`,children:`Loading workspaces...`}),s&&(0,J.jsx)(`div`,{className:`text-center text-destructive`,children:(0,J.jsx)(`p`,{children:s})}),!n&&!s&&e.length===0&&(0,J.jsx)(`p`,{className:`text-center text-muted-foreground`,children:`No workspaces found`}),e.length>0&&(0,J.jsx)(`div`,{className:`grid gap-4`,children:e.map((t,n)=>{let r={...t,createdAt:t.createdAt,updatedAt:t.updatedAt,color:t.color===null?void 0:t.color},i=R(t.color);return(0,J.jsxs)(`div`,{...ze(n),className:`flex items-stretch rounded-lg ${He(n,e.length)||``} ${Ve===n?`opacity-60`:``}`,children:[(0,J.jsx)(`button`,{type:`button`,...Be(n),title:`Drag to reorder`,"aria-label":`Drag to reorder`,className:`hidden w-5 shrink-0 cursor-grab items-center justify-center rounded-l-lg active:cursor-grabbing md:flex ${i?``:`bg-muted`}`,style:i?{backgroundColor:i}:void 0,children:(0,J.jsx)(o,{className:`h-4 w-4 ${ne(i)}`})}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsx)(xe,{workspace:r,onStart:Ie,onStop:Le,onEnter:Re,onEdit:Pe,onSettings:e=>{ke?Ae(`workspaces`,`settings`,G(e)):Oe(`/workspaces/${G(e)}/settings/general`)},onDestroy:Fe})})]},t.id)})})]}),Z&&(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsxs)(`h2`,{className:`text-xl font-semibold`,children:[`Edit Workspace: `,Z.label]}),(0,J.jsxs)(`form`,{onSubmit:Ne,className:`space-y-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{htmlFor:`edit-label`,className:`text-sm font-medium`,children:`Label`}),(0,J.jsx)(g,{id:`edit-label`,value:Z.label,onChange:e=>Q(t=>t?{...t,label:e.target.value}:null),placeholder:`Workspace Label`})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{htmlFor:`edit-description`,className:`text-sm font-medium`,children:`Description`}),(0,J.jsx)(g,{id:`edit-description`,value:Z.description||``,onChange:e=>Q(t=>t?{...t,description:e.target.value}:null),placeholder:`Description (optional)`})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{htmlFor:`edit-color`,className:`text-sm font-medium`,children:`Icon & Color`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,title:`Pick icon & color`,onClick:e=>N({x:Math.min(e.clientX,window.innerWidth-290),y:Math.min(e.clientY,window.innerHeight-360)}),className:`flex h-10 w-10 items-center justify-center rounded-md border hover:bg-accent`,children:(0,J.jsx)(r,{icon:Z.icon||`ph:stack-fill`,width:22,height:22,color:R(Z.color)})}),(0,J.jsx)(g,{id:`edit-workspace-color`,type:`color`,value:Z.color||`#FFFFFF`,onChange:e=>Q(t=>t?{...t,color:e.target.value}:null),className:`h-10 w-16 p-1`}),(0,J.jsx)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>Q(e=>e?{...e,color:z()}:null),children:`Randomize Color`})]})]}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(h,{type:`submit`,disabled:!Z.label?.trim(),children:`Save Changes`}),(0,J.jsx)(h,{type:`button`,variant:`outline`,onClick:()=>Q(null),children:`Cancel`})]})]}),M&&(0,J.jsx)(ae,{x:M.x,y:M.y,current:{icon:Z.icon??void 0,color:Z.color??void 0},onChange:e=>{Q(t=>{if(!t)return null;let n={...t};return`icon`in e&&(n.icon=e.icon??null),`color`in e&&e.color&&(n.color=e.color),n})},onClose:()=>N(null)})]})]})}function Te({onImported:e,onClose:t}){let{showToast:n}=v(),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(``),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(``);return(0,J.jsx)(K,{title:`Import (pull) a remote Workspace`,onClose:t,children:(0,J.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault();let i;try{i=new URL(r.trim()).origin}catch{n({title:`Error`,description:`Invalid server URL`,variant:`destructive`});return}if(!a.trim().startsWith(`canvas-`)){n({title:`Error`,description:`Invalid access token (expected canvas-...)`,variant:`destructive`});return}f(!0),m(`Starting…`);try{let t=await E(i,a.trim(),e=>{m(O[e.phase]||e.phase)},{name:s.trim(),label:l.trim()});n({title:`Success`,description:`Workspace '${t.label||t.name}' imported from ${i}.`}),e(t)}catch(e){let t=e,r=t?.message||t?.payload?.message||`Failed to import remote workspace`;n({title:`Error`,description:r,variant:`destructive`})}finally{f(!1),m(``)}},className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,J.jsx)(g,{placeholder:`Server URL (e.g., https://my.canvas-server.tld)`,value:r,onChange:e=>i(e.target.value),disabled:d}),(0,J.jsx)(g,{placeholder:`Workspace share token (canvas-...)`,value:a,onChange:e=>o(e.target.value),disabled:d}),(0,J.jsx)(h,{type:`submit`,disabled:d||!r.trim()||!a.trim()||!s.trim()||!l.trim(),children:d?`Importing…`:`Import Workspace`})]}),(0,J.jsx)(ve,{name:s,label:l,setName:c,setLabel:u,disabled:d}),d&&p&&(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:p}),(0,J.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Pulls a full `,(0,J.jsx)(`strong`,{children:`copy`}),` of the workspace from the remote canvas-server into this one, where it then lives independently. The remote workspace is stopped while it is packed, and large workspaces can take several minutes — progress is shown above.`]})]})})}function Ee(){let{showToast:e}=v(),[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(!1),s=e=>{try{return new URL(e)}catch{return null}};return(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Open shared Workspace (local)`}),(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,J.jsx)(g,{placeholder:`Shared URL (e.g., https://host/rest/v2/pub/workspaces/ID)`,value:t,onChange:e=>n(e.target.value)}),(0,J.jsx)(g,{placeholder:`Access token (canvas-...)`,value:r,onChange:e=>i(e.target.value)}),(0,J.jsx)(h,{onClick:async()=>{if(!s(t.trim())){e({title:`Error`,description:`Invalid URL`,variant:`destructive`});return}if(!r.trim().startsWith(`canvas-`)){e({title:`Error`,description:`Invalid access token`,variant:`destructive`});return}o(!0);try{sessionStorage.setItem(`sharedToken:last`,r.trim());let e=new URLSearchParams({url:t.trim()}).toString();window.location.href=`/shared?${e}`}catch(t){e({title:`Error`,description:t instanceof Error?t.message:`Failed to open shared resource`,variant:`destructive`})}finally{o(!1)}},disabled:a||!t.trim()||!r.trim(),children:`Open`})]}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`We use your provided URL and token to fetch via the remote's public API.`})]})}function De({onClose:e,onChanged:t}){let{showToast:n}=v(),r=i(),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)([]),p=(0,q.useCallback)(async()=>{try{f(await C())}catch{f([])}},[]);(0,q.useEffect)(()=>{p()},[p]);let m=async e=>{e.preventDefault();let r;try{r=new URL(a.trim()).origin}catch{n({title:`Error`,description:`Invalid server URL`,variant:`destructive`});return}u(!0);try{let e=await w(r,s.trim());n({title:`Remote workspace added`,description:`'${e.label}' is available as ${e.address}.`}),o(``),c(``),await p(),t?.()}catch(e){let t=e;n({title:`Error`,description:t?.message||t?.payload?.message||`Failed to add remote workspace`,variant:`destructive`})}finally{u(!1)}},_=async e=>{try{await y(e.id),await p(),t?.()}catch(e){n({title:`Error`,description:e instanceof Error?e.message:`Failed to remove remote workspace`,variant:`destructive`})}};return(0,J.jsxs)(K,{title:`Open a remote Workspace`,onClose:e,children:[(0,J.jsxs)(`form`,{onSubmit:m,className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,J.jsx)(g,{placeholder:`Server URL (e.g., https://my.canvas-server.tld)`,value:a,onChange:e=>o(e.target.value),disabled:l}),(0,J.jsx)(g,{placeholder:`Workspace share token (canvas-...)`,value:s,onChange:e=>c(e.target.value),disabled:l}),(0,J.jsx)(h,{type:`submit`,disabled:l||!a.trim()||!s.trim(),children:l?`Checking…`:`Add Remote`})]}),(0,J.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Keeps the workspace on its own server and registers it here as`,` `,(0,J.jsx)(`code`,{className:`font-mono text-xs`,children:`name@host`}),` — nothing is copied. Every call you make to it is forwarded to the remote with the share token (its permissions apply); document content and thumbnails are cached locally so they stay readable when the remote is offline. Use “Import remote…” if you want an independent local copy instead.`]})]}),d.length>0&&(0,J.jsx)(`ul`,{className:`mt-4 space-y-2 border-t pt-3`,children:d.map(e=>(0,J.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-md border p-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`truncate text-sm font-medium`,children:[e.label,(0,J.jsx)(`span`,{className:`ml-2 rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground`,children:`remote`})]}),(0,J.jsxs)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-muted-foreground`,children:[e.address,` · `,e.remote.url]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,J.jsx)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(`/workspaces/${e.address}`),children:`Open`}),(0,J.jsx)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>_(e),className:`text-destructive hover:text-destructive`,children:`Remove`})]})]},e.id))})]})}export{we as default};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{_t as r}from"./react-BHzhHVTZ.js";import{g as i}from"./chunk-62JRHF6Z-vspAGgtK.js";import{Bn as a,Hn as o,It as s,Pt as c,X as l,at as u,ht as d,qn as f,rt as p,yr as m}from"./ui-76Hw0NU_.js";import{t as h}from"./button-Bum-POPT.js";import{t as g}from"./input-BOtCd4HP.js";import{t as _}from"./api-CA6WiiYM.js";import{n as v}from"./use-toast-BlLDqSUO.js";import{Gt as y,Kt as b,Nt as x,_n as S,bt as C,i as w,on as T,pt as E,sn as D,t as O,v as ee}from"./workspace-46EFyEKZ.js";import{a as k,c as A,i as j,l as M,n as N,o as P,r as F,s as I,t as L}from"./alert-dialog-CShuAcnP.js";import{t as te}from"./use-mobile-Db-vWu9Y.js";import"./layer-style-Byl5LNFR.js";import{i as R,r as ne,t as z}from"./color-DFEH4BfK.js";import{t as B}from"./workspace-access-C9nZlBBZ.js";import{i as re}from"./use-menu-CaiLyPdw.js";import{r as ie}from"./last-path-BbXWC3b3.js";import{At as V,Ct as ae,Dt as oe,Et as H,Mt as se,Nt as ce,Ot as le,Pt as U,Tt as ue,jt as W,pt as G,wt as de}from"./index-CJapDuPp.js";import{n as fe}from"./page-header-BoCaZiqu.js";import{t as K}from"./form-panel-DZj3WZ3z.js";import{t as pe}from"./use-create-panel-DhSNIGtr.js";import{n as me,t as he}from"./useSocketSubscription-ifW-vnlb.js";import{a as ge,i as _e,n as ve,r as ye,t as be}from"./workspace-import-form-Bu1nlv8u.js";var q=e(n(),1),J=t();function xe({workspace:e,onStart:t,onStop:n,onEnter:r,onEdit:i,onSettings:a,onDestroy:o}){let[c,f]=(0,q.useState)(!1),g=e.status===`active`,_=e.type===`universe`||e.name===`universe`,v=e.status===`error`,y=e.status===`not_found`,b=e.isShared===!0||e.type===`shared`,x=e.ownerEmail||e.owner,S=typeof e.sharedVia==`object`&&e.sharedVia?e.sharedVia:null,C=S?.permissions||[],w=C.includes(`admin`)?`admin`:C.includes(`write`)?`read/write`:`read-only`,T=S?.type===`group`?`via group ${S.principal}`:S?.type===`user`?`shared with you`:``,E=e.origin===`remote`,D=e.status===`offline`,O=R(e.color),ee=O?``:`border-border`,te=O?{borderLeftColor:O,borderLeftWidth:`4px`}:{borderLeftWidth:`4px`};return(0,J.jsx)(J.Fragment,{children:(0,J.jsxs)(V,{className:`relative ${ee}`,style:te,children:[(0,J.jsx)(ce,{children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 basis-40`,children:[(0,J.jsx)(U,{className:`truncate`,children:e.label||e.name}),(0,J.jsx)(se,{children:b?`Shared from ${x}`:e.description||``})]}),(0,J.jsxs)(`div`,{className:`flex w-full shrink-0 flex-wrap items-center gap-2 sm:w-auto`,children:[g?(0,J.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>n(G(e)),title:`Stop Workspace`,disabled:v||y,children:(0,J.jsx)(p,{className:`h-4 w-4`})}):(0,J.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>t(G(e)),title:D?`Remote unreachable${e.statusMessage?`: ${e.statusMessage}`:``}`:`Start Workspace`,disabled:v||y||D,children:(0,J.jsx)(s,{className:`h-4 w-4`})}),g&&(0,J.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>r(G(e)),title:`Enter Workspace`,disabled:v||y,children:(0,J.jsx)(m,{className:`h-4 w-4`})}),a&&(0,J.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>a(e),title:B(e)?`Workspace settings`:`Workspace settings require admin access`,"aria-label":`Workspace settings`,disabled:y||!B(e),children:(0,J.jsx)(d,{className:`h-4 w-4`})}),i&&!_&&!b&&(0,J.jsx)(h,{variant:`outline`,size:`icon`,onClick:()=>i(e),title:`Edit Workspace`,disabled:v||y,children:(0,J.jsx)(u,{className:`h-4 w-4`})}),o&&!_&&!b&&(0,J.jsxs)(L,{open:c,onOpenChange:f,children:[(0,J.jsx)(M,{asChild:!0,children:(0,J.jsx)(h,{variant:`outline`,size:`icon`,title:E?`Remove remote workspace reference`:`Delete Workspace`,disabled:g&&!E,className:`text-destructive hover:text-destructive hover:bg-destructive/10`,children:(0,J.jsx)(l,{className:`h-4 w-4`})})}),(0,J.jsxs)(j,{children:[(0,J.jsxs)(I,{children:[(0,J.jsx)(A,{children:E?`Remove remote workspace`:`Delete Workspace`}),(0,J.jsx)(k,{children:E?(0,J.jsxs)(J.Fragment,{children:[`Remove the reference to "`,e.label||e.name,`" from this server?`,(0,J.jsx)(`br`,{}),(0,J.jsx)(`br`,{}),`The workspace itself stays untouched on `,e.remote?.url||e.host,`; only the stored share token and the local cache entry are dropped.`]}):(0,J.jsxs)(J.Fragment,{children:[`Are you sure you want to delete the workspace "`,e.label||e.name,`"?`,(0,J.jsx)(`br`,{}),(0,J.jsx)(`br`,{}),(0,J.jsx)(`strong`,{children:`This action cannot be undone.`}),` All data associated with this workspace, including documents, contexts, and configurations will be permanently removed.`]})})]}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{children:`Cancel`}),(0,J.jsx)(N,{onClick:()=>{o(e),f(!1)},className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:E?`Remove reference`:`Delete Workspace`})]})]})]})]})]})}),(0,J.jsx)(W,{children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`h-3 w-3 rounded-full ${(()=>{switch(e.status){case`active`:return`bg-success`;case`inactive`:case`available`:return`bg-muted-foreground`;case`error`:case`offline`:return`bg-destructive`;case`not_found`:return`bg-muted-foreground`;default:return`bg-accent`}})()}`}),(0,J.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:(()=>{switch(e.status){case`active`:return`Active`;case`inactive`:return`Inactive`;case`error`:return`Error`;case`not_found`:return`Not Found`;case`available`:return`Available`;case`removed`:return`Removed`;case`destroyed`:return`Destroyed`;case`offline`:return`Offline`;default:return e.status}})()}),_&&(0,J.jsx)(`span`,{className:`ml-2 rounded-full bg-primary/10 px-2 py-1 text-xs text-primary`,children:`Universe`}),E&&(0,J.jsxs)(`span`,{className:`ml-2 rounded-full bg-info/10 px-2 py-1 text-xs text-info`,title:e.remote?.url?`${e.remote.url} (${(e.remote.permissions||[]).join(`, `)||`no permissions`})`:void 0,children:[`Remote · `,e.host]}),b&&(0,J.jsxs)(`span`,{className:`ml-2 rounded-full bg-info/10 px-2 py-1 text-xs text-info`,title:[T,`${w} access`].filter(Boolean).join(` · `),children:[`Shared · `,w]})]})})]})})}var Y=[{value:`full`,icon:f,title:`Standard`,blurb:`Everything in one folder: your files in home/, alongside db/, data/, git/.`,tree:[`workspace.json`,`home/ ← your files`,`db/ data/ cache/ Git/`]},{value:`home`,icon:a,title:`Roaming home`,blurb:`The workspace folder IS your drive. Mount it over WebDAV and it looks like a plain home directory. Canvas keeps its files in a hidden .workspace/.`,tree:[`your files, at the top level`,`.workspace/ ← hidden, ignored`]}];function Se({value:e,onChange:t,disabled:n=!1,idPrefix:r=`workspace-layout`,compact:i=!1}){return(0,J.jsx)(`div`,{className:i?`space-y-1.5`:`grid gap-2 sm:grid-cols-2`,children:Y.map(i=>{let a=e===i.value,o=i.icon;return(0,J.jsxs)(`button`,{id:`${r}-${i.value}`,type:`button`,role:`radio`,"aria-checked":a,disabled:n,onClick:()=>t(i.value),className:`flex w-full gap-2 rounded-md border p-2.5 text-left transition-colors disabled:opacity-50 ${a?`border-primary bg-accent/40`:`hover:bg-accent/20`}`,children:[(0,J.jsx)(o,{className:`mt-0.5 h-4 w-4 shrink-0 ${a?`text-primary`:`text-muted-foreground`}`}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block text-xs font-medium`,children:i.title}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-[11px] leading-snug text-muted-foreground`,children:i.blurb}),(0,J.jsx)(`span`,{className:`mt-1 block font-mono text-[10px] leading-relaxed text-muted-foreground/80`,children:i.tree.map(e=>(0,J.jsx)(`span`,{className:`block truncate`,children:e},e))})]})]},i.value)})})}function Ce(){let[e,t]=(0,q.useState)(`full`),[n,r]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{let e=!0;return _.get(`/ping`,{skipAuth:!0}).then(r=>{let i=r?.defaults?.workspaceLayout;e&&!n&&(i===`home`||i===`full`)&&t(i)}).catch(()=>{}),()=>{e=!1}},[]),[e,e=>{r(!0),t(e)}]}function we(){let[e,t]=(0,q.useState)([]),[n,a]=(0,q.useState)(!0),[s,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(``),[m,_]=(0,q.useState)(z()),[y,C]=(0,q.useState)(null),[w,E]=(0,q.useState)(``),[O,k]=Ce(),[A,j]=(0,q.useState)(null),[M,N]=(0,q.useState)(null),[P,F]=(0,q.useState)(!1),I=le(),[L,B]=pe(),V=ge(),[se,ce]=(0,q.useState)(!1),[U,W]=(0,q.useState)(!1),[ve,Y]=(0,q.useState)(!1),[we,X]=(0,q.useState)(!1),[Z,Q]=(0,q.useState)(null),{showToast:$}=v(),Oe=i(),ke=te(),{openM2Drawer:Ae}=re(),je=me();he(je,`workspace`,{"workspace:status:changed":e=>t(t=>t.map(t=>t.id===e.workspaceId?{...t,status:e.status}:t)),"workspace:created":e=>t(t=>[...t,e.workspace]),"workspace:deleted":e=>t(t=>t.filter(t=>t.id!==e.workspaceId)),"workspaces.scanned":({report:e})=>{!e.discovered.length&&!e.adopted.length&&!e.updated.length&&!e.missing.length||x().then(e=>t(H(e))).catch(()=>{})}}),(0,q.useEffect)(()=>{let e=async()=>{try{a(!0);let e=await x();t(H(e)),l(null)}catch(e){console.error(`Workspace fetch error:`,e);let t=`Failed to fetch workspaces`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to fetch workspaces`}l(t),$({title:`Error`,description:t,variant:`destructive`})}finally{a(!1)}};e();let n=()=>{e()};return window.addEventListener(`workspaces:refresh`,n),()=>{window.removeEventListener(`workspaces:refresh`,n)}},[je,$]);let Me=async e=>{if(e.preventDefault(),u.trim()){F(!0);try{let e=await ee({name:u,description:f||void 0,color:m,icon:y,label:w||u,layout:O});if(t(t=>[...t,e]),window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),V.selected.size>0){try{await T(e.name);let{ok:t,failed:n}=await _e(e.name,Array.from(V.selected),V.tree);n&&$({title:`Folders`,description:`${t} folder(s) created, ${n} failed`,variant:`destructive`})}catch(e){console.error(`Default folder creation failed:`,e),$({title:`Folders`,description:`Workspace created, but default folders failed`,variant:`destructive`})}V.setSelected(new Set)}d(``),p(``),_(z()),C(null),E(``),$({title:`Success`,description:`Workspace '${e.label||e.name}' created.`}),B(!1)}catch(e){console.error(`Workspace creation error:`,e);let t=`Failed to create workspace`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to create workspace`}$({title:`Error`,description:t,variant:`destructive`})}finally{F(!1)}}},Ne=async e=>{if(e.preventDefault(),Z)try{let e={label:Z.label,description:Z.description,color:Z.color,icon:Z.icon??null};await S(Z.name,e),t(t=>t.map(t=>t.id===Z.id?{...t,...e}:t)),window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),$({title:`Success`,description:`Workspace '${Z.label}' details updated.`}),Q(null)}catch(e){let t=e instanceof Error?e.message:`Failed to update workspace`;$({title:`Error`,description:t,variant:`destructive`})}},Pe=e=>{Q(e)},Fe=async e=>{try{await b(e.name),t(t=>t.filter(t=>t.id!==e.id)),$({title:`Success`,description:`Workspace '${e.label||e.name}' has been destroyed.`})}catch(e){let t=e instanceof Error?e.message:`Failed to destroy workspace`;$({title:`Error`,description:t,variant:`destructive`})}},Ie=async e=>{try{let n=await T(e);t(e=>e.map(e=>e.id===n.id?{...e,...n}:e)),$({title:`Success`,description:`Workspace '${n.label||n.name}' started.`}),window.dispatchEvent(new CustomEvent(`workspaces:refresh`))}catch(e){console.error(`Workspace start error:`,e);let t=`Failed to start workspace`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to start workspace`}$({title:`Error`,description:t,variant:`destructive`})}},Le=async e=>{try{let n=await D(e);t(e=>e.map(e=>e.id===n.id?{...e,...n}:e)),$({title:`Success`,description:`Workspace '${n.label||n.name}' stopped.`}),window.dispatchEvent(new CustomEvent(`workspaces:refresh`))}catch(e){console.error(`Workspace stop error:`,e);let t=`Failed to stop workspace`;if(e instanceof Error)t=e.message;else if(typeof e==`object`&&e){let n=e;t=n.message||n.error||n.payload?.message||n.payload?.error||n.statusText||`Failed to stop workspace`}$({title:`Error`,description:t,variant:`destructive`})}},Re=e=>{Oe(ie(e))},{rowProps:ze,handleProps:Be,draggingIndex:Ve,insertLineClass:He}=oe((n,r)=>{let i=de(e,n,r);t(i),ue(i,(e,t)=>S(G(e),{order:t})).then(({failed:e})=>{window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),e&&$({title:`Partial reorder`,description:`${e} workspace(s) could not be reordered`,variant:`destructive`})})});return(0,J.jsxs)(`div`,{className:`space-y-6`,children:[(0,J.jsx)(fe,{title:`Workspaces`,description:`Divide your Universe into self-contained workspaces`,actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(h,{variant:`outline`,onClick:()=>ce(e=>!e),className:`max-sm:hidden`,children:`Open shared Workspace (local)…`}),(0,J.jsx)(h,{variant:`outline`,onClick:()=>Y(e=>!e),children:`Import workspace`}),(0,J.jsx)(h,{variant:`outline`,onClick:()=>W(e=>!e),className:`max-sm:hidden`,children:`Import remote…`}),(0,J.jsx)(h,{variant:`outline`,onClick:()=>X(e=>!e),className:`max-sm:hidden`,children:`Open remote…`}),!I.local&&!L&&(0,J.jsxs)(h,{onClick:()=>B(!0),className:`max-sm:h-9 max-sm:w-9 max-sm:p-0`,"aria-label":`Create workspace`,title:`Create workspace`,children:[(0,J.jsx)(c,{className:`h-4 w-4 sm:mr-2`}),(0,J.jsx)(`span`,{className:`max-sm:hidden`,children:`Create Workspace`})]})]})}),!I.local&&L&&(0,J.jsx)(K,{title:`Create New Workspace`,onClose:()=>B(!1),children:(0,J.jsxs)(`form`,{onSubmit:Me,className:`space-y-4`,children:[(0,J.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,J.jsx)(g,{value:u,onChange:e=>d(e.target.value),placeholder:`Workspace Name (e.g., 'my-project')`,disabled:P}),(0,J.jsx)(g,{value:w,onChange:e=>E(e.target.value),placeholder:`Workspace Label (display name, optional)`,disabled:P})]}),(0,J.jsx)(g,{value:f,onChange:e=>p(e.target.value),placeholder:`Description (optional)`,disabled:P}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`label`,{htmlFor:`workspace-color`,className:`text-sm font-medium`,children:`Icon & Color`}),(0,J.jsx)(`button`,{type:`button`,title:`Pick icon & color`,disabled:P,onClick:e=>j({x:Math.min(e.clientX,window.innerWidth-290),y:Math.min(e.clientY,window.innerHeight-360)}),className:`flex h-10 w-10 items-center justify-center rounded-md border hover:bg-accent`,children:(0,J.jsx)(r,{icon:y||`ph:stack-fill`,width:22,height:22,color:R(m)})}),(0,J.jsx)(g,{id:`workspace-color`,type:`color`,value:m,onChange:e=>_(e.target.value),className:`h-10 w-16 p-1`,disabled:P}),(0,J.jsx)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>_(z()),disabled:P,children:`Randomize`})]}),A&&(0,J.jsx)(ae,{x:A.x,y:A.y,current:{icon:y??void 0,color:m},onChange:e=>{`icon`in e&&C(e.icon??null),`color`in e&&e.color&&_(e.color)},onClose:()=>j(null)}),(0,J.jsxs)(`div`,{className:`rounded-lg border p-3`,children:[(0,J.jsx)(`p`,{className:`text-sm font-medium`,children:`Folder structure`}),(0,J.jsx)(`p`,{className:`mb-3 mt-0.5 text-xs text-muted-foreground`,children:`How the workspace directory is laid out on disk. Fixed once created.`}),(0,J.jsx)(Se,{value:O,onChange:k,disabled:P,idPrefix:`create-workspace-layout`})]}),(0,J.jsxs)(`div`,{className:`rounded-lg border p-3`,children:[(0,J.jsxs)(`p`,{className:`text-sm font-medium`,children:[`Default folders `,(0,J.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`})]}),(0,J.jsx)(`p`,{className:`mb-3 mt-0.5 text-xs text-muted-foreground`,children:`Ticked folders are created right after the workspace, with matching icons and colors.`}),(0,J.jsx)(ye,{selected:V.selected,onToggle:V.toggle,tree:V.tree,onTreeChange:V.setTree,disabled:P,idPrefix:`create-default-folders`})]}),(0,J.jsxs)(h,{type:`submit`,disabled:P||!u.trim(),children:[(0,J.jsx)(c,{className:`mr-2 h-4 w-4`}),`Create Workspace`]})]})}),se&&(0,J.jsx)(Ee,{}),we&&(0,J.jsx)(De,{onClose:()=>X(!1),onChanged:async()=>{try{t(H(await x()))}catch{}window.dispatchEvent(new CustomEvent(`workspaces:refresh`))}}),ve&&(0,J.jsx)(K,{title:`Import workspace`,onClose:()=>Y(!1),children:(0,J.jsx)(be,{onImported:()=>Y(!1)})}),U&&(0,J.jsx)(Te,{onImported:e=>{t(t=>t.some(t=>t.id===e.id)?t:[...t,e]),window.dispatchEvent(new CustomEvent(`workspaces:refresh`)),W(!1)},onClose:()=>W(!1)}),(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Your Workspaces`}),n&&(0,J.jsx)(`p`,{className:`text-center text-muted-foreground`,children:`Loading workspaces...`}),s&&(0,J.jsx)(`div`,{className:`text-center text-destructive`,children:(0,J.jsx)(`p`,{children:s})}),!n&&!s&&e.length===0&&(0,J.jsx)(`p`,{className:`text-center text-muted-foreground`,children:`No workspaces found`}),e.length>0&&(0,J.jsx)(`div`,{className:`grid gap-4`,children:e.map((t,n)=>{let r={...t,createdAt:t.createdAt,updatedAt:t.updatedAt,color:t.color===null?void 0:t.color},i=R(t.color);return(0,J.jsxs)(`div`,{...ze(n),className:`flex items-stretch rounded-lg ${He(n,e.length)||``} ${Ve===n?`opacity-60`:``}`,children:[(0,J.jsx)(`button`,{type:`button`,...Be(n),title:`Drag to reorder`,"aria-label":`Drag to reorder`,className:`hidden w-5 shrink-0 cursor-grab items-center justify-center rounded-l-lg active:cursor-grabbing md:flex ${i?``:`bg-muted`}`,style:i?{backgroundColor:i}:void 0,children:(0,J.jsx)(o,{className:`h-4 w-4 ${ne(i)}`})}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsx)(xe,{workspace:r,onStart:Ie,onStop:Le,onEnter:Re,onEdit:Pe,onSettings:e=>{ke?Ae(`workspaces`,`settings`,G(e)):Oe(`/workspaces/${G(e)}/settings/general`)},onDestroy:Fe})})]},t.id)})})]}),Z&&(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsxs)(`h2`,{className:`text-xl font-semibold`,children:[`Edit Workspace: `,Z.label]}),(0,J.jsxs)(`form`,{onSubmit:Ne,className:`space-y-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{htmlFor:`edit-label`,className:`text-sm font-medium`,children:`Label`}),(0,J.jsx)(g,{id:`edit-label`,value:Z.label,onChange:e=>Q(t=>t?{...t,label:e.target.value}:null),placeholder:`Workspace Label`})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{htmlFor:`edit-description`,className:`text-sm font-medium`,children:`Description`}),(0,J.jsx)(g,{id:`edit-description`,value:Z.description||``,onChange:e=>Q(t=>t?{...t,description:e.target.value}:null),placeholder:`Description (optional)`})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{htmlFor:`edit-color`,className:`text-sm font-medium`,children:`Icon & Color`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,title:`Pick icon & color`,onClick:e=>N({x:Math.min(e.clientX,window.innerWidth-290),y:Math.min(e.clientY,window.innerHeight-360)}),className:`flex h-10 w-10 items-center justify-center rounded-md border hover:bg-accent`,children:(0,J.jsx)(r,{icon:Z.icon||`ph:stack-fill`,width:22,height:22,color:R(Z.color)})}),(0,J.jsx)(g,{id:`edit-workspace-color`,type:`color`,value:Z.color||`#FFFFFF`,onChange:e=>Q(t=>t?{...t,color:e.target.value}:null),className:`h-10 w-16 p-1`}),(0,J.jsx)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>Q(e=>e?{...e,color:z()}:null),children:`Randomize Color`})]})]}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(h,{type:`submit`,disabled:!Z.label?.trim(),children:`Save Changes`}),(0,J.jsx)(h,{type:`button`,variant:`outline`,onClick:()=>Q(null),children:`Cancel`})]})]}),M&&(0,J.jsx)(ae,{x:M.x,y:M.y,current:{icon:Z.icon??void 0,color:Z.color??void 0},onChange:e=>{Q(t=>{if(!t)return null;let n={...t};return`icon`in e&&(n.icon=e.icon??null),`color`in e&&e.color&&(n.color=e.color),n})},onClose:()=>N(null)})]})]})}function Te({onImported:e,onClose:t}){let{showToast:n}=v(),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(``),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(``);return(0,J.jsx)(K,{title:`Import (pull) a remote Workspace`,onClose:t,children:(0,J.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault();let i;try{i=new URL(r.trim()).origin}catch{n({title:`Error`,description:`Invalid server URL`,variant:`destructive`});return}if(!a.trim().startsWith(`canvas-`)){n({title:`Error`,description:`Invalid access token (expected canvas-...)`,variant:`destructive`});return}f(!0),m(`Starting…`);try{let t=await E(i,a.trim(),e=>{m(O[e.phase]||e.phase)},{name:s.trim(),label:l.trim()});n({title:`Success`,description:`Workspace '${t.label||t.name}' imported from ${i}.`}),e(t)}catch(e){let t=e,r=t?.message||t?.payload?.message||`Failed to import remote workspace`;n({title:`Error`,description:r,variant:`destructive`})}finally{f(!1),m(``)}},className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,J.jsx)(g,{placeholder:`Server URL (e.g., https://my.canvas-server.tld)`,value:r,onChange:e=>i(e.target.value),disabled:d}),(0,J.jsx)(g,{placeholder:`Workspace share token (canvas-...)`,value:a,onChange:e=>o(e.target.value),disabled:d}),(0,J.jsx)(h,{type:`submit`,disabled:d||!r.trim()||!a.trim()||!s.trim()||!l.trim(),children:d?`Importing…`:`Import Workspace`})]}),(0,J.jsx)(ve,{name:s,label:l,setName:c,setLabel:u,disabled:d}),d&&p&&(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:p}),(0,J.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Pulls a full `,(0,J.jsx)(`strong`,{children:`copy`}),` of the workspace from the remote canvas-server into this one, where it then lives independently. The remote workspace is stopped while it is packed, and large workspaces can take several minutes — progress is shown above.`]})]})})}function Ee(){let{showToast:e}=v(),[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(!1),s=e=>{try{return new URL(e)}catch{return null}};return(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Open shared Workspace (local)`}),(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,J.jsx)(g,{placeholder:`Shared URL (e.g., https://host/rest/v2/pub/workspaces/ID)`,value:t,onChange:e=>n(e.target.value)}),(0,J.jsx)(g,{placeholder:`Access token (canvas-...)`,value:r,onChange:e=>i(e.target.value)}),(0,J.jsx)(h,{onClick:async()=>{if(!s(t.trim())){e({title:`Error`,description:`Invalid URL`,variant:`destructive`});return}if(!r.trim().startsWith(`canvas-`)){e({title:`Error`,description:`Invalid access token`,variant:`destructive`});return}o(!0);try{sessionStorage.setItem(`sharedToken:last`,r.trim());let e=new URLSearchParams({url:t.trim()}).toString();window.location.href=`/shared?${e}`}catch(t){e({title:`Error`,description:t instanceof Error?t.message:`Failed to open shared resource`,variant:`destructive`})}finally{o(!1)}},disabled:a||!t.trim()||!r.trim(),children:`Open`})]}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`We use your provided URL and token to fetch via the remote's public API.`})]})}function De({onClose:e,onChanged:t}){let{showToast:n}=v(),r=i(),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)([]),p=(0,q.useCallback)(async()=>{try{f(await C())}catch{f([])}},[]);(0,q.useEffect)(()=>{p()},[p]);let m=async e=>{e.preventDefault();let r;try{r=new URL(a.trim()).origin}catch{n({title:`Error`,description:`Invalid server URL`,variant:`destructive`});return}u(!0);try{let e=await w(r,s.trim());n({title:`Remote workspace added`,description:`'${e.label}' is available as ${e.address}.`}),o(``),c(``),await p(),t?.()}catch(e){let t=e;n({title:`Error`,description:t?.message||t?.payload?.message||`Failed to add remote workspace`,variant:`destructive`})}finally{u(!1)}},_=async e=>{try{await y(e.id),await p(),t?.()}catch(e){n({title:`Error`,description:e instanceof Error?e.message:`Failed to remove remote workspace`,variant:`destructive`})}};return(0,J.jsxs)(K,{title:`Open a remote Workspace`,onClose:e,children:[(0,J.jsxs)(`form`,{onSubmit:m,className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,J.jsx)(g,{placeholder:`Server URL (e.g., https://my.canvas-server.tld)`,value:a,onChange:e=>o(e.target.value),disabled:l}),(0,J.jsx)(g,{placeholder:`Workspace share token (canvas-...)`,value:s,onChange:e=>c(e.target.value),disabled:l}),(0,J.jsx)(h,{type:`submit`,disabled:l||!a.trim()||!s.trim(),children:l?`Checking…`:`Add Remote`})]}),(0,J.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Keeps the workspace on its own server and registers it here as`,` `,(0,J.jsx)(`code`,{className:`font-mono text-xs`,children:`name@host`}),` — nothing is copied. Every call you make to it is forwarded to the remote with the share token (its permissions apply); document content and thumbnails are cached locally so they stay readable when the remote is offline. Use “Import remote…” if you want an independent local copy instead.`]})]}),d.length>0&&(0,J.jsx)(`ul`,{className:`mt-4 space-y-2 border-t pt-3`,children:d.map(e=>(0,J.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-md border p-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`truncate text-sm font-medium`,children:[e.label,(0,J.jsx)(`span`,{className:`ml-2 rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground`,children:`remote`})]}),(0,J.jsxs)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-muted-foreground`,children:[e.address,` · `,e.remote.url]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,J.jsx)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(`/workspaces/${e.address}`),children:`Open`}),(0,J.jsx)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>_(e),className:`text-destructive hover:text-destructive`,children:`Remove`})]})]},e.id))})]})}export{we as default};
|
package/dist/index.html
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
}
|
|
47
47
|
})()
|
|
48
48
|
</script>
|
|
49
|
-
<script type="module" crossorigin src="/assets/index-
|
|
49
|
+
<script type="module" crossorigin src="/assets/index-CJapDuPp.js"></script>
|
|
50
50
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-C0FnF6B9.js">
|
|
51
51
|
<link rel="modulepreload" crossorigin href="/assets/code-editor-BOIngd5F.js">
|
|
52
52
|
<link rel="modulepreload" crossorigin href="/assets/react-BHzhHVTZ.js">
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
<link rel="modulepreload" crossorigin href="/assets/use-document-modal-PG8bQyIB.js">
|
|
98
98
|
<link rel="modulepreload" crossorigin href="/assets/sketch-lazy-BOFTGGTA.js">
|
|
99
99
|
<link rel="modulepreload" crossorigin href="/assets/geo-CZfs0E-x.js">
|
|
100
|
-
<link rel="modulepreload" crossorigin href="/assets/ObjectPropertiesCard-
|
|
101
|
-
<link rel="modulepreload" crossorigin href="/assets/TodosWidget-
|
|
100
|
+
<link rel="modulepreload" crossorigin href="/assets/ObjectPropertiesCard-B9gkyowI.js">
|
|
101
|
+
<link rel="modulepreload" crossorigin href="/assets/TodosWidget-DdN3vJfS.js">
|
|
102
102
|
<link rel="modulepreload" crossorigin href="/assets/document-open-mode-DoImW-xs.js">
|
|
103
103
|
<link rel="modulepreload" crossorigin href="/assets/PickDocumentsCard-B72XNYh3.js">
|
|
104
104
|
<link rel="modulepreload" crossorigin href="/assets/PathPickerField-B58yeJGw.js">
|
|
@@ -107,25 +107,25 @@
|
|
|
107
107
|
<link rel="modulepreload" crossorigin href="/assets/search-COMZIxA7.js">
|
|
108
108
|
<link rel="modulepreload" crossorigin href="/assets/use-sortable-data-W2inLcb5.js">
|
|
109
109
|
<link rel="modulepreload" crossorigin href="/assets/workspace-BydSRtST.js">
|
|
110
|
-
<link rel="modulepreload" crossorigin href="/assets/document-list-
|
|
110
|
+
<link rel="modulepreload" crossorigin href="/assets/document-list-BX13fcRu.js">
|
|
111
111
|
<link rel="modulepreload" crossorigin href="/assets/url-params-n7kU_WZ-.js">
|
|
112
|
-
<link rel="modulepreload" crossorigin href="/assets/use-canvas-pins-
|
|
112
|
+
<link rel="modulepreload" crossorigin href="/assets/use-canvas-pins-BfT9xMi5.js">
|
|
113
113
|
<link rel="modulepreload" crossorigin href="/assets/use-menu-CaiLyPdw.js">
|
|
114
|
-
<link rel="modulepreload" crossorigin href="/assets/registry-
|
|
114
|
+
<link rel="modulepreload" crossorigin href="/assets/registry-C7aVPPMW.js">
|
|
115
115
|
<link rel="modulepreload" crossorigin href="/assets/use-applet-target-DmIdCxa_.js">
|
|
116
116
|
<link rel="modulepreload" crossorigin href="/assets/last-path-BbXWC3b3.js">
|
|
117
|
-
<link rel="modulepreload" crossorigin href="/assets/workspace-area-menu-
|
|
117
|
+
<link rel="modulepreload" crossorigin href="/assets/workspace-area-menu-DEyR7-bZ.js">
|
|
118
118
|
<link rel="modulepreload" crossorigin href="/assets/workspace-content-gate-CGZmT2kw.js">
|
|
119
119
|
<link rel="modulepreload" crossorigin href="/assets/sha256-65KIjGvZ.js">
|
|
120
120
|
<link rel="modulepreload" crossorigin href="/assets/UploadProgressList-CHQ-Kn-e.js">
|
|
121
121
|
<link rel="modulepreload" crossorigin href="/assets/FileForm-B6eFRKG-.js">
|
|
122
122
|
<link rel="modulepreload" crossorigin href="/assets/use-theme-DaxpiICf.js">
|
|
123
123
|
<link rel="stylesheet" crossorigin href="/assets/map-BcsP_QXj.css">
|
|
124
|
-
<link rel="stylesheet" crossorigin href="/assets/ObjectPropertiesCard-
|
|
124
|
+
<link rel="stylesheet" crossorigin href="/assets/ObjectPropertiesCard-Docu7O5V.css">
|
|
125
125
|
<link rel="stylesheet" crossorigin href="/assets/backend-sync-progress-DU-e9TWi.css">
|
|
126
126
|
<link rel="stylesheet" crossorigin href="/assets/document-list-DAYdk5vh.css">
|
|
127
127
|
<link rel="stylesheet" crossorigin href="/assets/use-canvas-pins-C57Vbkrq.css">
|
|
128
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
128
|
+
<link rel="stylesheet" crossorigin href="/assets/index-lwdPSalm.css">
|
|
129
129
|
<link rel="manifest" href="/manifest.webmanifest"></head>
|
|
130
130
|
<body>
|
|
131
131
|
<div id="root"></div>
|