react-zeugma 6.9.12 → 7.0.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 +21 -20
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/{types-D7fO-n0A.d.cts → types-TTO4dDzX.d.cts} +20 -3
- package/dist/{types-D7fO-n0A.d.ts → types-TTO4dDzX.d.ts} +20 -3
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +12 -18
- package/dist/utils.d.ts +12 -18
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -247,17 +247,16 @@ 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
|
-
| `
|
|
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` | - |
|
|
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
|
+
| `selectTab` | Callback when a tab is selected. | `(id: string) => void` | - |
|
|
256
|
+
| `removeTab` | Callback when a tab is closed. | `(id: string) => void` | - |
|
|
257
|
+
| `classNames` | Custom class names for the container and tabs. | `{ container?: string; tab?: string \| ((tabId: string) => string) }` | - |
|
|
258
|
+
| `styles` | Custom CSS style overrides for the container and tabs. | `{ container?: CSSProperties; tab?: CSSProperties \| ((tabId: string) => CSSProperties) }` | - |
|
|
259
|
+
| `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` | - |
|
|
261
260
|
|
|
262
261
|
---
|
|
263
262
|
|
|
@@ -284,14 +283,17 @@ const controller = useZeugma({
|
|
|
284
283
|
|
|
285
284
|
##### Options
|
|
286
285
|
|
|
287
|
-
| Parameter | Description | Type
|
|
288
|
-
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
289
|
-
| `initialLayout` | Initial layout tree structure. Only used on mount. | `TreeNode \| null`
|
|
290
|
-
| `layout` | Controlled layout tree structure. Hook runs in controlled mode if provided. | `TreeNode \| null`
|
|
291
|
-
| `onChange` | Callback triggered when the layout tree updates.
|
|
292
|
-
| `
|
|
293
|
-
| `
|
|
294
|
-
| `
|
|
286
|
+
| Parameter | Description | Type | Default |
|
|
287
|
+
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------- | ------- |
|
|
288
|
+
| `initialLayout` | Initial layout tree structure. Only used on mount. | `TreeNode \| null` | `null` |
|
|
289
|
+
| `layout` | Controlled layout tree structure. Hook runs in controlled mode if provided. | `TreeNode \| null` | `null` |
|
|
290
|
+
| `onChange` | Callback triggered when the layout tree updates (splits, positions, sizes, active tab). | `(newLayout: TreeNode \| null) => void` | - |
|
|
291
|
+
| `initialMetadata` | Initial metadata mapping for all tabs/widgets in uncontrolled mode. | `Record<string, Record<string, unknown>>` | - |
|
|
292
|
+
| `metadata` | Controlled metadata mapping for all tabs/widgets. | `Record<string, Record<string, unknown>>` | - |
|
|
293
|
+
| `onMetadataChange` | Callback triggered when tab/widget metadata changes. | `(metadata: Record<string, Record<string, unknown>>) => void` | - |
|
|
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` |
|
|
295
297
|
|
|
296
298
|
---
|
|
297
299
|
|
|
@@ -378,7 +380,6 @@ const {
|
|
|
378
380
|
| `metadata` | Active tab's custom metadata. | `Record<string, unknown> \| undefined` |
|
|
379
381
|
| `updateMetadata` | Updates active tab's metadata. | `(updater: (current: Record<string, unknown> \| undefined) => Record<string, unknown> \| undefined) => void` |
|
|
380
382
|
| `locked` | Whether the pane or the dashboard is locked. | `boolean` |
|
|
381
|
-
| `tabsMetadata` | Tab metadata mapping for all tabs inside this pane. | `Record<string, Record<string, unknown>> \| undefined` |
|
|
382
383
|
| `updateTabMetadata` | Updates metadata for a specific tab in the pane. | `(tabId: string, updater: (current: Record<string, unknown> \| undefined) => Record<string, unknown> \| undefined) => void` |
|
|
383
384
|
| `isActiveTabPoppedOut` | **[Experimental]** Whether the active tab is popped out into a new window. | `boolean` |
|
|
384
385
|
| `popoutTab` | **[Experimental]** Popout the active tab into a new window. | `(tabId?: string) => void` |
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var mn=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 mn__default=/*#__PURE__*/_interopDefault(mn);function $t({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 u=s=>{n(s);},l=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let s=document.getElementById("zeugma-global-cursor-style");s&&s.remove(),document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",l),r();};document.addEventListener("pointermove",u),document.addEventListener("pointerup",l);}var gt=pn.createContext(void 0),Re=pn.createContext(void 0),Te=pn.createContext(void 0),bt=pn.createContext(void 0),ae=()=>{let e=pn.useContext(gt);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},Ze=()=>{let e=pn.useContext(Re);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e},Je=()=>{let e=pn.useContext(bt);if(!e)throw new Error("useZeugmaDrag must be used within a Zeugma provider");return e};function Ht(e){let t=pn.useRef(null);return pn.useEffect(()=>{if(!e){t.current=null;return}let n=o=>{t.current={x:o.clientX,y:o.clientY};},r=o=>{let u=o.touches[0]||o.changedTouches[0];u&&(t.current={x:u.clientX,y:u.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){pn.useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function Bt(){let[e,t]=pn.useState({}),[n,r]=pn.useState({}),o=pn.useRef({}),u=pn.useRef(null),l=pn.useRef({}),s=pn.useRef(null),c=pn.useRef(true);pn.useEffect(()=>(c.current=true,()=>{c.current=false;}),[]);let f=pn.useCallback((y,D,N)=>{c.current&&t(T=>{if(!D){if(N&&T[y]!==N||!T[y])return T;let Z={...T};return delete Z[y],Z}return T[y]===D?T:{...T,[y]:D}});},[]),i=pn.useCallback((y,D)=>{c.current&&r(N=>{if(!D){if(!N[y])return N;let T={...N};return delete T[y],T}return N[y]===D?N:{...N,[y]:D}});},[]),b=pn.useCallback((y,D)=>{o.current[y]=D;},[]),g=pn.useCallback(y=>{u.current=y;},[]),m=pn.useCallback((y,D)=>{l.current[y]=D;},[]);return {portalTargets:pn.useMemo(()=>({...e,...n}),[e,n]),registerPortalTarget:f,registerPopoutTarget:i,registerRenderCallback:b,renderCallbacksRef:o,registerRenderPane:g,renderPaneRef:u,registerTabHeader:m,tabHeadersRef:l,activeIdRef:s}}function Un(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 Ft(e){return pn.useMemo(()=>Un(e),[e])}function _t(e){let{onDragStart:t,onDragEnd:n}=e,[r,o]=pn.useState(null),[u,l]=pn.useState(null),s=pn.useCallback(f=>{t&&t(f);},[t]),c=pn.useCallback((f,i,b)=>{n&&n(f,i,b);},[n]);return {overTabId:r,setOverTabId:o,overTabPosition:u,setOverTabPosition:l,handleDragStartInternal:s,handleDragEndInternal:c}}function Vt(e){let n=pn.useContext(Te)?.registerRenderPane;pn.useEffect(()=>{n&&e&&n(e);},[n,e]);}function pe(){return "pane-"+Math.random().toString(36).substring(2,11)}function be(e,t){if(e===null)return null;if(e.type==="pane")return e.id===t?null:e;let n=be(e.first,t),r=be(e.second,t);return n===null?r:r===null?n:{...e,first:n,second:r}}function fe(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 u=e.activeTabId;e.activeTabId===t&&(u=o[0]);let l={...e.tabsMetadata};return delete l[t],{...e,tabIds:o,activeTabId:u,tabsMetadata:Object.keys(l).length>0?l:void 0}}return e}let n=fe(e.first,t),r=fe(e.second,t);return n===null?r:r===null?n:{...e,first:n,second:r}}function Ee(e,t,n,r,o){if(e===null)return typeof o=="string"?{type:"pane",id:pe(),tabIds:[o],activeTabId:o}:o;if(e.type==="pane"){if(e.id===t){let u=typeof o=="string"?{type:"pane",id:pe(),tabIds:[o],activeTabId:o}:o,l=r==="left"||r==="top";return {type:"split",direction:n,first:l?u:e,second:l?e:u,splitPercentage:50}}return e}return {...e,first:Ee(e.first,t,n,r,o)||e.first,second:Ee(e.second,t,n,r,o)||e.second}}function Xn(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 jt(e,t,n,r){if(e===null)return {type:"pane",id:pe(),tabIds:[n],activeTabId:n,tabsMetadata:r?{[n]:r}:void 0};let o=t?ne(e,t):null;if(o&&o.type==="pane"){let s=function(c){if(c.type==="pane"&&c.id===t){let f=[...c.tabIds];f.includes(n)||f.push(n);let i=c.tabsMetadata;return r&&(i={...c.tabsMetadata,[n]:r}),{...c,tabIds:f,activeTabId:n,tabsMetadata:i}}return c.type==="split"?{...c,first:s(c.first),second:s(c.second)}:c};return s(e)}let u={type:"pane",id:pe(),tabIds:[n],activeTabId:n,tabsMetadata:r?{[n]:r}:void 0};return Xn(e,u)}function xe(e,t,n){return e===null?null:e===t?{...e,splitPercentage:n}:e.type==="split"?{...e,first:xe(e.first,t,n)||e.first,second:xe(e.second,t,n)||e.second}:e}function ne(e,t){return e===null?null:e.type==="pane"?e.id===t?e:null:e.type==="split"?ne(e.first,t)??ne(e.second,t):null}function U(e,t){return e===null?null:e.type==="pane"?e.tabIds.includes(t)?e:null:e.type==="split"?U(e.first,t)??U(e.second,t):null}function Wt(e,t){return ne(e,t)??U(e,t)}function nt(e,t){let n=U(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 qt(e,t){return U(e,t)?.tabsMetadata?.[t]}function Ut(e,t){let n=ne(e,t);return n?.tabsMetadata?.[n.activeTabId]}function et(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.tabIds.includes(t)){let r=e.tabsMetadata||{},o=r[t],u=n(o),l={...r};return u===void 0?delete l[t]:l[t]=u,{...e,tabsMetadata:Object.keys(l).length>0?l:void 0}}return e}return e.type==="split"?{...e,first:et(e.first,t,n)??e.first,second:et(e.second,t,n)??e.second}:e}function tt(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:tt(e.first,t,n)??e.first,second:tt(e.second,t,n)??e.second}:e}function Se(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:Se(e.first,t,n)??e.first,second:Se(e.second,t,n)??e.second}:e}function Xt(e,t,n){if(e===null)return null;let o=U(e,t)?.tabsMetadata?.[t],u=fe(e,t);if(u===null)return {type:"pane",id:pe(),tabIds:[t],activeTabId:t,tabsMetadata:o?{[t]:o}:void 0};function l(s){if(s.type==="pane"){if(s.id===n){let c=[...s.tabIds];c.includes(t)||c.push(t);let f={...s.tabsMetadata};return o&&(f[t]=o),{...s,tabIds:c,activeTabId:t,tabsMetadata:Object.keys(f).length>0?f:void 0}}return s}return s.type==="split"?{...s,first:l(s.first),second:l(s.second)}:s}return l(u)}function Yn(e,t,n){if(e===null)return null;if(t===n)return e;let r=U(e,t),o=U(e,n);if(!r||!o)return e;let u=r.id,l=o.id,s=r.tabsMetadata?.[t],c=o.tabsMetadata?.[n];function f(i){if(i.type==="pane"){let b=false,g=[...i.tabIds],m=i.activeTabId,h=i.tabsMetadata?{...i.tabsMetadata}:{};if(u===l){if(i.id===u){let y=g.indexOf(t),D=g.indexOf(n);y!==-1&&D!==-1&&(g[y]=n,g[D]=t),m=t,b=true;}}else i.id===u&&(g=g.map(y=>y===t?n:y),m===t&&(m=n),delete h[t],c&&(h[n]=c),b=true),i.id===l&&(g=g.map(y=>y===n?t:y),m===n&&(m=t),delete h[n],s&&(h[t]=s),b=true);return b?{...i,tabIds:g,activeTabId:m,tabsMetadata:Object.keys(h).length>0?h:void 0}:i}return i.type==="split"?{...i,first:f(i.first),second:f(i.second)}:i}return f(e)}function He(e,t,n,r="before"){if(e===null)return null;if(t===n)return e;if(r==="center")return Yn(e,t,n);let u=U(e,t)?.tabsMetadata?.[t],l=fe(e,t);if(l===null)return {type:"pane",id:pe(),tabIds:[t],activeTabId:t,tabsMetadata:u?{[t]:u}:void 0};function s(c){if(c.type==="pane"){if(c.tabIds.includes(n)){let i=[...c.tabIds].filter(m=>m!==t),b=i.indexOf(n);b<0&&(b=0),r==="after"&&(b+=1),i.splice(b,0,t);let g={...c.tabsMetadata};return u&&(g[t]=u),{...c,tabIds:i,activeTabId:t,tabsMetadata:Object.keys(g).length>0?g:void 0}}return c}return c.type==="split"?{...c,first:s(c.first),second:s(c.second)}:c}return s(l)}function ve(e,t=0,n=0,r=100,o=100,u="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:l,splitPercentage:s,first:c,second:f}=e,b={id:`splitter-${u}-${l}`,currentNode:e,direction:l,left:l==="row"?t+r*(s/100):t,top:l==="column"?n+o*(s/100):n,width:l==="row"?0:r,height:l==="column"?0:o,parentLeft:t,parentTop:n,parentWidth:r,parentHeight:o},g={panes:[],splitters:[]},m={panes:[],splitters:[]};if(l==="row"){let h=r*(s/100);g=ve(c,t,n,h,o,`${u}-L`),m=ve(f,t+h,n,r-h,o,`${u}-R`);}else {let h=o*(s/100);g=ve(c,t,n,r,h,`${u}-T`),m=ve(f,t,n+h,r,o-h,`${u}-B`);}return {panes:[...g.panes,...m.panes],splitters:[b,...g.splitters,...m.splitters]}}function Yt(e,t,n,r="before"){if(e===null)return null;let o=ne(e,t);if(!o)return e;let u=o.tabIds,l=o.activeTabId,s=o.tabsMetadata||{},c=be(e,t);if(c===null)return o;function f(i){if(i.type==="pane"){if(i.tabIds.includes(n)){let g=[...i.tabIds].filter(y=>!u.includes(y)),m=g.indexOf(n);m<0&&(m=0),r==="after"&&(m+=1),g.splice(m,0,...u);let h={...i.tabsMetadata};for(let y of u)s[y]&&(h[y]=s[y]);return {...i,tabIds:g,activeTabId:l,tabsMetadata:Object.keys(h).length>0?h:void 0}}return i}return i.type==="split"?{...i,first:f(i.first),second:f(i.second)}:i}return f(c)}function Gt(e,t,n,r){if(!((t==="tab"||t==="pane")&&n&&e.includes(n))||!r)return -1;let l=e.indexOf(n);return r==="before"?l:l+1}function Jt(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 u=e[o],l=t[o];if(typeof u=="object"&&u!==null&&typeof l=="object"&&l!==null){if(!Jt(u,l))return false}else if(u!==l)return false}return true}function Gn(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)||!Jt(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 Gn(e.tabsMetadata,n.tabsMetadata)}}function Jn(e){let{initialLayout:t,layout:n,onChange:r,fullscreenPaneId:o,onFullscreenChange:u,locked:l=false}=e,[s,c]=pn.useState(()=>n!==void 0?n:t??null),[f,i]=pn.useState(()=>n!==void 0?n:t??null),b=pn.useRef(n),[g,m]=pn.useState(o||null),[h,y]=pn.useState(l),[D,N]=pn.useState([]),[T,Z]=pn.useState(null),[C,M]=pn.useState(null),[H,a]=pn.useState(null),d=pn.useRef(null),v=pn.useCallback(p=>{d.current=p;},[]),R=pn.useRef(s);R.current=s;let I=pn.useRef(g);I.current=g;let q=pn.useRef(r);q.current=r;let oe=pn.useRef(u);oe.current=u;let J=pn.useCallback(p=>{m(p),oe.current?.(p);},[]);pn.useEffect(()=>{y(l);},[l]),pn.useEffect(()=>{o!==void 0&&m(o);},[o]),n!==void 0&&($e(n,b.current??null)||(b.current=n,c(n),i(n),N(p=>{if(p.length===0)return p;let w=p.filter(x=>nt(n,x)!==null);return w.length===p.length?p:w})));let A=pn.useCallback(p=>(...w)=>{let x=R.current,$=p(x,...w);$e(x,$)||(R.current=$,c($),i($),N(_=>{if(_.length===0)return _;let se=_.filter(j=>nt($,j)!==null);return se.length===_.length?_:se}),q.current?.($));},[]),B=pn.useCallback(A((p,w)=>typeof w=="function"?w(p):w),[A]),W=pn.useCallback(p=>{I.current===null&&i(w=>typeof p=="function"?p(w):p);},[]),V=pn.useCallback(p=>{m(null),oe.current?.(null),Z(null),M(null),a(null),B(p),i(()=>typeof p=="function"?p(R.current):p);},[B]),F=pn.useCallback(A((p,w)=>I.current!==null?p:be(p,w)),[A]),L=pn.useCallback(A((p,w,x,$)=>{if(I.current!==null)return p;let _=fe(p,w)??p;return jt(_,x,w,$)}),[A]),P=pn.useCallback(A((p,w,x,$,_)=>{if(I.current!==null)return p;let se=ne(p,w)??U(p,w);if(!se)return p;let j=ne(p,_)??U(p,_)??{type:"pane",id:_,tabIds:[_],activeTabId:_},ye=be(p,j.id);return Ee(ye,se.id,x,$,j)}),[A]),z=pn.useCallback(A((p,w,x)=>I.current!==null?p:xe(p,w,x)),[A]),E=pn.useCallback(A((p,w,x)=>et(p,w,x)),[A]),O=pn.useCallback(A((p,w,x)=>{let $=ne(p,w)??U(p,w);return $?tt(p,$.id,x):p}),[A]),ue=pn.useCallback(A((p,w,x)=>{let $=ne(p,w)??U(p,w);return $?Se(p,$.id,x):p}),[A]),K=pn.useCallback(A((p,w,x)=>{if(I.current!==null)return p;let $=ne(p,x)??U(p,x);return $?Xt(p,w,$.id):p}),[A]),ee=pn.useCallback(A((p,w,x,$)=>I.current!==null?p:He(p,w,x,$)),[A]),Y=pn.useCallback(A((p,w)=>I.current!==null?p:fe(p,w)),[A]),te=pn.useCallback(p=>ne(R.current,p),[]),S=pn.useCallback(p=>U(R.current,p),[]),k=pn.useCallback(p=>nt(R.current,p),[]),ie=pn.useCallback(p=>qt(R.current,p),[]),le=pn.useCallback(p=>Ut(R.current,p),[]),Q=pn.useCallback(p=>{I.current===null&&N(w=>w.includes(p)?w:[...w,p]);},[]),re=pn.useCallback(p=>{I.current===null&&N(w=>w.includes(p)?w.filter(x=>x!==p):w);},[]);return {layout:s,setLayout:V,_internalSetLayout:W,renderingLayout:f,fullscreenPaneId:g,setFullscreenPaneId:J,locked:h,setLocked:y,poppedOutTabIds:D,activeId:T,setActiveId:Z,activeType:C,setActiveType:M,dismissIntentId:H,setDismissIntentId:a,containerRef:d,setContainerRef:v,removePane:F,addTab:L,updateMetadata:E,updatePaneLock:O,selectTab:ue,mergeTab:K,moveTab:ee,removeTab:Y,splitPane:P,updateSplitPercentage:z,popoutTab:Q,dockTab:re,findPaneById:te,findPaneContainingTab:S,findTabById:k,getTabMetadata:ie,getActiveTabMetadata:le}}var Qn=()=>{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,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 ot=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},rt=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};var Kt=e=>{let n=e.active.id.toString().startsWith("tab-header-"),o=core.pointerWithin(e);if(o.length>0)return [...o].sort((l,s)=>{let c=l.id.toString(),f=s.id.toString(),i=c.startsWith("tab-drop-"),b=f.startsWith("tab-drop-");if(i&&!b)return -1;if(!i&&b)return 1;let g=c.startsWith("drop-root-"),m=f.startsWith("drop-root-");return g&&!m?-1:!g&&m?1:0});if(n){let u=e.droppableContainers.filter(l=>l.id.toString().startsWith("tab-drop-"));return core.closestCenter({...e,droppableContainers:u})}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 nn(e){let{layout:t,_internalSetLayout:n,setLayout:r,activeId:o,setActiveId:u,activeType:l,setActiveType:s,dismissIntentId:c,setDismissIntentId:f,setOverTabId:i,setOverTabPosition:b,containerRef:g,dragActivationDistance:m,enableDragToDismiss:h,dismissThreshold:y,onRemove:D,onDragStart:N,onDragEnd:T,onDismissIntentChange:Z,removeTab:C,removePane:M}=e,H=pn.useRef(null),a=Ht(o),d=pn.useRef(null),[v,R]=pn.useState(false);return $t(v),{sensors:core.useSensors(core.useSensor(ot,{activationConstraint:{distance:m}}),core.useSensor(rt,{activationConstraint:{delay:250,tolerance:5}})),collisionDetection:Kt,onDragStart:B=>{let W=B.active.id.toString(),V=W.startsWith("tab-header-"),F=V?W.substring(11):W;u(F),s(V?"tab":"pane"),i(null),b(null);let L=B.activatorEvent;a.current=Be(L),h&&g.current?H.current=g.current.getBoundingClientRect():H.current=null;let P=t;if(V){let E=U(t,F);E&&(P=Se(t,E.id,F)||t);}d.current=P;let z=V?fe(P,F):be(P,F);n(z),N&&N(F);},onDragMove:B=>{let{over:W}=B,V=W?.id.toString()||"",F=V.startsWith("drop-locked-");R(S=>S===F?S:F);let L=B.active.id.toString(),P=L.startsWith("tab-header-"),z=P?L.substring(11):L,E=V.match(/^tab-drop-(.+)$/);if(E&&W&&(P||l==="pane")){let[,S]=E;if(z!==S){let k="before",ie=W.rect,le=B.activatorEvent,Q=null;if(a.current)Q=a.current.x;else {let re=Be(le);re&&(Q=re.x+B.delta.x);}if(Q!==null){let re=ie.left+ie.width/2;Q>re&&(k="after");}i(re=>re===S?re:S),b(re=>re===k?re:k);}else i(k=>k===null?k:null),b(k=>k===null?k:null);}else i(S=>S===null?S:null),b(S=>S===null?S:null);if(!h)return;let O=H.current;if(!O){c!==null&&(f(null),Z?.(null));return}let ue=B.activatorEvent,K=null,ee=null;if(a.current)K=a.current.x,ee=a.current.y;else {let S=Be(ue);S&&(K=S.x+B.delta.x,ee=S.y+B.delta.y);}let Y=0;if(K!==null&&ee!==null){let S=0,k=0;K<O.left?S=O.left-K:K>O.right&&(S=K-O.right),ee<O.top?k=O.top-ee:ee>O.bottom&&(k=ee-O.bottom),Y=Math.sqrt(S*S+k*k);}else {let S=B.active.rect.current.translated;if(S){let k=S.left+S.width/2,ie=S.top+S.height/2,le=0,Q=0;k<O.left?le=O.left-k:k>O.right&&(le=k-O.right),ie<O.top?Q=O.top-ie:ie>O.bottom&&(Q=ie-O.bottom),Y=Math.sqrt(le*le+Q*Q);}}Y>y?c!==z&&(f(z),Z?.(z)):c!==null&&(f(null),Z?.(null));},onDragEnd:B=>{u(null),s(null),R(false),i(null),b(null);let{active:W,over:V}=B,F=W.id.toString(),L=F.startsWith("tab-header-"),P=L?F.substring(11):F,z=h&&c===P;f(null),Z?.(null),H.current=null;let E=d.current||t;if(d.current=null,z){D?D(P):L?C(P):M(P),T&&T(P,null,null);return}if(!V){n(E),T&&T(P,null,null);return}let O=V.id.toString();if(O.startsWith("drop-locked-")){n(E),T&&T(P,null,null);return}let ue=O.match(/^tab-drop-(.+)$/);if(ue){let[,p]=ue;if(L)if(P!==p){let w="before",x=V.rect,$=B.activatorEvent,_=null;if(a.current)_=a.current.x;else {let j=Be($);j&&(_=j.x+B.delta.x);}if(_!==null){let j=x.left+x.width/2;_>j&&(w="after");}let se=He(E,P,p,w);r(se),T&&T(P,p,{type:"move",position:"center"});}else n(E),T&&T(P,null,null);else {let w="before",x=V.rect,$=B.activatorEvent,_=null;if(a.current)_=a.current.x;else {let j=Be($);j&&(_=j.x+B.delta.x);}if(_!==null){let j=x.left+x.width/2;_>j&&(w="after");}let se=Yt(E,P,p,w);r(se),T&&T(P,p,{type:"move",position:"center"});}return}let K=O.match(/^drop-root-(1\/4|1\/3)-(top|bottom|left|right|start|end)$/);if(K){let[,p,w]=K,x=w;x==="start"&&(x="left"),x==="end"&&(x="right");let $=L?fe(E,P):be(E,P),_;if(L){let j=U(E,P)?.tabsMetadata?.[P];_={type:"pane",id:pe(),tabIds:[P],activeTabId:P,tabsMetadata:j?{[P]:j}:void 0};}else _=ne(E,P)??{type:"pane",id:pe(),tabIds:[P],activeTabId:P};if($===null)r(_);else {let se=x==="left"||x==="right",j=x==="left"||x==="top",ye=50;p==="1/4"?ye=j?25:75:p==="1/3"&&(ye=j?100/3:200/3),r({type:"split",direction:se?"row":"column",first:j?_:$,second:j?$:_,splitPercentage:ye});}T&&T(P,"root",{type:"split",direction:x==="left"||x==="right"?"row":"column",position:x});return}let ee=O.match(/^drop-(left|right|top|bottom|center)-(.+)$/);if(!ee){n(E),T&&T(P,null,null);return}let[,Y,te]=ee;if(Y==="center"){if(L){let p=ne(E,te);if(p&&p.activeTabId){let w=p.activeTabId,x=He(E,P,w,"center");r(x),T&&T(P,te,{type:"move",position:"center"});}else n(E),T&&T(P,null,null);}else n(E),T&&T(P,null,null);return}let S=L?U(E,P):ne(E,P),k=S&&S.id===te,ie=S&&S.tabIds.length===1;if(P===te||k&&ie){n(E),T&&T(P,null,null);return}let le=Y==="left"||Y==="right"?"row":"column",Q;if(L){let w=U(E,P)?.tabsMetadata?.[P];Q={type:"pane",id:pe(),tabIds:[P],activeTabId:P,tabsMetadata:w?{[P]:w}:void 0};}else Q=ne(E,P)??{type:"pane",id:pe(),tabIds:[P],activeTabId:P};let re=L?fe(E,P):be(E,P),ze=Ee(re,te,le,Y,Q);r(ze),T&&T(P,te,{type:"split",direction:le,position:Y});},onDragCancel:()=>{u(null),s(null),R(false),i(null),b(null),f(null),Z?.(null),H.current=null;let B=d.current||t;d.current=null,n(B),B!==t&&r(B);}}}function rn({persist:e,layout:t,setLayout:n}){let r=typeof e=="object"?e.enabled!==false:!!e,o=typeof e=="object"&&e.key||"zeugma-layout",[u,l]=pn.useState(false);pn.useEffect(()=>{if(r){let s=localStorage.getItem(o);if(s)try{let c=JSON.parse(s);c&&n(c);}catch(c){console.error("Failed to parse persisted zeugma layout",c);}}l(true);},[r,o,n]),pn.useEffect(()=>{r&&u&&(t?localStorage.setItem(o,JSON.stringify(t)):localStorage.removeItem(o));},[r,o,t,u]);}var ge=null,sn=false,G=new Set,Ce=new Set,Ie=null;function io(){typeof window>"u"||Ie||(Ie=new MutationObserver(e=>{e.forEach(t=>{t.addedNodes.forEach(n=>{n instanceof HTMLElement&&(n.tagName.toLowerCase()==="style"||n.tagName.toLowerCase()==="link")&&G.forEach(r=>{try{let o=n.cloneNode(!0);if(o.tagName.toLowerCase()==="link"){let u=n.href;u&&o.setAttribute("href",u);}r.head.appendChild(o);}catch(o){console.warn("Failed to mirror style node to popout:",o);}});});});}),Ie.observe(document.head,{childList:true}));}function vt(){Ie&&(Ie.disconnect(),Ie=null);}var Le=null;function lo(){typeof window>"u"||Le||(Le=new MutationObserver(e=>{e.forEach(t=>{if(t.type==="attributes"&&t.attributeName){let n=document.documentElement.getAttribute(t.attributeName);G.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);}});}});}),Le.observe(document.documentElement,{attributes:true}));}function ht(){Le&&(Le.disconnect(),Le=null);}var ln=e=>{typeof requestAnimationFrame<"u"?requestAnimationFrame(e):setTimeout(e,0);};function me(){if(typeof window>"u")return document;if(ge&&ge.target){let n=ge.target.ownerDocument;if(n&&n!==document&&G.has(n))return n}let e=window.event;if(e&&e.target){let r=e.target.ownerDocument;if(r&&r!==document&&G.has(r))return r}let t=window.__zeugmaActivePopoutDocument;return t&&G.has(t)?t:document}function cn(){if(typeof window>"u"||sn)return;sn=true;let e=(a,d)=>{if(!a||!d)return false;try{let v=Object.getPrototypeOf(a);for(;v;){if(v===d)return !0;v=Object.getPrototypeOf(v);}}catch{}return false},t=(a,d)=>{try{Object.defineProperty(a,Symbol.hasInstance,{value:function(v){return v?e(v,a.prototype)?!0:d(v):!1},configurable:!0,writable:!0});}catch(v){console.warn("Failed to patch Symbol.hasInstance on",a,v);}};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"),u=Object.getOwnPropertyDescriptor(n,"head"),l=Object.getOwnPropertyDescriptor(n,"activeElement"),s=Object.getOwnPropertyDescriptor(n,"defaultView"),c=Object.getOwnPropertyDescriptor(n,"scrollingElement");Object.defineProperties(document,{body:{get(){let a=me();return a&&a!==document?a.body:r?.get?.call(document)||document.body},configurable:true},documentElement:{get(){let a=me();return a&&a!==document?a.documentElement:o?.get?.call(document)||document.documentElement},configurable:true},head:{get(){let a=me();return a&&a!==document?a.head:u?.get?.call(document)||document.head},configurable:true},activeElement:{get(){let a=me();return a&&a!==document?a.activeElement:l?.get?.call(document)||document.activeElement},configurable:true},defaultView:{get(){let a=me();return a&&a!==document?a.defaultView:s?.get?.call(document)||document.defaultView},configurable:true},scrollingElement:{get(){let a=me();return a&&a!==document?a.scrollingElement:c?.get?.call(document)||document.scrollingElement},configurable:true}});let f=Window.prototype,i=["innerWidth","innerHeight","pageXOffset","pageYOffset","scrollX","scrollY","screenX","screenY","outerWidth","outerHeight","devicePixelRatio"],b={};i.forEach(a=>{let d=Object.getOwnPropertyDescriptor(f,a)||Object.getOwnPropertyDescriptor(window,a);d&&d.get&&(b[a]=d.get);}),i.forEach(a=>{Object.defineProperty(window,a,{get(){let d=me();if(d&&d!==document&&d.defaultView)try{return d.defaultView[a]}catch{}let v=b[a];return v?v.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 G)try{if(d.contains(a))return !0}catch{}return false};let m=()=>{ge=null,globalThis.__zeugmaActivePopoutDocument=null;};["pointerdown","mousedown","click","keydown","focus","touchstart"].forEach(a=>{window.addEventListener(a,m,true);});let y=document.createElement;document.createElement=function(a,d){let v=me();return v&&v!==document?v.createElement(a,d):y.call(document,a,d)};let D=document.addEventListener;document.addEventListener=function(a,d,v){Ce.add({target:"document",type:a,listener:d,options:v}),D.call(document,a,d,v),G.forEach(R=>{try{R.addEventListener(a,d,v);}catch{}});};let N=document.removeEventListener;document.removeEventListener=function(a,d,v){for(let R of Ce)if(R.target==="document"&&R.type===a&&R.listener===d){Ce.delete(R);break}N.call(document,a,d,v),G.forEach(R=>{try{R.removeEventListener(a,d,v);}catch{}});};let T=window.addEventListener;window.addEventListener=function(a,d,v){Ce.add({target:"window",type:a,listener:d,options:v}),T.call(window,a,d,v),G.forEach(R=>{try{R.defaultView&&R.defaultView.addEventListener(a,d,v);}catch{}});};let Z=window.removeEventListener;window.removeEventListener=function(a,d,v){for(let R of Ce)if(R.target==="window"&&R.type===a&&R.listener===d){Ce.delete(R);break}Z.call(window,a,d,v),G.forEach(R=>{try{R.defaultView&&R.defaultView.removeEventListener(a,d,v);}catch{}});};let C=document.getElementById;document.getElementById=function(a){let d=me();if(d&&d!==document)return d.getElementById(a);let v=C.call(document,a);if(v)return v;for(let R of G)try{let I=R.getElementById(a);if(I)return I}catch{}return null};let M=document.querySelector;document.querySelector=function(a){let d=me();if(d&&d!==document)return d.querySelector(a);let v=M.call(document,a);if(v)return v;for(let R of G)try{let I=R.querySelector(a);if(I)return I}catch{}return null};let H=document.querySelectorAll;document.querySelectorAll=function(a){let d=me();if(d&&d!==document)return d.querySelectorAll(a);let v=H.call(document,a);if(v.length>0)return v;for(let R of G)try{let I=R.querySelectorAll(a);if(I.length>0)return I}catch{}return v};}function un(e){let{poppedOutTabIds:t,registerPopoutTarget:n,findTabById:r,dockTab:o}=e,u=pn.useRef({});pn.useEffect(()=>{let l=u.current;t.forEach(s=>{if(l[s]){try{l[s].focus();}catch{}return}cn();let f=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}l[s]=i,G.add(i.document),Ce.forEach(d=>{try{d.target==="window"?i.addEventListener(d.type,d.listener,d.options):i.document.addEventListener(d.type,d.listener,d.options);}catch{}}),io(),lo(),i.document.title=f,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 v=d.cloneNode(true);if(d.tagName.toLowerCase()==="link"){let R=d.href;R&&v.setAttribute("href",R);}else if(d.tagName.toLowerCase()==="style")try{let R=d.sheet?.cssRules;if(R&&R.length>0){let I=Array.from(R).map(q=>q.cssText).join(`
|
|
10
|
-
`);v.textContent
|
|
11
|
-
`);return R.replaceSync(I),R}catch{return null}}).filter(v=>v!==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 b=document.getElementById(`zeugma-tab-target-${s}`),g="";b&&(g=window.getComputedStyle(b).backgroundColor,(!g||g==="transparent"||g==="rgba(0, 0, 0, 0)")&&b.parentElement&&(g=window.getComputedStyle(b.parentElement).backgroundColor));let m=window.getComputedStyle(document.documentElement),h=window.getComputedStyle(document.body),y=h.backgroundColor,N=!y||y==="transparent"||y==="rgba(0, 0, 0, 0)"?m.backgroundColor:y,T=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=T,i.document.body.style.backgroundColor=T),i.document.body.style.color=h.color||m.color,i.document.body.style.fontFamily=h.fontFamily||m.fontFamily;let C=i.document.createElement("div");C.id=`zeugma-popout-container-${s}`,C.className="zeugma-popout-container",C.style.width="100%",C.style.height="100%",C.style.overflow="hidden",C.style.border="none",i.document.body.appendChild(C),n?.(s,C);let M=["pointerdown","mousedown","click","keydown","focus","touchstart"],H=d=>{ge=d,globalThis.__zeugmaActivePopoutDocument=i.document,setTimeout(()=>{ge===d&&(ge=null,globalThis.__zeugmaActivePopoutDocument=null);},0);};M.forEach(d=>{i.addEventListener(d,H,true);});let a=()=>{ge=null,globalThis.__zeugmaActivePopoutDocument=null,G.delete(i.document),G.size===0&&(vt(),ht()),o(s);};i.addEventListener("beforeunload",a),i.__zeugmaCleanup=()=>{M.forEach(d=>{i.removeEventListener(d,H,true);}),i.removeEventListener("beforeunload",a);};}),Object.keys(l).forEach(s=>{if(!t.includes(s)){let c=l[s];if(delete l[s],n?.(s,null),c){ge&&ge.target.ownerDocument===c.document&&(ge=null),globalThis.__zeugmaActivePopoutDocument===c.document&&(globalThis.__zeugmaActivePopoutDocument=null),G.delete(c.document),G.size===0&&(vt(),ht());try{let f=c;f.__zeugmaCleanup&&f.__zeugmaCleanup(),ln(()=>{try{f.close();}catch{}});}catch{}}}});},[t,n,r,o]),pn.useEffect(()=>()=>{let l=u.current;Object.keys(l).forEach(s=>{let c=l[s];if(c){G.delete(c.document);try{let f=c;f.__zeugmaCleanup&&f.__zeugmaCleanup(),ln(()=>{try{f.close();}catch{}});}catch{}}}),G.size===0&&(vt(),ht());},[]);}typeof window<"u"&&cn();var dn=({activeId:e,render:t,className:n})=>{let r=pn.useRef(null);return pn.useEffect(()=>{let o=u=>{r.current&&(r.current.style.transform=`translate(${u.clientX+12}px, ${u.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 fn=pn__default.default.memo(({tabDetails:e,target:t,renderWidget:n})=>{let{id:r}=e,{renderPopoutWrapper:o}=ae(),[u,l]=pn.useState(false),s=pn.useRef(null);if(pn.useEffect(()=>{l(true);},[]),pn.useEffect(()=>{if(!u||!s.current)return;let m=s.current;if(t)t.ownerDocument.adoptNode(m),t.appendChild(m);else {let h=document.getElementById("zeugma-hidden-portal-container");h||(h=document.createElement("div"),h.id="zeugma-hidden-portal-container",h.style.display="none",document.body.appendChild(h)),document.adoptNode(m),h.appendChild(m);}},[t,u]),pn.useEffect(()=>()=>{s.current&&s.current.remove();},[]),!u)return null;let c=t?t.ownerDocument:document;s.current&&s.current.ownerDocument!==c&&c.adoptNode(s.current),s.current||(s.current=c.createElement("div"),s.current.className=`zeugma-portal-wrapper-${r}`,s.current.style.width="100%",s.current.style.height="100%");let f=s.current;if(!f||!n)return null;let i=!!(t&&t.ownerDocument&&t.ownerDocument!==document),b=i?"-popped":"-docked",g=jsxRuntime.jsx(pn__default.default.Fragment,{children:n(e)},`${r}${b}`);return i&&o&&(g=o({tabId:r,document:c,window:c.defaultView||window,children:g})),reactDom.createPortal(g,f)},(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 mn=({activeId:e,activeType:t,dismissIntentId:n,renderDragOverlay:r,renderPaneRef:o,renderPane:u,tabHeadersRef:l,classNames:s})=>{if(r)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:r({type:t,id:e,isDismissing:e===n})});if(t==="pane"){let c=o.current||u;if(c)return jsxRuntime.jsx("div",{className:s.paneDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:c(e)})}else if(t==="tab"){let c=o.current||u;if(c)return jsxRuntime.jsx("div",{className:s.tabDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:c(e)});let f=l.current[e];if(f){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:f({isDragging:true,isOver:false})})}}return jsxRuntime.jsx("div",{style:{pointerEvents:"none",overflow:"hidden",width:"100%",height:"100%"}})};function Tt({containerRef:e,isRow:t,direction:n,splitPercentage:r,resizerSize:o,snapThreshold:u,layout:l,currentNode:s,onLayoutChange:c,onResizeStart:f,onResizeEnd:i,parentLeft:b,parentTop:g,parentWidth:m,parentHeight:h}){let{onResizeStart:y,onResize:D,onResizeEnd:N,minSplitPercentage:T=5,maxSplitPercentage:Z=95,locked:C=false}=ae();return pn.useCallback(M=>{if(C)return;M.preventDefault();let H=e.current;if(!H)return;f&&f(),y&&y(s);let a=H.getBoundingClientRect(),d=M.clientX,v=M.clientY,R=r,I=M.currentTarget,q=a.left+a.width*(b/100),oe=a.top+a.height*(g/100),J=a.width*(m/100),A=a.height*(h/100),W=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(F=>F!==I&&F.getAttribute("data-direction")===n).map(F=>{let L=F.getBoundingClientRect();return t?L.left+L.width/2:L.top+L.height/2}),V=R;zt({cursor:t?"col-resize":"row-resize",resizerEl:I,onMove:F=>{let L=t?(F.clientX-d)/J*100:(F.clientY-v)/A*100,P=R+L,z=t?q+(J-o)*(P/100)+o/2:oe+(A-o)*(P/100)+o/2,E=1/0,O=null;for(let Y of W){let te=Math.abs(z-Y);te<u&&te<E&&(E=te,O=Y);}let ue=P;O!==null&&(ue=t?(O-o/2-q)/(J-o)*100:(O-o/2-oe)/(A-o)*100);let K=Math.max(T,Math.min(Z,ue));V=K;let ee=xe(l,s,K);if(ee){let{panes:Y,splitters:te}=ve(ee),S=e.current;if(S){for(let k of Y)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 te)S.style.setProperty(`--splitter-pos-${k.id}`,`${k.direction==="row"?k.left:k.top}%`);}}D&&D(s,K);},onEnd:()=>{let F=xe(l,s,V),L=e.current;if(L){let{panes:P,splitters:z}=ve(F);for(let E of P)L.style.removeProperty(`--pane-left-${E.paneId}`),L.style.removeProperty(`--pane-top-${E.paneId}`),L.style.removeProperty(`--pane-width-${E.paneId}`),L.style.removeProperty(`--pane-height-${E.paneId}`);for(let E of z)L.style.removeProperty(`--splitter-pos-${E.id}`);}c(F),i&&i(),N&&N(s,V);}});},[e,t,n,r,o,u,l,s,c,f,i,y,D,N,T,Z,b,g,m,h])}var gn=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:r})=>{let{renderingLayout:o,setLayout:u,classNames:l,locked:s}=ae(),[c,f]=pn.useState(false),{currentNode:i,direction:b,left:g,top:m,width:h,height:y,parentLeft:D,parentTop:N,parentWidth:T,parentHeight:Z}=e,C=b==="row",M=Tt({containerRef:r,isRow:C,direction:b,splitPercentage:i.splitPercentage,resizerSize:t,snapThreshold:n,layout:o,currentNode:i,onLayoutChange:u,onResizeStart:()=>f(true),onResizeEnd:()=>f(false),parentLeft:D,parentTop:N,parentWidth:T,parentHeight:Z}),H=C?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${g}%) - ${t/2}px)`,top:`calc(${m}% + ${t/2}px)`,width:`${t}px`,height:`calc(${y}% - ${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(${h}% - ${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:l.resizer||"","data-direction":b,"data-resizing":c||void 0,style:H,onPointerDown:M,role:"separator","aria-valuenow":i.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},bn=pn__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 Pt=({renderPane:e,tree:t,resizerSize:n,snapThreshold:r})=>{Vt(e);let{renderingLayout:o,activeId:u,dismissIntentId:l,setContainerRef:s,fullscreenPaneId:c,snapThreshold:f,locked:i,classNames:b,resizerSize:g}=ae(),m=r!==void 0?r:f??8,h=n!==void 0?n:g??4,y=t!==void 0?t:o,D=pn.useRef(null),{panes:N,splitters:T}=pn.useMemo(()=>y?ve(y):{panes:[],splitters:[]},[y]);if(!y&&t!==void 0)return null;let Z=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[N.map(C=>{let M=c===C.paneId;return jsxRuntime.jsx("div",{style:{position:"absolute",left:M?"0%":`var(--pane-left-${C.paneId}, ${C.left}%)`,top:M?"0%":`var(--pane-top-${C.paneId}, ${C.top}%)`,width:M?"100%":`var(--pane-width-${C.paneId}, ${C.width}%)`,height:M?"100%":`var(--pane-height-${C.paneId}, ${C.height}%)`,overflow:"hidden",zIndex:M?20:1,display:c&&!M?"none":"block",padding:M?"0px":`${h/2}px`,boxSizing:"border-box"},children:jsxRuntime.jsx(bn,{paneId:C.paneId,renderPane:e})},C.paneId)}),!c&&T.map(C=>jsxRuntime.jsx(gn,{splitter:C,resizerSize:h,snapThreshold:m,containerRef:D},C.id))]});if(t===void 0){let C=u!==null&&u===l,M=a=>{s(a),D.current=a;},H=`${b.dashboard||""} ${C&&b.dashboardDismissActive||""} ${i&&b.dashboardLocked||""}`.trim();return jsxRuntime.jsxs("div",{ref:M,className:H,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:[Z(),u!==null&&!i&&jsxRuntime.jsx(yn,{activeClassName:b.rootDropPreview??b.dropPreview})]})}return jsxRuntime.jsx("div",{ref:D,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:Z()})};var Do=e=>{let{controller:t,children:n,renderDragOverlay:r,classNames:o={},renderPane:u,resizerSize:l,dragActivationDistance:s=8,snapThreshold:c=8,minSplitPercentage:f=5,maxSplitPercentage:i=95,enableDragToDismiss:b=false,dismissThreshold:g=60,onRemove:m,onDragStart:h,onDragEnd:y,onResizeStart:D,onResize:N,onResizeEnd:T,onDismissIntentChange:Z,persist:C=false,renderPopoutWrapper:M}=e,H=t,{layout:a,setLayout:d,_internalSetLayout:v,renderingLayout:R,fullscreenPaneId:I,setFullscreenPaneId:q,locked:oe,setLocked:J,findPaneById:A,findPaneContainingTab:B,findTabById:W,getTabMetadata:V,getActiveTabMetadata:F,activeId:L,setActiveId:P,activeType:z,setActiveType:E,dismissIntentId:O,setDismissIntentId:ue,containerRef:K,setContainerRef:ee,removePane:Y,addTab:te,updateMetadata:S,updatePaneLock:k,selectTab:ie,mergeTab:le,removeTab:Q,splitPane:re,updateSplitPercentage:ze,moveTab:p,poppedOutTabIds:w=[],popoutTab:x,dockTab:$}=H;rn({persist:C,layout:a,setLayout:d});let{portalTargets:_,registerPortalTarget:se,registerPopoutTarget:j,registerRenderCallback:ye,renderCallbacksRef:Ue,registerRenderPane:Nt,renderPaneRef:dt,registerTabHeader:It,tabHeadersRef:pt,activeIdRef:Xe}=Bt();un({poppedOutTabIds:w,registerPopoutTarget:j,findTabById:W,dockTab:$});let Lt=pn.useCallback(de=>w.includes(de),[w]),{overTabId:kt,setOverTabId:zn,overTabPosition:Mt,setOverTabPosition:Zn,handleDragStartInternal:Hn,handleDragEndInternal:$n}=_t({onDragStart:h,onDragEnd:y}),Bn=nn({layout:a,_internalSetLayout:v,setLayout:d,activeId:L,setActiveId:P,activeType:z,setActiveType:E,dismissIntentId:O,setDismissIntentId:ue,setOverTabId:zn,setOverTabPosition:Zn,containerRef:K,dragActivationDistance:s,enableDragToDismiss:b,dismissThreshold:g,onRemove:m,onDragStart:Hn,onDragEnd:$n,onDismissIntentChange:Z,removeTab:Q,removePane:Y}),ft=pn.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]),Ot=pn.useCallback((de,Ye)=>{T&&T(de,Ye);},[T]),Fn=pn.useMemo(()=>({layout:a,renderingLayout:R,setLayout:d,activeId:L,activeType:z,dismissIntentId:O,setContainerRef:ee,fullscreenPaneId:I,classNames:ft,onRemove:m,onFullscreenChange:q,snapThreshold:c,onResizeStart:D,onResize:N,onResizeEnd:Ot,minSplitPercentage:f,maxSplitPercentage:i,locked:oe,setLocked:J,findPaneById:A,findPaneContainingTab:B,findTabById:W,getTabMetadata:V,getActiveTabMetadata:F,renderPane:u,resizerSize:l,poppedOutTabIds:w,isTabPoppedOut:Lt,renderPopoutWrapper:M}),[a,R,L,z,O,ee,I,ft,m,q,c,D,N,f,i,d,Ot,oe,J,A,B,W,V,F,u,l,w,Lt,M]),_n=pn.useMemo(()=>({overTabId:kt,overTabPosition:Mt}),[kt,Mt]),Vn=pn.useMemo(()=>({removePane:Y,addTab:te,updateMetadata:S,updatePaneLock:k,selectTab:ie,mergeTab:le,removeTab:Q,setFullscreenPaneId:q,setLocked:J,splitPane:re,updateSplitPercentage:ze,moveTab:p,popoutTab:x,dockTab:$}),[Y,te,S,k,ie,le,Q,q,J,re,ze,p,x,$]),jn=Ft(a),Wn=pn.useMemo(()=>({registerPortalTarget:se,registerRenderCallback:ye,renderCallbacksRef:Ue,registerRenderPane:Nt,renderPaneRef:dt,registerTabHeader:It,tabHeadersRef:pt,activeIdRef:Xe,registerPopoutTarget:j}),[se,ye,Ue,Nt,dt,It,pt,Xe,j]);return Xe&&(Xe.current=L),jsxRuntime.jsx(Re.Provider,{value:Vn,children:jsxRuntime.jsx(gt.Provider,{value:Fn,children:jsxRuntime.jsx(bt.Provider,{value:_n,children:jsxRuntime.jsxs(Te.Provider,{value:Wn,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",...Bn,children:n}),L&&z&&jsxRuntime.jsx(dn,{activeId:L,render:de=>jsxRuntime.jsx("div",{style:{transition:"transform 150ms cubic-bezier(0.2, 0, 0, 1)",transform:de===O?"scale(0.8)":"scale(1)",transformOrigin:"top left"},children:jsxRuntime.jsx(mn,{activeId:de,activeType:z,dismissIntentId:O,renderDragOverlay:r,renderPaneRef:dt,renderPane:u,tabHeadersRef:pt,classNames:ft})}),className:`${o.dragOverlay||""} ${L===O&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:jn.map(de=>{let Ye=_[de],At=W(de);return At?jsxRuntime.jsx(fn,{tabDetails:At,target:Ye||null,renderWidget:Ue.current[de]},de):null})})]})})})})},Eo=({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(Pt,{renderPane:e,resizerSize:t,snapThreshold:n})},So=e=>{let{children:t,...n}=e,{controller:r}=e;if(!r)throw new Error("Zeugma component requires a controller.");return jsxRuntime.jsx(Do,{...e,children:t!==void 0?t:jsxRuntime.jsx(Eo,{...n})})};var Lo={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"}}},ko={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"}}},Mo=({id:e,fraction:t,edge:n,activeClassName:r})=>{let{setNodeRef:o,isOver:u}=core.useDroppable({id:e}),l={position:"absolute",pointerEvents:"none",zIndex:101,boxSizing:"border-box",...ko[n][t]};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:o,style:Lo[n][t]}),u&&jsxRuntime.jsx("div",{className:r,style:l})]})},yn=({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(Mo,{id:n.id,fraction:n.fraction,edge:n.edge,activeClassName:e},n.id))});var st=pn.createContext(null);var Ho={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"}},$o={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"}},it=({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:Ho[t]}),o&&jsxRuntime.jsx("div",{className:n,style:$o[t]})]})};var Rn=({children:e,className:t,style:n})=>{let r=pn.useContext(st);if(!r)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:o,...u}=r;return jsxRuntime.jsx("div",{className:t,style:{cursor:o?"default":"grab",userSelect:o?"auto":"none",touchAction:o?"auto":"none",...n},...o?{}:u,children:e})};var Yo=pn.createContext(void 0);var je=({id:e,locked:t=false,children:n,className:r,style:o})=>{let{locked:u,classNames:l={},fullscreenPaneId:s,poppedOutTabIds:c=[]}=ae(),f=pn.useContext(Re),{overTabId:i}=Je(),b=pn.useContext(Te);pn.useEffect(()=>(b?.registerTabHeader&&b.registerTabHeader(e,n),()=>{b?.registerTabHeader&&b.activeIdRef?.current!==e&&b.registerTabHeader(e,()=>null);}),[e,n,b]);let g=c.includes(e),m=pn.useContext(wt),h=t||u||(m?.locked??false)||s!==null,{attributes:y,listeners:D,setNodeRef:N,isDragging:T}=core.useDraggable({id:`tab-header-${e}`,disabled:h}),{setNodeRef:Z,isOver:C}=core.useDroppable({id:`tab-drop-${e}`,disabled:h}),M=W=>{N(W),Z(W);},H=C&&i===e,a=m?.tabIds||[],d=a.indexOf(e),v=m?.activeTabId,I=d>0&&e!==v&&a[d-1]!==v?jsxRuntime.jsx("div",{className:l.tabSeparator}):null,q=m?m.activeTabId===e:false,oe=m?.tabsMetadata?.[e],J=pn.useCallback(()=>{m?.selectTab(e);},[m,e]),A=pn.useCallback(()=>{m?.removeTab(e);},[m,e]),B=pn.useMemo(()=>({tabId:e,isActive:q,isDragging:T,isOver:H,metadata:oe,locked:h,selectTab:J,removeTab:A,isPoppedOut:g,popoutTab:()=>f?.popoutTab(e),dockTab:()=>f?.dockTab(e)}),[e,q,T,H,oe,h,J,A,g,f]);return jsxRuntime.jsx(Yo.Provider,{value:B,children:jsxRuntime.jsxs("div",{ref:M,id:`tab-header-${e}`,className:r,style:{display:"inline-flex",position:"relative",cursor:h?"default":"grab",...o},...h?{}:D,...h?{}:y,children:[I,n({isDragging:T,isOver:H})]})})};var wt=pn.createContext(void 0);var Dn=(e,t)=>typeof e=="function"?e(t):e,xt=({tabIds:e,activeTabId:t,locked:n,tabsMetadata:r,selectTab:o,removeTab:u,renderTab:l,classNames:s,styles:c})=>{let f=pn.useContext(lt),i=e??f?.tabIds??[],b=t??f?.activeTabId??"",g=n??f?.locked??false,m=r??f?.tabsMetadata,h=o??f?.selectTab??(()=>{}),y=u??f?.removeTab??(()=>{}),{classNames:D={},activeType:N,poppedOutTabIds:T=[]}=ae(),Z=pn.useContext(Re),{overTabId:C,overTabPosition:M}=Je(),H=pn.useMemo(()=>({tabIds:i,activeTabId:b,locked:g,tabsMetadata:m,selectTab:h,removeTab:y}),[i,b,g,m,h,y]),a=Gt(i,N,C,M);return jsxRuntime.jsx(wt.Provider,{value:H,children:jsxRuntime.jsxs("div",{className:s?.container,style:{display:"flex",alignItems:"center",height:"100%",...c?.container},children:[i.map((d,v)=>{let R=m?.[d],I=Dn(s?.tab,d),q=Dn(c?.tab,d),oe=v===a;return jsxRuntime.jsxs(pn__default.default.Fragment,{children:[oe&&D.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:D.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:v===0?"none":"translateX(-50%)"}})}),jsxRuntime.jsx(je,{id:d,locked:g,className:I,style:q,children:({isDragging:J,isOver:A})=>l({id:d,paneId:f?.id??"",isActive:d===b,index:v,isDragging:J,isOver:A,metadata:R,onSelect:()=>h(d),onRemove:()=>y(d),isPoppedOut:T.includes(d),popout:()=>Z?.popoutTab(d),dock:()=>Z?.dockTab(d)})})]},d)}),a===i.length&&D.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:D.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:"translateX(-100%)"}})})]})})};xt.Tab=je;var Sn=({className:e,style:t,children:n})=>jsxRuntime.jsx("div",{className:e,style:t,children:n});var lt=pn.createContext(void 0),In=()=>{let e=pn.useContext(lt);if(!e)throw new Error("usePaneContext must be used within a Pane component");return e},ar=({children:e,className:t,style:n})=>{let{activeTabId:r}=In(),{classNames:o,isTabPoppedOut:u}=ae(),{dockTab:l}=Ze(),s=pn.useRef(null),c=pn.useContext(Te);if(!c)throw new Error("PaneContent must be used within a Zeugma provider");let{registerPortalTarget:f,registerRenderCallback:i}=c,b=pn.useMemo(()=>typeof e=="function"?e:()=>e,[e]);i(r,b),pn.useEffect(()=>{let m=s.current;return f(r,m),()=>{f(r,null,m);}},[r,f]);let g=u(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:()=>l(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"})]})})},Me=({id:e,children:t,style:n,locked:r=false})=>{let{layout:o,renderingLayout:u,activeId:l,activeType:s,classNames:c,fullscreenPaneId:f,onFullscreenChange:i,locked:b,poppedOutTabIds:g=[]}=ae(),{removePane:m,updateMetadata:h,selectTab:y,removeTab:D,popoutTab:N,dockTab:T}=Ze(),Z=pn.useMemo(()=>{if(s==="tab"&&e===l){let O=U(o,e)?.tabsMetadata?.[e];return {type:"pane",id:e,tabIds:[e],activeTabId:e,tabsMetadata:O?{[e]:O}:void 0}}return Wt(e===l?o:u,e)},[o,u,e,l,s]),C=Z?.id??e,M=Z?.tabIds??[e],H=Z?.activeTabId??e,a=Z?.tabsMetadata,d=a?.[e],v=Z?.locked??false,R=r||v,I=b||R||f!==null,q=b||R||f!==null,oe=l!==null&&l!==e&&(!M.includes(l)||M.length>1)&&!q,{attributes:J,listeners:A,setNodeRef:B}=core.useDraggable({id:e,disabled:I}),W=l!==null&&M.includes(l),V=f===e,F=pn.useMemo(()=>({isDragging:W,isFullscreen:V,toggleFullscreen:()=>i?.(V?null:e),remove:()=>{V&&i?.(null),m(C);},metadata:d,updateMetadata:z=>{h(e,z);},locked:I,tabIds:M,activeTabId:H,selectTab:z=>y(C,z),removeTab:z=>{V&&z===H&&i?.(null),D(z);},tabsMetadata:a,updateTabMetadata:(z,E)=>{h(z,E);},isActiveTabPoppedOut:g.includes(H),popoutTab:z=>N(z||H),dockTab:z=>T(z||H)}),[W,V,i,e,D,d,h,I,M,H,y,C,a,g,N,T]),L=pn.useMemo(()=>I?{disabled:true}:{...A,...J},[A,J,I]),P=`${c.pane||""} ${R&&c.paneLocked||""}`.trim();return jsxRuntime.jsx(lt.Provider,{value:{id:e,...F},children:jsxRuntime.jsx(st.Provider,{value:L,children:jsxRuntime.jsxs("div",{ref:B,id:e,className:P,style:{position:"relative",width:"100%",height:"100%",...n},children:[t,oe&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:[["top","bottom","left","right"].map(z=>jsxRuntime.jsx(it,{id:`drop-${z}-${e}`,position:z,activeClassName:c.dropPreview},z)),s==="tab"&&jsxRuntime.jsx(it,{id:`drop-center-${e}`,position:"center",activeClassName:c.swapPreview??c.dropPreview})]}),l!==null&&l!==e&&q&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsxRuntime.jsx(it,{id:`drop-locked-${e}`,position:"full",activeClassName:c.lockedPreview||""})})]})})})};Me.Content=ar;Me.DragHandle=Rn;Me.Tabs=xt;Me.Tab=je;Me.Controls=Sn;var ut=new Map;function We(e){let t=ut.get(e);return t||(t={mounts:0,renders:0,listeners:new Set},ut.set(e,t)),t}function Ln(e,t){let n=We(e);return n.listeners.add(t),()=>{n.listeners.delete(t);}}function Dt(e){let t=ut.get(e);t&&t.listeners.forEach(n=>n());}function kn(e){let t=ut.get(e);t&&(t.mounts=0,t.renders=0,Dt(e));}function Oe(e,t){let n=pn.useId(),r=typeof e=="string"?{id:e,...t}:e||{},{id:o=n,logToConsole:u=false,disabled:l=false}=r,s=pn.useRef(0),c=pn.useRef(false),[,f]=pn.useState(0);if(l||(s.current+=1),pn.useEffect(()=>{if(l)return;let g=Ln(o,()=>{f(h=>h+1);}),m=We(o);return m.mounts+=1,c.current=true,u&&console.log(`[DevTools:${o}] Mounted: ${m.mounts} | Rendered: ${s.current}`),Dt(o),()=>{c.current=false,g();}},[o,l,u]),!l){let g=We(o);g.renders=Math.max(g.renders,s.current);}let i=pn.useCallback(()=>{s.current=0,kn(o);},[o]);return l?{mounts:0,renders:0,reset:i}:{mounts:We(o).mounts,renders:s.current,reset:i}}function On({id:e,className:t,style:n,logToConsole:r=false,disabled:o=false}){let{mounts:u,renders:l}=Oe(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:u})]}),jsxRuntime.jsx("span",{children:"|"}),jsxRuntime.jsxs("span",{children:["R: ",jsxRuntime.jsx("strong",{children:l})]})]})}function An({id:e,label:t,children:n,className:r,footerClassName:o,style:u,logToConsole:l=false,disabled:s=false}){let c=t||e||"widget",{mounts:f,renders:i}=Oe(e,{logToConsole:l,disabled:s});return s?jsxRuntime.jsx(jsxRuntime.Fragment,{children:n}):jsxRuntime.jsxs("div",{className:r,style:u,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:c}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntime.jsxs("span",{children:["Mounts: ",jsxRuntime.jsx("strong",{className:"counter-mounts",children:f})]}),jsxRuntime.jsx("span",{children:"|"}),jsxRuntime.jsxs("span",{children:["Renders: ",jsxRuntime.jsx("strong",{className:"counter-renders",children:i})]})]})]})]})}exports.Pane=Me;exports.PaneTree=Pt;exports.RenderCounterBadge=On;exports.RenderCounterFooter=An;exports.Zeugma=So;exports.usePaneContext=In;exports.useRenderCounter=Oe;exports.useResizer=Tt;exports.useZeugma=Jn;exports.useZeugmaContext=Qn;//# sourceMappingURL=index.cjs.map
|
|
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
|
+
`);v.textContent=$;}}catch{}l.document.head.appendChild(v);}),typeof document.adoptedStyleSheets<"u"&&typeof l.document.adoptedStyleSheets<"u")try{let p=Array.from(document.adoptedStyleSheets).map(v=>{try{let x=new l.CSSStyleSheet,$=Array.from(v.cssRules).map(V=>V.cssText).join(`
|
|
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
|
|
12
12
|
//# sourceMappingURL=index.cjs.map
|