react-zeugma 7.0.0 → 7.1.0
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/README.md +36 -41
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -11
- package/dist/index.d.ts +7 -11
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/{types-TTO4dDzX.d.cts → types-CADS6yWc.d.cts} +3 -22
- package/dist/{types-TTO4dDzX.d.ts → types-CADS6yWc.d.ts} +3 -22
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +14 -12
- package/dist/utils.d.ts +14 -12
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -247,16 +247,17 @@ import { Tabs } from 'react-zeugma'
|
|
|
247
247
|
|
|
248
248
|
##### Props
|
|
249
249
|
|
|
250
|
-
| Property
|
|
251
|
-
|
|
|
252
|
-
| `tabIds`
|
|
253
|
-
| `activeTabId`
|
|
254
|
-
| `locked`
|
|
255
|
-
| `
|
|
256
|
-
| `
|
|
257
|
-
| `
|
|
258
|
-
| `
|
|
259
|
-
| `
|
|
250
|
+
| Property | Description | Type | Default |
|
|
251
|
+
| -------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
|
|
252
|
+
| `tabIds` | Array of tab IDs. | `string[]` | - |
|
|
253
|
+
| `activeTabId` | The currently active tab ID. | `string` | - |
|
|
254
|
+
| `locked` | Whether tab dragging/reordering is disabled. | `boolean` | `false` |
|
|
255
|
+
| `tabsMetadata` | Metadata mapping associated with each tab in the pane. | `Record<string, Record<string, unknown>>` | - |
|
|
256
|
+
| `selectTab` | Callback when a tab is selected. | `(id: string) => void` | - |
|
|
257
|
+
| `removeTab` | Callback when a tab is closed. | `(id: string) => void` | - |
|
|
258
|
+
| `classNames` | Custom class names for the container and tabs. | `{ container?: string; tab?: string \| ((tabId: string) => string) }` | - |
|
|
259
|
+
| `styles` | Custom CSS style overrides for the container and tabs. | `{ container?: CSSProperties; tab?: CSSProperties \| ((tabId: string) => CSSProperties) }` | - |
|
|
260
|
+
| `renderTab` | Render prop function called for each tab item. | `(props: { tabId: string; activeTabId: string; isDragging: boolean; isOver: boolean; metadata?: Record<string, unknown>; onSelect: () => void; onRemove: () => void; isPoppedOut: boolean; popout: () => void; dock: () => void }) => ReactNode` | - |
|
|
260
261
|
|
|
261
262
|
---
|
|
262
263
|
|
|
@@ -283,17 +284,14 @@ const controller = useZeugma({
|
|
|
283
284
|
|
|
284
285
|
##### Options
|
|
285
286
|
|
|
286
|
-
| Parameter | Description | Type
|
|
287
|
-
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
288
|
-
| `initialLayout` | Initial layout tree structure. Only used on mount. | `TreeNode \| null`
|
|
289
|
-
| `layout` | Controlled layout tree structure. Hook runs in controlled mode if provided. | `TreeNode \| null`
|
|
290
|
-
| `onChange` | Callback triggered when the layout tree updates
|
|
291
|
-
| `
|
|
292
|
-
| `
|
|
293
|
-
| `
|
|
294
|
-
| `fullscreenPaneId` | Controlled fullscreen pane ID. When active (not null), structural layout changes (closes, additions, splits, merges, resizes, and popouts) are blocked at the API level. | `string \| null` | `null` |
|
|
295
|
-
| `onFullscreenChange` | Callback triggered when fullscreen state toggles. | `(paneId: string \| null) => void` | - |
|
|
296
|
-
| `locked` | Global lock status to disable resizing and drag-and-drop operations. | `boolean` | `false` |
|
|
287
|
+
| Parameter | Description | Type | Default |
|
|
288
|
+
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------- | ------- |
|
|
289
|
+
| `initialLayout` | Initial layout tree structure. Only used on mount. | `TreeNode \| null` | `null` |
|
|
290
|
+
| `layout` | Controlled layout tree structure. Hook runs in controlled mode if provided. | `TreeNode \| null` | `null` |
|
|
291
|
+
| `onChange` | Callback triggered when the layout tree updates. | `(newLayout: TreeNode \| null) => void` | - |
|
|
292
|
+
| `fullscreenPaneId` | Controlled fullscreen pane ID. When active (not null), structural layout changes (closes, additions, splits, merges, resizes, and popouts) are blocked at the API level. | `string \| null` | `null` |
|
|
293
|
+
| `onFullscreenChange` | Callback triggered when fullscreen state toggles. | `(paneId: string \| null) => void` | - |
|
|
294
|
+
| `locked` | Global lock status to disable resizing and drag-and-drop operations. | `boolean` | `false` |
|
|
297
295
|
|
|
298
296
|
---
|
|
299
297
|
|
|
@@ -322,7 +320,6 @@ const { layout, locked, setLocked, addTab, removePane, selectTab, findPaneById }
|
|
|
322
320
|
| `setLocked` | Updates the global layout lock state. | `Dispatch<SetStateAction<boolean>>` |
|
|
323
321
|
| `removePane` | Removes a pane and collapses the split. | `(paneId: string) => void` |
|
|
324
322
|
| `addTab` | Adds a tab to a pane, or splits/creates one if target is omitted. | `(tabId: string, targetPaneId?: string, metadata?: Record<string, unknown>) => void` |
|
|
325
|
-
| `updateMetadata` | Mutates a specific tab's metadata. | `(id: string, updater: (current: Record<string, unknown> \| undefined) => Record<string, unknown> \| undefined) => void` |
|
|
326
323
|
| `updatePaneLock` | Toggles the lock status of a specific pane. | `(paneId: string, locked: boolean) => void` |
|
|
327
324
|
| `selectTab` | Focuses/activates a tab within a pane. | `(paneId: string, tabId: string) => void` |
|
|
328
325
|
| `mergeTab` | Programmatically drags and drops a tab from one pane to another. | `(draggedTabId: string, targetPaneId: string) => void` |
|
|
@@ -360,30 +357,28 @@ const {
|
|
|
360
357
|
remove,
|
|
361
358
|
selectTab,
|
|
362
359
|
removeTab,
|
|
363
|
-
updateMetadata,
|
|
364
360
|
} = usePaneContext()
|
|
365
361
|
```
|
|
366
362
|
|
|
367
363
|
##### Context Values
|
|
368
364
|
|
|
369
|
-
| Property / Method | Description | Type
|
|
370
|
-
| ---------------------- | -------------------------------------------------------------------------- |
|
|
371
|
-
| `id` | The ID of the current pane. | `string`
|
|
372
|
-
| `tabIds` | List of tab IDs inside the pane. | `string[]`
|
|
373
|
-
| `activeTabId` | Currently active tab ID. | `string`
|
|
374
|
-
| `isDragging` | `true` if this pane is being dragged. | `boolean`
|
|
375
|
-
| `isFullscreen` | `true` if this pane is maximized. | `boolean`
|
|
376
|
-
| `toggleFullscreen` | Toggles maximized state for this pane. | `() => void`
|
|
377
|
-
| `remove` | Removes this pane from the layout tree. | `() => void`
|
|
378
|
-
| `selectTab` | Activates a tab within this pane. | `(tabId: string) => void`
|
|
379
|
-
| `removeTab` | Closes a tab from this pane. | `(tabId: string) => void`
|
|
380
|
-
| `metadata` | Active tab's custom metadata. | `Record<string, unknown> \| undefined`
|
|
381
|
-
| `
|
|
382
|
-
| `
|
|
383
|
-
| `
|
|
384
|
-
| `
|
|
385
|
-
| `
|
|
386
|
-
| `dockTab` | **[Experimental]** Dock the active tab back to the main layout. | `(tabId?: string) => void` |
|
|
365
|
+
| Property / Method | Description | Type |
|
|
366
|
+
| ---------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
367
|
+
| `id` | The ID of the current pane. | `string` |
|
|
368
|
+
| `tabIds` | List of tab IDs inside the pane. | `string[]` |
|
|
369
|
+
| `activeTabId` | Currently active tab ID. | `string` |
|
|
370
|
+
| `isDragging` | `true` if this pane is being dragged. | `boolean` |
|
|
371
|
+
| `isFullscreen` | `true` if this pane is maximized. | `boolean` |
|
|
372
|
+
| `toggleFullscreen` | Toggles maximized state for this pane. | `() => void` |
|
|
373
|
+
| `remove` | Removes this pane from the layout tree. | `() => void` |
|
|
374
|
+
| `selectTab` | Activates a tab within this pane. | `(tabId: string) => void` |
|
|
375
|
+
| `removeTab` | Closes a tab from this pane. | `(tabId: string) => void` |
|
|
376
|
+
| `metadata` | Active tab's custom metadata. | `Record<string, unknown> \| undefined` |
|
|
377
|
+
| `locked` | Whether the pane or the dashboard is locked. | `boolean` |
|
|
378
|
+
| `tabsMetadata` | Tab metadata mapping for all tabs inside this pane. | `Record<string, Record<string, unknown>> \| undefined` |
|
|
379
|
+
| `isActiveTabPoppedOut` | **[Experimental]** Whether the active tab is popped out into a new window. | `boolean` |
|
|
380
|
+
| `popoutTab` | **[Experimental]** Popout the active tab into a new window. | `(tabId?: string) => void` |
|
|
381
|
+
| `dockTab` | **[Experimental]** Dock the active tab back to the main layout. | `(tabId?: string) => void` |
|
|
387
382
|
|
|
388
383
|
---
|
|
389
384
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var un=require('react'),core=require('@dnd-kit/core'),jsxRuntime=require('react/jsx-runtime'),reactDom=require('react-dom');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var un__default=/*#__PURE__*/_interopDefault(un);function Ot({cursor:e,resizerEl:t,onMove:n,onEnd:r}){document.body.classList.add("zeugma-resizing");let o=document.createElement("style");o.id="zeugma-global-cursor-style",o.textContent=`
|
|
2
2
|
* {
|
|
3
3
|
cursor: ${e} !important;
|
|
4
4
|
user-select: none !important;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
.zeugma-resizing *:not([role="separator"]) {
|
|
7
7
|
pointer-events: none !important;
|
|
8
8
|
}
|
|
9
|
-
`,document.head.appendChild(o),t.setAttribute("data-resizing","true");let c=i=>{n(i);},u=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let i=document.getElementById("zeugma-global-cursor-style");i&&i.remove(),document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",u),r();};document.addEventListener("pointermove",c),document.addEventListener("pointerup",u);}var yt=mn.createContext(void 0),Ie=mn.createContext(void 0),Se=mn.createContext(void 0),Tt=mn.createContext(void 0),ie=()=>{let e=mn.useContext(yt);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},We=()=>{let e=mn.useContext(Ie);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e},rt=()=>{let e=mn.useContext(Tt);if(!e)throw new Error("useZeugmaDrag must be used within a Zeugma provider");return e};function Ft(e){let t=mn.useRef(null);return mn.useEffect(()=>{if(!e){t.current=null;return}let n=o=>{t.current={x:o.clientX,y:o.clientY};},r=o=>{let c=o.touches[0]||o.changedTouches[0];c&&(t.current={x:c.clientX,y:c.clientY});};return window.addEventListener("pointermove",n,{passive:true}),window.addEventListener("touchmove",r,{passive:true}),()=>{window.removeEventListener("pointermove",n),window.removeEventListener("touchmove",r);}},[e]),t}function _t(e){mn.useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function Vt(){let[e,t]=mn.useState({}),[n,r]=mn.useState({}),o=mn.useRef({}),c=mn.useRef(null),u=mn.useRef({}),i=mn.useRef(null),a=mn.useRef(true);mn.useEffect(()=>(a.current=true,()=>{a.current=false;}),[]);let d=mn.useCallback((y,S,k)=>{a.current&&t(h=>{if(!S){if(k&&h[y]!==k||!h[y])return h;let z={...h};return delete z[y],z}return h[y]===S?h:{...h,[y]:S}});},[]),l=mn.useCallback((y,S)=>{a.current&&r(k=>{if(!S){if(!k[y])return k;let h={...k};return delete h[y],h}return k[y]===S?k:{...k,[y]:S}});},[]),m=mn.useCallback((y,S)=>{o.current[y]=S;},[]),g=mn.useCallback(y=>{c.current=y;},[]),b=mn.useCallback((y,S)=>{u.current[y]=S;},[]);return {portalTargets:mn.useMemo(()=>({...e,...n}),[e,n]),registerPortalTarget:d,registerPopoutTarget:l,registerRenderCallback:m,renderCallbacksRef:o,registerRenderPane:g,renderPaneRef:c,registerTabHeader:b,tabHeadersRef:u,activeIdRef:i}}function Yn(e){let t=new Set;function n(r){r&&(r.type==="pane"?r.tabIds.forEach(o=>{t.add(o);}):r.type==="split"&&(n(r.first),n(r.second)));}return n(e),Array.from(t).sort()}function Wt(e){return mn.useMemo(()=>Yn(e),[e])}function jt(e){let{onDragStart:t,onDragEnd:n}=e,[r,o]=mn.useState(null),[c,u]=mn.useState(null),i=mn.useCallback(d=>{t&&t(d);},[t]),a=mn.useCallback((d,l,m)=>{n&&n(d,l,m);},[n]);return {overTabId:r,setOverTabId:o,overTabPosition:c,setOverTabPosition:u,handleDragStartInternal:i,handleDragEndInternal:a}}function qt(e){let n=mn.useContext(Se)?.registerRenderPane;mn.useEffect(()=>{n&&e&&n(e);},[n,e]);}function be(){return "pane-"+Math.random().toString(36).substring(2,11)}function Pe(e,t){if(e===null)return null;if(e.type==="pane")return e.id===t?null:e;let n=Pe(e.first,t),r=Pe(e.second,t);return n===null?r:r===null?n:{...e,first:n,second:r}}function ve(e,t){if(e===null)return null;if(e.type==="pane"){if(e.tabIds.includes(t)){let o=e.tabIds.filter(u=>u!==t);if(o.length===0)return null;let c=e.activeTabId;return e.activeTabId===t&&(c=o[0]),{...e,tabIds:o,activeTabId:c}}return e}let n=ve(e.first,t),r=ve(e.second,t);return n===null?r:r===null?n:{...e,first:n,second:r}}function ze(e,t,n,r,o){if(e===null)return typeof o=="string"?{type:"pane",id:be(),tabIds:[o],activeTabId:o}:o;if(e.type==="pane"){if(e.id===t){let c=typeof o=="string"?{type:"pane",id:be(),tabIds:[o],activeTabId:o}:o,u=r==="left"||r==="top";return {type:"split",direction:n,first:u?c:e,second:u?e:c,splitPercentage:50}}return e}return {...e,first:ze(e.first,t,n,r,o)||e.first,second:ze(e.second,t,n,r,o)||e.second}}function Gn(e,t){if(e===null)return t;function n(r,o){return r.type==="pane"?{type:"split",direction:o==="row"?"column":"row",splitPercentage:50,first:r,second:t}:{...r,second:n(r.second,r.direction)}}return n(e,null)}function Ut(e,t,n){if(e===null)return {type:"pane",id:be(),tabIds:[n],activeTabId:n};let r=t?Q(e,t):null;if(r&&r.type==="pane"){let u=function(i){if(i.type==="pane"&&i.id===t){let a=[...i.tabIds];return a.includes(n)||a.push(n),{...i,tabIds:a,activeTabId:n}}return i.type==="split"?{...i,first:u(i.first),second:u(i.second)}:i};return u(e)}let o={type:"pane",id:be(),tabIds:[n],activeTabId:n};return Gn(e,o)}function ke(e,t,n){return e===null?null:e===t?{...e,splitPercentage:n}:e.type==="split"?{...e,first:ke(e.first,t,n)||e.first,second:ke(e.second,t,n)||e.second}:e}function Q(e,t){return e===null?null:e.type==="pane"?e.id===t?e:null:e.type==="split"?Q(e.first,t)??Q(e.second,t):null}function ce(e,t){return e===null?null:e.type==="pane"?e.tabIds.includes(t)?e:null:e.type==="split"?ce(e.first,t)??ce(e.second,t):null}function Xt(e,t){return Q(e,t)??ce(e,t)}function lt(e,t){let n=ce(e,t);if(!n)return null;let r=n.tabIds.indexOf(t);return {id:t,paneId:n.id,isActive:n.activeTabId===t,index:r,metadata:void 0}}function at(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.id===t){if(n===false){let{locked:r,...o}=e;return o}return {...e,locked:n}}return e}return e.type==="split"?{...e,first:at(e.first,t,n)??e.first,second:at(e.second,t,n)??e.second}:e}function Ze(e,t,n){return e===null?null:e.type==="pane"?e.id===t?e.activeTabId===n?e:{...e,activeTabId:n}:e:e.type==="split"?{...e,first:Ze(e.first,t,n)??e.first,second:Ze(e.second,t,n)??e.second}:e}function Yt(e,t,n){if(e===null)return null;let r=ve(e,t);if(r===null)return {type:"pane",id:be(),tabIds:[t],activeTabId:t};function o(c){if(c.type==="pane"){if(c.id===n){let u=[...c.tabIds];return u.includes(t)||u.push(t),{...c,tabIds:u,activeTabId:t}}return c}return c.type==="split"?{...c,first:o(c.first),second:o(c.second)}:c}return o(r)}function Jn(e,t,n){if(e===null)return null;if(t===n)return e;let r=ce(e,t),o=ce(e,n);if(!r||!o)return e;let c=r.id,u=o.id;function i(a){if(a.type==="pane"){let d=false,l=[...a.tabIds],m=a.activeTabId;if(c===u){if(a.id===c){let g=l.indexOf(t),b=l.indexOf(n);g!==-1&&b!==-1&&(l[g]=n,l[b]=t),m=t,d=true;}}else a.id===c&&(l=l.map(g=>g===t?n:g),m===t&&(m=n),d=true),a.id===u&&(l=l.map(g=>g===n?t:g),m===n&&(m=t),d=true);return d?{...a,tabIds:l,activeTabId:m}:a}return a.type==="split"?{...a,first:i(a.first),second:i(a.second)}:a}return i(e)}function je(e,t,n,r="before"){if(e===null)return null;if(t===n)return e;if(r==="center")return Jn(e,t,n);let o=ve(e,t);if(o===null)return {type:"pane",id:be(),tabIds:[t],activeTabId:t};function c(u){if(u.type==="pane"){if(u.tabIds.includes(n)){let a=[...u.tabIds].filter(l=>l!==t),d=a.indexOf(n);return d<0&&(d=0),r==="after"&&(d+=1),a.splice(d,0,t),{...u,tabIds:a,activeTabId:t}}return u}return u.type==="split"?{...u,first:c(u.first),second:c(u.second)}:u}return c(o)}function we(e,t=0,n=0,r=100,o=100,c="root"){if(e===null)return {panes:[],splitters:[]};if(e.type==="pane")return {panes:[{paneId:e.id,left:t,top:n,width:r,height:o,node:e}],splitters:[]};let{direction:u,splitPercentage:i,first:a,second:d}=e,m={id:`splitter-${c}-${u}`,currentNode:e,direction:u,left:u==="row"?t+r*(i/100):t,top:u==="column"?n+o*(i/100):n,width:u==="row"?0:r,height:u==="column"?0:o,parentLeft:t,parentTop:n,parentWidth:r,parentHeight:o},g={panes:[],splitters:[]},b={panes:[],splitters:[]};if(u==="row"){let T=r*(i/100);g=we(a,t,n,T,o,`${c}-L`),b=we(d,t+T,n,r-T,o,`${c}-R`);}else {let T=o*(i/100);g=we(a,t,n,r,T,`${c}-T`),b=we(d,t,n+T,r,o-T,`${c}-B`);}return {panes:[...g.panes,...b.panes],splitters:[m,...g.splitters,...b.splitters]}}function Gt(e,t,n,r="before"){if(e===null)return null;let o=Q(e,t);if(!o)return e;let c=o.tabIds,u=o.activeTabId,i=Pe(e,t);if(i===null)return o;function a(d){if(d.type==="pane"){if(d.tabIds.includes(n)){let m=[...d.tabIds].filter(b=>!c.includes(b)),g=m.indexOf(n);return g<0&&(g=0),r==="after"&&(g+=1),m.splice(g,0,...c),{...d,tabIds:m,activeTabId:u}}return d}return d.type==="split"?{...d,first:a(d.first),second:a(d.second)}:d}return a(i)}function Jt(e,t,n,r){if(!((t==="tab"||t==="pane")&&n&&e.includes(n))||!r)return -1;let u=e.indexOf(n);return r==="before"?u:u+1}function qe(e,t){if(e===t)return true;if(!e||!t||e.type!==t.type)return false;if(e.type==="split"){let n=t;return e.direction===n.direction&&e.splitPercentage===n.splitPercentage&&qe(e.first,n.first)&&qe(e.second,n.second)}else {let n=t;if(e.id!==n.id||e.activeTabId!==n.activeTabId||e.locked!==n.locked||e.tabIds.length!==n.tabIds.length)return false;for(let r=0;r<e.tabIds.length;r++)if(e.tabIds[r]!==n.tabIds[r])return false;return true}}var Ue=mn.createContext(null);var Kt={};function tn(e,t){let n=e?{...e}:{},r=new Map,o=new Set,c=i=>{let a=r.get(i);a&&a.forEach(d=>d()),o.forEach(d=>d()),t?.(n);};return {get:i=>n[i],getAll:()=>n,set:(i,a)=>{if(a===void 0){if(!(i in n))return;let d={...n};delete d[i],n=d;}else {if(n[i]===a)return;n={...n,[i]:a};}c(i);},update:(i,a)=>{let d=n[i],l=a(d);if(l!==d){if(l===void 0){if(!(i in n))return;let m={...n};delete m[i],n=m;}else n={...n,[i]:l};c(i);}},remove:i=>{if(!(i in n))return;let a={...n};delete a[i],n=a,c(i);},setAll:i=>{let a=i?{...i}:{},d=Object.keys(n),l=Object.keys(a),m=d.length!==l.length,g=new Set;if(m){for(let b of d)n[b]!==a[b]&&g.add(b);for(let b of l)n[b]!==a[b]&&g.add(b);}else for(let b of d)n[b]!==a[b]&&(m=true,g.add(b));m&&(n=a,g.forEach(b=>{let T=r.get(b);T&&T.forEach(y=>y());}),o.forEach(b=>b()),t?.(n));},subscribe:(i,a)=>{let d=r.get(i);return d||(d=new Set,r.set(i,d)),d.add(a),()=>{d?.delete(a),d?.size===0&&r.delete(i);}},subscribeAll:i=>(o.add(i),()=>{o.delete(i);})}}function Ee(e,t){let n=mn.useContext(Ue),r=t??n;return mn.useSyncExternalStore(o=>r?r.subscribe(e,o):()=>{},()=>r?r.get(e):void 0,()=>r?r.get(e):void 0)}function Qn(e){let t=mn.useContext(Ue),n=e??t;return mn.useSyncExternalStore(r=>n?n.subscribeAll(r):()=>{},()=>n?n.getAll():Kt,()=>n?n.getAll():Kt)}function eo(e){let{initialLayout:t,layout:n,onChange:r,initialMetadata:o,metadata:c,onMetadataChange:u,fullscreenPaneId:i,onFullscreenChange:a,locked:d=false}=e,[l,m]=mn.useState(()=>n!==void 0?n:t??null),[g,b]=mn.useState(()=>n!==void 0?n:t??null),T=mn.useRef(n),[y,S]=mn.useState(i||null),[k,h]=mn.useState(d),[z,D]=mn.useState([]),[M,E]=mn.useState(null),[s,p]=mn.useState(null),[v,x]=mn.useState(null),$=mn.useRef(null),V=mn.useCallback(f=>{$.current=f;},[]),W=mn.useRef(l);W.current=l;let B=mn.useRef(y);B.current=y;let ae=mn.useRef(r);ae.current=r;let Z=mn.useRef(a);Z.current=a;let j=mn.useRef(u);j.current=u;let F=mn.useRef(null);F.current||(F.current=tn(c!==void 0?c:o,f=>j.current?.(f)));let C=F.current,I=mn.useRef(c);mn.useEffect(()=>{c!==void 0&&c!==I.current&&(I.current=c,C.setAll(c));},[c,C]);let P=mn.useCallback(f=>{S(f),Z.current?.(f);},[]);mn.useEffect(()=>{h(d);},[d]),mn.useEffect(()=>{i!==void 0&&S(i);},[i]),n!==void 0&&(qe(n,T.current??null)||(T.current=n,m(n),b(n),D(f=>{if(f.length===0)return f;let w=f.filter(H=>lt(n,H)!==null);return w.length===f.length?f:w})));let L=mn.useCallback(f=>(...w)=>{let H=W.current,_=f(H,...w);qe(H,_)||(W.current=_,m(_),b(_),D(le=>{if(le.length===0)return le;let Re=le.filter(xe=>lt(_,xe)!==null);return Re.length===le.length?le:Re}),ae.current?.(_));},[]),R=mn.useCallback(L((f,w)=>typeof w=="function"?w(f):w),[L]),A=mn.useCallback(f=>{B.current===null&&b(w=>typeof f=="function"?f(w):f);},[]),me=mn.useCallback(f=>{S(null),Z.current?.(null),E(null),p(null),x(null),R(f),b(()=>typeof f=="function"?f(W.current):f);},[R]),ee=mn.useCallback(f=>{if(B.current!==null)return;let w=Q(W.current,f);w&&w.tabIds.forEach(H=>C.remove(H)),L(H=>Pe(H,f))();},[C,L]),te=mn.useCallback((f,w,H)=>{B.current===null&&(H!==void 0&&C.set(f,H),L(_=>{let le=ve(_,f)??_;return Ut(le,w,f)})());},[C,L]),X=mn.useCallback(L((f,w,H,_,le)=>{if(B.current!==null)return f;let Re=Q(f,w)??ce(f,w);if(!Re)return f;let xe=Q(f,le)??ce(f,le)??{type:"pane",id:le,tabIds:[le],activeTabId:le},tt=Pe(f,xe.id);return ze(tt,Re.id,H,_,xe)}),[L]),ne=mn.useCallback(L((f,w,H)=>B.current!==null?f:ke(f,w,H)),[L]),N=mn.useCallback((f,w)=>{C.update(f,w);},[C]),O=mn.useCallback(L((f,w,H)=>{let _=Q(f,w)??ce(f,w);return _?at(f,_.id,H):f}),[L]),ue=mn.useCallback(L((f,w,H)=>{let _=Q(f,w)??ce(f,w);return _?Ze(f,_.id,H):f}),[L]),de=mn.useCallback(L((f,w,H)=>{if(B.current!==null)return f;let _=Q(f,H)??ce(f,H);return _?Yt(f,w,_.id):f}),[L]),G=mn.useCallback(L((f,w,H,_)=>B.current!==null?f:je(f,w,H,_)),[L]),oe=mn.useCallback(f=>{B.current===null&&(C.remove(f),L(w=>ve(w,f))());},[C,L]),Me=mn.useCallback(f=>Q(W.current,f),[]),re=mn.useCallback(f=>ce(W.current,f),[]),se=mn.useCallback(f=>{let w=lt(W.current,f);return w?{...w,metadata:C.get(f)}:null},[C]),q=mn.useCallback(f=>C.get(f),[C]),pe=mn.useCallback(f=>{let w=Q(W.current,f);if(w)return C.get(w.activeTabId)},[C]),J=mn.useCallback(f=>{B.current===null&&D(w=>w.includes(f)?w:[...w,f]);},[]),Te=mn.useCallback(f=>{B.current===null&&D(w=>w.includes(f)?w.filter(H=>H!==f):w);},[]);return {metadataStore:C,layout:l,setLayout:me,_internalSetLayout:A,renderingLayout:g,fullscreenPaneId:y,setFullscreenPaneId:P,locked:k,setLocked:h,poppedOutTabIds:z,activeId:M,setActiveId:E,activeType:s,setActiveType:p,dismissIntentId:v,setDismissIntentId:x,containerRef:$,setContainerRef:V,removePane:ee,addTab:te,updateMetadata:N,updatePaneLock:O,selectTab:ue,mergeTab:de,moveTab:G,removeTab:oe,splitPane:X,updateSplitPercentage:ne,popoutTab:J,dockTab:Te,findPaneById:Me,findPaneContainingTab:re,findTabById:se,getTabMetadata:q,getActiveTabMetadata:pe}}var to=()=>{let e=ie(),t=We();return {layout:e.layout,setLayout:e.setLayout,fullscreenPaneId:e.fullscreenPaneId,setFullscreenPaneId:t.setFullscreenPaneId,locked:e.locked,setLocked:t.setLocked,removePane:t.removePane,addTab:t.addTab,updateMetadata:t.updateMetadata,updatePaneLock:t.updatePaneLock,selectTab:t.selectTab,mergeTab:t.mergeTab,removeTab:t.removeTab,splitPane:t.splitPane,updateSplitPercentage:t.updateSplitPercentage,moveTab:t.moveTab,findPaneById:e.findPaneById,findPaneContainingTab:e.findPaneContainingTab,findTabById:e.findTabById,getTabMetadata:e.getTabMetadata,getActiveTabMetadata:e.getActiveTabMetadata,poppedOutTabIds:e.poppedOutTabIds,popoutTab:t.popoutTab,dockTab:t.dockTab}};var ct=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},ut=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};var nn=e=>{let n=e.active.id.toString().startsWith("tab-header-"),o=core.pointerWithin(e);if(o.length>0)return [...o].sort((u,i)=>{let a=u.id.toString(),d=i.id.toString(),l=a.startsWith("tab-drop-"),m=d.startsWith("tab-drop-");if(l&&!m)return -1;if(!l&&m)return 1;let g=a.startsWith("drop-root-"),b=d.startsWith("drop-root-");return g&&!b?-1:!g&&b?1:0});if(n){let c=e.droppableContainers.filter(u=>u.id.toString().startsWith("tab-drop-"));return core.closestCenter({...e,droppableContainers:c})}return []};function Xe(e){if(e instanceof MouseEvent||e instanceof PointerEvent)return {x:e.clientX,y:e.clientY};if(typeof TouchEvent<"u"&&e instanceof TouchEvent){let t=e.touches[0]||e.changedTouches[0];if(t)return {x:t.clientX,y:t.clientY}}return null}function sn(e){let{layout:t,_internalSetLayout:n,setLayout:r,activeId:o,setActiveId:c,activeType:u,setActiveType:i,dismissIntentId:a,setDismissIntentId:d,setOverTabId:l,setOverTabPosition:m,containerRef:g,dragActivationDistance:b,enableDragToDismiss:T,dismissThreshold:y,onRemove:S,onDragStart:k,onDragEnd:h,onDismissIntentChange:z,removeTab:D,removePane:M}=e,E=mn.useRef(null),s=Ft(o),p=mn.useRef(null),[v,x]=mn.useState(false);return _t(v),{sensors:core.useSensors(core.useSensor(ct,{activationConstraint:{distance:b}}),core.useSensor(ut,{activationConstraint:{delay:250,tolerance:5}})),collisionDetection:nn,onDragStart:Z=>{let j=Z.active.id.toString(),F=j.startsWith("tab-header-"),C=F?j.substring(11):j;c(C),i(F?"tab":"pane"),l(null),m(null);let I=Z.activatorEvent;s.current=Xe(I),T&&g.current?E.current=g.current.getBoundingClientRect():E.current=null;let P=t;if(F){let R=ce(t,C);R&&(P=Ze(t,R.id,C)||t);}p.current=P;let L=F?ve(P,C):Pe(P,C);n(L),k&&k(C);},onDragMove:Z=>{let{over:j}=Z,F=j?.id.toString()||"",C=F.startsWith("drop-locked-");x(N=>N===C?N:C);let I=Z.active.id.toString(),P=I.startsWith("tab-header-"),L=P?I.substring(11):I,R=F.match(/^tab-drop-(.+)$/);if(R&&j&&(P||u==="pane")){let[,N]=R;if(L!==N){let O="before",ue=j.rect,de=Z.activatorEvent,G=null;if(s.current)G=s.current.x;else {let oe=Xe(de);oe&&(G=oe.x+Z.delta.x);}if(G!==null){let oe=ue.left+ue.width/2;G>oe&&(O="after");}l(oe=>oe===N?oe:N),m(oe=>oe===O?oe:O);}else l(O=>O===null?O:null),m(O=>O===null?O:null);}else l(N=>N===null?N:null),m(N=>N===null?N:null);if(!T)return;let A=E.current;if(!A){a!==null&&(d(null),z?.(null));return}let me=Z.activatorEvent,ee=null,te=null;if(s.current)ee=s.current.x,te=s.current.y;else {let N=Xe(me);N&&(ee=N.x+Z.delta.x,te=N.y+Z.delta.y);}let X=0;if(ee!==null&&te!==null){let N=0,O=0;ee<A.left?N=A.left-ee:ee>A.right&&(N=ee-A.right),te<A.top?O=A.top-te:te>A.bottom&&(O=te-A.bottom),X=Math.sqrt(N*N+O*O);}else {let N=Z.active.rect.current.translated;if(N){let O=N.left+N.width/2,ue=N.top+N.height/2,de=0,G=0;O<A.left?de=A.left-O:O>A.right&&(de=O-A.right),ue<A.top?G=A.top-ue:ue>A.bottom&&(G=ue-A.bottom),X=Math.sqrt(de*de+G*G);}}X>y?a!==L&&(d(L),z?.(L)):a!==null&&(d(null),z?.(null));},onDragEnd:Z=>{c(null),i(null),x(false),l(null),m(null);let{active:j,over:F}=Z,C=j.id.toString(),I=C.startsWith("tab-header-"),P=I?C.substring(11):C,L=T&&a===P;d(null),z?.(null),E.current=null;let R=p.current||t;if(p.current=null,L){S?S(P):I?D(P):M(P),h&&h(P,null,null);return}if(!F){n(R),h&&h(P,null,null);return}let A=F.id.toString();if(A.startsWith("drop-locked-")){n(R),h&&h(P,null,null);return}let me=A.match(/^tab-drop-(.+)$/);if(me){let[,re]=me;if(I)if(P!==re){let se="before",q=F.rect,pe=Z.activatorEvent,J=null;if(s.current)J=s.current.x;else {let K=Xe(pe);K&&(J=K.x+Z.delta.x);}if(J!==null){let K=q.left+q.width/2;J>K&&(se="after");}let Te=je(R,P,re,se);r(Te),h&&h(P,re,{type:"move",position:"center"});}else n(R),h&&h(P,null,null);else {let se="before",q=F.rect,pe=Z.activatorEvent,J=null;if(s.current)J=s.current.x;else {let K=Xe(pe);K&&(J=K.x+Z.delta.x);}if(J!==null){let K=q.left+q.width/2;J>K&&(se="after");}let Te=Gt(R,P,re,se);r(Te),h&&h(P,re,{type:"move",position:"center"});}return}let ee=A.match(/^drop-root-(1\/4|1\/3)-(top|bottom|left|right|start|end)$/);if(ee){let[,re,se]=ee,q=se;q==="start"&&(q="left"),q==="end"&&(q="right");let pe=I?ve(R,P):Pe(R,P),J;if(I?J={type:"pane",id:be(),tabIds:[P],activeTabId:P}:J=Q(R,P)??{type:"pane",id:be(),tabIds:[P],activeTabId:P},pe===null)r(J);else {let Te=q==="left"||q==="right",K=q==="left"||q==="top",f=50;re==="1/4"?f=K?25:75:re==="1/3"&&(f=K?100/3:200/3),r({type:"split",direction:Te?"row":"column",first:K?J:pe,second:K?pe:J,splitPercentage:f});}h&&h(P,"root",{type:"split",direction:q==="left"||q==="right"?"row":"column",position:q});return}let te=A.match(/^drop-(left|right|top|bottom|center)-(.+)$/);if(!te){n(R),h&&h(P,null,null);return}let[,X,ne]=te;if(X==="center"){if(I){let re=Q(R,ne);if(re&&re.activeTabId){let se=re.activeTabId,q=je(R,P,se,"center");r(q),h&&h(P,ne,{type:"move",position:"center"});}else n(R),h&&h(P,null,null);}else n(R),h&&h(P,null,null);return}let N=I?ce(R,P):Q(R,P),O=N&&N.id===ne,ue=N&&N.tabIds.length===1;if(P===ne||O&&ue){n(R),h&&h(P,null,null);return}let de=X==="left"||X==="right"?"row":"column",G;I?G={type:"pane",id:be(),tabIds:[P],activeTabId:P}:G=Q(R,P)??{type:"pane",id:be(),tabIds:[P],activeTabId:P};let oe=I?ve(R,P):Pe(R,P),Me=ze(oe,ne,de,X,G);r(Me),h&&h(P,ne,{type:"split",direction:de,position:X});},onDragCancel:()=>{c(null),i(null),x(false),l(null),m(null),d(null),z?.(null),E.current=null;let Z=p.current||t;p.current=null,n(Z),Z!==t&&r(Z);}}}function an({persist:e,layout:t,setLayout:n,metadataStore:r}){let o=typeof e=="object"?e.enabled!==false:!!e,c=typeof e=="object"&&e.key||"zeugma-layout",u=typeof e=="object"&&e.metadataKey||`${c}-metadata`,[i,a]=mn.useState(false);mn.useEffect(()=>{if(o){let d=localStorage.getItem(c);if(d)try{let l=JSON.parse(d);l&&n(l);}catch(l){console.error("Failed to parse persisted zeugma layout",l);}if(r){let l=localStorage.getItem(u);if(l)try{let m=JSON.parse(l);m&&typeof m=="object"&&r.setAll(m);}catch(m){console.error("Failed to parse persisted zeugma metadata",m);}}}a(true);},[o,c,u,n,r]),mn.useEffect(()=>{o&&i&&(t?localStorage.setItem(c,JSON.stringify(t)):localStorage.removeItem(c));},[o,c,t,i]),mn.useEffect(()=>{if(o&&i&&r)return r.subscribeAll(()=>{let l=r.getAll();Object.keys(l).length>0?localStorage.setItem(u,JSON.stringify(l)):localStorage.removeItem(u);})},[o,i,u,r]);}var ye=null,cn=false,Y=new Set,Oe=new Set,He=null;function uo(){typeof window>"u"||He||(He=new MutationObserver(e=>{e.forEach(t=>{t.addedNodes.forEach(n=>{n instanceof HTMLElement&&(n.tagName.toLowerCase()==="style"||n.tagName.toLowerCase()==="link")&&Y.forEach(r=>{try{let o=n.cloneNode(!0);if(o.tagName.toLowerCase()==="link"){let c=n.href;c&&o.setAttribute("href",c);}r.head.appendChild(o);}catch(o){console.warn("Failed to mirror style node to popout:",o);}});});});}),He.observe(document.head,{childList:true}));}function xt(){He&&(He.disconnect(),He=null);}var $e=null;function po(){typeof window>"u"||$e||($e=new MutationObserver(e=>{e.forEach(t=>{if(t.type==="attributes"&&t.attributeName){let n=document.documentElement.getAttribute(t.attributeName);Y.forEach(r=>{try{r&&r.documentElement&&(n!==null?r.documentElement.setAttribute(t.attributeName,n):r.documentElement.removeAttribute(t.attributeName));}catch(o){console.warn("Failed to sync documentElement attribute:",o);}});}});}),$e.observe(document.documentElement,{attributes:true}));}function wt(){$e&&($e.disconnect(),$e=null);}var un=e=>{typeof requestAnimationFrame<"u"?requestAnimationFrame(e):setTimeout(e,0);};function he(){if(typeof window>"u")return document;if(ye&&ye.target){let n=ye.target.ownerDocument;if(n&&n!==document&&Y.has(n))return n}let e=window.event;if(e&&e.target){let r=e.target.ownerDocument;if(r&&r!==document&&Y.has(r))return r}let t=window.__zeugmaActivePopoutDocument;return t&&Y.has(t)?t:document}function dn(){if(typeof window>"u"||cn)return;cn=true;let e=(s,p)=>{if(!s||!p)return false;try{let v=Object.getPrototypeOf(s);for(;v;){if(v===p)return !0;v=Object.getPrototypeOf(v);}}catch{}return false},t=(s,p)=>{try{Object.defineProperty(s,Symbol.hasInstance,{value:function(v){return v?e(v,s.prototype)?!0:p(v):!1},configurable:!0,writable:!0});}catch(v){console.warn("Failed to patch Symbol.hasInstance on",s,v);}};typeof Node<"u"&&t(Node,s=>typeof s.nodeType=="number"&&typeof s.nodeName=="string"),typeof Element<"u"&&t(Element,s=>s.nodeType===1),typeof HTMLElement<"u"&&t(HTMLElement,s=>s.nodeType===1&&typeof s.style=="object"),typeof HTMLBodyElement<"u"&&t(HTMLBodyElement,s=>s.nodeType===1&&s.tagName==="BODY"),typeof HTMLHtmlElement<"u"&&t(HTMLHtmlElement,s=>s.nodeType===1&&s.tagName==="HTML"),typeof HTMLInputElement<"u"&&t(HTMLInputElement,s=>s.nodeType===1&&s.tagName==="INPUT"),typeof HTMLTextAreaElement<"u"&&t(HTMLTextAreaElement,s=>s.nodeType===1&&s.tagName==="TEXTAREA"),typeof ShadowRoot<"u"&&t(ShadowRoot,s=>s.nodeType===11&&s.host!==void 0),typeof SVGElement<"u"&&t(SVGElement,s=>s.nodeType===1&&typeof s.getBBox=="function"),typeof Document<"u"&&t(Document,s=>s.nodeType===9),typeof Window<"u"&&t(Window,s=>s&&typeof s.document=="object"&&typeof s.location=="object");let n=Document.prototype,r=Object.getOwnPropertyDescriptor(n,"body"),o=Object.getOwnPropertyDescriptor(n,"documentElement"),c=Object.getOwnPropertyDescriptor(n,"head"),u=Object.getOwnPropertyDescriptor(n,"activeElement"),i=Object.getOwnPropertyDescriptor(n,"defaultView"),a=Object.getOwnPropertyDescriptor(n,"scrollingElement");Object.defineProperties(document,{body:{get(){let s=he();return s&&s!==document?s.body:r?.get?.call(document)||document.body},configurable:true},documentElement:{get(){let s=he();return s&&s!==document?s.documentElement:o?.get?.call(document)||document.documentElement},configurable:true},head:{get(){let s=he();return s&&s!==document?s.head:c?.get?.call(document)||document.head},configurable:true},activeElement:{get(){let s=he();return s&&s!==document?s.activeElement:u?.get?.call(document)||document.activeElement},configurable:true},defaultView:{get(){let s=he();return s&&s!==document?s.defaultView:i?.get?.call(document)||document.defaultView},configurable:true},scrollingElement:{get(){let s=he();return s&&s!==document?s.scrollingElement:a?.get?.call(document)||document.scrollingElement},configurable:true}});let d=Window.prototype,l=["innerWidth","innerHeight","pageXOffset","pageYOffset","scrollX","scrollY","screenX","screenY","outerWidth","outerHeight","devicePixelRatio"],m={};l.forEach(s=>{let p=Object.getOwnPropertyDescriptor(d,s)||Object.getOwnPropertyDescriptor(window,s);p&&p.get&&(m[s]=p.get);}),l.forEach(s=>{Object.defineProperty(window,s,{get(){let p=he();if(p&&p!==document&&p.defaultView)try{return p.defaultView[s]}catch{}let v=m[s];return v?v.call(window):window[s]},configurable:true});});let g=Node.prototype.contains;Node.prototype.contains=function(s){if(!s)return false;if(g.call(this,s))return true;if(this===document||this===document.body||this===document.documentElement)for(let p of Y)try{if(p.contains(s))return !0}catch{}return false};let b=()=>{ye=null,globalThis.__zeugmaActivePopoutDocument=null;};["pointerdown","mousedown","click","keydown","focus","touchstart"].forEach(s=>{window.addEventListener(s,b,true);});let y=document.createElement;document.createElement=function(s,p){let v=he();return v&&v!==document?v.createElement(s,p):y.call(document,s,p)};let S=document.addEventListener;document.addEventListener=function(s,p,v){Oe.add({target:"document",type:s,listener:p,options:v}),S.call(document,s,p,v),Y.forEach(x=>{try{x.addEventListener(s,p,v);}catch{}});};let k=document.removeEventListener;document.removeEventListener=function(s,p,v){for(let x of Oe)if(x.target==="document"&&x.type===s&&x.listener===p){Oe.delete(x);break}k.call(document,s,p,v),Y.forEach(x=>{try{x.removeEventListener(s,p,v);}catch{}});};let h=window.addEventListener;window.addEventListener=function(s,p,v){Oe.add({target:"window",type:s,listener:p,options:v}),h.call(window,s,p,v),Y.forEach(x=>{try{x.defaultView&&x.defaultView.addEventListener(s,p,v);}catch{}});};let z=window.removeEventListener;window.removeEventListener=function(s,p,v){for(let x of Oe)if(x.target==="window"&&x.type===s&&x.listener===p){Oe.delete(x);break}z.call(window,s,p,v),Y.forEach(x=>{try{x.defaultView&&x.defaultView.removeEventListener(s,p,v);}catch{}});};let D=document.getElementById;document.getElementById=function(s){let p=he();if(p&&p!==document)return p.getElementById(s);let v=D.call(document,s);if(v)return v;for(let x of Y)try{let $=x.getElementById(s);if($)return $}catch{}return null};let M=document.querySelector;document.querySelector=function(s){let p=he();if(p&&p!==document)return p.querySelector(s);let v=M.call(document,s);if(v)return v;for(let x of Y)try{let $=x.querySelector(s);if($)return $}catch{}return null};let E=document.querySelectorAll;document.querySelectorAll=function(s){let p=he();if(p&&p!==document)return p.querySelectorAll(s);let v=E.call(document,s);if(v.length>0)return v;for(let x of Y)try{let $=x.querySelectorAll(s);if($.length>0)return $}catch{}return v};}function pn(e){let{poppedOutTabIds:t,registerPopoutTarget:n,findTabById:r,dockTab:o}=e,c=mn.useRef({});mn.useEffect(()=>{let u=c.current;t.forEach(i=>{if(u[i]){try{u[i].focus();}catch{}return}dn();let d=r(i)?.metadata?.title||`Tab ${i}`,l=window.open("",`zeugma-popout-${i}`,"width=800,height=600");if(!l){console.warn("Failed to open popout window. Check popup blocker."),o(i);return}u[i]=l,Y.add(l.document),Oe.forEach(p=>{try{p.target==="window"?l.addEventListener(p.type,p.listener,p.options):l.document.addEventListener(p.type,p.listener,p.options);}catch{}}),uo(),po(),l.document.title=d,l.document.head.innerHTML="";try{let p=l.document.createElement("base");p.setAttribute("href",window.location.origin+"/"),l.document.head.appendChild(p);}catch{}if(Array.from(document.querySelectorAll('style, link[rel="stylesheet"]')).forEach(p=>{let v=p.cloneNode(true);if(p.tagName.toLowerCase()==="link"){let x=p.href;x&&v.setAttribute("href",x);}else if(p.tagName.toLowerCase()==="style")try{let x=p.sheet?.cssRules;if(x&&x.length>0){let $=Array.from(x).map(V=>V.cssText).join(`
|
|
10
|
-
`);
|
|
11
|
-
`);return x.replaceSync($),x}catch{return null}}).filter(v=>v!==null);l.document.adoptedStyleSheets=p;}catch(p){console.warn("Failed to copy adoptedStyleSheets:",p);}l.document.documentElement.className=document.documentElement.className,l.document.body.className=document.body.className,Array.from(document.documentElement.attributes).forEach(p=>{l.document.documentElement.setAttribute(p.name,p.value);}),l.document.body.style.margin="0",l.document.body.style.padding="0",l.document.body.style.height="100vh",l.document.body.style.overflow="hidden";let m=document.getElementById(`zeugma-tab-target-${i}`),g="";m&&(g=window.getComputedStyle(m).backgroundColor,(!g||g==="transparent"||g==="rgba(0, 0, 0, 0)")&&m.parentElement&&(g=window.getComputedStyle(m.parentElement).backgroundColor));let b=window.getComputedStyle(document.documentElement),T=window.getComputedStyle(document.body),y=T.backgroundColor,k=!y||y==="transparent"||y==="rgba(0, 0, 0, 0)"?b.backgroundColor:y,h=g&&g!=="transparent"&&g!=="rgba(0, 0, 0, 0)"?g:k&&k!=="transparent"&&k!=="rgba(0, 0, 0, 0)"?k:"#181b1f";document.documentElement.getAttribute("data-theme")||(l.document.documentElement.style.backgroundColor=h,l.document.body.style.backgroundColor=h),l.document.body.style.color=T.color||b.color,l.document.body.style.fontFamily=T.fontFamily||b.fontFamily;let D=l.document.createElement("div");D.id=`zeugma-popout-container-${i}`,D.className="zeugma-popout-container",D.style.width="100%",D.style.height="100%",D.style.overflow="hidden",D.style.border="none",l.document.body.appendChild(D),n?.(i,D);let M=["pointerdown","mousedown","click","keydown","focus","touchstart"],E=p=>{ye=p,globalThis.__zeugmaActivePopoutDocument=l.document,setTimeout(()=>{ye===p&&(ye=null,globalThis.__zeugmaActivePopoutDocument=null);},0);};M.forEach(p=>{l.addEventListener(p,E,true);});let s=()=>{ye=null,globalThis.__zeugmaActivePopoutDocument=null,Y.delete(l.document),Y.size===0&&(xt(),wt()),o(i);};l.addEventListener("beforeunload",s),l.__zeugmaCleanup=()=>{M.forEach(p=>{l.removeEventListener(p,E,true);}),l.removeEventListener("beforeunload",s);};}),Object.keys(u).forEach(i=>{if(!t.includes(i)){let a=u[i];if(delete u[i],n?.(i,null),a){ye&&ye.target.ownerDocument===a.document&&(ye=null),globalThis.__zeugmaActivePopoutDocument===a.document&&(globalThis.__zeugmaActivePopoutDocument=null),Y.delete(a.document),Y.size===0&&(xt(),wt());try{let d=a;d.__zeugmaCleanup&&d.__zeugmaCleanup(),un(()=>{try{d.close();}catch{}});}catch{}}}});},[t,n,r,o]),mn.useEffect(()=>()=>{let u=c.current;Object.keys(u).forEach(i=>{let a=u[i];if(a){Y.delete(a.document);try{let d=a;d.__zeugmaCleanup&&d.__zeugmaCleanup(),un(()=>{try{d.close();}catch{}});}catch{}}}),Y.size===0&&(xt(),wt());},[]);}typeof window<"u"&&dn();var fn=({activeId:e,render:t,className:n})=>{let r=mn.useRef(null);return mn.useEffect(()=>{let o=c=>{r.current&&(r.current.style.transform=`translate(${c.clientX+12}px, ${c.clientY+12}px)`);};return document.addEventListener("pointermove",o),()=>document.removeEventListener("pointermove",o)},[]),jsxRuntime.jsx("div",{ref:r,className:n,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var gn=mn__default.default.memo(({tabDetails:e,target:t,renderWidget:n})=>{let{id:r}=e,o=Ee(r),{renderPopoutWrapper:c}=ie(),[u,i]=mn.useState(false),a=mn.useRef(null),d=mn.useMemo(()=>({...e,metadata:o}),[e,o]);if(mn.useEffect(()=>{i(true);},[]),mn.useEffect(()=>{if(!u||!a.current)return;let y=a.current;if(t)t.ownerDocument.adoptNode(y),t.appendChild(y);else {let S=document.getElementById("zeugma-hidden-portal-container");S||(S=document.createElement("div"),S.id="zeugma-hidden-portal-container",S.style.display="none",document.body.appendChild(S)),document.adoptNode(y),S.appendChild(y);}},[t,u]),mn.useEffect(()=>()=>{a.current&&a.current.remove();},[]),!u)return null;let l=t?t.ownerDocument:document;a.current&&a.current.ownerDocument!==l&&l.adoptNode(a.current),a.current||(a.current=l.createElement("div"),a.current.className=`zeugma-portal-wrapper-${r}`,a.current.style.width="100%",a.current.style.height="100%");let m=a.current;if(!m||!n)return null;let g=!!(t&&t.ownerDocument&&t.ownerDocument!==document),b=g?"-popped":"-docked",T=jsxRuntime.jsx(mn__default.default.Fragment,{children:n(d)},`${r}${b}`);return g&&c&&(T=c({tabId:r,document:l,window:l.defaultView||window,children:T})),reactDom.createPortal(T,m)},(e,t)=>e.target===t.target&&e.renderWidget===t.renderWidget&&e.tabDetails.id===t.tabDetails.id&&e.tabDetails.paneId===t.tabDetails.paneId&&e.tabDetails.isActive===t.tabDetails.isActive&&e.tabDetails.index===t.tabDetails.index);var bn=({activeId:e,activeType:t,dismissIntentId:n,renderDragOverlay:r,renderPaneRef:o,renderPane:c,tabHeadersRef:u,classNames:i})=>{if(r)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:r({type:t,id:e,isDismissing:e===n})});if(t==="pane"){let a=o.current||c;if(a)return jsxRuntime.jsx("div",{className:i.paneDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:a(e)})}else if(t==="tab"){let a=o.current||c;if(a)return jsxRuntime.jsx("div",{className:i.tabDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:a(e)});let d=u.current[e];if(d){let l=i.tab?typeof i.tab=="function"?i.tab(e):i.tab:"";return jsxRuntime.jsx("div",{className:`${i.tabDragPreview||""} ${l}`.trim(),style:{display:"inline-flex",position:"relative",pointerEvents:"none",overflow:"hidden"},children:d({isDragging:true,isOver:false})})}}return jsxRuntime.jsx("div",{style:{pointerEvents:"none",overflow:"hidden",width:"100%",height:"100%"}})};function Dt({containerRef:e,isRow:t,direction:n,splitPercentage:r,resizerSize:o,snapThreshold:c,layout:u,currentNode:i,onLayoutChange:a,onResizeStart:d,onResizeEnd:l,parentLeft:m,parentTop:g,parentWidth:b,parentHeight:T}){let{onResizeStart:y,onResize:S,onResizeEnd:k,minSplitPercentage:h=5,maxSplitPercentage:z=95,locked:D=false}=ie();return mn.useCallback(M=>{if(D)return;M.preventDefault();let E=e.current;if(!E)return;d&&d(),y&&y(i);let s=E.getBoundingClientRect(),p=M.clientX,v=M.clientY,x=r,$=M.currentTarget,V=s.left+s.width*(m/100),W=s.top+s.height*(g/100),B=s.width*(b/100),ae=s.height*(T/100),j=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(C=>C!==$&&C.getAttribute("data-direction")===n).map(C=>{let I=C.getBoundingClientRect();return t?I.left+I.width/2:I.top+I.height/2}),F=x;$t({cursor:t?"col-resize":"row-resize",resizerEl:$,onMove:C=>{let I=t?(C.clientX-p)/B*100:(C.clientY-v)/ae*100,P=x+I,L=t?V+(B-o)*(P/100)+o/2:W+(ae-o)*(P/100)+o/2,R=1/0,A=null;for(let X of j){let ne=Math.abs(L-X);ne<c&&ne<R&&(R=ne,A=X);}let me=P;A!==null&&(me=t?(A-o/2-V)/(B-o)*100:(A-o/2-W)/(ae-o)*100);let ee=Math.max(h,Math.min(z,me));F=ee;let te=ke(u,i,ee);if(te){let{panes:X,splitters:ne}=we(te),N=e.current;if(N){for(let O of X)N.style.setProperty(`--pane-left-${O.paneId}`,`${O.left}%`),N.style.setProperty(`--pane-top-${O.paneId}`,`${O.top}%`),N.style.setProperty(`--pane-width-${O.paneId}`,`${O.width}%`),N.style.setProperty(`--pane-height-${O.paneId}`,`${O.height}%`);for(let O of ne)N.style.setProperty(`--splitter-pos-${O.id}`,`${O.direction==="row"?O.left:O.top}%`);}}S&&S(i,ee);},onEnd:()=>{let C=ke(u,i,F),I=e.current;if(I){let{panes:P,splitters:L}=we(C);for(let R of P)I.style.removeProperty(`--pane-left-${R.paneId}`),I.style.removeProperty(`--pane-top-${R.paneId}`),I.style.removeProperty(`--pane-width-${R.paneId}`),I.style.removeProperty(`--pane-height-${R.paneId}`);for(let R of L)I.style.removeProperty(`--splitter-pos-${R.id}`);}a(C),l&&l(),k&&k(i,F);}});},[e,t,n,r,o,c,u,i,a,d,l,y,S,k,h,z,m,g,b,T])}var vn=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:r})=>{let{renderingLayout:o,setLayout:c,classNames:u,locked:i}=ie(),[a,d]=mn.useState(false),{currentNode:l,direction:m,left:g,top:b,width:T,height:y,parentLeft:S,parentTop:k,parentWidth:h,parentHeight:z}=e,D=m==="row",M=Dt({containerRef:r,isRow:D,direction:m,splitPercentage:l.splitPercentage,resizerSize:t,snapThreshold:n,layout:o,currentNode:l,onLayoutChange:c,onResizeStart:()=>d(true),onResizeEnd:()=>d(false),parentLeft:S,parentTop:k,parentWidth:h,parentHeight:z}),E=D?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${g}%) - ${t/2}px)`,top:`calc(${b}% + ${t/2}px)`,width:`${t}px`,height:`calc(${y}% - ${t}px)`,cursor:i?"default":"col-resize",pointerEvents:i?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"}:{position:"absolute",left:`calc(${g}% + ${t/2}px)`,top:`calc(var(--splitter-pos-${e.id}, ${b}%) - ${t/2}px)`,width:`calc(${T}% - ${t}px)`,height:`${t}px`,cursor:i?"default":"row-resize",pointerEvents:i?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsxRuntime.jsx("div",{className:u.resizer||"","data-direction":m,"data-resizing":a||void 0,style:E,onPointerDown:M,role:"separator","aria-valuenow":l.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},hn=mn__default.default.memo(({paneId:e,renderPane:t})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:t(e)}),(e,t)=>e.paneId===t.paneId&&e.renderPane===t.renderPane);var St=({renderPane:e,tree:t,resizerSize:n,snapThreshold:r})=>{qt(e);let{renderingLayout:o,activeId:c,dismissIntentId:u,setContainerRef:i,fullscreenPaneId:a,snapThreshold:d,locked:l,classNames:m,resizerSize:g}=ie(),b=r!==void 0?r:d??8,T=n!==void 0?n:g??4,y=t!==void 0?t:o,S=mn.useRef(null),{panes:k,splitters:h}=mn.useMemo(()=>y?we(y):{panes:[],splitters:[]},[y]);if(!y&&t!==void 0)return null;let z=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[k.map(D=>{let M=a===D.paneId;return jsxRuntime.jsx("div",{style:{position:"absolute",left:M?"0%":`var(--pane-left-${D.paneId}, ${D.left}%)`,top:M?"0%":`var(--pane-top-${D.paneId}, ${D.top}%)`,width:M?"100%":`var(--pane-width-${D.paneId}, ${D.width}%)`,height:M?"100%":`var(--pane-height-${D.paneId}, ${D.height}%)`,overflow:"hidden",zIndex:M?20:1,display:a&&!M?"none":"block",padding:M?"0px":`${T/2}px`,boxSizing:"border-box"},children:jsxRuntime.jsx(hn,{paneId:D.paneId,renderPane:e})},D.paneId)}),!a&&h.map(D=>jsxRuntime.jsx(vn,{splitter:D,resizerSize:T,snapThreshold:b,containerRef:S},D.id))]});if(t===void 0){let D=c!==null&&c===u,M=s=>{i(s),S.current=s;},E=`${m.dashboard||""} ${D&&m.dashboardDismissActive||""} ${l&&m.dashboardLocked||""}`.trim();return jsxRuntime.jsxs("div",{ref:M,className:E,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:[z(),c!==null&&!l&&jsxRuntime.jsx(Pn,{activeClassName:m.rootDropPreview??m.dropPreview})]})}return jsxRuntime.jsx("div",{ref:S,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:z()})};var Io=e=>{let{controller:t,children:n,renderDragOverlay:r,classNames:o={},renderPane:c,resizerSize:u,dragActivationDistance:i=8,snapThreshold:a=8,minSplitPercentage:d=5,maxSplitPercentage:l=95,enableDragToDismiss:m=false,dismissThreshold:g=60,onRemove:b,onDragStart:T,onDragEnd:y,onResizeStart:S,onResize:k,onResizeEnd:h,onDismissIntentChange:z,persist:D=false,renderPopoutWrapper:M}=e,E=t,{layout:s,setLayout:p,_internalSetLayout:v,renderingLayout:x,fullscreenPaneId:$,setFullscreenPaneId:V,locked:W,setLocked:B,findPaneById:ae,findPaneContainingTab:Z,findTabById:j,getTabMetadata:F,getActiveTabMetadata:C,activeId:I,setActiveId:P,activeType:L,setActiveType:R,dismissIntentId:A,setDismissIntentId:me,containerRef:ee,setContainerRef:te,removePane:X,addTab:ne,updateMetadata:N,updatePaneLock:O,selectTab:ue,mergeTab:de,removeTab:G,splitPane:oe,updateSplitPercentage:Me,moveTab:re,poppedOutTabIds:se=[],popoutTab:q,dockTab:pe}=E;an({persist:D,layout:s,setLayout:p,metadataStore:E.metadataStore});let{portalTargets:J,registerPortalTarget:Te,registerPopoutTarget:K,registerRenderCallback:f,renderCallbacksRef:w,registerRenderPane:H,renderPaneRef:_,registerTabHeader:le,tabHeadersRef:Re,activeIdRef:xe}=Vt();pn({poppedOutTabIds:se,registerPopoutTarget:K,findTabById:j,dockTab:pe});let tt=mn.useCallback(ge=>se.includes(ge),[se]),{overTabId:At,setOverTabId:Hn,overTabPosition:zt,setOverTabPosition:$n,handleDragStartInternal:Bn,handleDragEndInternal:Fn}=jt({onDragStart:T,onDragEnd:y}),_n=sn({layout:s,_internalSetLayout:v,setLayout:p,activeId:I,setActiveId:P,activeType:L,setActiveType:R,dismissIntentId:A,setDismissIntentId:me,setOverTabId:Hn,setOverTabPosition:$n,containerRef:ee,dragActivationDistance:i,enableDragToDismiss:m,dismissThreshold:g,onRemove:b,onDragStart:Bn,onDragEnd:Fn,onDismissIntentChange:z,removeTab:G,removePane:X}),vt=mn.useMemo(()=>o,[o.dashboard,o.dashboardDismissActive,o.pane,o.paneLocked,o.dropPreview,o.rootDropPreview,o.dragOverlay,o.paneDragPreview,o.tabDragPreview,o.resizer,o.dismissPreview,o.dashboardLocked,o.lockedPreview,o.tabDropPreview,o.tabSeparator,o.tabsContainer,o.tab,o.paneContainer,o.paneHeader,o.paneControls,o.paneButton,o.tabCloseButton,o.dragHandle]),Zt=mn.useCallback((ge,nt)=>{h&&h(ge,nt);},[h]),Vn=mn.useMemo(()=>({layout:s,renderingLayout:x,setLayout:p,activeId:I,activeType:L,dismissIntentId:A,setContainerRef:te,fullscreenPaneId:$,classNames:vt,onRemove:b,onFullscreenChange:V,snapThreshold:a,onResizeStart:S,onResize:k,onResizeEnd:Zt,minSplitPercentage:d,maxSplitPercentage:l,locked:W,setLocked:B,findPaneById:ae,findPaneContainingTab:Z,findTabById:j,getTabMetadata:F,getActiveTabMetadata:C,renderPane:c,resizerSize:u,poppedOutTabIds:se,isTabPoppedOut:tt,renderPopoutWrapper:M}),[s,x,I,L,A,te,$,vt,b,V,a,S,k,d,l,p,Zt,W,B,ae,Z,j,F,C,c,u,se,tt,M]),Wn=mn.useMemo(()=>({overTabId:At,overTabPosition:zt}),[At,zt]),jn=mn.useMemo(()=>({removePane:X,addTab:ne,updateMetadata:N,updatePaneLock:O,selectTab:ue,mergeTab:de,removeTab:G,setFullscreenPaneId:V,setLocked:B,splitPane:oe,updateSplitPercentage:Me,moveTab:re,popoutTab:q,dockTab:pe}),[X,ne,N,O,ue,de,G,V,B,oe,Me,re,q,pe]),qn=Wt(s),Un=mn.useMemo(()=>({registerPortalTarget:Te,registerRenderCallback:f,renderCallbacksRef:w,registerRenderPane:H,renderPaneRef:_,registerTabHeader:le,tabHeadersRef:Re,activeIdRef:xe,registerPopoutTarget:K}),[Te,f,w,H,_,le,Re,xe,K]);return xe&&(xe.current=I),jsxRuntime.jsx(Ue.Provider,{value:E.metadataStore,children:jsxRuntime.jsx(Ie.Provider,{value:jn,children:jsxRuntime.jsx(yt.Provider,{value:Vn,children:jsxRuntime.jsx(Tt.Provider,{value:Wn,children:jsxRuntime.jsxs(Se.Provider,{value:Un,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",..._n,children:n}),I&&L&&jsxRuntime.jsx(fn,{activeId:I,render:ge=>jsxRuntime.jsx("div",{style:{transition:"transform 150ms cubic-bezier(0.2, 0, 0, 1)",transform:ge===A?"scale(0.8)":"scale(1)",transformOrigin:"top left"},children:jsxRuntime.jsx(bn,{activeId:ge,activeType:L,dismissIntentId:A,renderDragOverlay:r,renderPaneRef:_,renderPane:c,tabHeadersRef:Re,classNames:vt})}),className:`${o.dragOverlay||""} ${I===A&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:qn.map(ge=>{let nt=J[ge],Ht=j(ge);return Ht?jsxRuntime.jsx(gn,{tabDetails:Ht,target:nt||null,renderWidget:w.current[ge]},ge):null})})]})})})})})},Lo=({renderPane:e,resizerSize:t,snapThreshold:n})=>{if(!e)throw new Error("Zeugma component requires a renderPane prop when used as a standalone renderer.");return jsxRuntime.jsx(St,{renderPane:e,resizerSize:t,snapThreshold:n})},ko=e=>{let{children:t,...n}=e,{controller:r}=e;if(!r)throw new Error("Zeugma component requires a controller.");return jsxRuntime.jsx(Io,{...e,children:t!==void 0?t:jsxRuntime.jsx(Lo,{...n})})};var Ao={top:{"1/4":{position:"absolute",top:0,left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",top:"24px",left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"}},bottom:{"1/4":{position:"absolute",bottom:0,left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",bottom:"24px",left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"}},left:{"1/4":{position:"absolute",left:0,top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",left:"24px",top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"}},right:{"1/4":{position:"absolute",right:0,top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",right:"24px",top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"}}},zo={top:{"1/4":{top:0,left:0,width:"100%",height:"60px",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px"},"1/3":{top:0,left:0,width:"100%",height:"96px",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},bottom:{"1/4":{bottom:0,left:0,width:"100%",height:"60px",borderTopLeftRadius:"12px",borderTopRightRadius:"12px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},"1/3":{bottom:0,left:0,width:"100%",height:"96px",borderTopLeftRadius:"12px",borderTopRightRadius:"12px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"}},left:{"1/4":{left:0,top:0,width:"60px",height:"100%",borderTopRightRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},"1/3":{left:0,top:0,width:"96px",height:"100%",borderTopRightRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"}},right:{"1/4":{right:0,top:0,width:"60px",height:"100%",borderTopLeftRadius:"12px",borderBottomLeftRadius:"12px",borderTopRightRadius:"0px",borderBottomRightRadius:"0px"},"1/3":{right:0,top:0,width:"96px",height:"100%",borderTopLeftRadius:"12px",borderBottomLeftRadius:"12px",borderTopRightRadius:"0px",borderBottomRightRadius:"0px"}}},Zo=({id:e,fraction:t,edge:n,activeClassName:r})=>{let{setNodeRef:o,isOver:c}=core.useDroppable({id:e}),u={position:"absolute",pointerEvents:"none",zIndex:101,boxSizing:"border-box",...zo[n][t]};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:o,style:Ao[n][t]}),c&&jsxRuntime.jsx("div",{className:r,style:u})]})},Pn=({activeClassName:e})=>jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:99,pointerEvents:"none"},children:[{id:"drop-root-1/4-top",fraction:"1/4",edge:"top"},{id:"drop-root-1/3-top",fraction:"1/3",edge:"top"},{id:"drop-root-1/4-bottom",fraction:"1/4",edge:"bottom"},{id:"drop-root-1/3-bottom",fraction:"1/3",edge:"bottom"},{id:"drop-root-1/4-left",fraction:"1/4",edge:"left"},{id:"drop-root-1/3-left",fraction:"1/3",edge:"left"},{id:"drop-root-1/4-right",fraction:"1/4",edge:"right"},{id:"drop-root-1/3-right",fraction:"1/3",edge:"right"}].map(n=>jsxRuntime.jsx(Zo,{id:n.id,fraction:n.fraction,edge:n.edge,activeClassName:e},n.id))});var pt=mn.createContext(null);var _o={top:{position:"absolute",top:0,left:0,width:"100%",height:"25%",zIndex:20,pointerEvents:"auto"},bottom:{position:"absolute",bottom:0,left:0,width:"100%",height:"25%",zIndex:20,pointerEvents:"auto"},left:{position:"absolute",top:"25%",left:0,width:"50%",height:"50%",zIndex:20,pointerEvents:"auto"},right:{position:"absolute",top:"25%",right:0,width:"50%",height:"50%",zIndex:20,pointerEvents:"auto"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:20,pointerEvents:"auto",cursor:"not-allowed"},center:{position:"absolute",top:"25%",left:"25%",width:"50%",height:"50%",zIndex:22,pointerEvents:"auto"}},Vo={top:{position:"absolute",top:0,left:0,right:0,height:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},bottom:{position:"absolute",bottom:0,left:0,right:0,height:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},left:{position:"absolute",top:0,bottom:0,left:0,width:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},right:{position:"absolute",top:0,bottom:0,right:0,width:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:21,pointerEvents:"none",boxSizing:"border-box"},center:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:21,pointerEvents:"none",boxSizing:"border-box"}},ft=({id:e,position:t,activeClassName:n})=>{let{setNodeRef:r,isOver:o}=core.useDroppable({id:e});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:r,style:_o[t]}),o&&jsxRuntime.jsx("div",{className:n,style:Vo[t]})]})};var wn=({children:e,className:t,style:n})=>{let r=mn.useContext(pt);if(!r)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:o,...c}=r;return jsxRuntime.jsx("div",{className:t,style:{cursor:o?"default":"grab",userSelect:o?"auto":"none",touchAction:o?"auto":"none",...n},...o?{}:c,children:e})};var Qo=mn.createContext(void 0);var Ke=({id:e,locked:t=false,children:n,className:r,style:o})=>{let{locked:c,classNames:u={},fullscreenPaneId:i,poppedOutTabIds:a=[]}=ie(),d=mn.useContext(Ie),{overTabId:l}=rt(),m=mn.useContext(Se),g=Ee(e);mn.useEffect(()=>(m?.registerTabHeader&&m.registerTabHeader(e,n),()=>{m?.registerTabHeader&&m.activeIdRef?.current!==e&&m.registerTabHeader(e,()=>null);}),[e,n,m]);let b=a.includes(e),T=mn.useContext(Nt),y=t||c||(T?.locked??false)||i!==null,{attributes:S,listeners:k,setNodeRef:h,isDragging:z}=core.useDraggable({id:`tab-header-${e}`,disabled:y}),{setNodeRef:D,isOver:M}=core.useDroppable({id:`tab-drop-${e}`,disabled:y}),E=j=>{h(j),D(j);},s=M&&l===e,p=T?.tabIds||[],v=p.indexOf(e),x=T?.activeTabId,V=v>0&&e!==x&&p[v-1]!==x?jsxRuntime.jsx("div",{className:u.tabSeparator}):null,W=T?T.activeTabId===e:false,B=mn.useCallback(()=>{T?.selectTab(e);},[T,e]),ae=mn.useCallback(()=>{T?.removeTab(e);},[T,e]),Z=mn.useMemo(()=>({tabId:e,isActive:W,isDragging:z,isOver:s,metadata:g,locked:y,selectTab:B,removeTab:ae,isPoppedOut:b,popoutTab:()=>d?.popoutTab(e),dockTab:()=>d?.dockTab(e)}),[e,W,z,s,g,y,B,ae,b,d]);return jsxRuntime.jsx(Qo.Provider,{value:Z,children:jsxRuntime.jsxs("div",{ref:E,id:`tab-header-${e}`,className:r,style:{display:"inline-flex",position:"relative",cursor:y?"default":"grab",...o},...y?{}:k,...y?{}:S,children:[V,n({isDragging:z,isOver:s,metadata:g})]})})};var Nt=mn.createContext(void 0);var En=(e,t)=>typeof e=="function"?e(t):e,It=({tabIds:e,activeTabId:t,locked:n,selectTab:r,removeTab:o,renderTab:c,classNames:u,styles:i})=>{let a=mn.useContext(mt),d=e??a?.tabIds??[],l=t??a?.activeTabId??"",m=n??a?.locked??false,g=r??a?.selectTab??(()=>{}),b=o??a?.removeTab??(()=>{}),{classNames:T={},activeType:y,poppedOutTabIds:S=[]}=ie(),k=mn.useContext(Ie),{overTabId:h,overTabPosition:z}=rt(),D=mn.useMemo(()=>({tabIds:d,activeTabId:l,locked:m,selectTab:g,removeTab:b}),[d,l,m,g,b]),M=Jt(d,y,h,z);return jsxRuntime.jsx(Nt.Provider,{value:D,children:jsxRuntime.jsxs("div",{className:u?.container,style:{display:"flex",alignItems:"center",height:"100%",...i?.container},children:[d.map((E,s)=>{let p=En(u?.tab,E),v=En(i?.tab,E),x=s===M;return jsxRuntime.jsxs(mn__default.default.Fragment,{children:[x&&T.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:T.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:s===0?"none":"translateX(-50%)"}})}),jsxRuntime.jsx(Ke,{id:E,locked:m,className:p,style:v,children:({isDragging:$,isOver:V,metadata:W})=>c({id:E,paneId:a?.id??"",isActive:E===l,index:s,isDragging:$,isOver:V,metadata:W,onSelect:()=>g(E),onRemove:()=>b(E),isPoppedOut:S.includes(E),popout:()=>k?.popoutTab(E),dock:()=>k?.dockTab(E)})})]},E)}),M===d.length&&T.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:T.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:"translateX(-100%)"}})})]})})};It.Tab=Ke;var In=({className:e,style:t,children:n})=>jsxRuntime.jsx("div",{className:e,style:t,children:n});var mt=mn.createContext(void 0),kn=()=>{let e=mn.useContext(mt);if(!e)throw new Error("usePaneContext must be used within a Pane component");return e},cr=({children:e,className:t,style:n})=>{let{activeTabId:r}=kn(),{classNames:o,isTabPoppedOut:c}=ie(),{dockTab:u}=We(),i=mn.useRef(null),a=mn.useContext(Se);if(!a)throw new Error("PaneContent must be used within a Zeugma provider");let{registerPortalTarget:d,registerRenderCallback:l}=a,m=mn.useMemo(()=>typeof e=="function"?e:()=>e,[e]);l(r,m),mn.useEffect(()=>{let b=i.current;return d(r,b),()=>{d(r,null,b);}},[r,d]);let g=c(r);return jsxRuntime.jsx("div",{ref:i,id:`zeugma-tab-target-${r}`,className:`${o.tabContentWrapper||""} ${t||""}`.trim(),style:{height:"100%",width:"100%",position:"relative",...n},children:g&&jsxRuntime.jsxs("div",{className:"zeugma-popout-placeholder",style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"12px",padding:"24px",textAlign:"center",backgroundColor:"#161719",color:"#94a3b8",fontSize:"13px",fontWeight:500},children:[jsxRuntime.jsx("div",{children:"This panel is open in a new window"}),jsxRuntime.jsx("button",{onClick:()=>u(r),style:{padding:"6px 12px",fontSize:"11px",fontWeight:600,borderRadius:"4px",backgroundColor:"#2563eb",color:"#ffffff",border:"none",cursor:"pointer",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},onMouseOver:b=>{b.currentTarget.style.backgroundColor="#1d4ed8";},onMouseOut:b=>{b.currentTarget.style.backgroundColor="#2563eb";},children:"Dock Back"})]})})},Fe=({id:e,children:t,style:n,locked:r=false})=>{let{layout:o,renderingLayout:c,activeId:u,activeType:i,classNames:a,fullscreenPaneId:d,onFullscreenChange:l,locked:m,poppedOutTabIds:g=[]}=ie(),{removePane:b,updateMetadata:T,selectTab:y,removeTab:S,popoutTab:k,dockTab:h}=We(),z=mn.useMemo(()=>i==="tab"&&e===u?{type:"pane",id:e,tabIds:[e],activeTabId:e}:Xt(e===u?o:c,e),[o,c,e,u,i]),D=z?.id??e,M=z?.tabIds??[e],E=z?.activeTabId??e,s=Ee(E),p=Ee(e),v=s??p,x=z?.locked??false,$=r||x,V=m||$||d!==null,W=m||$||d!==null,B=u!==null&&u!==e&&(!M.includes(u)||M.length>1)&&!W,{attributes:ae,listeners:Z,setNodeRef:j}=core.useDraggable({id:e,disabled:V}),F=u!==null&&M.includes(u),C=d===e,I=mn.useMemo(()=>({isDragging:F,isFullscreen:C,toggleFullscreen:()=>l?.(C?null:e),remove:()=>{C&&l?.(null),b(D);},metadata:v,updateMetadata:R=>{T(E||e,R);},locked:V,tabIds:M,activeTabId:E,selectTab:R=>y(D,R),removeTab:R=>{C&&R===E&&l?.(null),S(R);},updateTabMetadata:(R,A)=>{T(R,A);},isActiveTabPoppedOut:g.includes(E),popoutTab:R=>k(R||E),dockTab:R=>h(R||E)}),[F,C,l,e,S,v,T,V,M,E,y,D,g,k,h]),P=mn.useMemo(()=>V?{disabled:true}:{...Z,...ae},[Z,ae,V]),L=`${a.pane||""} ${$&&a.paneLocked||""}`.trim();return jsxRuntime.jsx(mt.Provider,{value:{id:e,...I},children:jsxRuntime.jsx(pt.Provider,{value:P,children:jsxRuntime.jsxs("div",{ref:j,id:e,className:L,style:{position:"relative",width:"100%",height:"100%",...n},children:[t,B&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:[["top","bottom","left","right"].map(R=>jsxRuntime.jsx(ft,{id:`drop-${R}-${e}`,position:R,activeClassName:a.dropPreview},R)),i==="tab"&&jsxRuntime.jsx(ft,{id:`drop-center-${e}`,position:"center",activeClassName:a.swapPreview??a.dropPreview})]}),u!==null&&u!==e&&W&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsxRuntime.jsx(ft,{id:`drop-locked-${e}`,position:"full",activeClassName:a.lockedPreview||""})})]})})})};Fe.Content=cr;Fe.DragHandle=wn;Fe.Tabs=It;Fe.Tab=Ke;Fe.Controls=In;var bt=new Map;function Qe(e){let t=bt.get(e);return t||(t={mounts:0,renders:0,listeners:new Set},bt.set(e,t)),t}function On(e,t){let n=Qe(e);return n.listeners.add(t),()=>{n.listeners.delete(t);}}function kt(e){let t=bt.get(e);t&&t.listeners.forEach(n=>n());}function Mn(e){let t=bt.get(e);t&&(t.mounts=0,t.renders=0,kt(e));}function _e(e,t){let n=mn.useId(),r=typeof e=="string"?{id:e,...t}:e||{},{id:o=n,logToConsole:c=false,disabled:u=false}=r,i=mn.useRef(0),a=mn.useRef(false),[,d]=mn.useState(0);if(u||(i.current+=1),mn.useEffect(()=>{if(u)return;let g=On(o,()=>{d(T=>T+1);}),b=Qe(o);return b.mounts+=1,a.current=true,c&&console.log(`[DevTools:${o}] Mounted: ${b.mounts} | Rendered: ${i.current}`),kt(o),()=>{a.current=false,g();}},[o,u,c]),!u){let g=Qe(o);g.renders=Math.max(g.renders,i.current);}let l=mn.useCallback(()=>{i.current=0,Mn(o);},[o]);return u?{mounts:0,renders:0,reset:l}:{mounts:Qe(o).mounts,renders:i.current,reset:l}}function zn({id:e,className:t,style:n,logToConsole:r=false,disabled:o=false}){let{mounts:c,renders:u}=_e(e,{logToConsole:r,disabled:o});return o?null:jsxRuntime.jsxs("div",{className:t,style:n,children:[jsxRuntime.jsxs("span",{children:["M: ",jsxRuntime.jsx("strong",{children:c})]}),jsxRuntime.jsx("span",{children:"|"}),jsxRuntime.jsxs("span",{children:["R: ",jsxRuntime.jsx("strong",{children:u})]})]})}function Zn({id:e,label:t,children:n,className:r,footerClassName:o,style:c,logToConsole:u=false,disabled:i=false}){let a=t||e||"widget",{mounts:d,renders:l}=_e(e,{logToConsole:u,disabled:i});return i?jsxRuntime.jsx(jsxRuntime.Fragment,{children:n}):jsxRuntime.jsxs("div",{className:r,style:c,children:[n&&jsxRuntime.jsx("div",{style:{flex:1,height:"100%",width:"100%",minHeight:0,overflow:"hidden",position:"relative"},children:n}),jsxRuntime.jsxs("div",{className:o,children:[jsxRuntime.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntime.jsxs("span",{children:["Mounts: ",jsxRuntime.jsx("strong",{className:"counter-mounts",children:d})]}),jsxRuntime.jsx("span",{children:"|"}),jsxRuntime.jsxs("span",{children:["Renders: ",jsxRuntime.jsx("strong",{className:"counter-renders",children:l})]})]})]})]})}exports.Pane=Fe;exports.PaneTree=St;exports.RenderCounterBadge=zn;exports.RenderCounterFooter=Zn;exports.Zeugma=ko;exports.useAllMetadata=Qn;exports.usePaneContext=kn;exports.useRenderCounter=_e;exports.useResizer=Dt;exports.useTabMetadata=Ee;exports.useZeugma=eo;exports.useZeugmaContext=to;//# sourceMappingURL=index.cjs.map
|
|
9
|
+
`,document.head.appendChild(o),t.setAttribute("data-resizing","true");let c=s=>{n(s);},u=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let s=document.getElementById("zeugma-global-cursor-style");s&&s.remove(),document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",u),r();};document.addEventListener("pointermove",c),document.addEventListener("pointerup",u);}var mt=un.createContext(void 0),xe=un.createContext(void 0),Te=un.createContext(void 0),gt=un.createContext(void 0),ae=()=>{let e=un.useContext(mt);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},Ze=()=>{let e=un.useContext(xe);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e},Ge=()=>{let e=un.useContext(gt);if(!e)throw new Error("useZeugmaDrag must be used within a Zeugma provider");return e};function zt(e){let t=un.useRef(null);return un.useEffect(()=>{if(!e){t.current=null;return}let n=o=>{t.current={x:o.clientX,y:o.clientY};},r=o=>{let c=o.touches[0]||o.changedTouches[0];c&&(t.current={x:c.clientX,y:c.clientY});};return window.addEventListener("pointermove",n,{passive:true}),window.addEventListener("touchmove",r,{passive:true}),()=>{window.removeEventListener("pointermove",n),window.removeEventListener("touchmove",r);}},[e]),t}function Zt(e){un.useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function Ht(){let[e,t]=un.useState({}),[n,r]=un.useState({}),o=un.useRef({}),c=un.useRef(null),u=un.useRef({}),s=un.useRef(null),l=un.useRef(true);un.useEffect(()=>(l.current=true,()=>{l.current=false;}),[]);let p=un.useCallback((T,C,N)=>{l.current&&t(h=>{if(!C){if(N&&h[T]!==N||!h[T])return h;let Z={...h};return delete Z[T],Z}return h[T]===C?h:{...h,[T]:C}});},[]),i=un.useCallback((T,C)=>{l.current&&r(N=>{if(!C){if(!N[T])return N;let h={...N};return delete h[T],h}return N[T]===C?N:{...N,[T]:C}});},[]),v=un.useCallback((T,C)=>{o.current[T]=C;},[]),g=un.useCallback(T=>{c.current=T;},[]),m=un.useCallback((T,C)=>{u.current[T]=C;},[]);return {portalTargets:un.useMemo(()=>({...e,...n}),[e,n]),registerPortalTarget:p,registerPopoutTarget:i,registerRenderCallback:v,renderCallbacksRef:o,registerRenderPane:g,renderPaneRef:c,registerTabHeader:m,tabHeadersRef:u,activeIdRef:s}}function jn(e){let t=new Set;function n(r){r&&(r.type==="pane"?r.tabIds.forEach(o=>{t.add(o);}):r.type==="split"&&(n(r.first),n(r.second)));}return n(e),Array.from(t).sort()}function $t(e){return un.useMemo(()=>jn(e),[e])}function Bt(e){let{onDragStart:t,onDragEnd:n}=e,[r,o]=un.useState(null),[c,u]=un.useState(null),s=un.useCallback(p=>{t&&t(p);},[t]),l=un.useCallback((p,i,v)=>{n&&n(p,i,v);},[n]);return {overTabId:r,setOverTabId:o,overTabPosition:c,setOverTabPosition:u,handleDragStartInternal:s,handleDragEndInternal:l}}function Ft(e){let n=un.useContext(Te)?.registerRenderPane;un.useEffect(()=>{n&&e&&n(e);},[n,e]);}function fe(){return "pane-"+Math.random().toString(36).substring(2,11)}function ve(e,t){if(e===null)return null;if(e.type==="pane")return e.id===t?null:e;let n=ve(e.first,t),r=ve(e.second,t);return n===null?r:r===null?n:{...e,first:n,second:r}}function me(e,t){if(e===null)return null;if(e.type==="pane"){if(e.tabIds.includes(t)){let o=e.tabIds.filter(s=>s!==t);if(o.length===0)return null;let c=e.activeTabId;e.activeTabId===t&&(c=o[0]);let u={...e.tabsMetadata};return delete u[t],{...e,tabIds:o,activeTabId:c,tabsMetadata:Object.keys(u).length>0?u:void 0}}return e}let n=me(e.first,t),r=me(e.second,t);return n===null?r:r===null?n:{...e,first:n,second:r}}function Se(e,t,n,r,o){if(e===null)return typeof o=="string"?{type:"pane",id:fe(),tabIds:[o],activeTabId:o}:o;if(e.type==="pane"){if(e.id===t){let c=typeof o=="string"?{type:"pane",id:fe(),tabIds:[o],activeTabId:o}:o,u=r==="left"||r==="top";return {type:"split",direction:n,first:u?c:e,second:u?e:c,splitPercentage:50}}return e}return {...e,first:Se(e.first,t,n,r,o)||e.first,second:Se(e.second,t,n,r,o)||e.second}}function qn(e,t){if(e===null)return t;function n(r,o){return r.type==="pane"?{type:"split",direction:o==="row"?"column":"row",splitPercentage:50,first:r,second:t}:{...r,second:n(r.second,r.direction)}}return n(e,null)}function _t(e,t,n,r){if(e===null)return {type:"pane",id:fe(),tabIds:[n],activeTabId:n,tabsMetadata:r?{[n]:r}:void 0};let o=t?re(e,t):null;if(o&&o.type==="pane"){let s=function(l){if(l.type==="pane"&&l.id===t){let p=[...l.tabIds];p.includes(n)||p.push(n);let i=l.tabsMetadata;return r&&(i={...l.tabsMetadata,[n]:r}),{...l,tabIds:p,activeTabId:n,tabsMetadata:i}}return l.type==="split"?{...l,first:s(l.first),second:s(l.second)}:l};return s(e)}let c={type:"pane",id:fe(),tabIds:[n],activeTabId:n,tabsMetadata:r?{[n]:r}:void 0};return qn(e,c)}function Ce(e,t,n){return e===null?null:e===t?{...e,splitPercentage:n}:e.type==="split"?{...e,first:Ce(e.first,t,n)||e.first,second:Ce(e.second,t,n)||e.second}:e}function re(e,t){return e===null?null:e.type==="pane"?e.id===t?e:null:e.type==="split"?re(e.first,t)??re(e.second,t):null}function j(e,t){return e===null?null:e.type==="pane"?e.tabIds.includes(t)?e:null:e.type==="split"?j(e.first,t)??j(e.second,t):null}function Vt(e,t){return re(e,t)??j(e,t)}function et(e,t){let n=j(e,t);if(!n)return null;let r=n.tabIds.indexOf(t);return {id:t,paneId:n.id,isActive:n.activeTabId===t,index:r,metadata:n.tabsMetadata?.[t]}}function Wt(e,t){return j(e,t)?.tabsMetadata?.[t]}function jt(e,t){let n=re(e,t);return n?.tabsMetadata?.[n.activeTabId]}function Ke(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.id===t){if(n===false){let{locked:r,...o}=e;return o}return {...e,locked:n}}return e}return e.type==="split"?{...e,first:Ke(e.first,t,n)??e.first,second:Ke(e.second,t,n)??e.second}:e}function Ne(e,t,n){return e===null?null:e.type==="pane"?e.id===t?e.activeTabId===n?e:{...e,activeTabId:n}:e:e.type==="split"?{...e,first:Ne(e.first,t,n)??e.first,second:Ne(e.second,t,n)??e.second}:e}function qt(e,t,n){if(e===null)return null;let o=j(e,t)?.tabsMetadata?.[t],c=me(e,t);if(c===null)return {type:"pane",id:fe(),tabIds:[t],activeTabId:t,tabsMetadata:o?{[t]:o}:void 0};function u(s){if(s.type==="pane"){if(s.id===n){let l=[...s.tabIds];l.includes(t)||l.push(t);let p={...s.tabsMetadata};return o&&(p[t]=o),{...s,tabIds:l,activeTabId:t,tabsMetadata:Object.keys(p).length>0?p:void 0}}return s}return s.type==="split"?{...s,first:u(s.first),second:u(s.second)}:s}return u(c)}function Un(e,t,n){if(e===null)return null;if(t===n)return e;let r=j(e,t),o=j(e,n);if(!r||!o)return e;let c=r.id,u=o.id,s=r.tabsMetadata?.[t],l=o.tabsMetadata?.[n];function p(i){if(i.type==="pane"){let v=false,g=[...i.tabIds],m=i.activeTabId,P=i.tabsMetadata?{...i.tabsMetadata}:{};if(c===u){if(i.id===c){let T=g.indexOf(t),C=g.indexOf(n);T!==-1&&C!==-1&&(g[T]=n,g[C]=t),m=t,v=true;}}else i.id===c&&(g=g.map(T=>T===t?n:T),m===t&&(m=n),delete P[t],l&&(P[n]=l),v=true),i.id===u&&(g=g.map(T=>T===n?t:T),m===n&&(m=t),delete P[n],s&&(P[t]=s),v=true);return v?{...i,tabIds:g,activeTabId:m,tabsMetadata:Object.keys(P).length>0?P:void 0}:i}return i.type==="split"?{...i,first:p(i.first),second:p(i.second)}:i}return p(e)}function He(e,t,n,r="before"){if(e===null)return null;if(t===n)return e;if(r==="center")return Un(e,t,n);let c=j(e,t)?.tabsMetadata?.[t],u=me(e,t);if(u===null)return {type:"pane",id:fe(),tabIds:[t],activeTabId:t,tabsMetadata:c?{[t]:c}:void 0};function s(l){if(l.type==="pane"){if(l.tabIds.includes(n)){let i=[...l.tabIds].filter(m=>m!==t),v=i.indexOf(n);v<0&&(v=0),r==="after"&&(v+=1),i.splice(v,0,t);let g={...l.tabsMetadata};return c&&(g[t]=c),{...l,tabIds:i,activeTabId:t,tabsMetadata:Object.keys(g).length>0?g:void 0}}return l}return l.type==="split"?{...l,first:s(l.first),second:s(l.second)}:l}return s(u)}function he(e,t=0,n=0,r=100,o=100,c="root"){if(e===null)return {panes:[],splitters:[]};if(e.type==="pane")return {panes:[{paneId:e.id,left:t,top:n,width:r,height:o,node:e}],splitters:[]};let{direction:u,splitPercentage:s,first:l,second:p}=e,v={id:`splitter-${c}-${u}`,currentNode:e,direction:u,left:u==="row"?t+r*(s/100):t,top:u==="column"?n+o*(s/100):n,width:u==="row"?0:r,height:u==="column"?0:o,parentLeft:t,parentTop:n,parentWidth:r,parentHeight:o},g={panes:[],splitters:[]},m={panes:[],splitters:[]};if(u==="row"){let P=r*(s/100);g=he(l,t,n,P,o,`${c}-L`),m=he(p,t+P,n,r-P,o,`${c}-R`);}else {let P=o*(s/100);g=he(l,t,n,r,P,`${c}-T`),m=he(p,t,n+P,r,o-P,`${c}-B`);}return {panes:[...g.panes,...m.panes],splitters:[v,...g.splitters,...m.splitters]}}function Ut(e,t,n,r="before"){if(e===null)return null;let o=re(e,t);if(!o)return e;let c=o.tabIds,u=o.activeTabId,s=o.tabsMetadata||{},l=ve(e,t);if(l===null)return o;function p(i){if(i.type==="pane"){if(i.tabIds.includes(n)){let g=[...i.tabIds].filter(T=>!c.includes(T)),m=g.indexOf(n);m<0&&(m=0),r==="after"&&(m+=1),g.splice(m,0,...c);let P={...i.tabsMetadata};for(let T of c)s[T]&&(P[T]=s[T]);return {...i,tabIds:g,activeTabId:u,tabsMetadata:Object.keys(P).length>0?P:void 0}}return i}return i.type==="split"?{...i,first:p(i.first),second:p(i.second)}:i}return p(l)}function Xt(e,t,n,r){if(!((t==="tab"||t==="pane")&&n&&e.includes(n))||!r)return -1;let u=e.indexOf(n);return r==="before"?u:u+1}function Yt(e,t){if(e===t)return true;if(!e||!t)return false;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return false;for(let o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return false;let c=e[o],u=t[o];if(typeof c=="object"&&c!==null&&typeof u=="object"&&u!==null){if(!Yt(c,u))return false}else if(c!==u)return false}return true}function Xn(e,t){if(e===t)return true;if(!e||!t)return false;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return false;for(let o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Yt(e[o],t[o]))return false;return true}function $e(e,t){if(e===t)return true;if(!e||!t||e.type!==t.type)return false;if(e.type==="split"){let n=t;return e.direction===n.direction&&e.splitPercentage===n.splitPercentage&&$e(e.first,n.first)&&$e(e.second,n.second)}else {let n=t;if(e.id!==n.id||e.activeTabId!==n.activeTabId||e.locked!==n.locked||e.tabIds.length!==n.tabIds.length)return false;for(let r=0;r<e.tabIds.length;r++)if(e.tabIds[r]!==n.tabIds[r])return false;return Xn(e.tabsMetadata,n.tabsMetadata)}}function Yn(e){let{initialLayout:t,layout:n,onChange:r,fullscreenPaneId:o,onFullscreenChange:c,locked:u=false}=e,[s,l]=un.useState(()=>n!==void 0?n:t??null),[p,i]=un.useState(()=>n!==void 0?n:t??null),v=un.useRef(n),[g,m]=un.useState(o||null),[P,T]=un.useState(u),[C,N]=un.useState([]),[h,Z]=un.useState(null),[w,L]=un.useState(null),[$,a]=un.useState(null),d=un.useRef(null),y=un.useCallback(f=>{d.current=f;},[]),R=un.useRef(s);R.current=s;let M=un.useRef(g);M.current=g;let q=un.useRef(r);q.current=r;let K=un.useRef(c);K.current=c;let Q=un.useCallback(f=>{m(f),K.current?.(f);},[]);un.useEffect(()=>{T(u);},[u]),un.useEffect(()=>{o!==void 0&&m(o);},[o]),n!==void 0&&($e(n,v.current??null)||(v.current=n,l(n),i(n),N(f=>{if(f.length===0)return f;let x=f.filter(O=>et(n,O)!==null);return x.length===f.length?f:x})));let z=un.useCallback(f=>(...x)=>{let O=R.current,D=f(O,...x);$e(O,D)||(R.current=D,l(D),i(D),N(W=>{if(W.length===0)return W;let _=W.filter(le=>et(D,le)!==null);return _.length===W.length?W:_}),q.current?.(D));},[]),H=un.useCallback(z((f,x)=>typeof x=="function"?x(f):x),[z]),F=un.useCallback(f=>{M.current===null&&i(x=>typeof f=="function"?f(x):f);},[]),V=un.useCallback(f=>{m(null),K.current?.(null),Z(null),L(null),a(null),H(f),i(()=>typeof f=="function"?f(R.current):f);},[H]),B=un.useCallback(z((f,x)=>M.current!==null?f:ve(f,x)),[z]),I=un.useCallback(z((f,x,O,D)=>{if(M.current!==null)return f;let W=me(f,x)??f;return _t(W,O,x,D)}),[z]),b=un.useCallback(z((f,x,O,D,W)=>{if(M.current!==null)return f;let _=re(f,x)??j(f,x);if(!_)return f;let le=re(f,W)??j(f,W)??{type:"pane",id:W,tabIds:[W],activeTabId:W},U=ve(f,le.id);return Se(U,_.id,O,D,le)}),[z]),Y=un.useCallback(z((f,x,O)=>M.current!==null?f:Ce(f,x,O)),[z]),E=un.useCallback(z((f,x,O)=>{let D=re(f,x)??j(f,x);return D?Ke(f,D.id,O):f}),[z]),A=un.useCallback(z((f,x,O)=>{let D=re(f,x)??j(f,x);return D?Ne(f,D.id,O):f}),[z]),de=un.useCallback(z((f,x,O)=>{if(M.current!==null)return f;let D=re(f,O)??j(f,O);return D?qt(f,x,D.id):f}),[z]),ee=un.useCallback(z((f,x,O,D)=>M.current!==null?f:He(f,x,O,D)),[z]),te=un.useCallback(z((f,x)=>M.current!==null?f:me(f,x)),[z]),G=un.useCallback(f=>re(R.current,f),[]),ne=un.useCallback(f=>j(R.current,f),[]),S=un.useCallback(f=>et(R.current,f),[]),k=un.useCallback(f=>Wt(R.current,f),[]),ce=un.useCallback(f=>jt(R.current,f),[]),ie=un.useCallback(f=>{M.current===null&&N(x=>x.includes(f)?x:[...x,f]);},[]),oe=un.useCallback(f=>{M.current===null&&N(x=>x.includes(f)?x.filter(O=>O!==f):x);},[]);return {layout:s,setLayout:V,_internalSetLayout:F,renderingLayout:p,fullscreenPaneId:g,setFullscreenPaneId:Q,locked:P,setLocked:T,poppedOutTabIds:C,activeId:h,setActiveId:Z,activeType:w,setActiveType:L,dismissIntentId:$,setDismissIntentId:a,containerRef:d,setContainerRef:y,removePane:B,addTab:I,updatePaneLock:E,selectTab:A,mergeTab:de,moveTab:ee,removeTab:te,splitPane:b,updateSplitPercentage:Y,popoutTab:ie,dockTab:oe,findPaneById:G,findPaneContainingTab:ne,findTabById:S,getTabMetadata:k,getActiveTabMetadata:ce}}var Gn=()=>{let e=ae(),t=Ze();return {layout:e.layout,setLayout:e.setLayout,fullscreenPaneId:e.fullscreenPaneId,setFullscreenPaneId:t.setFullscreenPaneId,locked:e.locked,setLocked:t.setLocked,removePane:t.removePane,addTab:t.addTab,updatePaneLock:t.updatePaneLock,selectTab:t.selectTab,mergeTab:t.mergeTab,removeTab:t.removeTab,splitPane:t.splitPane,updateSplitPercentage:t.updateSplitPercentage,moveTab:t.moveTab,findPaneById:e.findPaneById,findPaneContainingTab:e.findPaneContainingTab,findTabById:e.findTabById,getTabMetadata:e.getTabMetadata,getActiveTabMetadata:e.getActiveTabMetadata,poppedOutTabIds:e.poppedOutTabIds,popoutTab:t.popoutTab,dockTab:t.dockTab}};var tt=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},nt=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};var Jt=e=>{let n=e.active.id.toString().startsWith("tab-header-"),o=core.pointerWithin(e);if(o.length>0)return [...o].sort((u,s)=>{let l=u.id.toString(),p=s.id.toString(),i=l.startsWith("tab-drop-"),v=p.startsWith("tab-drop-");if(i&&!v)return -1;if(!i&&v)return 1;let g=l.startsWith("drop-root-"),m=p.startsWith("drop-root-");return g&&!m?-1:!g&&m?1:0});if(n){let c=e.droppableContainers.filter(u=>u.id.toString().startsWith("tab-drop-"));return core.closestCenter({...e,droppableContainers:c})}return []};function Be(e){if(e instanceof MouseEvent||e instanceof PointerEvent)return {x:e.clientX,y:e.clientY};if(typeof TouchEvent<"u"&&e instanceof TouchEvent){let t=e.touches[0]||e.changedTouches[0];if(t)return {x:t.clientX,y:t.clientY}}return null}function en(e){let{layout:t,_internalSetLayout:n,setLayout:r,activeId:o,setActiveId:c,activeType:u,setActiveType:s,dismissIntentId:l,setDismissIntentId:p,setOverTabId:i,setOverTabPosition:v,containerRef:g,dragActivationDistance:m,enableDragToDismiss:P,dismissThreshold:T,onRemove:C,onDragStart:N,onDragEnd:h,onDismissIntentChange:Z,removeTab:w,removePane:L}=e,$=un.useRef(null),a=zt(o),d=un.useRef(null),[y,R]=un.useState(false);return Zt(y),{sensors:core.useSensors(core.useSensor(tt,{activationConstraint:{distance:m}}),core.useSensor(nt,{activationConstraint:{delay:250,tolerance:5}})),collisionDetection:Jt,onDragStart:H=>{let F=H.active.id.toString(),V=F.startsWith("tab-header-"),B=V?F.substring(11):F;c(B),s(V?"tab":"pane"),i(null),v(null);let I=H.activatorEvent;a.current=Be(I),P&&g.current?$.current=g.current.getBoundingClientRect():$.current=null;let b=t;if(V){let E=j(t,B);E&&(b=Ne(t,E.id,B)||t);}d.current=b;let Y=V?me(b,B):ve(b,B);n(Y),N&&N(B);},onDragMove:H=>{let{over:F}=H,V=F?.id.toString()||"",B=V.startsWith("drop-locked-");R(S=>S===B?S:B);let I=H.active.id.toString(),b=I.startsWith("tab-header-"),Y=b?I.substring(11):I,E=V.match(/^tab-drop-(.+)$/);if(E&&F&&(b||u==="pane")){let[,S]=E;if(Y!==S){let k="before",ce=F.rect,ie=H.activatorEvent,oe=null;if(a.current)oe=a.current.x;else {let se=Be(ie);se&&(oe=se.x+H.delta.x);}if(oe!==null){let se=ce.left+ce.width/2;oe>se&&(k="after");}i(se=>se===S?se:S),v(se=>se===k?se:k);}else i(k=>k===null?k:null),v(k=>k===null?k:null);}else i(S=>S===null?S:null),v(S=>S===null?S:null);if(!P)return;let A=$.current;if(!A){l!==null&&(p(null),Z?.(null));return}let de=H.activatorEvent,ee=null,te=null;if(a.current)ee=a.current.x,te=a.current.y;else {let S=Be(de);S&&(ee=S.x+H.delta.x,te=S.y+H.delta.y);}let G=0;if(ee!==null&&te!==null){let S=0,k=0;ee<A.left?S=A.left-ee:ee>A.right&&(S=ee-A.right),te<A.top?k=A.top-te:te>A.bottom&&(k=te-A.bottom),G=Math.sqrt(S*S+k*k);}else {let S=H.active.rect.current.translated;if(S){let k=S.left+S.width/2,ce=S.top+S.height/2,ie=0,oe=0;k<A.left?ie=A.left-k:k>A.right&&(ie=k-A.right),ce<A.top?oe=A.top-ce:ce>A.bottom&&(oe=ce-A.bottom),G=Math.sqrt(ie*ie+oe*oe);}}G>T?l!==Y&&(p(Y),Z?.(Y)):l!==null&&(p(null),Z?.(null));},onDragEnd:H=>{c(null),s(null),R(false),i(null),v(null);let{active:F,over:V}=H,B=F.id.toString(),I=B.startsWith("tab-header-"),b=I?B.substring(11):B,Y=P&&l===b;p(null),Z?.(null),$.current=null;let E=d.current||t;if(d.current=null,Y){C?C(b):I?w(b):L(b),h&&h(b,null,null);return}if(!V){n(E),h&&h(b,null,null);return}let A=V.id.toString();if(A.startsWith("drop-locked-")){n(E),h&&h(b,null,null);return}let de=A.match(/^tab-drop-(.+)$/);if(de){let[,x]=de;if(I)if(b!==x){let O="before",D=V.rect,W=H.activatorEvent,_=null;if(a.current)_=a.current.x;else {let U=Be(W);U&&(_=U.x+H.delta.x);}if(_!==null){let U=D.left+D.width/2;_>U&&(O="after");}let le=He(E,b,x,O);r(le),h&&h(b,x,{type:"move",position:"center"});}else n(E),h&&h(b,null,null);else {let O="before",D=V.rect,W=H.activatorEvent,_=null;if(a.current)_=a.current.x;else {let U=Be(W);U&&(_=U.x+H.delta.x);}if(_!==null){let U=D.left+D.width/2;_>U&&(O="after");}let le=Ut(E,b,x,O);r(le),h&&h(b,x,{type:"move",position:"center"});}return}let ee=A.match(/^drop-root-(1\/4|1\/3)-(top|bottom|left|right|start|end)$/);if(ee){let[,x,O]=ee,D=O;D==="start"&&(D="left"),D==="end"&&(D="right");let W=I?me(E,b):ve(E,b),_;if(I){let U=j(E,b)?.tabsMetadata?.[b];_={type:"pane",id:fe(),tabIds:[b],activeTabId:b,tabsMetadata:U?{[b]:U}:void 0};}else _=re(E,b)??{type:"pane",id:fe(),tabIds:[b],activeTabId:b};if(W===null)r(_);else {let le=D==="left"||D==="right",U=D==="left"||D==="top",Re=50;x==="1/4"?Re=U?25:75:x==="1/3"&&(Re=U?100/3:200/3),r({type:"split",direction:le?"row":"column",first:U?_:W,second:U?W:_,splitPercentage:Re});}h&&h(b,"root",{type:"split",direction:D==="left"||D==="right"?"row":"column",position:D});return}let te=A.match(/^drop-(left|right|top|bottom|center)-(.+)$/);if(!te){n(E),h&&h(b,null,null);return}let[,G,ne]=te;if(G==="center"){if(I){let x=re(E,ne);if(x&&x.activeTabId){let O=x.activeTabId,D=He(E,b,O,"center");r(D),h&&h(b,ne,{type:"move",position:"center"});}else n(E),h&&h(b,null,null);}else n(E),h&&h(b,null,null);return}let S=I?j(E,b):re(E,b),k=S&&S.id===ne,ce=S&&S.tabIds.length===1;if(b===ne||k&&ce){n(E),h&&h(b,null,null);return}let ie=G==="left"||G==="right"?"row":"column",oe;if(I){let O=j(E,b)?.tabsMetadata?.[b];oe={type:"pane",id:fe(),tabIds:[b],activeTabId:b,tabsMetadata:O?{[b]:O}:void 0};}else oe=re(E,b)??{type:"pane",id:fe(),tabIds:[b],activeTabId:b};let se=I?me(E,b):ve(E,b),f=Se(se,ne,ie,G,oe);r(f),h&&h(b,ne,{type:"split",direction:ie,position:G});},onDragCancel:()=>{c(null),s(null),R(false),i(null),v(null),p(null),Z?.(null),$.current=null;let H=d.current||t;d.current=null,n(H),H!==t&&r(H);}}}function nn({persist:e,layout:t,setLayout:n}){let r=typeof e=="object"?e.enabled!==false:!!e,o=typeof e=="object"&&e.key||"zeugma-layout",[c,u]=un.useState(false);un.useEffect(()=>{if(r){let s=localStorage.getItem(o);if(s)try{let l=JSON.parse(s);l&&n(l);}catch(l){console.error("Failed to parse persisted zeugma layout",l);}}u(true);},[r,o,n]),un.useEffect(()=>{r&&c&&(t?localStorage.setItem(o,JSON.stringify(t)):localStorage.removeItem(o));},[r,o,t,c]);}var be=null,rn=false,J=new Set,De=new Set,Le=null;function ao(){typeof window>"u"||Le||(Le=new MutationObserver(e=>{e.forEach(t=>{t.addedNodes.forEach(n=>{n instanceof HTMLElement&&(n.tagName.toLowerCase()==="style"||n.tagName.toLowerCase()==="link")&&J.forEach(r=>{try{let o=n.cloneNode(!0);if(o.tagName.toLowerCase()==="link"){let c=n.href;c&&o.setAttribute("href",c);}r.head.appendChild(o);}catch(o){console.warn("Failed to mirror style node to popout:",o);}});});});}),Le.observe(document.head,{childList:true}));}function bt(){Le&&(Le.disconnect(),Le=null);}var ke=null;function so(){typeof window>"u"||ke||(ke=new MutationObserver(e=>{e.forEach(t=>{if(t.type==="attributes"&&t.attributeName){let n=document.documentElement.getAttribute(t.attributeName);J.forEach(r=>{try{r&&r.documentElement&&(n!==null?r.documentElement.setAttribute(t.attributeName,n):r.documentElement.removeAttribute(t.attributeName));}catch(o){console.warn("Failed to sync documentElement attribute:",o);}});}});}),ke.observe(document.documentElement,{attributes:true}));}function vt(){ke&&(ke.disconnect(),ke=null);}var an=e=>{typeof requestAnimationFrame<"u"?requestAnimationFrame(e):setTimeout(e,0);};function ge(){if(typeof window>"u")return document;if(be&&be.target){let n=be.target.ownerDocument;if(n&&n!==document&&J.has(n))return n}let e=window.event;if(e&&e.target){let r=e.target.ownerDocument;if(r&&r!==document&&J.has(r))return r}let t=window.__zeugmaActivePopoutDocument;return t&&J.has(t)?t:document}function sn(){if(typeof window>"u"||rn)return;rn=true;let e=(a,d)=>{if(!a||!d)return false;try{let y=Object.getPrototypeOf(a);for(;y;){if(y===d)return !0;y=Object.getPrototypeOf(y);}}catch{}return false},t=(a,d)=>{try{Object.defineProperty(a,Symbol.hasInstance,{value:function(y){return y?e(y,a.prototype)?!0:d(y):!1},configurable:!0,writable:!0});}catch(y){console.warn("Failed to patch Symbol.hasInstance on",a,y);}};typeof Node<"u"&&t(Node,a=>typeof a.nodeType=="number"&&typeof a.nodeName=="string"),typeof Element<"u"&&t(Element,a=>a.nodeType===1),typeof HTMLElement<"u"&&t(HTMLElement,a=>a.nodeType===1&&typeof a.style=="object"),typeof HTMLBodyElement<"u"&&t(HTMLBodyElement,a=>a.nodeType===1&&a.tagName==="BODY"),typeof HTMLHtmlElement<"u"&&t(HTMLHtmlElement,a=>a.nodeType===1&&a.tagName==="HTML"),typeof HTMLInputElement<"u"&&t(HTMLInputElement,a=>a.nodeType===1&&a.tagName==="INPUT"),typeof HTMLTextAreaElement<"u"&&t(HTMLTextAreaElement,a=>a.nodeType===1&&a.tagName==="TEXTAREA"),typeof ShadowRoot<"u"&&t(ShadowRoot,a=>a.nodeType===11&&a.host!==void 0),typeof SVGElement<"u"&&t(SVGElement,a=>a.nodeType===1&&typeof a.getBBox=="function"),typeof Document<"u"&&t(Document,a=>a.nodeType===9),typeof Window<"u"&&t(Window,a=>a&&typeof a.document=="object"&&typeof a.location=="object");let n=Document.prototype,r=Object.getOwnPropertyDescriptor(n,"body"),o=Object.getOwnPropertyDescriptor(n,"documentElement"),c=Object.getOwnPropertyDescriptor(n,"head"),u=Object.getOwnPropertyDescriptor(n,"activeElement"),s=Object.getOwnPropertyDescriptor(n,"defaultView"),l=Object.getOwnPropertyDescriptor(n,"scrollingElement");Object.defineProperties(document,{body:{get(){let a=ge();return a&&a!==document?a.body:r?.get?.call(document)||document.body},configurable:true},documentElement:{get(){let a=ge();return a&&a!==document?a.documentElement:o?.get?.call(document)||document.documentElement},configurable:true},head:{get(){let a=ge();return a&&a!==document?a.head:c?.get?.call(document)||document.head},configurable:true},activeElement:{get(){let a=ge();return a&&a!==document?a.activeElement:u?.get?.call(document)||document.activeElement},configurable:true},defaultView:{get(){let a=ge();return a&&a!==document?a.defaultView:s?.get?.call(document)||document.defaultView},configurable:true},scrollingElement:{get(){let a=ge();return a&&a!==document?a.scrollingElement:l?.get?.call(document)||document.scrollingElement},configurable:true}});let p=Window.prototype,i=["innerWidth","innerHeight","pageXOffset","pageYOffset","scrollX","scrollY","screenX","screenY","outerWidth","outerHeight","devicePixelRatio"],v={};i.forEach(a=>{let d=Object.getOwnPropertyDescriptor(p,a)||Object.getOwnPropertyDescriptor(window,a);d&&d.get&&(v[a]=d.get);}),i.forEach(a=>{Object.defineProperty(window,a,{get(){let d=ge();if(d&&d!==document&&d.defaultView)try{return d.defaultView[a]}catch{}let y=v[a];return y?y.call(window):window[a]},configurable:true});});let g=Node.prototype.contains;Node.prototype.contains=function(a){if(!a)return false;if(g.call(this,a))return true;if(this===document||this===document.body||this===document.documentElement)for(let d of J)try{if(d.contains(a))return !0}catch{}return false};let m=()=>{be=null,globalThis.__zeugmaActivePopoutDocument=null;};["pointerdown","mousedown","click","keydown","focus","touchstart"].forEach(a=>{window.addEventListener(a,m,true);});let T=document.createElement;document.createElement=function(a,d){let y=ge();return y&&y!==document?y.createElement(a,d):T.call(document,a,d)};let C=document.addEventListener;document.addEventListener=function(a,d,y){De.add({target:"document",type:a,listener:d,options:y}),C.call(document,a,d,y),J.forEach(R=>{try{R.addEventListener(a,d,y);}catch{}});};let N=document.removeEventListener;document.removeEventListener=function(a,d,y){for(let R of De)if(R.target==="document"&&R.type===a&&R.listener===d){De.delete(R);break}N.call(document,a,d,y),J.forEach(R=>{try{R.removeEventListener(a,d,y);}catch{}});};let h=window.addEventListener;window.addEventListener=function(a,d,y){De.add({target:"window",type:a,listener:d,options:y}),h.call(window,a,d,y),J.forEach(R=>{try{R.defaultView&&R.defaultView.addEventListener(a,d,y);}catch{}});};let Z=window.removeEventListener;window.removeEventListener=function(a,d,y){for(let R of De)if(R.target==="window"&&R.type===a&&R.listener===d){De.delete(R);break}Z.call(window,a,d,y),J.forEach(R=>{try{R.defaultView&&R.defaultView.removeEventListener(a,d,y);}catch{}});};let w=document.getElementById;document.getElementById=function(a){let d=ge();if(d&&d!==document)return d.getElementById(a);let y=w.call(document,a);if(y)return y;for(let R of J)try{let M=R.getElementById(a);if(M)return M}catch{}return null};let L=document.querySelector;document.querySelector=function(a){let d=ge();if(d&&d!==document)return d.querySelector(a);let y=L.call(document,a);if(y)return y;for(let R of J)try{let M=R.querySelector(a);if(M)return M}catch{}return null};let $=document.querySelectorAll;document.querySelectorAll=function(a){let d=ge();if(d&&d!==document)return d.querySelectorAll(a);let y=$.call(document,a);if(y.length>0)return y;for(let R of J)try{let M=R.querySelectorAll(a);if(M.length>0)return M}catch{}return y};}function ln(e){let{poppedOutTabIds:t,registerPopoutTarget:n,findTabById:r,dockTab:o}=e,c=un.useRef({});un.useEffect(()=>{let u=c.current;t.forEach(s=>{if(u[s]){try{u[s].focus();}catch{}return}sn();let p=r(s)?.metadata?.title||`Tab ${s}`,i=window.open("",`zeugma-popout-${s}`,"width=800,height=600");if(!i){console.warn("Failed to open popout window. Check popup blocker."),o(s);return}u[s]=i,J.add(i.document),De.forEach(d=>{try{d.target==="window"?i.addEventListener(d.type,d.listener,d.options):i.document.addEventListener(d.type,d.listener,d.options);}catch{}}),ao(),so(),i.document.title=p,i.document.head.innerHTML="";try{let d=i.document.createElement("base");d.setAttribute("href",window.location.origin+"/"),i.document.head.appendChild(d);}catch{}if(Array.from(document.querySelectorAll('style, link[rel="stylesheet"]')).forEach(d=>{let y=d.cloneNode(true);if(d.tagName.toLowerCase()==="link"){let R=d.href;R&&y.setAttribute("href",R);}else if(d.tagName.toLowerCase()==="style")try{let R=d.sheet?.cssRules;if(R&&R.length>0){let M=Array.from(R).map(q=>q.cssText).join(`
|
|
10
|
+
`);y.textContent=M;}}catch{}i.document.head.appendChild(y);}),typeof document.adoptedStyleSheets<"u"&&typeof i.document.adoptedStyleSheets<"u")try{let d=Array.from(document.adoptedStyleSheets).map(y=>{try{let R=new i.CSSStyleSheet,M=Array.from(y.cssRules).map(q=>q.cssText).join(`
|
|
11
|
+
`);return R.replaceSync(M),R}catch{return null}}).filter(y=>y!==null);i.document.adoptedStyleSheets=d;}catch(d){console.warn("Failed to copy adoptedStyleSheets:",d);}i.document.documentElement.className=document.documentElement.className,i.document.body.className=document.body.className,Array.from(document.documentElement.attributes).forEach(d=>{i.document.documentElement.setAttribute(d.name,d.value);}),i.document.body.style.margin="0",i.document.body.style.padding="0",i.document.body.style.height="100vh",i.document.body.style.overflow="hidden";let v=document.getElementById(`zeugma-tab-target-${s}`),g="";v&&(g=window.getComputedStyle(v).backgroundColor,(!g||g==="transparent"||g==="rgba(0, 0, 0, 0)")&&v.parentElement&&(g=window.getComputedStyle(v.parentElement).backgroundColor));let m=window.getComputedStyle(document.documentElement),P=window.getComputedStyle(document.body),T=P.backgroundColor,N=!T||T==="transparent"||T==="rgba(0, 0, 0, 0)"?m.backgroundColor:T,h=g&&g!=="transparent"&&g!=="rgba(0, 0, 0, 0)"?g:N&&N!=="transparent"&&N!=="rgba(0, 0, 0, 0)"?N:"#181b1f";document.documentElement.getAttribute("data-theme")||(i.document.documentElement.style.backgroundColor=h,i.document.body.style.backgroundColor=h),i.document.body.style.color=P.color||m.color,i.document.body.style.fontFamily=P.fontFamily||m.fontFamily;let w=i.document.createElement("div");w.id=`zeugma-popout-container-${s}`,w.className="zeugma-popout-container",w.style.width="100%",w.style.height="100%",w.style.overflow="hidden",w.style.border="none",i.document.body.appendChild(w),n?.(s,w);let L=["pointerdown","mousedown","click","keydown","focus","touchstart"],$=d=>{be=d,globalThis.__zeugmaActivePopoutDocument=i.document,setTimeout(()=>{be===d&&(be=null,globalThis.__zeugmaActivePopoutDocument=null);},0);};L.forEach(d=>{i.addEventListener(d,$,true);});let a=()=>{be=null,globalThis.__zeugmaActivePopoutDocument=null,J.delete(i.document),J.size===0&&(bt(),vt()),o(s);};i.addEventListener("beforeunload",a),i.__zeugmaCleanup=()=>{L.forEach(d=>{i.removeEventListener(d,$,true);}),i.removeEventListener("beforeunload",a);};}),Object.keys(u).forEach(s=>{if(!t.includes(s)){let l=u[s];if(delete u[s],n?.(s,null),l){be&&be.target.ownerDocument===l.document&&(be=null),globalThis.__zeugmaActivePopoutDocument===l.document&&(globalThis.__zeugmaActivePopoutDocument=null),J.delete(l.document),J.size===0&&(bt(),vt());try{let p=l;p.__zeugmaCleanup&&p.__zeugmaCleanup(),an(()=>{try{p.close();}catch{}});}catch{}}}});},[t,n,r,o]),un.useEffect(()=>()=>{let u=c.current;Object.keys(u).forEach(s=>{let l=u[s];if(l){J.delete(l.document);try{let p=l;p.__zeugmaCleanup&&p.__zeugmaCleanup(),an(()=>{try{p.close();}catch{}});}catch{}}}),J.size===0&&(bt(),vt());},[]);}typeof window<"u"&&sn();var cn=({activeId:e,render:t,className:n})=>{let r=un.useRef(null);return un.useEffect(()=>{let o=c=>{r.current&&(r.current.style.transform=`translate(${c.clientX+12}px, ${c.clientY+12}px)`);};return document.addEventListener("pointermove",o),()=>document.removeEventListener("pointermove",o)},[]),jsxRuntime.jsx("div",{ref:r,className:n,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var dn=un__default.default.memo(({tabDetails:e,target:t,renderWidget:n})=>{let{id:r}=e,{renderPopoutWrapper:o}=ae(),[c,u]=un.useState(false),s=un.useRef(null);if(un.useEffect(()=>{u(true);},[]),un.useEffect(()=>{if(!c||!s.current)return;let m=s.current;if(t)t.ownerDocument.adoptNode(m),t.appendChild(m);else {let P=document.getElementById("zeugma-hidden-portal-container");P||(P=document.createElement("div"),P.id="zeugma-hidden-portal-container",P.style.display="none",document.body.appendChild(P)),document.adoptNode(m),P.appendChild(m);}},[t,c]),un.useEffect(()=>()=>{s.current&&s.current.remove();},[]),!c)return null;let l=t?t.ownerDocument:document;s.current&&s.current.ownerDocument!==l&&l.adoptNode(s.current),s.current||(s.current=l.createElement("div"),s.current.className=`zeugma-portal-wrapper-${r}`,s.current.style.width="100%",s.current.style.height="100%");let p=s.current;if(!p||!n)return null;let i=!!(t&&t.ownerDocument&&t.ownerDocument!==document),v=i?"-popped":"-docked",g=jsxRuntime.jsx(un__default.default.Fragment,{children:n(e)},`${r}${v}`);return i&&o&&(g=o({tabId:r,document:l,window:l.defaultView||window,children:g})),reactDom.createPortal(g,p)},(e,t)=>e.target===t.target&&e.renderWidget===t.renderWidget&&e.tabDetails.id===t.tabDetails.id&&e.tabDetails.paneId===t.tabDetails.paneId&&e.tabDetails.isActive===t.tabDetails.isActive&&e.tabDetails.index===t.tabDetails.index&&e.tabDetails.metadata===t.tabDetails.metadata);var pn=({activeId:e,activeType:t,dismissIntentId:n,renderDragOverlay:r,renderPaneRef:o,renderPane:c,tabHeadersRef:u,classNames:s})=>{if(r)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:r({type:t,id:e,isDismissing:e===n})});if(t==="pane"){let l=o.current||c;if(l)return jsxRuntime.jsx("div",{className:s.paneDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:l(e)})}else if(t==="tab"){let l=o.current||c;if(l)return jsxRuntime.jsx("div",{className:s.tabDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:l(e)});let p=u.current[e];if(p){let i=s.tab?typeof s.tab=="function"?s.tab(e):s.tab:"";return jsxRuntime.jsx("div",{className:`${s.tabDragPreview||""} ${i}`.trim(),style:{display:"inline-flex",position:"relative",pointerEvents:"none",overflow:"hidden"},children:p({isDragging:true,isOver:false})})}}return jsxRuntime.jsx("div",{style:{pointerEvents:"none",overflow:"hidden",width:"100%",height:"100%"}})};function yt({containerRef:e,isRow:t,direction:n,splitPercentage:r,resizerSize:o,snapThreshold:c,layout:u,currentNode:s,onLayoutChange:l,onResizeStart:p,onResizeEnd:i,parentLeft:v,parentTop:g,parentWidth:m,parentHeight:P}){let{onResizeStart:T,onResize:C,onResizeEnd:N,minSplitPercentage:h=5,maxSplitPercentage:Z=95,locked:w=false}=ae();return un.useCallback(L=>{if(w)return;L.preventDefault();let $=e.current;if(!$)return;p&&p(),T&&T(s);let a=$.getBoundingClientRect(),d=L.clientX,y=L.clientY,R=r,M=L.currentTarget,q=a.left+a.width*(v/100),K=a.top+a.height*(g/100),Q=a.width*(m/100),z=a.height*(P/100),F=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(B=>B!==M&&B.getAttribute("data-direction")===n).map(B=>{let I=B.getBoundingClientRect();return t?I.left+I.width/2:I.top+I.height/2}),V=R;Ot({cursor:t?"col-resize":"row-resize",resizerEl:M,onMove:B=>{let I=t?(B.clientX-d)/Q*100:(B.clientY-y)/z*100,b=R+I,Y=t?q+(Q-o)*(b/100)+o/2:K+(z-o)*(b/100)+o/2,E=1/0,A=null;for(let G of F){let ne=Math.abs(Y-G);ne<c&&ne<E&&(E=ne,A=G);}let de=b;A!==null&&(de=t?(A-o/2-q)/(Q-o)*100:(A-o/2-K)/(z-o)*100);let ee=Math.max(h,Math.min(Z,de));V=ee;let te=Ce(u,s,ee);if(te){let{panes:G,splitters:ne}=he(te),S=e.current;if(S){for(let k of G)S.style.setProperty(`--pane-left-${k.paneId}`,`${k.left}%`),S.style.setProperty(`--pane-top-${k.paneId}`,`${k.top}%`),S.style.setProperty(`--pane-width-${k.paneId}`,`${k.width}%`),S.style.setProperty(`--pane-height-${k.paneId}`,`${k.height}%`);for(let k of ne)S.style.setProperty(`--splitter-pos-${k.id}`,`${k.direction==="row"?k.left:k.top}%`);}}C&&C(s,ee);},onEnd:()=>{let B=Ce(u,s,V),I=e.current;if(I){let{panes:b,splitters:Y}=he(B);for(let E of b)I.style.removeProperty(`--pane-left-${E.paneId}`),I.style.removeProperty(`--pane-top-${E.paneId}`),I.style.removeProperty(`--pane-width-${E.paneId}`),I.style.removeProperty(`--pane-height-${E.paneId}`);for(let E of Y)I.style.removeProperty(`--splitter-pos-${E.id}`);}l(B),i&&i(),N&&N(s,V);}});},[e,t,n,r,o,c,u,s,l,p,i,T,C,N,h,Z,v,g,m,P])}var fn=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:r})=>{let{renderingLayout:o,setLayout:c,classNames:u,locked:s}=ae(),[l,p]=un.useState(false),{currentNode:i,direction:v,left:g,top:m,width:P,height:T,parentLeft:C,parentTop:N,parentWidth:h,parentHeight:Z}=e,w=v==="row",L=yt({containerRef:r,isRow:w,direction:v,splitPercentage:i.splitPercentage,resizerSize:t,snapThreshold:n,layout:o,currentNode:i,onLayoutChange:c,onResizeStart:()=>p(true),onResizeEnd:()=>p(false),parentLeft:C,parentTop:N,parentWidth:h,parentHeight:Z}),$=w?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${g}%) - ${t/2}px)`,top:`calc(${m}% + ${t/2}px)`,width:`${t}px`,height:`calc(${T}% - ${t}px)`,cursor:s?"default":"col-resize",pointerEvents:s?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"}:{position:"absolute",left:`calc(${g}% + ${t/2}px)`,top:`calc(var(--splitter-pos-${e.id}, ${m}%) - ${t/2}px)`,width:`calc(${P}% - ${t}px)`,height:`${t}px`,cursor:s?"default":"row-resize",pointerEvents:s?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsxRuntime.jsx("div",{className:u.resizer||"","data-direction":v,"data-resizing":l||void 0,style:$,onPointerDown:L,role:"separator","aria-valuenow":i.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},mn=un__default.default.memo(({paneId:e,renderPane:t})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:t(e)}),(e,t)=>e.paneId===t.paneId&&e.renderPane===t.renderPane);var Tt=({renderPane:e,tree:t,resizerSize:n,snapThreshold:r})=>{Ft(e);let{renderingLayout:o,activeId:c,dismissIntentId:u,setContainerRef:s,fullscreenPaneId:l,snapThreshold:p,locked:i,classNames:v,resizerSize:g}=ae(),m=r!==void 0?r:p??8,P=n!==void 0?n:g??4,T=t!==void 0?t:o,C=un.useRef(null),{panes:N,splitters:h}=un.useMemo(()=>T?he(T):{panes:[],splitters:[]},[T]);if(!T&&t!==void 0)return null;let Z=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[N.map(w=>{let L=l===w.paneId;return jsxRuntime.jsx("div",{style:{position:"absolute",left:L?"0%":`var(--pane-left-${w.paneId}, ${w.left}%)`,top:L?"0%":`var(--pane-top-${w.paneId}, ${w.top}%)`,width:L?"100%":`var(--pane-width-${w.paneId}, ${w.width}%)`,height:L?"100%":`var(--pane-height-${w.paneId}, ${w.height}%)`,overflow:"hidden",zIndex:L?20:1,display:l&&!L?"none":"block",padding:L?"0px":`${P/2}px`,boxSizing:"border-box"},children:jsxRuntime.jsx(mn,{paneId:w.paneId,renderPane:e})},w.paneId)}),!l&&h.map(w=>jsxRuntime.jsx(fn,{splitter:w,resizerSize:P,snapThreshold:m,containerRef:C},w.id))]});if(t===void 0){let w=c!==null&&c===u,L=a=>{s(a),C.current=a;},$=`${v.dashboard||""} ${w&&v.dashboardDismissActive||""} ${i&&v.dashboardLocked||""}`.trim();return jsxRuntime.jsxs("div",{ref:L,className:$,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:[Z(),c!==null&&!i&&jsxRuntime.jsx(vn,{activeClassName:v.rootDropPreview??v.dropPreview})]})}return jsxRuntime.jsx("div",{ref:C,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:Z()})};var wo=e=>{let{controller:t,children:n,renderDragOverlay:r,classNames:o={},renderPane:c,resizerSize:u,dragActivationDistance:s=8,snapThreshold:l=8,minSplitPercentage:p=5,maxSplitPercentage:i=95,enableDragToDismiss:v=false,dismissThreshold:g=60,onRemove:m,onDragStart:P,onDragEnd:T,onResizeStart:C,onResize:N,onResizeEnd:h,onDismissIntentChange:Z,persist:w=false,renderPopoutWrapper:L}=e,$=t,{layout:a,setLayout:d,_internalSetLayout:y,renderingLayout:R,fullscreenPaneId:M,setFullscreenPaneId:q,locked:K,setLocked:Q,findPaneById:z,findPaneContainingTab:H,findTabById:F,getTabMetadata:V,getActiveTabMetadata:B,activeId:I,setActiveId:b,activeType:Y,setActiveType:E,dismissIntentId:A,setDismissIntentId:de,containerRef:ee,setContainerRef:te,removePane:G,addTab:ne,updatePaneLock:S,selectTab:k,mergeTab:ce,removeTab:ie,splitPane:oe,updateSplitPercentage:se,moveTab:f,poppedOutTabIds:x=[],popoutTab:O,dockTab:D}=$;nn({persist:w,layout:a,setLayout:d});let{portalTargets:W,registerPortalTarget:_,registerPopoutTarget:le,registerRenderCallback:U,renderCallbacksRef:Re,registerRenderPane:ct,renderPaneRef:ut,registerTabHeader:St,tabHeadersRef:dt,activeIdRef:Ue}=Ht();ln({poppedOutTabIds:x,registerPopoutTarget:le,findTabById:F,dockTab:D});let Nt=un.useCallback(pe=>x.includes(pe),[x]),{overTabId:It,setOverTabId:On,overTabPosition:Lt,setOverTabPosition:An,handleDragStartInternal:zn,handleDragEndInternal:Zn}=Bt({onDragStart:P,onDragEnd:T}),Hn=en({layout:a,_internalSetLayout:y,setLayout:d,activeId:I,setActiveId:b,activeType:Y,setActiveType:E,dismissIntentId:A,setDismissIntentId:de,setOverTabId:On,setOverTabPosition:An,containerRef:ee,dragActivationDistance:s,enableDragToDismiss:v,dismissThreshold:g,onRemove:m,onDragStart:zn,onDragEnd:Zn,onDismissIntentChange:Z,removeTab:ie,removePane:G}),pt=un.useMemo(()=>o,[o.dashboard,o.dashboardDismissActive,o.pane,o.paneLocked,o.dropPreview,o.rootDropPreview,o.dragOverlay,o.paneDragPreview,o.tabDragPreview,o.resizer,o.dismissPreview,o.dashboardLocked,o.lockedPreview,o.tabDropPreview,o.tabSeparator,o.tabsContainer,o.tab,o.paneContainer,o.paneHeader,o.paneControls,o.paneButton,o.tabCloseButton,o.dragHandle]),kt=un.useCallback((pe,Xe)=>{h&&h(pe,Xe);},[h]),$n=un.useMemo(()=>({layout:a,renderingLayout:R,setLayout:d,activeId:I,activeType:Y,dismissIntentId:A,setContainerRef:te,fullscreenPaneId:M,classNames:pt,onRemove:m,onFullscreenChange:q,snapThreshold:l,onResizeStart:C,onResize:N,onResizeEnd:kt,minSplitPercentage:p,maxSplitPercentage:i,locked:K,setLocked:Q,findPaneById:z,findPaneContainingTab:H,findTabById:F,getTabMetadata:V,getActiveTabMetadata:B,renderPane:c,resizerSize:u,poppedOutTabIds:x,isTabPoppedOut:Nt,renderPopoutWrapper:L}),[a,R,I,Y,A,te,M,pt,m,q,l,C,N,p,i,d,kt,K,Q,z,H,F,V,B,c,u,x,Nt,L]),Bn=un.useMemo(()=>({overTabId:It,overTabPosition:Lt}),[It,Lt]),Fn=un.useMemo(()=>({removePane:G,addTab:ne,updatePaneLock:S,selectTab:k,mergeTab:ce,removeTab:ie,setFullscreenPaneId:q,setLocked:Q,splitPane:oe,updateSplitPercentage:se,moveTab:f,popoutTab:O,dockTab:D}),[G,ne,S,k,ce,ie,q,Q,oe,se,f,O,D]),_n=$t(a),Vn=un.useMemo(()=>({registerPortalTarget:_,registerRenderCallback:U,renderCallbacksRef:Re,registerRenderPane:ct,renderPaneRef:ut,registerTabHeader:St,tabHeadersRef:dt,activeIdRef:Ue,registerPopoutTarget:le}),[_,U,Re,ct,ut,St,dt,Ue,le]);return Ue&&(Ue.current=I),jsxRuntime.jsx(xe.Provider,{value:Fn,children:jsxRuntime.jsx(mt.Provider,{value:$n,children:jsxRuntime.jsx(gt.Provider,{value:Bn,children:jsxRuntime.jsxs(Te.Provider,{value:Vn,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",...Hn,children:n}),I&&Y&&jsxRuntime.jsx(cn,{activeId:I,render:pe=>jsxRuntime.jsx("div",{style:{transition:"transform 150ms cubic-bezier(0.2, 0, 0, 1)",transform:pe===A?"scale(0.8)":"scale(1)",transformOrigin:"top left"},children:jsxRuntime.jsx(pn,{activeId:pe,activeType:Y,dismissIntentId:A,renderDragOverlay:r,renderPaneRef:ut,renderPane:c,tabHeadersRef:dt,classNames:pt})}),className:`${o.dragOverlay||""} ${I===A&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:_n.map(pe=>{let Xe=W[pe],Mt=F(pe);return Mt?jsxRuntime.jsx(dn,{tabDetails:Mt,target:Xe||null,renderWidget:Re.current[pe]},pe):null})})]})})})})},Co=({renderPane:e,resizerSize:t,snapThreshold:n})=>{if(!e)throw new Error("Zeugma component requires a renderPane prop when used as a standalone renderer.");return jsxRuntime.jsx(Tt,{renderPane:e,resizerSize:t,snapThreshold:n})},Do=e=>{let{children:t,...n}=e,{controller:r}=e;if(!r)throw new Error("Zeugma component requires a controller.");return jsxRuntime.jsx(wo,{...e,children:t!==void 0?t:jsxRuntime.jsx(Co,{...n})})};var No={top:{"1/4":{position:"absolute",top:0,left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",top:"24px",left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"}},bottom:{"1/4":{position:"absolute",bottom:0,left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",bottom:"24px",left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"}},left:{"1/4":{position:"absolute",left:0,top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",left:"24px",top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"}},right:{"1/4":{position:"absolute",right:0,top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",right:"24px",top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"}}},Io={top:{"1/4":{top:0,left:0,width:"100%",height:"60px",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px"},"1/3":{top:0,left:0,width:"100%",height:"96px",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},bottom:{"1/4":{bottom:0,left:0,width:"100%",height:"60px",borderTopLeftRadius:"12px",borderTopRightRadius:"12px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},"1/3":{bottom:0,left:0,width:"100%",height:"96px",borderTopLeftRadius:"12px",borderTopRightRadius:"12px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"}},left:{"1/4":{left:0,top:0,width:"60px",height:"100%",borderTopRightRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},"1/3":{left:0,top:0,width:"96px",height:"100%",borderTopRightRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"}},right:{"1/4":{right:0,top:0,width:"60px",height:"100%",borderTopLeftRadius:"12px",borderBottomLeftRadius:"12px",borderTopRightRadius:"0px",borderBottomRightRadius:"0px"},"1/3":{right:0,top:0,width:"96px",height:"100%",borderTopLeftRadius:"12px",borderBottomLeftRadius:"12px",borderTopRightRadius:"0px",borderBottomRightRadius:"0px"}}},Lo=({id:e,fraction:t,edge:n,activeClassName:r})=>{let{setNodeRef:o,isOver:c}=core.useDroppable({id:e}),u={position:"absolute",pointerEvents:"none",zIndex:101,boxSizing:"border-box",...Io[n][t]};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:o,style:No[n][t]}),c&&jsxRuntime.jsx("div",{className:r,style:u})]})},vn=({activeClassName:e})=>jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:99,pointerEvents:"none"},children:[{id:"drop-root-1/4-top",fraction:"1/4",edge:"top"},{id:"drop-root-1/3-top",fraction:"1/3",edge:"top"},{id:"drop-root-1/4-bottom",fraction:"1/4",edge:"bottom"},{id:"drop-root-1/3-bottom",fraction:"1/3",edge:"bottom"},{id:"drop-root-1/4-left",fraction:"1/4",edge:"left"},{id:"drop-root-1/3-left",fraction:"1/3",edge:"left"},{id:"drop-root-1/4-right",fraction:"1/4",edge:"right"},{id:"drop-root-1/3-right",fraction:"1/3",edge:"right"}].map(n=>jsxRuntime.jsx(Lo,{id:n.id,fraction:n.fraction,edge:n.edge,activeClassName:e},n.id))});var rt=un.createContext(null);var zo={top:{position:"absolute",top:0,left:0,width:"100%",height:"25%",zIndex:20,pointerEvents:"auto"},bottom:{position:"absolute",bottom:0,left:0,width:"100%",height:"25%",zIndex:20,pointerEvents:"auto"},left:{position:"absolute",top:"25%",left:0,width:"50%",height:"50%",zIndex:20,pointerEvents:"auto"},right:{position:"absolute",top:"25%",right:0,width:"50%",height:"50%",zIndex:20,pointerEvents:"auto"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:20,pointerEvents:"auto",cursor:"not-allowed"},center:{position:"absolute",top:"25%",left:"25%",width:"50%",height:"50%",zIndex:22,pointerEvents:"auto"}},Zo={top:{position:"absolute",top:0,left:0,right:0,height:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},bottom:{position:"absolute",bottom:0,left:0,right:0,height:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},left:{position:"absolute",top:0,bottom:0,left:0,width:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},right:{position:"absolute",top:0,bottom:0,right:0,width:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:21,pointerEvents:"none",boxSizing:"border-box"},center:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:21,pointerEvents:"none",boxSizing:"border-box"}},at=({id:e,position:t,activeClassName:n})=>{let{setNodeRef:r,isOver:o}=core.useDroppable({id:e});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:r,style:zo[t]}),o&&jsxRuntime.jsx("div",{className:n,style:Zo[t]})]})};var Tn=({children:e,className:t,style:n})=>{let r=un.useContext(rt);if(!r)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:o,...c}=r;return jsxRuntime.jsx("div",{className:t,style:{cursor:o?"default":"grab",userSelect:o?"auto":"none",touchAction:o?"auto":"none",...n},...o?{}:c,children:e})};var Uo=un.createContext(void 0);var We=({id:e,locked:t=false,children:n,className:r,style:o})=>{let{locked:c,classNames:u={},fullscreenPaneId:s,poppedOutTabIds:l=[]}=ae(),p=un.useContext(xe),{overTabId:i}=Ge(),v=un.useContext(Te);un.useEffect(()=>(v?.registerTabHeader&&v.registerTabHeader(e,n),()=>{v?.registerTabHeader&&v.activeIdRef?.current!==e&&v.registerTabHeader(e,()=>null);}),[e,n,v]);let g=l.includes(e),m=un.useContext(Rt),P=t||c||(m?.locked??false)||s!==null,{attributes:T,listeners:C,setNodeRef:N,isDragging:h}=core.useDraggable({id:`tab-header-${e}`,disabled:P}),{setNodeRef:Z,isOver:w}=core.useDroppable({id:`tab-drop-${e}`,disabled:P}),L=F=>{N(F),Z(F);},$=w&&i===e,a=m?.tabIds||[],d=a.indexOf(e),y=m?.activeTabId,M=d>0&&e!==y&&a[d-1]!==y?jsxRuntime.jsx("div",{className:u.tabSeparator}):null,q=m?m.activeTabId===e:false,K=m?.tabsMetadata?.[e],Q=un.useCallback(()=>{m?.selectTab(e);},[m,e]),z=un.useCallback(()=>{m?.removeTab(e);},[m,e]),H=un.useMemo(()=>({tabId:e,isActive:q,isDragging:h,isOver:$,metadata:K,locked:P,selectTab:Q,removeTab:z,isPoppedOut:g,popoutTab:()=>p?.popoutTab(e),dockTab:()=>p?.dockTab(e)}),[e,q,h,$,K,P,Q,z,g,p]);return jsxRuntime.jsx(Uo.Provider,{value:H,children:jsxRuntime.jsxs("div",{ref:L,id:`tab-header-${e}`,className:r,style:{display:"inline-flex",position:"relative",cursor:P?"default":"grab",...o},...P?{}:C,...P?{}:T,children:[M,n({isDragging:h,isOver:$})]})})};var Rt=un.createContext(void 0);var wn=(e,t)=>typeof e=="function"?e(t):e,xt=({tabIds:e,activeTabId:t,locked:n,tabsMetadata:r,selectTab:o,removeTab:c,renderTab:u,classNames:s,styles:l})=>{let p=un.useContext(st),i=e??p?.tabIds??[],v=t??p?.activeTabId??"",g=n??p?.locked??false,m=r??p?.tabsMetadata,P=o??p?.selectTab??(()=>{}),T=c??p?.removeTab??(()=>{}),{classNames:C={},activeType:N,poppedOutTabIds:h=[]}=ae(),Z=un.useContext(xe),{overTabId:w,overTabPosition:L}=Ge(),$=un.useMemo(()=>({tabIds:i,activeTabId:v,locked:g,tabsMetadata:m,selectTab:P,removeTab:T}),[i,v,g,m,P,T]),a=Xt(i,N,w,L);return jsxRuntime.jsx(Rt.Provider,{value:$,children:jsxRuntime.jsxs("div",{className:s?.container,style:{display:"flex",alignItems:"center",height:"100%",...l?.container},children:[i.map((d,y)=>{let R=m?.[d],M=wn(s?.tab,d),q=wn(l?.tab,d),K=y===a;return jsxRuntime.jsxs(un__default.default.Fragment,{children:[K&&C.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:C.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:y===0?"none":"translateX(-50%)"}})}),jsxRuntime.jsx(We,{id:d,locked:g,className:M,style:q,children:({isDragging:Q,isOver:z})=>u({id:d,paneId:p?.id??"",isActive:d===v,index:y,isDragging:Q,isOver:z,metadata:R,onSelect:()=>P(d),onRemove:()=>T(d),isPoppedOut:h.includes(d),popout:()=>Z?.popoutTab(d),dock:()=>Z?.dockTab(d)})})]},d)}),a===i.length&&C.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:C.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:"translateX(-100%)"}})})]})})};xt.Tab=We;var Dn=({className:e,style:t,children:n})=>jsxRuntime.jsx("div",{className:e,style:t,children:n});var st=un.createContext(void 0),Sn=()=>{let e=un.useContext(st);if(!e)throw new Error("usePaneContext must be used within a Pane component");return e},or=({children:e,className:t,style:n})=>{let{activeTabId:r}=Sn(),{classNames:o,isTabPoppedOut:c}=ae(),{dockTab:u}=Ze(),s=un.useRef(null),l=un.useContext(Te);if(!l)throw new Error("PaneContent must be used within a Zeugma provider");let{registerPortalTarget:p,registerRenderCallback:i}=l,v=un.useMemo(()=>typeof e=="function"?e:()=>e,[e]);i(r,v),un.useEffect(()=>{let m=s.current;return p(r,m),()=>{p(r,null,m);}},[r,p]);let g=c(r);return jsxRuntime.jsx("div",{ref:s,id:`zeugma-tab-target-${r}`,className:`${o.tabContentWrapper||""} ${t||""}`.trim(),style:{height:"100%",width:"100%",position:"relative",...n},children:g&&jsxRuntime.jsxs("div",{className:"zeugma-popout-placeholder",style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"12px",padding:"24px",textAlign:"center",backgroundColor:"#161719",color:"#94a3b8",fontSize:"13px",fontWeight:500},children:[jsxRuntime.jsx("div",{children:"This panel is open in a new window"}),jsxRuntime.jsx("button",{onClick:()=>u(r),style:{padding:"6px 12px",fontSize:"11px",fontWeight:600,borderRadius:"4px",backgroundColor:"#2563eb",color:"#ffffff",border:"none",cursor:"pointer",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},onMouseOver:m=>{m.currentTarget.style.backgroundColor="#1d4ed8";},onMouseOut:m=>{m.currentTarget.style.backgroundColor="#2563eb";},children:"Dock Back"})]})})},Oe=({id:e,children:t,style:n,locked:r=false})=>{let{layout:o,renderingLayout:c,activeId:u,activeType:s,classNames:l,fullscreenPaneId:p,onFullscreenChange:i,locked:v,poppedOutTabIds:g=[]}=ae(),{removePane:m,selectTab:P,removeTab:T,popoutTab:C,dockTab:N}=Ze(),h=un.useMemo(()=>{if(s==="tab"&&e===u){let E=j(o,e)?.tabsMetadata?.[e];return {type:"pane",id:e,tabIds:[e],activeTabId:e,tabsMetadata:E?{[e]:E}:void 0}}return Vt(e===u?o:c,e)},[o,c,e,u,s]),Z=h?.id??e,w=h?.tabIds??[e],L=h?.activeTabId??e,$=h?.tabsMetadata,a=$?.[e],d=h?.locked??false,y=r||d,R=v||y||p!==null,M=v||y||p!==null,q=u!==null&&u!==e&&(!w.includes(u)||w.length>1)&&!M,{attributes:K,listeners:Q,setNodeRef:z}=core.useDraggable({id:e,disabled:R}),H=u!==null&&w.includes(u),F=p===e,V=un.useMemo(()=>({isDragging:H,isFullscreen:F,toggleFullscreen:()=>i?.(F?null:e),remove:()=>{F&&i?.(null),m(Z);},metadata:a,locked:R,tabIds:w,activeTabId:L,selectTab:b=>P(Z,b),removeTab:b=>{F&&b===L&&i?.(null),T(b);},tabsMetadata:$,isActiveTabPoppedOut:g.includes(L),popoutTab:b=>C(b||L),dockTab:b=>N(b||L)}),[H,F,i,e,T,a,R,w,L,P,Z,$,g,C,N]),B=un.useMemo(()=>R?{disabled:true}:{...Q,...K},[Q,K,R]),I=`${l.pane||""} ${y&&l.paneLocked||""}`.trim();return jsxRuntime.jsx(st.Provider,{value:{id:e,...V},children:jsxRuntime.jsx(rt.Provider,{value:B,children:jsxRuntime.jsxs("div",{ref:z,id:e,className:I,style:{position:"relative",width:"100%",height:"100%",...n},children:[t,q&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:[["top","bottom","left","right"].map(b=>jsxRuntime.jsx(at,{id:`drop-${b}-${e}`,position:b,activeClassName:l.dropPreview},b)),s==="tab"&&jsxRuntime.jsx(at,{id:`drop-center-${e}`,position:"center",activeClassName:l.swapPreview??l.dropPreview})]}),u!==null&&u!==e&&M&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsxRuntime.jsx(at,{id:`drop-locked-${e}`,position:"full",activeClassName:l.lockedPreview||""})})]})})})};Oe.Content=or;Oe.DragHandle=Tn;Oe.Tabs=xt;Oe.Tab=We;Oe.Controls=Dn;var lt=new Map;function je(e){let t=lt.get(e);return t||(t={mounts:0,renders:0,listeners:new Set},lt.set(e,t)),t}function Nn(e,t){let n=je(e);return n.listeners.add(t),()=>{n.listeners.delete(t);}}function Ct(e){let t=lt.get(e);t&&t.listeners.forEach(n=>n());}function In(e){let t=lt.get(e);t&&(t.mounts=0,t.renders=0,Ct(e));}function Ae(e,t){let n=un.useId(),r=typeof e=="string"?{id:e,...t}:e||{},{id:o=n,logToConsole:c=false,disabled:u=false}=r,s=un.useRef(0),l=un.useRef(false),[,p]=un.useState(0);if(u||(s.current+=1),un.useEffect(()=>{if(u)return;let g=Nn(o,()=>{p(P=>P+1);}),m=je(o);return m.mounts+=1,l.current=true,c&&console.log(`[DevTools:${o}] Mounted: ${m.mounts} | Rendered: ${s.current}`),Ct(o),()=>{l.current=false,g();}},[o,u,c]),!u){let g=je(o);g.renders=Math.max(g.renders,s.current);}let i=un.useCallback(()=>{s.current=0,In(o);},[o]);return u?{mounts:0,renders:0,reset:i}:{mounts:je(o).mounts,renders:s.current,reset:i}}function kn({id:e,className:t,style:n,logToConsole:r=false,disabled:o=false}){let{mounts:c,renders:u}=Ae(e,{logToConsole:r,disabled:o});return o?null:jsxRuntime.jsxs("div",{className:t,style:n,children:[jsxRuntime.jsxs("span",{children:["M: ",jsxRuntime.jsx("strong",{children:c})]}),jsxRuntime.jsx("span",{children:"|"}),jsxRuntime.jsxs("span",{children:["R: ",jsxRuntime.jsx("strong",{children:u})]})]})}function Mn({id:e,label:t,children:n,className:r,footerClassName:o,style:c,logToConsole:u=false,disabled:s=false}){let l=t||e||"widget",{mounts:p,renders:i}=Ae(e,{logToConsole:u,disabled:s});return s?jsxRuntime.jsx(jsxRuntime.Fragment,{children:n}):jsxRuntime.jsxs("div",{className:r,style:c,children:[n&&jsxRuntime.jsx("div",{style:{flex:1,height:"100%",width:"100%",minHeight:0,overflow:"hidden",position:"relative"},children:n}),jsxRuntime.jsxs("div",{className:o,children:[jsxRuntime.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntime.jsxs("span",{children:["Mounts: ",jsxRuntime.jsx("strong",{className:"counter-mounts",children:p})]}),jsxRuntime.jsx("span",{children:"|"}),jsxRuntime.jsxs("span",{children:["Renders: ",jsxRuntime.jsx("strong",{className:"counter-renders",children:i})]})]})]})]})}exports.Pane=Oe;exports.PaneTree=Tt;exports.RenderCounterBadge=kn;exports.RenderCounterFooter=Mn;exports.Zeugma=Do;exports.usePaneContext=Sn;exports.useRenderCounter=Ae;exports.useResizer=yt;exports.useZeugma=Yn;exports.useZeugmaContext=Gn;//# sourceMappingURL=index.cjs.map
|
|
12
12
|
//# sourceMappingURL=index.cjs.map
|