react-zeugma 6.9.2 → 6.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var ge=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 ge__default=/*#__PURE__*/_interopDefault(ge);function Nt({cursor:e,resizerEl:t,onMove:n,onEnd:a}){document.body.classList.add("zeugma-resizing");let o=document.createElement("style");o.id="zeugma-global-cursor-style",o.textContent=`
1
+ 'use strict';var ge=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 ge__default=/*#__PURE__*/_interopDefault(ge);function It({cursor:e,resizerEl:t,onMove:n,onEnd:a}){document.body.classList.add("zeugma-resizing");let o=document.createElement("style");o.id="zeugma-global-cursor-style",o.textContent=`
2
2
  * {
3
3
  cursor: ${e} !important;
4
4
  user-select: none !important;
@@ -6,7 +6,7 @@
6
6
  .zeugma-resizing *:not([role="separator"]) {
7
7
  pointer-events: none !important;
8
8
  }
9
- `,document.head.appendChild(o),t.setAttribute("data-resizing","true");let c=i=>{n(i);},u=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let i=document.getElementById("zeugma-global-cursor-style");i&&i.remove(),document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",u),a();};document.addEventListener("pointermove",c),document.addEventListener("pointerup",u);}function Ae(e){try{return JSON.stringify(e)}catch{return ""}}var dt=ge.createContext(void 0),we=ge.createContext(void 0),Pe=ge.createContext(void 0),pt=ge.createContext(void 0),re=()=>{let e=ge.useContext(dt);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},ze=()=>{let e=ge.useContext(we);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e},Ue=()=>{let e=ge.useContext(pt);if(!e)throw new Error("useZeugmaDrag must be used within a Zeugma provider");return e};function Lt(e){let t=ge.useRef(null);return ge.useEffect(()=>{if(!e){t.current=null;return}let n=o=>{t.current={x:o.clientX,y:o.clientY};},a=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",a,{passive:true}),()=>{window.removeEventListener("pointermove",n),window.removeEventListener("touchmove",a);}},[e]),t}function Mt(e){ge.useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function kt(){let[e,t]=ge.useState({}),[n,a]=ge.useState({}),o=ge.useRef({}),c=ge.useRef(null),u=ge.useRef({}),i=ge.useRef(null),d=ge.useRef(true);ge.useEffect(()=>(d.current=true,()=>{d.current=false;}),[]);let f=ge.useCallback((T,x,L)=>{d.current&&t(h=>{if(!x){if(L&&h[T]!==L||!h[T])return h;let H={...h};return delete H[T],H}return h[T]===x?h:{...h,[T]:x}});},[]),s=ge.useCallback((T,x)=>{d.current&&a(L=>{if(!x){if(!L[T])return L;let h={...L};return delete h[T],h}return L[T]===x?L:{...L,[T]:x}});},[]),b=ge.useCallback((T,x)=>{o.current[T]=x;},[]),g=ge.useCallback(T=>{c.current=T;},[]),m=ge.useCallback((T,x)=>{u.current[T]=x;},[]);return {portalTargets:ge.useMemo(()=>({...e,...n}),[e,n]),registerPortalTarget:f,registerPopoutTarget:s,registerRenderCallback:b,renderCallbacksRef:o,registerRenderPane:g,renderPaneRef:c,registerTabHeader:m,tabHeadersRef:u,activeIdRef:i}}function An(e){let t=new Set;function n(a){a&&(a.type==="pane"?a.tabIds.forEach(o=>{t.add(o);}):a.type==="split"&&(n(a.first),n(a.second)));}return n(e),Array.from(t).sort()}function Ot(e){return ge.useMemo(()=>An(e),[e])}function At(e){let{onDragStart:t,onDragEnd:n}=e,[a,o]=ge.useState(null),[c,u]=ge.useState(null),i=ge.useCallback(f=>{t&&t(f);},[t]),d=ge.useCallback((f,s,b)=>{n&&n(f,s,b);},[n]);return {overTabId:a,setOverTabId:o,overTabPosition:c,setOverTabPosition:u,handleDragStartInternal:i,handleDragEndInternal:d}}function zt(e){let n=ge.useContext(Pe)?.registerRenderPane;ge.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),a=be(e.second,t);return n===null?a:a===null?n:{...e,first:n,second:a}}function fe(e,t){if(e===null)return null;if(e.type==="pane"){if(e.tabIds.includes(t)){let o=e.tabIds.filter(i=>i!==t);if(o.length===0)return null;let c=e.activeTabId;e.activeTabId===t&&(c=o[0]);let u={...e.tabsMetadata};return delete u[t],{...e,tabIds:o,activeTabId:c,tabsMetadata:Object.keys(u).length>0?u:void 0}}return e}let n=fe(e.first,t),a=fe(e.second,t);return n===null?a:a===null?n:{...e,first:n,second:a}}function Se(e,t,n,a,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 c=typeof o=="string"?{type:"pane",id:pe(),tabIds:[o],activeTabId:o}:o,u=a==="left"||a==="top";return {type:"split",direction:n,first:u?c:e,second:u?e:c,splitPercentage:50}}return e}return {...e,first:Se(e.first,t,n,a,o)||e.first,second:Se(e.second,t,n,a,o)||e.second}}function zn(e,t){if(e===null)return t;function n(a,o){return a.type==="pane"?{type:"split",direction:o==="row"?"column":"row",splitPercentage:50,first:a,second:t}:{...a,second:n(a.second,a.direction)}}return n(e,null)}function Zt(e,t,n,a){if(e===null)return {type:"pane",id:pe(),tabIds:[n],activeTabId:n,tabsMetadata:a?{[n]:a}:void 0};let o=t?te(e,t):null;if(o&&o.type==="pane"){let i=function(d){if(d.type==="pane"&&d.id===t){let f=[...d.tabIds];f.includes(n)||f.push(n);let s=d.tabsMetadata;return a&&(s={...d.tabsMetadata,[n]:a}),{...d,tabIds:f,activeTabId:n,tabsMetadata:s}}return d.type==="split"?{...d,first:i(d.first),second:i(d.second)}:d};return i(e)}let c={type:"pane",id:pe(),tabIds:[n],activeTabId:n,tabsMetadata:a?{[n]:a}:void 0};return zn(e,c)}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 te(e,t){return e===null?null:e.type==="pane"?e.id===t?e:null:e.type==="split"?te(e.first,t)??te(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 Ht(e,t){return te(e,t)??U(e,t)}function $t(e,t){let n=U(e,t);if(!n)return null;let a=n.tabIds.indexOf(t);return {id:t,paneId:n.id,isActive:n.activeTabId===t,index:a,metadata:n.tabsMetadata?.[t],remountOnPopout:n.tabsMetadata?.[t]?.remountOnPopout}}function _t(e,t){return U(e,t)?.tabsMetadata?.[t]}function Bt(e,t){let n=te(e,t);return n?.tabsMetadata?.[n.activeTabId]}function Je(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.tabIds.includes(t)){let a=e.tabsMetadata||{},o=a[t],c=n(o),u={...a};return c===void 0?delete u[t]:u[t]=c,{...e,tabsMetadata:Object.keys(u).length>0?u:void 0}}return e}return e.type==="split"?{...e,first:Je(e.first,t,n)??e.first,second:Je(e.second,t,n)??e.second}:e}function Ge(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.id===t){if(n===false){let{locked:a,...o}=e;return o}return {...e,locked:n}}return e}return e.type==="split"?{...e,first:Ge(e.first,t,n)??e.first,second:Ge(e.second,t,n)??e.second}:e}function Ne(e,t,n){return e===null?null:e.type==="pane"?e.id===t?e.activeTabId===n?e:{...e,activeTabId:n}:e:e.type==="split"?{...e,first:Ne(e.first,t,n)??e.first,second:Ne(e.second,t,n)??e.second}:e}function Ft(e,t,n){if(e===null)return null;let o=U(e,t)?.tabsMetadata?.[t],c=fe(e,t);if(c===null)return {type:"pane",id:pe(),tabIds:[t],activeTabId:t,tabsMetadata:o?{[t]:o}:void 0};function u(i){if(i.type==="pane"){if(i.id===n){let d=[...i.tabIds];d.includes(t)||d.push(t);let f={...i.tabsMetadata};return o&&(f[t]=o),{...i,tabIds:d,activeTabId:t,tabsMetadata:Object.keys(f).length>0?f:void 0}}return i}return i.type==="split"?{...i,first:u(i.first),second:u(i.second)}:i}return u(c)}function Zn(e,t,n){if(e===null)return null;if(t===n)return e;let a=U(e,t),o=U(e,n);if(!a||!o)return e;let c=a.id,u=o.id,i=a.tabsMetadata?.[t],d=o.tabsMetadata?.[n];function f(s){if(s.type==="pane"){let b=false,g=[...s.tabIds],m=s.activeTabId,y=s.tabsMetadata?{...s.tabsMetadata}:{};if(c===u){if(s.id===c){let T=g.indexOf(t),x=g.indexOf(n);T!==-1&&x!==-1&&(g[T]=n,g[x]=t),m=t,b=true;}}else s.id===c&&(g=g.map(T=>T===t?n:T),m===t&&(m=n),delete y[t],d&&(y[n]=d),b=true),s.id===u&&(g=g.map(T=>T===n?t:T),m===n&&(m=t),delete y[n],i&&(y[t]=i),b=true);return b?{...s,tabIds:g,activeTabId:m,tabsMetadata:Object.keys(y).length>0?y:void 0}:s}return s.type==="split"?{...s,first:f(s.first),second:f(s.second)}:s}return f(e)}function Ze(e,t,n,a="before"){if(e===null)return null;if(t===n)return e;if(a==="center")return Zn(e,t,n);let c=U(e,t)?.tabsMetadata?.[t],u=fe(e,t);if(u===null)return {type:"pane",id:pe(),tabIds:[t],activeTabId:t,tabsMetadata:c?{[t]:c}:void 0};function i(d){if(d.type==="pane"){if(d.tabIds.includes(n)){let s=[...d.tabIds].filter(m=>m!==t),b=s.indexOf(n);b<0&&(b=0),a==="after"&&(b+=1),s.splice(b,0,t);let g={...d.tabsMetadata};return c&&(g[t]=c),{...d,tabIds:s,activeTabId:t,tabsMetadata:Object.keys(g).length>0?g:void 0}}return d}return d.type==="split"?{...d,first:i(d.first),second:i(d.second)}:d}return i(u)}function ve(e,t=0,n=0,a=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:a,height:o,node:e}],splitters:[]};let{direction:u,splitPercentage:i,first:d,second:f}=e,b={id:`splitter-${c}-${u}`,currentNode:e,direction:u,left:u==="row"?t+a*(i/100):t,top:u==="column"?n+o*(i/100):n,width:u==="row"?0:a,height:u==="column"?0:o,parentLeft:t,parentTop:n,parentWidth:a,parentHeight:o},g={panes:[],splitters:[]},m={panes:[],splitters:[]};if(u==="row"){let y=a*(i/100);g=ve(d,t,n,y,o,`${c}-L`),m=ve(f,t+y,n,a-y,o,`${c}-R`);}else {let y=o*(i/100);g=ve(d,t,n,a,y,`${c}-T`),m=ve(f,t,n+y,a,o-y,`${c}-B`);}return {panes:[...g.panes,...m.panes],splitters:[b,...g.splitters,...m.splitters]}}function Vt(e,t,n,a="before"){if(e===null)return null;let o=te(e,t);if(!o)return e;let c=o.tabIds,u=o.activeTabId,i=o.tabsMetadata||{},d=be(e,t);if(d===null)return o;function f(s){if(s.type==="pane"){if(s.tabIds.includes(n)){let g=[...s.tabIds].filter(T=>!c.includes(T)),m=g.indexOf(n);m<0&&(m=0),a==="after"&&(m+=1),g.splice(m,0,...c);let y={...s.tabsMetadata};for(let T of c)i[T]&&(y[T]=i[T]);return {...s,tabIds:g,activeTabId:u,tabsMetadata:Object.keys(y).length>0?y:void 0}}return s}return s.type==="split"?{...s,first:f(s.first),second:f(s.second)}:s}return f(d)}function Wt(e,t,n,a){if(!((t==="tab"||t==="pane")&&n&&e.includes(n))||!a)return -1;let u=e.indexOf(n);return a==="before"?u:u+1}function Hn(e){let{initialLayout:t,layout:n,onChange:a,fullscreenPaneId:o,onFullscreenChange:c,locked:u=false}=e,[i,d]=ge.useState(()=>n!==void 0?n:t??null),[f,s]=ge.useState(()=>n!==void 0?n:t??null),[b,g]=ge.useState(()=>Ae(n!==void 0?n:null)),[m,y]=ge.useState(o||null),[T,x]=ge.useState(u),[L,h]=ge.useState([]),[H,D]=ge.useState(null),[O,Z]=ge.useState(null),[r,l]=ge.useState(null),v=ge.useRef(null),R=ge.useCallback(p=>{v.current=p;},[]),M=ge.useRef(i);M.current=i;let q=ge.useRef(a);q.current=a;let ne=ge.useRef(c);ne.current=c;let J=ge.useCallback(p=>{y(p),ne.current?.(p);},[]);if(ge.useEffect(()=>{x(u);},[u]),ge.useEffect(()=>{o!==void 0&&y(o);},[o]),n!==void 0){let p=Ae(n);p!==b&&(g(p),d(n),s(n));}let A=ge.useCallback(p=>(...w)=>{let E=M.current,_=p(E,...w);Ae(E)!==Ae(_)&&(M.current=_,d(_),s(_),q.current?.(_));},[]),$=ge.useCallback(A((p,w)=>typeof w=="function"?w(p):w),[A]),W=ge.useCallback(p=>{s(w=>typeof p=="function"?p(w):p);},[]),F=ge.useCallback(p=>{y(null),ne.current?.(null),D(null),Z(null),l(null),$(p),s(()=>typeof p=="function"?p(M.current):p);},[$]),B=ge.useCallback(A((p,w)=>be(p,w)),[A]),N=ge.useCallback(A((p,w,E,_)=>{let V=fe(p,w)??p;return Zt(V,E,w,_)}),[A]),P=ge.useCallback(A((p,w,E,_,V)=>{let le=te(p,w)??U(p,w);if(!le)return p;let j=te(p,V)??U(p,V)??{type:"pane",id:V,tabIds:[V],activeTabId:V},Te=be(p,j.id);return Se(Te,le.id,E,_,j)}),[A]),z=ge.useCallback(A((p,w,E)=>xe(p,w,E)),[A]),C=ge.useCallback(A((p,w,E)=>Je(p,w,E)),[A]),k=ge.useCallback(A((p,w,E)=>{let _=te(p,w)??U(p,w);return _?Ge(p,_.id,E):p}),[A]),ue=ge.useCallback(A((p,w,E)=>{let _=te(p,w)??U(p,w);return _?Ne(p,_.id,E):p}),[A]),Q=ge.useCallback(A((p,w,E)=>{let _=te(p,E)??U(p,E);return _?Ft(p,w,_.id):p}),[A]),K=ge.useCallback(A((p,w,E,_)=>Ze(p,w,E,_)),[A]),Y=ge.useCallback(A((p,w)=>fe(p,w)),[A]),ee=ge.useCallback(p=>te(M.current,p),[]),S=ge.useCallback(p=>U(M.current,p),[]),I=ge.useCallback(p=>$t(M.current,p),[]),ie=ge.useCallback(p=>_t(M.current,p),[]),se=ge.useCallback(p=>Bt(M.current,p),[]),G=ge.useCallback(p=>{h(w=>w.includes(p)?w:[...w,p]);},[]),oe=ge.useCallback(p=>{h(w=>w.includes(p)?w.filter(E=>E!==p):w);},[]);return {layout:i,setLayout:F,_internalSetLayout:W,renderingLayout:f,fullscreenPaneId:m,setFullscreenPaneId:J,locked:T,setLocked:x,poppedOutTabIds:L,activeId:H,setActiveId:D,activeType:O,setActiveType:Z,dismissIntentId:r,setDismissIntentId:l,containerRef:v,setContainerRef:R,removePane:B,addTab:N,updateMetadata:C,updatePaneLock:k,selectTab:ue,mergeTab:Q,moveTab:K,removeTab:Y,splitPane:P,updateSplitPercentage:z,popoutTab:G,dockTab:oe,findPaneById:ee,findPaneContainingTab:S,findTabById:I,getTabMetadata:ie,getActiveTabMetadata:se}}var $n=()=>{let e=re(),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 Ke=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},et=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};var qt=e=>{let n=e.active.id.toString().startsWith("tab-header-"),o=core.pointerWithin(e);if(o.length>0)return [...o].sort((u,i)=>{let d=u.id.toString(),f=i.id.toString(),s=d.startsWith("tab-drop-"),b=f.startsWith("tab-drop-");if(s&&!b)return -1;if(!s&&b)return 1;let g=d.startsWith("drop-root-"),m=f.startsWith("drop-root-");return g&&!m?-1:!g&&m?1:0});if(n){let c=e.droppableContainers.filter(u=>u.id.toString().startsWith("tab-drop-"));return core.closestCenter({...e,droppableContainers:c})}return []};function He(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 Yt(e){let{layout:t,_internalSetLayout:n,setLayout:a,activeId:o,setActiveId:c,activeType:u,setActiveType:i,dismissIntentId:d,setDismissIntentId:f,setOverTabId:s,setOverTabPosition:b,containerRef:g,dragActivationDistance:m,enableDragToDismiss:y,dismissThreshold:T,onRemove:x,onDragStart:L,onDragEnd:h,onDismissIntentChange:H,removeTab:D,removePane:O}=e,Z=ge.useRef(null),r=Lt(o),l=ge.useRef(null),[v,R]=ge.useState(false);return Mt(v),{sensors:core.useSensors(core.useSensor(Ke,{activationConstraint:{distance:m}}),core.useSensor(et,{activationConstraint:{delay:250,tolerance:5}})),collisionDetection:qt,onDragStart:$=>{let W=$.active.id.toString(),F=W.startsWith("tab-header-"),B=F?W.substring(11):W;c(B),i(F?"tab":"pane"),s(null),b(null);let N=$.activatorEvent;r.current=He(N),y&&g.current?Z.current=g.current.getBoundingClientRect():Z.current=null;let P=t;if(F){let C=U(t,B);C&&(P=Ne(t,C.id,B)||t);}l.current=P;let z=F?fe(P,B):be(P,B);n(z),L&&L(B);},onDragMove:$=>{let{over:W}=$,F=W?.id.toString()||"",B=F.startsWith("drop-locked-");R(S=>S===B?S:B);let N=$.active.id.toString(),P=N.startsWith("tab-header-"),z=P?N.substring(11):N,C=F.match(/^tab-drop-(.+)$/);if(C&&W&&(P||u==="pane")){let[,S]=C;if(z!==S){let I="before",ie=W.rect,se=$.activatorEvent,G=null;if(r.current)G=r.current.x;else {let oe=He(se);oe&&(G=oe.x+$.delta.x);}if(G!==null){let oe=ie.left+ie.width/2;G>oe&&(I="after");}s(oe=>oe===S?oe:S),b(oe=>oe===I?oe:I);}else s(I=>I===null?I:null),b(I=>I===null?I:null);}else s(S=>S===null?S:null),b(S=>S===null?S:null);if(!y)return;let k=Z.current;if(!k){d!==null&&(f(null),H?.(null));return}let ue=$.activatorEvent,Q=null,K=null;if(r.current)Q=r.current.x,K=r.current.y;else {let S=He(ue);S&&(Q=S.x+$.delta.x,K=S.y+$.delta.y);}let Y=0;if(Q!==null&&K!==null){let S=0,I=0;Q<k.left?S=k.left-Q:Q>k.right&&(S=Q-k.right),K<k.top?I=k.top-K:K>k.bottom&&(I=K-k.bottom),Y=Math.sqrt(S*S+I*I);}else {let S=$.active.rect.current.translated;if(S){let I=S.left+S.width/2,ie=S.top+S.height/2,se=0,G=0;I<k.left?se=k.left-I:I>k.right&&(se=I-k.right),ie<k.top?G=k.top-ie:ie>k.bottom&&(G=ie-k.bottom),Y=Math.sqrt(se*se+G*G);}}Y>T?d!==z&&(f(z),H?.(z)):d!==null&&(f(null),H?.(null));},onDragEnd:$=>{c(null),i(null),R(false),s(null),b(null);let{active:W,over:F}=$,B=W.id.toString(),N=B.startsWith("tab-header-"),P=N?B.substring(11):B,z=y&&d===P;f(null),H?.(null),Z.current=null;let C=l.current||t;if(l.current=null,z){x?x(P):N?D(P):O(P),h&&h(P,null,null);return}if(!F){n(C),h&&h(P,null,null);return}let k=F.id.toString();if(k.startsWith("drop-locked-")){n(C),h&&h(P,null,null);return}let ue=k.match(/^tab-drop-(.+)$/);if(ue){let[,p]=ue;if(N)if(P!==p){let w="before",E=F.rect,_=$.activatorEvent,V=null;if(r.current)V=r.current.x;else {let j=He(_);j&&(V=j.x+$.delta.x);}if(V!==null){let j=E.left+E.width/2;V>j&&(w="after");}let le=Ze(C,P,p,w);a(le),h&&h(P,p,{type:"move",position:"center"});}else n(C),h&&h(P,null,null);else {let w="before",E=F.rect,_=$.activatorEvent,V=null;if(r.current)V=r.current.x;else {let j=He(_);j&&(V=j.x+$.delta.x);}if(V!==null){let j=E.left+E.width/2;V>j&&(w="after");}let le=Vt(C,P,p,w);a(le),h&&h(P,p,{type:"move",position:"center"});}return}let Q=k.match(/^drop-root-(1\/4|1\/3)-(top|bottom|left|right|start|end)$/);if(Q){let[,p,w]=Q,E=w;E==="start"&&(E="left"),E==="end"&&(E="right");let _=N?fe(C,P):be(C,P),V;if(N){let j=U(C,P)?.tabsMetadata?.[P];V={type:"pane",id:pe(),tabIds:[P],activeTabId:P,tabsMetadata:j?{[P]:j}:void 0};}else V=te(C,P)??{type:"pane",id:pe(),tabIds:[P],activeTabId:P};if(_===null)a(V);else {let le=E==="left"||E==="right",j=E==="left"||E==="top",Te=50;p==="1/4"?Te=j?25:75:p==="1/3"&&(Te=j?100/3:200/3),a({type:"split",direction:le?"row":"column",first:j?V:_,second:j?_:V,splitPercentage:Te});}h&&h(P,"root",{type:"split",direction:E==="left"||E==="right"?"row":"column",position:E});return}let K=k.match(/^drop-(left|right|top|bottom|center)-(.+)$/);if(!K){n(C),h&&h(P,null,null);return}let[,Y,ee]=K;if(Y==="center"){if(N){let p=te(C,ee);if(p&&p.activeTabId){let w=p.activeTabId,E=Ze(C,P,w,"center");a(E),h&&h(P,ee,{type:"move",position:"center"});}else n(C),h&&h(P,null,null);}else n(C),h&&h(P,null,null);return}let S=N?U(C,P):te(C,P),I=S&&S.id===ee,ie=S&&S.tabIds.length===1;if(P===ee||I&&ie){n(C),h&&h(P,null,null);return}let se=Y==="left"||Y==="right"?"row":"column",G;if(N){let w=U(C,P)?.tabsMetadata?.[P];G={type:"pane",id:pe(),tabIds:[P],activeTabId:P,tabsMetadata:w?{[P]:w}:void 0};}else G=te(C,P)??{type:"pane",id:pe(),tabIds:[P],activeTabId:P};let oe=N?fe(C,P):be(C,P),Oe=Se(oe,ee,se,Y,G);a(Oe),h&&h(P,ee,{type:"split",direction:se,position:Y});},onDragCancel:()=>{c(null),i(null),R(false),s(null),b(null),f(null),H?.(null),Z.current=null;let $=l.current||t;l.current=null,n($),$!==t&&a($);}}}function Gt({persist:e,layout:t,setLayout:n}){let a=typeof e=="object"?e.enabled!==false:!!e,o=typeof e=="object"&&e.key||"zeugma-layout",[c,u]=ge.useState(false);ge.useEffect(()=>{if(a){let i=localStorage.getItem(o);if(i)try{let d=JSON.parse(i);d&&n(d);}catch(d){console.error("Failed to parse persisted zeugma layout",d);}}u(true);},[a,o,n]),ge.useEffect(()=>{a&&c&&(t?localStorage.setItem(o,JSON.stringify(t)):localStorage.removeItem(o));},[a,o,t,c]);}var Ee=null,Kt=false,ae=new Set,De=new Set,Ie=null;function Xn(){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")&&ae.forEach(a=>{try{let o=n.cloneNode(!0);if(o.tagName.toLowerCase()==="link"){let c=n.href;c&&o.setAttribute("href",c);}a.head.appendChild(o);}catch(o){console.warn("Failed to mirror style node to popout:",o);}});});});}),Ie.observe(document.head,{childList:true}));}function ft(){Ie&&(Ie.disconnect(),Ie=null);}var Le=null;function Yn(){typeof window>"u"||Le||(Le=new MutationObserver(e=>{e.forEach(t=>{if(t.type==="attributes"&&t.attributeName){let n=document.documentElement.getAttribute(t.attributeName);ae.forEach(a=>{try{a&&a.documentElement&&(n!==null?a.documentElement.setAttribute(t.attributeName,n):a.documentElement.removeAttribute(t.attributeName));}catch(o){console.warn("Failed to sync documentElement attribute:",o);}});}});}),Le.observe(document.documentElement,{attributes:true}));}function mt(){Le&&(Le.disconnect(),Le=null);}var en=e=>{typeof requestAnimationFrame<"u"?requestAnimationFrame(e):setTimeout(e,0);};function me(){if(typeof window>"u")return document;if(Ee&&Ee.target){let t=Ee.target.ownerDocument;if(t&&t!==document)return t}let e=window.event;if(e&&e.target){let n=e.target.ownerDocument;if(n&&n!==document)return n}return window.__zeugmaActivePopoutDocument?window.__zeugmaActivePopoutDocument:document}function tn(){if(typeof window>"u"||Kt)return;Kt=true;let e=(r,l)=>{if(!r||!l)return false;try{let v=Object.getPrototypeOf(r);for(;v;){if(v===l)return !0;v=Object.getPrototypeOf(v);}}catch{}return false},t=(r,l)=>{try{Object.defineProperty(r,Symbol.hasInstance,{value:function(v){return v?e(v,r.prototype)?!0:l(v):!1},configurable:!0,writable:!0});}catch(v){console.warn("Failed to patch Symbol.hasInstance on",r,v);}};typeof Node<"u"&&t(Node,r=>typeof r.nodeType=="number"&&typeof r.nodeName=="string"),typeof Element<"u"&&t(Element,r=>r.nodeType===1),typeof HTMLElement<"u"&&t(HTMLElement,r=>r.nodeType===1&&typeof r.style=="object"),typeof HTMLBodyElement<"u"&&t(HTMLBodyElement,r=>r.nodeType===1&&r.tagName==="BODY"),typeof HTMLHtmlElement<"u"&&t(HTMLHtmlElement,r=>r.nodeType===1&&r.tagName==="HTML"),typeof HTMLInputElement<"u"&&t(HTMLInputElement,r=>r.nodeType===1&&r.tagName==="INPUT"),typeof HTMLTextAreaElement<"u"&&t(HTMLTextAreaElement,r=>r.nodeType===1&&r.tagName==="TEXTAREA"),typeof ShadowRoot<"u"&&t(ShadowRoot,r=>r.nodeType===11&&r.host!==void 0),typeof SVGElement<"u"&&t(SVGElement,r=>r.nodeType===1&&typeof r.getBBox=="function"),typeof Document<"u"&&t(Document,r=>r.nodeType===9),typeof Window<"u"&&t(Window,r=>r&&typeof r.document=="object"&&typeof r.location=="object");let n=Document.prototype,a=Object.getOwnPropertyDescriptor(n,"body"),o=Object.getOwnPropertyDescriptor(n,"documentElement"),c=Object.getOwnPropertyDescriptor(n,"head"),u=Object.getOwnPropertyDescriptor(n,"activeElement"),i=Object.getOwnPropertyDescriptor(n,"defaultView"),d=Object.getOwnPropertyDescriptor(n,"scrollingElement");Object.defineProperties(document,{body:{get(){let r=me();return r&&r!==document?r.body:a?.get?.call(document)||document.body},configurable:true},documentElement:{get(){let r=me();return r&&r!==document?r.documentElement:o?.get?.call(document)||document.documentElement},configurable:true},head:{get(){let r=me();return r&&r!==document?r.head:c?.get?.call(document)||document.head},configurable:true},activeElement:{get(){let r=me();return r&&r!==document?r.activeElement:u?.get?.call(document)||document.activeElement},configurable:true},defaultView:{get(){let r=me();return r&&r!==document?r.defaultView:i?.get?.call(document)||document.defaultView},configurable:true},scrollingElement:{get(){let r=me();return r&&r!==document?r.scrollingElement:d?.get?.call(document)||document.scrollingElement},configurable:true}});let f=Window.prototype,s=["innerWidth","innerHeight","pageXOffset","pageYOffset","scrollX","scrollY","screenX","screenY","outerWidth","outerHeight","devicePixelRatio"],b={};s.forEach(r=>{let l=Object.getOwnPropertyDescriptor(f,r)||Object.getOwnPropertyDescriptor(window,r);l&&l.get&&(b[r]=l.get);}),s.forEach(r=>{Object.defineProperty(window,r,{get(){let l=me();if(l&&l!==document&&l.defaultView)try{return l.defaultView[r]}catch{}let v=b[r];return v?v.call(window):window[r]},configurable:true});});let g=Node.prototype.contains;Node.prototype.contains=function(r){if(!r)return false;if(g.call(this,r))return true;if(this===document||this===document.body||this===document.documentElement)for(let l of ae)try{if(l.contains(r))return !0}catch{}return false};let m=()=>{Ee=null,globalThis.__zeugmaActivePopoutDocument=null;};["pointerdown","mousedown","click","keydown","focus","touchstart"].forEach(r=>{window.addEventListener(r,m,true);});let T=document.createElement;document.createElement=function(r,l){let v=me();return v&&v!==document?v.createElement(r,l):T.call(document,r,l)};let x=document.addEventListener;document.addEventListener=function(r,l,v){De.add({target:"document",type:r,listener:l,options:v}),x.call(document,r,l,v),ae.forEach(R=>{try{R.addEventListener(r,l,v);}catch{}});};let L=document.removeEventListener;document.removeEventListener=function(r,l,v){for(let R of De)if(R.target==="document"&&R.type===r&&R.listener===l){De.delete(R);break}L.call(document,r,l,v),ae.forEach(R=>{try{R.removeEventListener(r,l,v);}catch{}});};let h=window.addEventListener;window.addEventListener=function(r,l,v){De.add({target:"window",type:r,listener:l,options:v}),h.call(window,r,l,v),ae.forEach(R=>{try{R.defaultView&&R.defaultView.addEventListener(r,l,v);}catch{}});};let H=window.removeEventListener;window.removeEventListener=function(r,l,v){for(let R of De)if(R.target==="window"&&R.type===r&&R.listener===l){De.delete(R);break}H.call(window,r,l,v),ae.forEach(R=>{try{R.defaultView&&R.defaultView.removeEventListener(r,l,v);}catch{}});};let D=document.getElementById;document.getElementById=function(r){let l=me();if(l&&l!==document)return l.getElementById(r);let v=D.call(document,r);if(v)return v;for(let R of ae)try{let M=R.getElementById(r);if(M)return M}catch{}return null};let O=document.querySelector;document.querySelector=function(r){let l=me();if(l&&l!==document)return l.querySelector(r);let v=O.call(document,r);if(v)return v;for(let R of ae)try{let M=R.querySelector(r);if(M)return M}catch{}return null};let Z=document.querySelectorAll;document.querySelectorAll=function(r){let l=me();if(l&&l!==document)return l.querySelectorAll(r);let v=Z.call(document,r);if(v.length>0)return v;for(let R of ae)try{let M=R.querySelectorAll(r);if(M.length>0)return M}catch{}return v};}function nn(e){let{poppedOutTabIds:t,registerPopoutTarget:n,findTabById:a,dockTab:o}=e,c=ge.useRef({});ge.useEffect(()=>{let u=c.current;t.forEach(i=>{if(u[i]){try{u[i].focus();}catch{}return}tn();let f=a(i)?.metadata?.title||`Tab ${i}`,s=window.open("",`zeugma-popout-${i}`,"width=800,height=600");if(!s){console.warn("Failed to open popout window. Check popup blocker."),o(i);return}u[i]=s,ae.add(s.document),De.forEach(l=>{try{l.target==="window"?s.addEventListener(l.type,l.listener,l.options):s.document.addEventListener(l.type,l.listener,l.options);}catch{}}),Xn(),Yn(),s.document.title=f,s.document.head.innerHTML="";try{let l=s.document.createElement("base");l.setAttribute("href",window.location.origin+"/"),s.document.head.appendChild(l);}catch{}if(Array.from(document.querySelectorAll('style, link[rel="stylesheet"]')).forEach(l=>{let v=l.cloneNode(true);if(l.tagName.toLowerCase()==="link"){let R=l.href;R&&v.setAttribute("href",R);}else if(l.tagName.toLowerCase()==="style")try{let R=l.sheet?.cssRules;if(R&&R.length>0){let M=Array.from(R).map(q=>q.cssText).join(`
10
- `);v.textContent=M;}}catch{}s.document.head.appendChild(v);}),typeof document.adoptedStyleSheets<"u"&&typeof s.document.adoptedStyleSheets<"u")try{let l=Array.from(document.adoptedStyleSheets).map(v=>{try{let R=new s.CSSStyleSheet,M=Array.from(v.cssRules).map(q=>q.cssText).join(`
11
- `);return R.replaceSync(M),R}catch{return null}}).filter(v=>v!==null);s.document.adoptedStyleSheets=l;}catch(l){console.warn("Failed to copy adoptedStyleSheets:",l);}s.document.documentElement.className=document.documentElement.className,s.document.body.className=document.body.className,Array.from(document.documentElement.attributes).forEach(l=>{s.document.documentElement.setAttribute(l.name,l.value);}),s.document.body.style.margin="0",s.document.body.style.padding="0",s.document.body.style.height="100vh",s.document.body.style.overflow="hidden";let b=document.getElementById(`zeugma-tab-target-${i}`),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),y=window.getComputedStyle(document.body),T=y.backgroundColor,L=!T||T==="transparent"||T==="rgba(0, 0, 0, 0)"?m.backgroundColor:T,h=g&&g!=="transparent"&&g!=="rgba(0, 0, 0, 0)"?g:L&&L!=="transparent"&&L!=="rgba(0, 0, 0, 0)"?L:"#181b1f";document.documentElement.getAttribute("data-theme")||(s.document.documentElement.style.backgroundColor=h,s.document.body.style.backgroundColor=h),s.document.body.style.color=y.color||m.color,s.document.body.style.fontFamily=y.fontFamily||m.fontFamily;let D=s.document.createElement("div");D.id=`zeugma-popout-container-${i}`,D.className="grafana-panel h-full w-full overflow-hidden",D.style.width="100%",D.style.height="100%",D.style.border="none",s.document.body.appendChild(D),n?.(i,D);let O=["pointerdown","mousedown","click","keydown","focus","touchstart"],Z=l=>{Ee=l,globalThis.__zeugmaActivePopoutDocument=s.document,setTimeout(()=>{Ee===l&&(Ee=null,globalThis.__zeugmaActivePopoutDocument=null);},0);};O.forEach(l=>{s.addEventListener(l,Z,true);});let r=()=>{ae.delete(s.document),ae.size===0&&(ft(),mt()),o(i);};s.addEventListener("beforeunload",r),s.__zeugmaCleanup=()=>{O.forEach(l=>{s.removeEventListener(l,Z,true);}),s.removeEventListener("beforeunload",r);};}),Object.keys(u).forEach(i=>{if(!t.includes(i)){let d=u[i];if(delete u[i],n?.(i,null),d){ae.delete(d.document),ae.size===0&&(ft(),mt());try{let f=d;f.__zeugmaCleanup&&f.__zeugmaCleanup(),en(()=>{try{f.close();}catch{}});}catch{}}}});},[t,n,a,o]),ge.useEffect(()=>()=>{let u=c.current;Object.keys(u).forEach(i=>{let d=u[i];if(d){ae.delete(d.document);try{let f=d;f.__zeugmaCleanup&&f.__zeugmaCleanup(),en(()=>{try{f.close();}catch{}});}catch{}}}),ae.size===0&&(ft(),mt());},[]);}typeof window<"u"&&tn();var on=({activeId:e,render:t,className:n})=>{let a=ge.useRef(null);return ge.useEffect(()=>{let o=c=>{a.current&&(a.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:a,className:n,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var no=({popoutDoc:e,children:t})=>{if(e===document)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:t});let n=ge__default.default.useEffect,a=ge__default.default.useLayoutEffect,o=ge__default.default.useInsertionEffect;ge__default.default.useEffect=(c,u)=>n(()=>{window.__zeugmaActivePopoutDocument=e;try{let i=c();return typeof i=="function"?()=>{window.__zeugmaActivePopoutDocument=e;try{return i()}finally{window.__zeugmaActivePopoutDocument=null;}}:i}finally{window.__zeugmaActivePopoutDocument=null;}},u),ge__default.default.useLayoutEffect=(c,u)=>a(()=>{window.__zeugmaActivePopoutDocument=e;try{let i=c();return typeof i=="function"?()=>{window.__zeugmaActivePopoutDocument=e;try{return i()}finally{window.__zeugmaActivePopoutDocument=null;}}:i}finally{window.__zeugmaActivePopoutDocument=null;}},u),o&&(ge__default.default.useInsertionEffect=(c,u)=>o(()=>{window.__zeugmaActivePopoutDocument=e;try{let i=c();return typeof i=="function"?()=>{window.__zeugmaActivePopoutDocument=e;try{return i()}finally{window.__zeugmaActivePopoutDocument=null;}}:i}finally{window.__zeugmaActivePopoutDocument=null;}},u)),window.__zeugmaActivePopoutDocument=e;try{return jsxRuntime.jsx(jsxRuntime.Fragment,{children:t})}finally{window.__zeugmaActivePopoutDocument=null,ge__default.default.useEffect=n,ge__default.default.useLayoutEffect=a,o&&(ge__default.default.useInsertionEffect=o);}},an=ge__default.default.memo(({tabDetails:e,target:t,renderWidget:n})=>{let{id:a}=e,{renderPopoutWrapper:o}=re(),[c,u]=ge.useState(false),i=ge.useRef(null);if(ge.useEffect(()=>{u(true);},[]),ge.useEffect(()=>{if(!c||!i.current)return;let m=i.current;if(t)t.ownerDocument.adoptNode(m),t.appendChild(m);else {let y=document.getElementById("zeugma-hidden-portal-container");y||(y=document.createElement("div"),y.id="zeugma-hidden-portal-container",y.style.display="none",document.body.appendChild(y)),document.adoptNode(m),y.appendChild(m);}},[t,c]),ge.useEffect(()=>()=>{i.current&&i.current.remove();},[]),!c)return null;let d=t?t.ownerDocument:document;i.current&&i.current.ownerDocument!==d&&(i.current.remove(),i.current=null),i.current||(i.current=d.createElement("div"),i.current.className=`zeugma-portal-wrapper-${a}`,i.current.style.width="100%",i.current.style.height="100%");let f=i.current;if(!f||!n)return null;let s=!!(t&&t.ownerDocument&&t.ownerDocument!==document),b=e.remountOnPopout?s?"-popped":"-docked":"",g=jsxRuntime.jsx(ge__default.default.Fragment,{children:n(e)},`${a}${b}`);return s&&t&&t.ownerDocument&&o&&(g=o({tabId:a,document:t.ownerDocument,window:t.ownerDocument.defaultView||window,children:g})),reactDom.createPortal(jsxRuntime.jsx(no,{popoutDoc:s&&t?t.ownerDocument:document,children: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 sn=({activeId:e,activeType:t,dismissIntentId:n,renderDragOverlay:a,renderPaneRef:o,renderPane:c,tabHeadersRef:u,classNames:i})=>{if(a)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:a({type:t,id:e,isDismissing:e===n})});if(t==="pane"){let d=o.current||c;if(d)return jsxRuntime.jsx("div",{className:i.paneDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:d(e)})}else if(t==="tab"){let d=o.current||c;if(d)return jsxRuntime.jsx("div",{className:i.tabDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:d(e)});let f=u.current[e];if(f){let s=i.tab?typeof i.tab=="function"?i.tab(e):i.tab:"";return jsxRuntime.jsx("div",{className:`${i.tabDragPreview||""} ${s}`.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 bt({containerRef:e,isRow:t,direction:n,splitPercentage:a,resizerSize:o,snapThreshold:c,layout:u,currentNode:i,onLayoutChange:d,onResizeStart:f,onResizeEnd:s,parentLeft:b,parentTop:g,parentWidth:m,parentHeight:y}){let{onResizeStart:T,onResize:x,onResizeEnd:L,minSplitPercentage:h=5,maxSplitPercentage:H=95,locked:D=false}=re();return ge.useCallback(O=>{if(D)return;O.preventDefault();let Z=e.current;if(!Z)return;f&&f(),T&&T(i);let r=Z.getBoundingClientRect(),l=O.clientX,v=O.clientY,R=a,M=O.currentTarget,q=r.left+r.width*(b/100),ne=r.top+r.height*(g/100),J=r.width*(m/100),A=r.height*(y/100),W=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(B=>B!==M&&B.getAttribute("data-direction")===n).map(B=>{let N=B.getBoundingClientRect();return t?N.left+N.width/2:N.top+N.height/2}),F=R;Nt({cursor:t?"col-resize":"row-resize",resizerEl:M,onMove:B=>{let N=t?(B.clientX-l)/J*100:(B.clientY-v)/A*100,P=R+N,z=t?q+(J-o)*(P/100)+o/2:ne+(A-o)*(P/100)+o/2,C=1/0,k=null;for(let Y of W){let ee=Math.abs(z-Y);ee<c&&ee<C&&(C=ee,k=Y);}let ue=P;k!==null&&(ue=t?(k-o/2-q)/(J-o)*100:(k-o/2-ne)/(A-o)*100);let Q=Math.max(h,Math.min(H,ue));F=Q;let K=xe(u,i,Q);if(K){let{panes:Y,splitters:ee}=ve(K),S=e.current;if(S){for(let I of Y)S.style.setProperty(`--pane-left-${I.paneId}`,`${I.left}%`),S.style.setProperty(`--pane-top-${I.paneId}`,`${I.top}%`),S.style.setProperty(`--pane-width-${I.paneId}`,`${I.width}%`),S.style.setProperty(`--pane-height-${I.paneId}`,`${I.height}%`);for(let I of ee)S.style.setProperty(`--splitter-pos-${I.id}`,`${I.direction==="row"?I.left:I.top}%`);}}x&&x(i,Q);},onEnd:()=>{let B=xe(u,i,F),N=e.current;if(N){let{panes:P,splitters:z}=ve(B);for(let C of P)N.style.removeProperty(`--pane-left-${C.paneId}`),N.style.removeProperty(`--pane-top-${C.paneId}`),N.style.removeProperty(`--pane-width-${C.paneId}`),N.style.removeProperty(`--pane-height-${C.paneId}`);for(let C of z)N.style.removeProperty(`--splitter-pos-${C.id}`);}d(B),s&&s(),L&&L(i,F);}});},[e,t,n,a,o,c,u,i,d,f,s,T,x,L,h,H,b,g,m,y])}var ln=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:a})=>{let{renderingLayout:o,setLayout:c,classNames:u,locked:i}=re(),[d,f]=ge.useState(false),{currentNode:s,direction:b,left:g,top:m,width:y,height:T,parentLeft:x,parentTop:L,parentWidth:h,parentHeight:H}=e,D=b==="row",O=bt({containerRef:a,isRow:D,direction:b,splitPercentage:s.splitPercentage,resizerSize:t,snapThreshold:n,layout:o,currentNode:s,onLayoutChange:c,onResizeStart:()=>f(true),onResizeEnd:()=>f(false),parentLeft:x,parentTop:L,parentWidth:h,parentHeight:H}),Z=D?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${g}%) - ${t/2}px)`,top:`calc(${m}% + ${t/2}px)`,width:`${t}px`,height:`calc(${T}% - ${t}px)`,cursor: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}, ${m}%) - ${t/2}px)`,width:`calc(${y}% - ${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":b,"data-resizing":d||void 0,style:Z,onPointerDown:O,role:"separator","aria-valuenow":s.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},cn=ge__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 vt=({renderPane:e,tree:t,resizerSize:n,snapThreshold:a})=>{zt(e);let{renderingLayout:o,activeId:c,dismissIntentId:u,setContainerRef:i,fullscreenPaneId:d,snapThreshold:f,locked:s,classNames:b,resizerSize:g}=re(),m=a!==void 0?a:f??8,y=n!==void 0?n:g??4,T=t!==void 0?t:o,x=ge.useRef(null),{panes:L,splitters:h}=ge.useMemo(()=>T?ve(T):{panes:[],splitters:[]},[T]);if(!T&&t!==void 0)return null;let H=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[L.map(D=>{let O=d===D.paneId;return jsxRuntime.jsx("div",{style:{position:"absolute",left:O?"0%":`var(--pane-left-${D.paneId}, ${D.left}%)`,top:O?"0%":`var(--pane-top-${D.paneId}, ${D.top}%)`,width:O?"100%":`var(--pane-width-${D.paneId}, ${D.width}%)`,height:O?"100%":`var(--pane-height-${D.paneId}, ${D.height}%)`,overflow:"hidden",zIndex:O?20:1,display:d&&!O?"none":"block",padding:O?"0px":`${y/2}px`,boxSizing:"border-box"},children:jsxRuntime.jsx(cn,{paneId:D.paneId,renderPane:e})},D.paneId)}),!d&&h.map(D=>jsxRuntime.jsx(ln,{splitter:D,resizerSize:y,snapThreshold:m,containerRef:x},D.id))]});if(t===void 0){let D=c!==null&&c===u,O=r=>{i(r),x.current=r;},Z=`${b.dashboard||""} ${D&&b.dashboardDismissActive||""} ${s&&b.dashboardLocked||""}`.trim();return jsxRuntime.jsxs("div",{ref:O,className:Z,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:[H(),c!==null&&!s&&jsxRuntime.jsx(pn,{activeClassName:b.rootDropPreview??b.dropPreview})]})}return jsxRuntime.jsx("div",{ref:x,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:H()})};var fo=e=>{let{controller:t,children:n,renderDragOverlay:a,classNames:o={},renderPane:c,resizerSize:u,dragActivationDistance:i=8,snapThreshold:d=8,minSplitPercentage:f=5,maxSplitPercentage:s=95,enableDragToDismiss:b=false,dismissThreshold:g=60,onRemove:m,onDragStart:y,onDragEnd:T,onResizeStart:x,onResize:L,onResizeEnd:h,onDismissIntentChange:H,persist:D=false,renderPopoutWrapper:O}=e,Z=t,{layout:r,setLayout:l,_internalSetLayout:v,renderingLayout:R,fullscreenPaneId:M,setFullscreenPaneId:q,locked:ne,setLocked:J,findPaneById:A,findPaneContainingTab:$,findTabById:W,getTabMetadata:F,getActiveTabMetadata:B,activeId:N,setActiveId:P,activeType:z,setActiveType:C,dismissIntentId:k,setDismissIntentId:ue,containerRef:Q,setContainerRef:K,removePane:Y,addTab:ee,updateMetadata:S,updatePaneLock:I,selectTab:ie,mergeTab:se,removeTab:G,splitPane:oe,updateSplitPercentage:Oe,moveTab:p,poppedOutTabIds:w=[],popoutTab:E,dockTab:_}=Z;Gt({persist:D,layout:r,setLayout:l});let{portalTargets:V,registerPortalTarget:le,registerPopoutTarget:j,registerRenderCallback:Te,renderCallbacksRef:Ve,registerRenderPane:wt,renderPaneRef:st,registerTabHeader:Rt,tabHeadersRef:lt,activeIdRef:We}=kt();nn({poppedOutTabIds:w,registerPopoutTarget:j,findTabById:W,dockTab:_});let xt=ge.useCallback(de=>w.includes(de),[w]),{overTabId:Dt,setOverTabId:xn,overTabPosition:Et,setOverTabPosition:Dn,handleDragStartInternal:En,handleDragEndInternal:Cn}=At({onDragStart:y,onDragEnd:T}),Sn=Yt({layout:r,_internalSetLayout:v,setLayout:l,activeId:N,setActiveId:P,activeType:z,setActiveType:C,dismissIntentId:k,setDismissIntentId:ue,setOverTabId:xn,setOverTabPosition:Dn,containerRef:Q,dragActivationDistance:i,enableDragToDismiss:b,dismissThreshold:g,onRemove:m,onDragStart:En,onDragEnd:Cn,onDismissIntentChange:H,removeTab:G,removePane:Y}),ct=ge.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]),Ct=ge.useCallback((de,je)=>{h&&h(de,je);},[h]),Nn=ge.useMemo(()=>({layout:r,renderingLayout:R,setLayout:l,activeId:N,activeType:z,dismissIntentId:k,setContainerRef:K,fullscreenPaneId:M,classNames:ct,onRemove:m,onFullscreenChange:q,snapThreshold:d,onResizeStart:x,onResize:L,onResizeEnd:Ct,minSplitPercentage:f,maxSplitPercentage:s,locked:ne,setLocked:J,findPaneById:A,findPaneContainingTab:$,findTabById:W,getTabMetadata:F,getActiveTabMetadata:B,renderPane:c,resizerSize:u,poppedOutTabIds:w,isTabPoppedOut:xt,renderPopoutWrapper:O}),[r,R,N,z,k,K,M,ct,m,q,d,x,L,f,s,l,Ct,ne,J,A,$,W,F,B,c,u,w,xt,O]),In=ge.useMemo(()=>({overTabId:Dt,overTabPosition:Et}),[Dt,Et]),Ln=ge.useMemo(()=>({removePane:Y,addTab:ee,updateMetadata:S,updatePaneLock:I,selectTab:ie,mergeTab:se,removeTab:G,setFullscreenPaneId:q,setLocked:J,splitPane:oe,updateSplitPercentage:Oe,moveTab:p,popoutTab:E,dockTab:_}),[Y,ee,S,I,ie,se,G,q,J,oe,Oe,p,E,_]),Mn=Ot(r),kn=ge.useMemo(()=>({registerPortalTarget:le,registerRenderCallback:Te,renderCallbacksRef:Ve,registerRenderPane:wt,renderPaneRef:st,registerTabHeader:Rt,tabHeadersRef:lt,activeIdRef:We,registerPopoutTarget:j}),[le,Te,Ve,wt,st,Rt,lt,We,j]);return We&&(We.current=N),jsxRuntime.jsx(we.Provider,{value:Ln,children:jsxRuntime.jsx(dt.Provider,{value:Nn,children:jsxRuntime.jsx(pt.Provider,{value:In,children:jsxRuntime.jsxs(Pe.Provider,{value:kn,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",...Sn,children:n}),N&&z&&jsxRuntime.jsx(on,{activeId:N,render:de=>jsxRuntime.jsx("div",{style:{transition:"transform 150ms cubic-bezier(0.2, 0, 0, 1)",transform:de===k?"scale(0.8)":"scale(1)",transformOrigin:"top left"},children:jsxRuntime.jsx(sn,{activeId:de,activeType:z,dismissIntentId:k,renderDragOverlay:a,renderPaneRef:st,renderPane:c,tabHeadersRef:lt,classNames:ct})}),className:`${o.dragOverlay||""} ${N===k&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:Mn.map(de=>{let je=V[de],St=W(de);return St?jsxRuntime.jsx(an,{tabDetails:St,target:je||null,renderWidget:Ve.current[de]},de):null})})]})})})})},mo=({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(vt,{renderPane:e,resizerSize:t,snapThreshold:n})},go=e=>{let{children:t,...n}=e,{controller:a}=e;if(!a)throw new Error("Zeugma component requires a controller.");return jsxRuntime.jsx(fo,{...e,children:t!==void 0?t:jsxRuntime.jsx(mo,{...n})})};var ho={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"}}},yo={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"}}},To=({id:e,fraction:t,edge:n,activeClassName:a})=>{let{setNodeRef:o,isOver:c}=core.useDroppable({id:e}),u={position:"absolute",pointerEvents:"none",zIndex:101,boxSizing:"border-box",...yo[n][t]};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:o,style:ho[n][t]}),c&&jsxRuntime.jsx("div",{className:a,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(To,{id:n.id,fraction:n.fraction,edge:n.edge,activeClassName:e},n.id))});var ot=ge.createContext(null);var Do={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"}},Eo={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"}},rt=({id:e,position:t,activeClassName:n})=>{let{setNodeRef:a,isOver:o}=core.useDroppable({id:e});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:a,style:Do[t]}),o&&jsxRuntime.jsx("div",{className:n,style:Eo[t]})]})};var gn=({children:e,className:t,style:n})=>{let a=ge.useContext(ot);if(!a)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:o,...c}=a;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 zo=ge.createContext(void 0);var Fe=({id:e,locked:t=false,children:n,className:a,style:o})=>{let{locked:c,classNames:u={},fullscreenPaneId:i,poppedOutTabIds:d=[]}=re(),f=ge.useContext(we),{overTabId:s}=Ue(),b=ge.useContext(Pe);ge.useEffect(()=>(b?.registerTabHeader&&b.registerTabHeader(e,n),()=>{b?.registerTabHeader&&b.activeIdRef?.current!==e&&b.registerTabHeader(e,()=>null);}),[e,n,b]);let g=d.includes(e),m=ge.useContext(yt),y=t||c||(m?.locked??false)||i!==null,{attributes:T,listeners:x,setNodeRef:L,isDragging:h}=core.useDraggable({id:`tab-header-${e}`,disabled:y}),{setNodeRef:H,isOver:D}=core.useDroppable({id:`tab-drop-${e}`,disabled:y}),O=W=>{L(W),H(W);},Z=D&&s===e,r=m?.tabIds||[],l=r.indexOf(e),v=m?.activeTabId,M=l>0&&e!==v&&r[l-1]!==v?jsxRuntime.jsx("div",{className:u.tabSeparator}):null,q=m?m.activeTabId===e:false,ne=m?.tabsMetadata?.[e],J=ge.useCallback(()=>{m?.selectTab(e);},[m,e]),A=ge.useCallback(()=>{m?.removeTab(e);},[m,e]),$=ge.useMemo(()=>({tabId:e,isActive:q,isDragging:h,isOver:Z,metadata:ne,locked:y,selectTab:J,removeTab:A,isPoppedOut:g,popoutTab:()=>f?.popoutTab(e),dockTab:()=>f?.dockTab(e)}),[e,q,h,Z,ne,y,J,A,g,f]);return jsxRuntime.jsx(zo.Provider,{value:$,children:jsxRuntime.jsxs("div",{ref:O,id:`tab-header-${e}`,className:a,style:{display:"inline-flex",position:"relative",cursor:y?"default":"grab",...o},...y?{}:x,...y?{}:T,children:[M,n({isDragging:h,isOver:Z})]})})};var yt=ge.createContext(void 0);var yn=(e,t)=>typeof e=="function"?e(t):e,Tt=({tabIds:e,activeTabId:t,locked:n,tabsMetadata:a,selectTab:o,removeTab:c,renderTab:u,classNames:i,styles:d})=>{let f=ge.useContext(at),s=e??f?.tabIds??[],b=t??f?.activeTabId??"",g=n??f?.locked??false,m=a??f?.tabsMetadata,y=o??f?.selectTab??(()=>{}),T=c??f?.removeTab??(()=>{}),{classNames:x={},activeType:L,poppedOutTabIds:h=[]}=re(),H=ge.useContext(we),{overTabId:D,overTabPosition:O}=Ue(),Z=ge.useMemo(()=>({tabIds:s,activeTabId:b,locked:g,tabsMetadata:m,selectTab:y,removeTab:T}),[s,b,g,m,y,T]),r=Wt(s,L,D,O);return jsxRuntime.jsx(yt.Provider,{value:Z,children:jsxRuntime.jsxs("div",{className:i?.container,style:{display:"flex",alignItems:"center",height:"100%",...d?.container},children:[s.map((l,v)=>{let R=m?.[l],M=yn(i?.tab,l),q=yn(d?.tab,l),ne=v===r;return jsxRuntime.jsxs(ge__default.default.Fragment,{children:[ne&&x.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:x.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:v===0?"none":"translateX(-50%)"}})}),jsxRuntime.jsx(Fe,{id:l,locked:g,className:M,style:q,children:({isDragging:J,isOver:A})=>u({id:l,paneId:f?.id??"",isActive:l===b,index:v,isDragging:J,isOver:A,metadata:R,onSelect:()=>y(l),onRemove:()=>T(l),isPoppedOut:h.includes(l),popout:()=>H?.popoutTab(l),dock:()=>H?.dockTab(l)})})]},l)}),r===s.length&&x.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:x.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:"translateX(-100%)"}})})]})})};Tt.Tab=Fe;var Pn=({className:e,style:t,children:n})=>jsxRuntime.jsx("div",{className:e,style:t,children:n});var at=ge.createContext(void 0),Rn=()=>{let e=ge.useContext(at);if(!e)throw new Error("usePaneContext must be used within a Pane component");return e},qo=({children:e,className:t,style:n})=>{let{activeTabId:a}=Rn(),{classNames:o,isTabPoppedOut:c}=re(),{dockTab:u}=ze(),i=ge.useRef(null),d=ge.useContext(Pe);if(!d)throw new Error("PaneContent must be used within a Zeugma provider");let{registerPortalTarget:f,registerRenderCallback:s}=d,b=ge.useMemo(()=>typeof e=="function"?e:()=>e,[e]);s(a,b),ge.useEffect(()=>{let m=i.current;return f(a,m),()=>{f(a,null,m);}},[a,f]);let g=c(a);return jsxRuntime.jsx("div",{ref:i,id:`zeugma-tab-target-${a}`,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(a),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"})]})})},ke=({id:e,children:t,style:n,locked:a=false})=>{let{layout:o,renderingLayout:c,activeId:u,activeType:i,classNames:d,fullscreenPaneId:f,onFullscreenChange:s,locked:b,poppedOutTabIds:g=[]}=re(),{removePane:m,updateMetadata:y,selectTab:T,removeTab:x,popoutTab:L,dockTab:h}=ze(),H=ge.useMemo(()=>{if(i==="tab"&&e===u){let k=U(o,e)?.tabsMetadata?.[e];return {type:"pane",id:e,tabIds:[e],activeTabId:e,tabsMetadata:k?{[e]:k}:void 0}}return Ht(e===u?o:c,e)},[o,c,e,u,i]),D=H?.id??e,O=H?.tabIds??[e],Z=H?.activeTabId??e,r=H?.tabsMetadata,l=r?.[e],v=H?.locked??false,R=a||v,M=b||R||f!==null,q=b||R||f!==null,ne=u!==null&&u!==e&&(!O.includes(u)||O.length>1)&&!q,{attributes:J,listeners:A,setNodeRef:$}=core.useDraggable({id:e,disabled:M}),W=u!==null&&O.includes(u),F=f===e,B=ge.useMemo(()=>({isDragging:W,isFullscreen:F,toggleFullscreen:()=>s?.(F?null:e),remove:()=>{F&&s?.(null),m(D);},metadata:l,updateMetadata:z=>{y(e,z);},locked:M,tabIds:O,activeTabId:Z,selectTab:z=>T(D,z),removeTab:z=>{F&&z===Z&&s?.(null),x(z);},tabsMetadata:r,updateTabMetadata:(z,C)=>{y(z,C);},isActiveTabPoppedOut:g.includes(Z),popoutTab:z=>L(z||Z),dockTab:z=>h(z||Z)}),[W,F,s,e,x,l,y,M,O,Z,T,D,r,g,L,h]),N=ge.useMemo(()=>M?{disabled:true}:{...A,...J},[A,J,M]),P=`${d.pane||""} ${R&&d.paneLocked||""}`.trim();return jsxRuntime.jsx(at.Provider,{value:{id:e,...B},children:jsxRuntime.jsx(ot.Provider,{value:N,children:jsxRuntime.jsxs("div",{ref:$,id:e,className:P,style:{position:"relative",width:"100%",height:"100%",...n},children:[t,ne&&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(rt,{id:`drop-${z}-${e}`,position:z,activeClassName:d.dropPreview},z)),i==="tab"&&jsxRuntime.jsx(rt,{id:`drop-center-${e}`,position:"center",activeClassName:d.swapPreview??d.dropPreview})]}),u!==null&&u!==e&&q&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsxRuntime.jsx(rt,{id:`drop-locked-${e}`,position:"full",activeClassName:d.lockedPreview||""})})]})})})};ke.Content=qo;ke.DragHandle=gn;ke.Tabs=Tt;ke.Tab=Fe;ke.Controls=Pn;exports.Pane=ke;exports.PaneTree=vt;exports.Zeugma=go;exports.usePaneContext=Rn;exports.useResizer=bt;exports.useZeugma=Hn;exports.useZeugmaContext=$n;//# 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),a();};document.addEventListener("pointermove",c),document.addEventListener("pointerup",u);}function Ae(e){try{return JSON.stringify(e)}catch{return ""}}var pt=ge.createContext(void 0),we=ge.createContext(void 0),Pe=ge.createContext(void 0),ft=ge.createContext(void 0),re=()=>{let e=ge.useContext(pt);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},ze=()=>{let e=ge.useContext(we);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e},Ue=()=>{let e=ge.useContext(ft);if(!e)throw new Error("useZeugmaDrag must be used within a Zeugma provider");return e};function Mt(e){let t=ge.useRef(null);return ge.useEffect(()=>{if(!e){t.current=null;return}let n=o=>{t.current={x:o.clientX,y:o.clientY};},a=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",a,{passive:true}),()=>{window.removeEventListener("pointermove",n),window.removeEventListener("touchmove",a);}},[e]),t}function kt(e){ge.useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function Ot(){let[e,t]=ge.useState({}),[n,a]=ge.useState({}),o=ge.useRef({}),c=ge.useRef(null),u=ge.useRef({}),i=ge.useRef(null),d=ge.useRef(true);ge.useEffect(()=>(d.current=true,()=>{d.current=false;}),[]);let f=ge.useCallback((P,D,L)=>{d.current&&t(v=>{if(!D){if(L&&v[P]!==L||!v[P])return v;let $={...v};return delete $[P],$}return v[P]===D?v:{...v,[P]:D}});},[]),s=ge.useCallback((P,D)=>{d.current&&a(L=>{if(!D){if(!L[P])return L;let v={...L};return delete v[P],v}return L[P]===D?L:{...L,[P]:D}});},[]),b=ge.useCallback((P,D)=>{o.current[P]=D;},[]),g=ge.useCallback(P=>{c.current=P;},[]),m=ge.useCallback((P,D)=>{u.current[P]=D;},[]);return {portalTargets:ge.useMemo(()=>({...e,...n}),[e,n]),registerPortalTarget:f,registerPopoutTarget:s,registerRenderCallback:b,renderCallbacksRef:o,registerRenderPane:g,renderPaneRef:c,registerTabHeader:m,tabHeadersRef:u,activeIdRef:i}}function An(e){let t=new Set;function n(a){a&&(a.type==="pane"?a.tabIds.forEach(o=>{t.add(o);}):a.type==="split"&&(n(a.first),n(a.second)));}return n(e),Array.from(t).sort()}function At(e){return ge.useMemo(()=>An(e),[e])}function zt(e){let{onDragStart:t,onDragEnd:n}=e,[a,o]=ge.useState(null),[c,u]=ge.useState(null),i=ge.useCallback(f=>{t&&t(f);},[t]),d=ge.useCallback((f,s,b)=>{n&&n(f,s,b);},[n]);return {overTabId:a,setOverTabId:o,overTabPosition:c,setOverTabPosition:u,handleDragStartInternal:i,handleDragEndInternal:d}}function Zt(e){let n=ge.useContext(Pe)?.registerRenderPane;ge.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),a=be(e.second,t);return n===null?a:a===null?n:{...e,first:n,second:a}}function fe(e,t){if(e===null)return null;if(e.type==="pane"){if(e.tabIds.includes(t)){let o=e.tabIds.filter(i=>i!==t);if(o.length===0)return null;let c=e.activeTabId;e.activeTabId===t&&(c=o[0]);let u={...e.tabsMetadata};return delete u[t],{...e,tabIds:o,activeTabId:c,tabsMetadata:Object.keys(u).length>0?u:void 0}}return e}let n=fe(e.first,t),a=fe(e.second,t);return n===null?a:a===null?n:{...e,first:n,second:a}}function Se(e,t,n,a,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 c=typeof o=="string"?{type:"pane",id:pe(),tabIds:[o],activeTabId:o}:o,u=a==="left"||a==="top";return {type:"split",direction:n,first:u?c:e,second:u?e:c,splitPercentage:50}}return e}return {...e,first:Se(e.first,t,n,a,o)||e.first,second:Se(e.second,t,n,a,o)||e.second}}function zn(e,t){if(e===null)return t;function n(a,o){return a.type==="pane"?{type:"split",direction:o==="row"?"column":"row",splitPercentage:50,first:a,second:t}:{...a,second:n(a.second,a.direction)}}return n(e,null)}function Ht(e,t,n,a){if(e===null)return {type:"pane",id:pe(),tabIds:[n],activeTabId:n,tabsMetadata:a?{[n]:a}:void 0};let o=t?te(e,t):null;if(o&&o.type==="pane"){let i=function(d){if(d.type==="pane"&&d.id===t){let f=[...d.tabIds];f.includes(n)||f.push(n);let s=d.tabsMetadata;return a&&(s={...d.tabsMetadata,[n]:a}),{...d,tabIds:f,activeTabId:n,tabsMetadata:s}}return d.type==="split"?{...d,first:i(d.first),second:i(d.second)}:d};return i(e)}let c={type:"pane",id:pe(),tabIds:[n],activeTabId:n,tabsMetadata:a?{[n]:a}:void 0};return zn(e,c)}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 te(e,t){return e===null?null:e.type==="pane"?e.id===t?e:null:e.type==="split"?te(e.first,t)??te(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 $t(e,t){return te(e,t)??U(e,t)}function Qe(e,t){let n=U(e,t);if(!n)return null;let a=n.tabIds.indexOf(t);return {id:t,paneId:n.id,isActive:n.activeTabId===t,index:a,metadata:n.tabsMetadata?.[t],remountOnPopout:n.tabsMetadata?.[t]?.remountOnPopout}}function _t(e,t){return U(e,t)?.tabsMetadata?.[t]}function Bt(e,t){let n=te(e,t);return n?.tabsMetadata?.[n.activeTabId]}function Je(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.tabIds.includes(t)){let a=e.tabsMetadata||{},o=a[t],c=n(o),u={...a};return c===void 0?delete u[t]:u[t]=c,{...e,tabsMetadata:Object.keys(u).length>0?u:void 0}}return e}return e.type==="split"?{...e,first:Je(e.first,t,n)??e.first,second:Je(e.second,t,n)??e.second}:e}function Ge(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.id===t){if(n===false){let{locked:a,...o}=e;return o}return {...e,locked:n}}return e}return e.type==="split"?{...e,first:Ge(e.first,t,n)??e.first,second:Ge(e.second,t,n)??e.second}:e}function Ne(e,t,n){return e===null?null:e.type==="pane"?e.id===t?e.activeTabId===n?e:{...e,activeTabId:n}:e:e.type==="split"?{...e,first:Ne(e.first,t,n)??e.first,second:Ne(e.second,t,n)??e.second}:e}function Ft(e,t,n){if(e===null)return null;let o=U(e,t)?.tabsMetadata?.[t],c=fe(e,t);if(c===null)return {type:"pane",id:pe(),tabIds:[t],activeTabId:t,tabsMetadata:o?{[t]:o}:void 0};function u(i){if(i.type==="pane"){if(i.id===n){let d=[...i.tabIds];d.includes(t)||d.push(t);let f={...i.tabsMetadata};return o&&(f[t]=o),{...i,tabIds:d,activeTabId:t,tabsMetadata:Object.keys(f).length>0?f:void 0}}return i}return i.type==="split"?{...i,first:u(i.first),second:u(i.second)}:i}return u(c)}function Zn(e,t,n){if(e===null)return null;if(t===n)return e;let a=U(e,t),o=U(e,n);if(!a||!o)return e;let c=a.id,u=o.id,i=a.tabsMetadata?.[t],d=o.tabsMetadata?.[n];function f(s){if(s.type==="pane"){let b=false,g=[...s.tabIds],m=s.activeTabId,y=s.tabsMetadata?{...s.tabsMetadata}:{};if(c===u){if(s.id===c){let P=g.indexOf(t),D=g.indexOf(n);P!==-1&&D!==-1&&(g[P]=n,g[D]=t),m=t,b=true;}}else s.id===c&&(g=g.map(P=>P===t?n:P),m===t&&(m=n),delete y[t],d&&(y[n]=d),b=true),s.id===u&&(g=g.map(P=>P===n?t:P),m===n&&(m=t),delete y[n],i&&(y[t]=i),b=true);return b?{...s,tabIds:g,activeTabId:m,tabsMetadata:Object.keys(y).length>0?y:void 0}:s}return s.type==="split"?{...s,first:f(s.first),second:f(s.second)}:s}return f(e)}function Ze(e,t,n,a="before"){if(e===null)return null;if(t===n)return e;if(a==="center")return Zn(e,t,n);let c=U(e,t)?.tabsMetadata?.[t],u=fe(e,t);if(u===null)return {type:"pane",id:pe(),tabIds:[t],activeTabId:t,tabsMetadata:c?{[t]:c}:void 0};function i(d){if(d.type==="pane"){if(d.tabIds.includes(n)){let s=[...d.tabIds].filter(m=>m!==t),b=s.indexOf(n);b<0&&(b=0),a==="after"&&(b+=1),s.splice(b,0,t);let g={...d.tabsMetadata};return c&&(g[t]=c),{...d,tabIds:s,activeTabId:t,tabsMetadata:Object.keys(g).length>0?g:void 0}}return d}return d.type==="split"?{...d,first:i(d.first),second:i(d.second)}:d}return i(u)}function ve(e,t=0,n=0,a=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:a,height:o,node:e}],splitters:[]};let{direction:u,splitPercentage:i,first:d,second:f}=e,b={id:`splitter-${c}-${u}`,currentNode:e,direction:u,left:u==="row"?t+a*(i/100):t,top:u==="column"?n+o*(i/100):n,width:u==="row"?0:a,height:u==="column"?0:o,parentLeft:t,parentTop:n,parentWidth:a,parentHeight:o},g={panes:[],splitters:[]},m={panes:[],splitters:[]};if(u==="row"){let y=a*(i/100);g=ve(d,t,n,y,o,`${c}-L`),m=ve(f,t+y,n,a-y,o,`${c}-R`);}else {let y=o*(i/100);g=ve(d,t,n,a,y,`${c}-T`),m=ve(f,t,n+y,a,o-y,`${c}-B`);}return {panes:[...g.panes,...m.panes],splitters:[b,...g.splitters,...m.splitters]}}function Vt(e,t,n,a="before"){if(e===null)return null;let o=te(e,t);if(!o)return e;let c=o.tabIds,u=o.activeTabId,i=o.tabsMetadata||{},d=be(e,t);if(d===null)return o;function f(s){if(s.type==="pane"){if(s.tabIds.includes(n)){let g=[...s.tabIds].filter(P=>!c.includes(P)),m=g.indexOf(n);m<0&&(m=0),a==="after"&&(m+=1),g.splice(m,0,...c);let y={...s.tabsMetadata};for(let P of c)i[P]&&(y[P]=i[P]);return {...s,tabIds:g,activeTabId:u,tabsMetadata:Object.keys(y).length>0?y:void 0}}return s}return s.type==="split"?{...s,first:f(s.first),second:f(s.second)}:s}return f(d)}function Wt(e,t,n,a){if(!((t==="tab"||t==="pane")&&n&&e.includes(n))||!a)return -1;let u=e.indexOf(n);return a==="before"?u:u+1}function Hn(e){let{initialLayout:t,layout:n,onChange:a,fullscreenPaneId:o,onFullscreenChange:c,locked:u=false}=e,[i,d]=ge.useState(()=>n!==void 0?n:t??null),[f,s]=ge.useState(()=>n!==void 0?n:t??null),[b,g]=ge.useState(()=>Ae(n!==void 0?n:null)),[m,y]=ge.useState(o||null),[P,D]=ge.useState(u),[L,v]=ge.useState([]),[$,E]=ge.useState(null),[O,Z]=ge.useState(null),[r,l]=ge.useState(null),h=ge.useRef(null),R=ge.useCallback(p=>{h.current=p;},[]),M=ge.useRef(i);M.current=i;let q=ge.useRef(a);q.current=a;let ne=ge.useRef(c);ne.current=c;let J=ge.useCallback(p=>{y(p),ne.current?.(p);},[]);if(ge.useEffect(()=>{D(u);},[u]),ge.useEffect(()=>{o!==void 0&&y(o);},[o]),n!==void 0){let p=Ae(n);p!==b&&(g(p),d(n),s(n),v(T=>{if(T.length===0)return T;let x=T.filter(H=>Qe(n,H)!==null);return x.length===T.length?T:x}));}let A=ge.useCallback(p=>(...T)=>{let x=M.current,H=p(x,...T);Ae(x)!==Ae(H)&&(M.current=H,d(H),s(H),v(F=>{if(F.length===0)return F;let ie=F.filter(W=>Qe(H,W)!==null);return ie.length===F.length?F:ie}),q.current?.(H));},[]),_=ge.useCallback(A((p,T)=>typeof T=="function"?T(p):T),[A]),j=ge.useCallback(p=>{s(T=>typeof p=="function"?p(T):p);},[]),V=ge.useCallback(p=>{y(null),ne.current?.(null),E(null),Z(null),l(null),_(p),s(()=>typeof p=="function"?p(M.current):p);},[_]),B=ge.useCallback(A((p,T)=>be(p,T)),[A]),N=ge.useCallback(A((p,T,x,H)=>{let F=fe(p,T)??p;return Ht(F,x,T,H)}),[A]),w=ge.useCallback(A((p,T,x,H,F)=>{let ie=te(p,T)??U(p,T);if(!ie)return p;let W=te(p,F)??U(p,F)??{type:"pane",id:F,tabIds:[F],activeTabId:F},Te=be(p,W.id);return Se(Te,ie.id,x,H,W)}),[A]),z=ge.useCallback(A((p,T,x)=>xe(p,T,x)),[A]),C=ge.useCallback(A((p,T,x)=>Je(p,T,x)),[A]),k=ge.useCallback(A((p,T,x)=>{let H=te(p,T)??U(p,T);return H?Ge(p,H.id,x):p}),[A]),ue=ge.useCallback(A((p,T,x)=>{let H=te(p,T)??U(p,T);return H?Ne(p,H.id,x):p}),[A]),Q=ge.useCallback(A((p,T,x)=>{let H=te(p,x)??U(p,x);return H?Ft(p,T,H.id):p}),[A]),K=ge.useCallback(A((p,T,x,H)=>Ze(p,T,x,H)),[A]),Y=ge.useCallback(A((p,T)=>fe(p,T)),[A]),ee=ge.useCallback(p=>te(M.current,p),[]),S=ge.useCallback(p=>U(M.current,p),[]),I=ge.useCallback(p=>Qe(M.current,p),[]),se=ge.useCallback(p=>_t(M.current,p),[]),le=ge.useCallback(p=>Bt(M.current,p),[]),G=ge.useCallback(p=>{v(T=>T.includes(p)?T:[...T,p]);},[]),oe=ge.useCallback(p=>{v(T=>T.includes(p)?T.filter(x=>x!==p):T);},[]);return {layout:i,setLayout:V,_internalSetLayout:j,renderingLayout:f,fullscreenPaneId:m,setFullscreenPaneId:J,locked:P,setLocked:D,poppedOutTabIds:L,activeId:$,setActiveId:E,activeType:O,setActiveType:Z,dismissIntentId:r,setDismissIntentId:l,containerRef:h,setContainerRef:R,removePane:B,addTab:N,updateMetadata:C,updatePaneLock:k,selectTab:ue,mergeTab:Q,moveTab:K,removeTab:Y,splitPane:w,updateSplitPercentage:z,popoutTab:G,dockTab:oe,findPaneById:ee,findPaneContainingTab:S,findTabById:I,getTabMetadata:se,getActiveTabMetadata:le}}var $n=()=>{let e=re(),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 et=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},tt=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};var qt=e=>{let n=e.active.id.toString().startsWith("tab-header-"),o=core.pointerWithin(e);if(o.length>0)return [...o].sort((u,i)=>{let d=u.id.toString(),f=i.id.toString(),s=d.startsWith("tab-drop-"),b=f.startsWith("tab-drop-");if(s&&!b)return -1;if(!s&&b)return 1;let g=d.startsWith("drop-root-"),m=f.startsWith("drop-root-");return g&&!m?-1:!g&&m?1:0});if(n){let c=e.droppableContainers.filter(u=>u.id.toString().startsWith("tab-drop-"));return core.closestCenter({...e,droppableContainers:c})}return []};function He(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 Yt(e){let{layout:t,_internalSetLayout:n,setLayout:a,activeId:o,setActiveId:c,activeType:u,setActiveType:i,dismissIntentId:d,setDismissIntentId:f,setOverTabId:s,setOverTabPosition:b,containerRef:g,dragActivationDistance:m,enableDragToDismiss:y,dismissThreshold:P,onRemove:D,onDragStart:L,onDragEnd:v,onDismissIntentChange:$,removeTab:E,removePane:O}=e,Z=ge.useRef(null),r=Mt(o),l=ge.useRef(null),[h,R]=ge.useState(false);return kt(h),{sensors:core.useSensors(core.useSensor(et,{activationConstraint:{distance:m}}),core.useSensor(tt,{activationConstraint:{delay:250,tolerance:5}})),collisionDetection:qt,onDragStart:_=>{let j=_.active.id.toString(),V=j.startsWith("tab-header-"),B=V?j.substring(11):j;c(B),i(V?"tab":"pane"),s(null),b(null);let N=_.activatorEvent;r.current=He(N),y&&g.current?Z.current=g.current.getBoundingClientRect():Z.current=null;let w=t;if(V){let C=U(t,B);C&&(w=Ne(t,C.id,B)||t);}l.current=w;let z=V?fe(w,B):be(w,B);n(z),L&&L(B);},onDragMove:_=>{let{over:j}=_,V=j?.id.toString()||"",B=V.startsWith("drop-locked-");R(S=>S===B?S:B);let N=_.active.id.toString(),w=N.startsWith("tab-header-"),z=w?N.substring(11):N,C=V.match(/^tab-drop-(.+)$/);if(C&&j&&(w||u==="pane")){let[,S]=C;if(z!==S){let I="before",se=j.rect,le=_.activatorEvent,G=null;if(r.current)G=r.current.x;else {let oe=He(le);oe&&(G=oe.x+_.delta.x);}if(G!==null){let oe=se.left+se.width/2;G>oe&&(I="after");}s(oe=>oe===S?oe:S),b(oe=>oe===I?oe:I);}else s(I=>I===null?I:null),b(I=>I===null?I:null);}else s(S=>S===null?S:null),b(S=>S===null?S:null);if(!y)return;let k=Z.current;if(!k){d!==null&&(f(null),$?.(null));return}let ue=_.activatorEvent,Q=null,K=null;if(r.current)Q=r.current.x,K=r.current.y;else {let S=He(ue);S&&(Q=S.x+_.delta.x,K=S.y+_.delta.y);}let Y=0;if(Q!==null&&K!==null){let S=0,I=0;Q<k.left?S=k.left-Q:Q>k.right&&(S=Q-k.right),K<k.top?I=k.top-K:K>k.bottom&&(I=K-k.bottom),Y=Math.sqrt(S*S+I*I);}else {let S=_.active.rect.current.translated;if(S){let I=S.left+S.width/2,se=S.top+S.height/2,le=0,G=0;I<k.left?le=k.left-I:I>k.right&&(le=I-k.right),se<k.top?G=k.top-se:se>k.bottom&&(G=se-k.bottom),Y=Math.sqrt(le*le+G*G);}}Y>P?d!==z&&(f(z),$?.(z)):d!==null&&(f(null),$?.(null));},onDragEnd:_=>{c(null),i(null),R(false),s(null),b(null);let{active:j,over:V}=_,B=j.id.toString(),N=B.startsWith("tab-header-"),w=N?B.substring(11):B,z=y&&d===w;f(null),$?.(null),Z.current=null;let C=l.current||t;if(l.current=null,z){D?D(w):N?E(w):O(w),v&&v(w,null,null);return}if(!V){n(C),v&&v(w,null,null);return}let k=V.id.toString();if(k.startsWith("drop-locked-")){n(C),v&&v(w,null,null);return}let ue=k.match(/^tab-drop-(.+)$/);if(ue){let[,p]=ue;if(N)if(w!==p){let T="before",x=V.rect,H=_.activatorEvent,F=null;if(r.current)F=r.current.x;else {let W=He(H);W&&(F=W.x+_.delta.x);}if(F!==null){let W=x.left+x.width/2;F>W&&(T="after");}let ie=Ze(C,w,p,T);a(ie),v&&v(w,p,{type:"move",position:"center"});}else n(C),v&&v(w,null,null);else {let T="before",x=V.rect,H=_.activatorEvent,F=null;if(r.current)F=r.current.x;else {let W=He(H);W&&(F=W.x+_.delta.x);}if(F!==null){let W=x.left+x.width/2;F>W&&(T="after");}let ie=Vt(C,w,p,T);a(ie),v&&v(w,p,{type:"move",position:"center"});}return}let Q=k.match(/^drop-root-(1\/4|1\/3)-(top|bottom|left|right|start|end)$/);if(Q){let[,p,T]=Q,x=T;x==="start"&&(x="left"),x==="end"&&(x="right");let H=N?fe(C,w):be(C,w),F;if(N){let W=U(C,w)?.tabsMetadata?.[w];F={type:"pane",id:pe(),tabIds:[w],activeTabId:w,tabsMetadata:W?{[w]:W}:void 0};}else F=te(C,w)??{type:"pane",id:pe(),tabIds:[w],activeTabId:w};if(H===null)a(F);else {let ie=x==="left"||x==="right",W=x==="left"||x==="top",Te=50;p==="1/4"?Te=W?25:75:p==="1/3"&&(Te=W?100/3:200/3),a({type:"split",direction:ie?"row":"column",first:W?F:H,second:W?H:F,splitPercentage:Te});}v&&v(w,"root",{type:"split",direction:x==="left"||x==="right"?"row":"column",position:x});return}let K=k.match(/^drop-(left|right|top|bottom|center)-(.+)$/);if(!K){n(C),v&&v(w,null,null);return}let[,Y,ee]=K;if(Y==="center"){if(N){let p=te(C,ee);if(p&&p.activeTabId){let T=p.activeTabId,x=Ze(C,w,T,"center");a(x),v&&v(w,ee,{type:"move",position:"center"});}else n(C),v&&v(w,null,null);}else n(C),v&&v(w,null,null);return}let S=N?U(C,w):te(C,w),I=S&&S.id===ee,se=S&&S.tabIds.length===1;if(w===ee||I&&se){n(C),v&&v(w,null,null);return}let le=Y==="left"||Y==="right"?"row":"column",G;if(N){let T=U(C,w)?.tabsMetadata?.[w];G={type:"pane",id:pe(),tabIds:[w],activeTabId:w,tabsMetadata:T?{[w]:T}:void 0};}else G=te(C,w)??{type:"pane",id:pe(),tabIds:[w],activeTabId:w};let oe=N?fe(C,w):be(C,w),Oe=Se(oe,ee,le,Y,G);a(Oe),v&&v(w,ee,{type:"split",direction:le,position:Y});},onDragCancel:()=>{c(null),i(null),R(false),s(null),b(null),f(null),$?.(null),Z.current=null;let _=l.current||t;l.current=null,n(_),_!==t&&a(_);}}}function Gt({persist:e,layout:t,setLayout:n}){let a=typeof e=="object"?e.enabled!==false:!!e,o=typeof e=="object"&&e.key||"zeugma-layout",[c,u]=ge.useState(false);ge.useEffect(()=>{if(a){let i=localStorage.getItem(o);if(i)try{let d=JSON.parse(i);d&&n(d);}catch(d){console.error("Failed to parse persisted zeugma layout",d);}}u(true);},[a,o,n]),ge.useEffect(()=>{a&&c&&(t?localStorage.setItem(o,JSON.stringify(t)):localStorage.removeItem(o));},[a,o,t,c]);}var Ee=null,Kt=false,ae=new Set,De=new Set,Ie=null;function Xn(){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")&&ae.forEach(a=>{try{let o=n.cloneNode(!0);if(o.tagName.toLowerCase()==="link"){let c=n.href;c&&o.setAttribute("href",c);}a.head.appendChild(o);}catch(o){console.warn("Failed to mirror style node to popout:",o);}});});});}),Ie.observe(document.head,{childList:true}));}function mt(){Ie&&(Ie.disconnect(),Ie=null);}var Le=null;function Yn(){typeof window>"u"||Le||(Le=new MutationObserver(e=>{e.forEach(t=>{if(t.type==="attributes"&&t.attributeName){let n=document.documentElement.getAttribute(t.attributeName);ae.forEach(a=>{try{a&&a.documentElement&&(n!==null?a.documentElement.setAttribute(t.attributeName,n):a.documentElement.removeAttribute(t.attributeName));}catch(o){console.warn("Failed to sync documentElement attribute:",o);}});}});}),Le.observe(document.documentElement,{attributes:true}));}function gt(){Le&&(Le.disconnect(),Le=null);}var en=e=>{typeof requestAnimationFrame<"u"?requestAnimationFrame(e):setTimeout(e,0);};function me(){if(typeof window>"u")return document;if(Ee&&Ee.target){let t=Ee.target.ownerDocument;if(t&&t!==document)return t}let e=window.event;if(e&&e.target){let n=e.target.ownerDocument;if(n&&n!==document)return n}return window.__zeugmaActivePopoutDocument?window.__zeugmaActivePopoutDocument:document}function tn(){if(typeof window>"u"||Kt)return;Kt=true;let e=(r,l)=>{if(!r||!l)return false;try{let h=Object.getPrototypeOf(r);for(;h;){if(h===l)return !0;h=Object.getPrototypeOf(h);}}catch{}return false},t=(r,l)=>{try{Object.defineProperty(r,Symbol.hasInstance,{value:function(h){return h?e(h,r.prototype)?!0:l(h):!1},configurable:!0,writable:!0});}catch(h){console.warn("Failed to patch Symbol.hasInstance on",r,h);}};typeof Node<"u"&&t(Node,r=>typeof r.nodeType=="number"&&typeof r.nodeName=="string"),typeof Element<"u"&&t(Element,r=>r.nodeType===1),typeof HTMLElement<"u"&&t(HTMLElement,r=>r.nodeType===1&&typeof r.style=="object"),typeof HTMLBodyElement<"u"&&t(HTMLBodyElement,r=>r.nodeType===1&&r.tagName==="BODY"),typeof HTMLHtmlElement<"u"&&t(HTMLHtmlElement,r=>r.nodeType===1&&r.tagName==="HTML"),typeof HTMLInputElement<"u"&&t(HTMLInputElement,r=>r.nodeType===1&&r.tagName==="INPUT"),typeof HTMLTextAreaElement<"u"&&t(HTMLTextAreaElement,r=>r.nodeType===1&&r.tagName==="TEXTAREA"),typeof ShadowRoot<"u"&&t(ShadowRoot,r=>r.nodeType===11&&r.host!==void 0),typeof SVGElement<"u"&&t(SVGElement,r=>r.nodeType===1&&typeof r.getBBox=="function"),typeof Document<"u"&&t(Document,r=>r.nodeType===9),typeof Window<"u"&&t(Window,r=>r&&typeof r.document=="object"&&typeof r.location=="object");let n=Document.prototype,a=Object.getOwnPropertyDescriptor(n,"body"),o=Object.getOwnPropertyDescriptor(n,"documentElement"),c=Object.getOwnPropertyDescriptor(n,"head"),u=Object.getOwnPropertyDescriptor(n,"activeElement"),i=Object.getOwnPropertyDescriptor(n,"defaultView"),d=Object.getOwnPropertyDescriptor(n,"scrollingElement");Object.defineProperties(document,{body:{get(){let r=me();return r&&r!==document?r.body:a?.get?.call(document)||document.body},configurable:true},documentElement:{get(){let r=me();return r&&r!==document?r.documentElement:o?.get?.call(document)||document.documentElement},configurable:true},head:{get(){let r=me();return r&&r!==document?r.head:c?.get?.call(document)||document.head},configurable:true},activeElement:{get(){let r=me();return r&&r!==document?r.activeElement:u?.get?.call(document)||document.activeElement},configurable:true},defaultView:{get(){let r=me();return r&&r!==document?r.defaultView:i?.get?.call(document)||document.defaultView},configurable:true},scrollingElement:{get(){let r=me();return r&&r!==document?r.scrollingElement:d?.get?.call(document)||document.scrollingElement},configurable:true}});let f=Window.prototype,s=["innerWidth","innerHeight","pageXOffset","pageYOffset","scrollX","scrollY","screenX","screenY","outerWidth","outerHeight","devicePixelRatio"],b={};s.forEach(r=>{let l=Object.getOwnPropertyDescriptor(f,r)||Object.getOwnPropertyDescriptor(window,r);l&&l.get&&(b[r]=l.get);}),s.forEach(r=>{Object.defineProperty(window,r,{get(){let l=me();if(l&&l!==document&&l.defaultView)try{return l.defaultView[r]}catch{}let h=b[r];return h?h.call(window):window[r]},configurable:true});});let g=Node.prototype.contains;Node.prototype.contains=function(r){if(!r)return false;if(g.call(this,r))return true;if(this===document||this===document.body||this===document.documentElement)for(let l of ae)try{if(l.contains(r))return !0}catch{}return false};let m=()=>{Ee=null,globalThis.__zeugmaActivePopoutDocument=null;};["pointerdown","mousedown","click","keydown","focus","touchstart"].forEach(r=>{window.addEventListener(r,m,true);});let P=document.createElement;document.createElement=function(r,l){let h=me();return h&&h!==document?h.createElement(r,l):P.call(document,r,l)};let D=document.addEventListener;document.addEventListener=function(r,l,h){De.add({target:"document",type:r,listener:l,options:h}),D.call(document,r,l,h),ae.forEach(R=>{try{R.addEventListener(r,l,h);}catch{}});};let L=document.removeEventListener;document.removeEventListener=function(r,l,h){for(let R of De)if(R.target==="document"&&R.type===r&&R.listener===l){De.delete(R);break}L.call(document,r,l,h),ae.forEach(R=>{try{R.removeEventListener(r,l,h);}catch{}});};let v=window.addEventListener;window.addEventListener=function(r,l,h){De.add({target:"window",type:r,listener:l,options:h}),v.call(window,r,l,h),ae.forEach(R=>{try{R.defaultView&&R.defaultView.addEventListener(r,l,h);}catch{}});};let $=window.removeEventListener;window.removeEventListener=function(r,l,h){for(let R of De)if(R.target==="window"&&R.type===r&&R.listener===l){De.delete(R);break}$.call(window,r,l,h),ae.forEach(R=>{try{R.defaultView&&R.defaultView.removeEventListener(r,l,h);}catch{}});};let E=document.getElementById;document.getElementById=function(r){let l=me();if(l&&l!==document)return l.getElementById(r);let h=E.call(document,r);if(h)return h;for(let R of ae)try{let M=R.getElementById(r);if(M)return M}catch{}return null};let O=document.querySelector;document.querySelector=function(r){let l=me();if(l&&l!==document)return l.querySelector(r);let h=O.call(document,r);if(h)return h;for(let R of ae)try{let M=R.querySelector(r);if(M)return M}catch{}return null};let Z=document.querySelectorAll;document.querySelectorAll=function(r){let l=me();if(l&&l!==document)return l.querySelectorAll(r);let h=Z.call(document,r);if(h.length>0)return h;for(let R of ae)try{let M=R.querySelectorAll(r);if(M.length>0)return M}catch{}return h};}function nn(e){let{poppedOutTabIds:t,registerPopoutTarget:n,findTabById:a,dockTab:o}=e,c=ge.useRef({});ge.useEffect(()=>{let u=c.current;t.forEach(i=>{if(u[i]){try{u[i].focus();}catch{}return}tn();let f=a(i)?.metadata?.title||`Tab ${i}`,s=window.open("",`zeugma-popout-${i}`,"width=800,height=600");if(!s){console.warn("Failed to open popout window. Check popup blocker."),o(i);return}u[i]=s,ae.add(s.document),De.forEach(l=>{try{l.target==="window"?s.addEventListener(l.type,l.listener,l.options):s.document.addEventListener(l.type,l.listener,l.options);}catch{}}),Xn(),Yn(),s.document.title=f,s.document.head.innerHTML="";try{let l=s.document.createElement("base");l.setAttribute("href",window.location.origin+"/"),s.document.head.appendChild(l);}catch{}if(Array.from(document.querySelectorAll('style, link[rel="stylesheet"]')).forEach(l=>{let h=l.cloneNode(true);if(l.tagName.toLowerCase()==="link"){let R=l.href;R&&h.setAttribute("href",R);}else if(l.tagName.toLowerCase()==="style")try{let R=l.sheet?.cssRules;if(R&&R.length>0){let M=Array.from(R).map(q=>q.cssText).join(`
10
+ `);h.textContent=M;}}catch{}s.document.head.appendChild(h);}),typeof document.adoptedStyleSheets<"u"&&typeof s.document.adoptedStyleSheets<"u")try{let l=Array.from(document.adoptedStyleSheets).map(h=>{try{let R=new s.CSSStyleSheet,M=Array.from(h.cssRules).map(q=>q.cssText).join(`
11
+ `);return R.replaceSync(M),R}catch{return null}}).filter(h=>h!==null);s.document.adoptedStyleSheets=l;}catch(l){console.warn("Failed to copy adoptedStyleSheets:",l);}s.document.documentElement.className=document.documentElement.className,s.document.body.className=document.body.className,Array.from(document.documentElement.attributes).forEach(l=>{s.document.documentElement.setAttribute(l.name,l.value);}),s.document.body.style.margin="0",s.document.body.style.padding="0",s.document.body.style.height="100vh",s.document.body.style.overflow="hidden";let b=document.getElementById(`zeugma-tab-target-${i}`),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),y=window.getComputedStyle(document.body),P=y.backgroundColor,L=!P||P==="transparent"||P==="rgba(0, 0, 0, 0)"?m.backgroundColor:P,v=g&&g!=="transparent"&&g!=="rgba(0, 0, 0, 0)"?g:L&&L!=="transparent"&&L!=="rgba(0, 0, 0, 0)"?L:"#181b1f";document.documentElement.getAttribute("data-theme")||(s.document.documentElement.style.backgroundColor=v,s.document.body.style.backgroundColor=v),s.document.body.style.color=y.color||m.color,s.document.body.style.fontFamily=y.fontFamily||m.fontFamily;let E=s.document.createElement("div");E.id=`zeugma-popout-container-${i}`,E.className="grafana-panel h-full w-full overflow-hidden",E.style.width="100%",E.style.height="100%",E.style.border="none",s.document.body.appendChild(E),n?.(i,E);let O=["pointerdown","mousedown","click","keydown","focus","touchstart"],Z=l=>{Ee=l,globalThis.__zeugmaActivePopoutDocument=s.document,setTimeout(()=>{Ee===l&&(Ee=null,globalThis.__zeugmaActivePopoutDocument=null);},0);};O.forEach(l=>{s.addEventListener(l,Z,true);});let r=()=>{ae.delete(s.document),ae.size===0&&(mt(),gt()),o(i);};s.addEventListener("beforeunload",r),s.__zeugmaCleanup=()=>{O.forEach(l=>{s.removeEventListener(l,Z,true);}),s.removeEventListener("beforeunload",r);};}),Object.keys(u).forEach(i=>{if(!t.includes(i)){let d=u[i];if(delete u[i],n?.(i,null),d){ae.delete(d.document),ae.size===0&&(mt(),gt());try{let f=d;f.__zeugmaCleanup&&f.__zeugmaCleanup(),en(()=>{try{f.close();}catch{}});}catch{}}}});},[t,n,a,o]),ge.useEffect(()=>()=>{let u=c.current;Object.keys(u).forEach(i=>{let d=u[i];if(d){ae.delete(d.document);try{let f=d;f.__zeugmaCleanup&&f.__zeugmaCleanup(),en(()=>{try{f.close();}catch{}});}catch{}}}),ae.size===0&&(mt(),gt());},[]);}typeof window<"u"&&tn();var on=({activeId:e,render:t,className:n})=>{let a=ge.useRef(null);return ge.useEffect(()=>{let o=c=>{a.current&&(a.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:a,className:n,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var no=({popoutDoc:e,children:t})=>{if(e===document)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:t});let n=ge__default.default.useEffect,a=ge__default.default.useLayoutEffect,o=ge__default.default.useInsertionEffect;ge__default.default.useEffect=(c,u)=>n(()=>{window.__zeugmaActivePopoutDocument=e;try{let i=c();return typeof i=="function"?()=>{window.__zeugmaActivePopoutDocument=e;try{return i()}finally{window.__zeugmaActivePopoutDocument=null;}}:i}finally{window.__zeugmaActivePopoutDocument=null;}},u),ge__default.default.useLayoutEffect=(c,u)=>a(()=>{window.__zeugmaActivePopoutDocument=e;try{let i=c();return typeof i=="function"?()=>{window.__zeugmaActivePopoutDocument=e;try{return i()}finally{window.__zeugmaActivePopoutDocument=null;}}:i}finally{window.__zeugmaActivePopoutDocument=null;}},u),o&&(ge__default.default.useInsertionEffect=(c,u)=>o(()=>{window.__zeugmaActivePopoutDocument=e;try{let i=c();return typeof i=="function"?()=>{window.__zeugmaActivePopoutDocument=e;try{return i()}finally{window.__zeugmaActivePopoutDocument=null;}}:i}finally{window.__zeugmaActivePopoutDocument=null;}},u)),window.__zeugmaActivePopoutDocument=e;try{return jsxRuntime.jsx(jsxRuntime.Fragment,{children:t})}finally{window.__zeugmaActivePopoutDocument=null,ge__default.default.useEffect=n,ge__default.default.useLayoutEffect=a,o&&(ge__default.default.useInsertionEffect=o);}},an=ge__default.default.memo(({tabDetails:e,target:t,renderWidget:n})=>{let{id:a}=e,{renderPopoutWrapper:o}=re(),[c,u]=ge.useState(false),i=ge.useRef(null);if(ge.useEffect(()=>{u(true);},[]),ge.useEffect(()=>{if(!c||!i.current)return;let m=i.current;if(t)t.ownerDocument.adoptNode(m),t.appendChild(m);else {let y=document.getElementById("zeugma-hidden-portal-container");y||(y=document.createElement("div"),y.id="zeugma-hidden-portal-container",y.style.display="none",document.body.appendChild(y)),document.adoptNode(m),y.appendChild(m);}},[t,c]),ge.useEffect(()=>()=>{i.current&&i.current.remove();},[]),!c)return null;let d=t?t.ownerDocument:document;i.current&&i.current.ownerDocument!==d&&d.adoptNode(i.current),i.current||(i.current=d.createElement("div"),i.current.className=`zeugma-portal-wrapper-${a}`,i.current.style.width="100%",i.current.style.height="100%");let f=i.current;if(!f||!n)return null;let s=!!(t&&t.ownerDocument&&t.ownerDocument!==document),b=e.remountOnPopout?s?"-popped":"-docked":"",g=jsxRuntime.jsx(ge__default.default.Fragment,{children:n(e)},`${a}${b}`);return s&&t&&t.ownerDocument&&o&&(g=o({tabId:a,document:t.ownerDocument,window:t.ownerDocument.defaultView||window,children:g})),reactDom.createPortal(jsxRuntime.jsx(no,{popoutDoc:s&&t?t.ownerDocument:document,children: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 sn=({activeId:e,activeType:t,dismissIntentId:n,renderDragOverlay:a,renderPaneRef:o,renderPane:c,tabHeadersRef:u,classNames:i})=>{if(a)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:a({type:t,id:e,isDismissing:e===n})});if(t==="pane"){let d=o.current||c;if(d)return jsxRuntime.jsx("div",{className:i.paneDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:d(e)})}else if(t==="tab"){let d=o.current||c;if(d)return jsxRuntime.jsx("div",{className:i.tabDragPreview||"",style:{pointerEvents:"none",width:"420px",height:"260px",overflow:"hidden"},children:d(e)});let f=u.current[e];if(f){let s=i.tab?typeof i.tab=="function"?i.tab(e):i.tab:"";return jsxRuntime.jsx("div",{className:`${i.tabDragPreview||""} ${s}`.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 vt({containerRef:e,isRow:t,direction:n,splitPercentage:a,resizerSize:o,snapThreshold:c,layout:u,currentNode:i,onLayoutChange:d,onResizeStart:f,onResizeEnd:s,parentLeft:b,parentTop:g,parentWidth:m,parentHeight:y}){let{onResizeStart:P,onResize:D,onResizeEnd:L,minSplitPercentage:v=5,maxSplitPercentage:$=95,locked:E=false}=re();return ge.useCallback(O=>{if(E)return;O.preventDefault();let Z=e.current;if(!Z)return;f&&f(),P&&P(i);let r=Z.getBoundingClientRect(),l=O.clientX,h=O.clientY,R=a,M=O.currentTarget,q=r.left+r.width*(b/100),ne=r.top+r.height*(g/100),J=r.width*(m/100),A=r.height*(y/100),j=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(B=>B!==M&&B.getAttribute("data-direction")===n).map(B=>{let N=B.getBoundingClientRect();return t?N.left+N.width/2:N.top+N.height/2}),V=R;It({cursor:t?"col-resize":"row-resize",resizerEl:M,onMove:B=>{let N=t?(B.clientX-l)/J*100:(B.clientY-h)/A*100,w=R+N,z=t?q+(J-o)*(w/100)+o/2:ne+(A-o)*(w/100)+o/2,C=1/0,k=null;for(let Y of j){let ee=Math.abs(z-Y);ee<c&&ee<C&&(C=ee,k=Y);}let ue=w;k!==null&&(ue=t?(k-o/2-q)/(J-o)*100:(k-o/2-ne)/(A-o)*100);let Q=Math.max(v,Math.min($,ue));V=Q;let K=xe(u,i,Q);if(K){let{panes:Y,splitters:ee}=ve(K),S=e.current;if(S){for(let I of Y)S.style.setProperty(`--pane-left-${I.paneId}`,`${I.left}%`),S.style.setProperty(`--pane-top-${I.paneId}`,`${I.top}%`),S.style.setProperty(`--pane-width-${I.paneId}`,`${I.width}%`),S.style.setProperty(`--pane-height-${I.paneId}`,`${I.height}%`);for(let I of ee)S.style.setProperty(`--splitter-pos-${I.id}`,`${I.direction==="row"?I.left:I.top}%`);}}D&&D(i,Q);},onEnd:()=>{let B=xe(u,i,V),N=e.current;if(N){let{panes:w,splitters:z}=ve(B);for(let C of w)N.style.removeProperty(`--pane-left-${C.paneId}`),N.style.removeProperty(`--pane-top-${C.paneId}`),N.style.removeProperty(`--pane-width-${C.paneId}`),N.style.removeProperty(`--pane-height-${C.paneId}`);for(let C of z)N.style.removeProperty(`--splitter-pos-${C.id}`);}d(B),s&&s(),L&&L(i,V);}});},[e,t,n,a,o,c,u,i,d,f,s,P,D,L,v,$,b,g,m,y])}var ln=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:a})=>{let{renderingLayout:o,setLayout:c,classNames:u,locked:i}=re(),[d,f]=ge.useState(false),{currentNode:s,direction:b,left:g,top:m,width:y,height:P,parentLeft:D,parentTop:L,parentWidth:v,parentHeight:$}=e,E=b==="row",O=vt({containerRef:a,isRow:E,direction:b,splitPercentage:s.splitPercentage,resizerSize:t,snapThreshold:n,layout:o,currentNode:s,onLayoutChange:c,onResizeStart:()=>f(true),onResizeEnd:()=>f(false),parentLeft:D,parentTop:L,parentWidth:v,parentHeight:$}),Z=E?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${g}%) - ${t/2}px)`,top:`calc(${m}% + ${t/2}px)`,width:`${t}px`,height:`calc(${P}% - ${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}, ${m}%) - ${t/2}px)`,width:`calc(${y}% - ${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":b,"data-resizing":d||void 0,style:Z,onPointerDown:O,role:"separator","aria-valuenow":s.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},cn=ge__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 ht=({renderPane:e,tree:t,resizerSize:n,snapThreshold:a})=>{Zt(e);let{renderingLayout:o,activeId:c,dismissIntentId:u,setContainerRef:i,fullscreenPaneId:d,snapThreshold:f,locked:s,classNames:b,resizerSize:g}=re(),m=a!==void 0?a:f??8,y=n!==void 0?n:g??4,P=t!==void 0?t:o,D=ge.useRef(null),{panes:L,splitters:v}=ge.useMemo(()=>P?ve(P):{panes:[],splitters:[]},[P]);if(!P&&t!==void 0)return null;let $=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[L.map(E=>{let O=d===E.paneId;return jsxRuntime.jsx("div",{style:{position:"absolute",left:O?"0%":`var(--pane-left-${E.paneId}, ${E.left}%)`,top:O?"0%":`var(--pane-top-${E.paneId}, ${E.top}%)`,width:O?"100%":`var(--pane-width-${E.paneId}, ${E.width}%)`,height:O?"100%":`var(--pane-height-${E.paneId}, ${E.height}%)`,overflow:"hidden",zIndex:O?20:1,display:d&&!O?"none":"block",padding:O?"0px":`${y/2}px`,boxSizing:"border-box"},children:jsxRuntime.jsx(cn,{paneId:E.paneId,renderPane:e})},E.paneId)}),!d&&v.map(E=>jsxRuntime.jsx(ln,{splitter:E,resizerSize:y,snapThreshold:m,containerRef:D},E.id))]});if(t===void 0){let E=c!==null&&c===u,O=r=>{i(r),D.current=r;},Z=`${b.dashboard||""} ${E&&b.dashboardDismissActive||""} ${s&&b.dashboardLocked||""}`.trim();return jsxRuntime.jsxs("div",{ref:O,className:Z,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:[$(),c!==null&&!s&&jsxRuntime.jsx(pn,{activeClassName:b.rootDropPreview??b.dropPreview})]})}return jsxRuntime.jsx("div",{ref:D,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:$()})};var fo=e=>{let{controller:t,children:n,renderDragOverlay:a,classNames:o={},renderPane:c,resizerSize:u,dragActivationDistance:i=8,snapThreshold:d=8,minSplitPercentage:f=5,maxSplitPercentage:s=95,enableDragToDismiss:b=false,dismissThreshold:g=60,onRemove:m,onDragStart:y,onDragEnd:P,onResizeStart:D,onResize:L,onResizeEnd:v,onDismissIntentChange:$,persist:E=false,renderPopoutWrapper:O}=e,Z=t,{layout:r,setLayout:l,_internalSetLayout:h,renderingLayout:R,fullscreenPaneId:M,setFullscreenPaneId:q,locked:ne,setLocked:J,findPaneById:A,findPaneContainingTab:_,findTabById:j,getTabMetadata:V,getActiveTabMetadata:B,activeId:N,setActiveId:w,activeType:z,setActiveType:C,dismissIntentId:k,setDismissIntentId:ue,containerRef:Q,setContainerRef:K,removePane:Y,addTab:ee,updateMetadata:S,updatePaneLock:I,selectTab:se,mergeTab:le,removeTab:G,splitPane:oe,updateSplitPercentage:Oe,moveTab:p,poppedOutTabIds:T=[],popoutTab:x,dockTab:H}=Z;Gt({persist:E,layout:r,setLayout:l});let{portalTargets:F,registerPortalTarget:ie,registerPopoutTarget:W,registerRenderCallback:Te,renderCallbacksRef:Ve,registerRenderPane:Rt,renderPaneRef:lt,registerTabHeader:xt,tabHeadersRef:ct,activeIdRef:We}=Ot();nn({poppedOutTabIds:T,registerPopoutTarget:W,findTabById:j,dockTab:H});let Dt=ge.useCallback(de=>T.includes(de),[T]),{overTabId:Et,setOverTabId:xn,overTabPosition:Ct,setOverTabPosition:Dn,handleDragStartInternal:En,handleDragEndInternal:Cn}=zt({onDragStart:y,onDragEnd:P}),Sn=Yt({layout:r,_internalSetLayout:h,setLayout:l,activeId:N,setActiveId:w,activeType:z,setActiveType:C,dismissIntentId:k,setDismissIntentId:ue,setOverTabId:xn,setOverTabPosition:Dn,containerRef:Q,dragActivationDistance:i,enableDragToDismiss:b,dismissThreshold:g,onRemove:m,onDragStart:En,onDragEnd:Cn,onDismissIntentChange:$,removeTab:G,removePane:Y}),ut=ge.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]),St=ge.useCallback((de,je)=>{v&&v(de,je);},[v]),Nn=ge.useMemo(()=>({layout:r,renderingLayout:R,setLayout:l,activeId:N,activeType:z,dismissIntentId:k,setContainerRef:K,fullscreenPaneId:M,classNames:ut,onRemove:m,onFullscreenChange:q,snapThreshold:d,onResizeStart:D,onResize:L,onResizeEnd:St,minSplitPercentage:f,maxSplitPercentage:s,locked:ne,setLocked:J,findPaneById:A,findPaneContainingTab:_,findTabById:j,getTabMetadata:V,getActiveTabMetadata:B,renderPane:c,resizerSize:u,poppedOutTabIds:T,isTabPoppedOut:Dt,renderPopoutWrapper:O}),[r,R,N,z,k,K,M,ut,m,q,d,D,L,f,s,l,St,ne,J,A,_,j,V,B,c,u,T,Dt,O]),In=ge.useMemo(()=>({overTabId:Et,overTabPosition:Ct}),[Et,Ct]),Ln=ge.useMemo(()=>({removePane:Y,addTab:ee,updateMetadata:S,updatePaneLock:I,selectTab:se,mergeTab:le,removeTab:G,setFullscreenPaneId:q,setLocked:J,splitPane:oe,updateSplitPercentage:Oe,moveTab:p,popoutTab:x,dockTab:H}),[Y,ee,S,I,se,le,G,q,J,oe,Oe,p,x,H]),Mn=At(r),kn=ge.useMemo(()=>({registerPortalTarget:ie,registerRenderCallback:Te,renderCallbacksRef:Ve,registerRenderPane:Rt,renderPaneRef:lt,registerTabHeader:xt,tabHeadersRef:ct,activeIdRef:We,registerPopoutTarget:W}),[ie,Te,Ve,Rt,lt,xt,ct,We,W]);return We&&(We.current=N),jsxRuntime.jsx(we.Provider,{value:Ln,children:jsxRuntime.jsx(pt.Provider,{value:Nn,children:jsxRuntime.jsx(ft.Provider,{value:In,children:jsxRuntime.jsxs(Pe.Provider,{value:kn,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",...Sn,children:n}),N&&z&&jsxRuntime.jsx(on,{activeId:N,render:de=>jsxRuntime.jsx("div",{style:{transition:"transform 150ms cubic-bezier(0.2, 0, 0, 1)",transform:de===k?"scale(0.8)":"scale(1)",transformOrigin:"top left"},children:jsxRuntime.jsx(sn,{activeId:de,activeType:z,dismissIntentId:k,renderDragOverlay:a,renderPaneRef:lt,renderPane:c,tabHeadersRef:ct,classNames:ut})}),className:`${o.dragOverlay||""} ${N===k&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:Mn.map(de=>{let je=F[de],Nt=j(de);return Nt?jsxRuntime.jsx(an,{tabDetails:Nt,target:je||null,renderWidget:Ve.current[de]},de):null})})]})})})})},mo=({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(ht,{renderPane:e,resizerSize:t,snapThreshold:n})},go=e=>{let{children:t,...n}=e,{controller:a}=e;if(!a)throw new Error("Zeugma component requires a controller.");return jsxRuntime.jsx(fo,{...e,children:t!==void 0?t:jsxRuntime.jsx(mo,{...n})})};var ho={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"}}},yo={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"}}},To=({id:e,fraction:t,edge:n,activeClassName:a})=>{let{setNodeRef:o,isOver:c}=core.useDroppable({id:e}),u={position:"absolute",pointerEvents:"none",zIndex:101,boxSizing:"border-box",...yo[n][t]};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:o,style:ho[n][t]}),c&&jsxRuntime.jsx("div",{className:a,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(To,{id:n.id,fraction:n.fraction,edge:n.edge,activeClassName:e},n.id))});var rt=ge.createContext(null);var Do={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"}},Eo={top:{position:"absolute",top:0,left:0,right:0,height:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},bottom:{position:"absolute",bottom:0,left:0,right:0,height:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},left:{position:"absolute",top:0,bottom:0,left:0,width:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},right:{position:"absolute",top:0,bottom:0,right:0,width:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:21,pointerEvents:"none",boxSizing:"border-box"},center:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:21,pointerEvents:"none",boxSizing:"border-box"}},at=({id:e,position:t,activeClassName:n})=>{let{setNodeRef:a,isOver:o}=core.useDroppable({id:e});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:a,style:Do[t]}),o&&jsxRuntime.jsx("div",{className:n,style:Eo[t]})]})};var gn=({children:e,className:t,style:n})=>{let a=ge.useContext(rt);if(!a)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:o,...c}=a;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 zo=ge.createContext(void 0);var Fe=({id:e,locked:t=false,children:n,className:a,style:o})=>{let{locked:c,classNames:u={},fullscreenPaneId:i,poppedOutTabIds:d=[]}=re(),f=ge.useContext(we),{overTabId:s}=Ue(),b=ge.useContext(Pe);ge.useEffect(()=>(b?.registerTabHeader&&b.registerTabHeader(e,n),()=>{b?.registerTabHeader&&b.activeIdRef?.current!==e&&b.registerTabHeader(e,()=>null);}),[e,n,b]);let g=d.includes(e),m=ge.useContext(Tt),y=t||c||(m?.locked??false)||i!==null,{attributes:P,listeners:D,setNodeRef:L,isDragging:v}=core.useDraggable({id:`tab-header-${e}`,disabled:y}),{setNodeRef:$,isOver:E}=core.useDroppable({id:`tab-drop-${e}`,disabled:y}),O=j=>{L(j),$(j);},Z=E&&s===e,r=m?.tabIds||[],l=r.indexOf(e),h=m?.activeTabId,M=l>0&&e!==h&&r[l-1]!==h?jsxRuntime.jsx("div",{className:u.tabSeparator}):null,q=m?m.activeTabId===e:false,ne=m?.tabsMetadata?.[e],J=ge.useCallback(()=>{m?.selectTab(e);},[m,e]),A=ge.useCallback(()=>{m?.removeTab(e);},[m,e]),_=ge.useMemo(()=>({tabId:e,isActive:q,isDragging:v,isOver:Z,metadata:ne,locked:y,selectTab:J,removeTab:A,isPoppedOut:g,popoutTab:()=>f?.popoutTab(e),dockTab:()=>f?.dockTab(e)}),[e,q,v,Z,ne,y,J,A,g,f]);return jsxRuntime.jsx(zo.Provider,{value:_,children:jsxRuntime.jsxs("div",{ref:O,id:`tab-header-${e}`,className:a,style:{display:"inline-flex",position:"relative",cursor:y?"default":"grab",...o},...y?{}:D,...y?{}:P,children:[M,n({isDragging:v,isOver:Z})]})})};var Tt=ge.createContext(void 0);var yn=(e,t)=>typeof e=="function"?e(t):e,Pt=({tabIds:e,activeTabId:t,locked:n,tabsMetadata:a,selectTab:o,removeTab:c,renderTab:u,classNames:i,styles:d})=>{let f=ge.useContext(it),s=e??f?.tabIds??[],b=t??f?.activeTabId??"",g=n??f?.locked??false,m=a??f?.tabsMetadata,y=o??f?.selectTab??(()=>{}),P=c??f?.removeTab??(()=>{}),{classNames:D={},activeType:L,poppedOutTabIds:v=[]}=re(),$=ge.useContext(we),{overTabId:E,overTabPosition:O}=Ue(),Z=ge.useMemo(()=>({tabIds:s,activeTabId:b,locked:g,tabsMetadata:m,selectTab:y,removeTab:P}),[s,b,g,m,y,P]),r=Wt(s,L,E,O);return jsxRuntime.jsx(Tt.Provider,{value:Z,children:jsxRuntime.jsxs("div",{className:i?.container,style:{display:"flex",alignItems:"center",height:"100%",...d?.container},children:[s.map((l,h)=>{let R=m?.[l],M=yn(i?.tab,l),q=yn(d?.tab,l),ne=h===r;return jsxRuntime.jsxs(ge__default.default.Fragment,{children:[ne&&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:h===0?"none":"translateX(-50%)"}})}),jsxRuntime.jsx(Fe,{id:l,locked:g,className:M,style:q,children:({isDragging:J,isOver:A})=>u({id:l,paneId:f?.id??"",isActive:l===b,index:h,isDragging:J,isOver:A,metadata:R,onSelect:()=>y(l),onRemove:()=>P(l),isPoppedOut:v.includes(l),popout:()=>$?.popoutTab(l),dock:()=>$?.dockTab(l)})})]},l)}),r===s.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%)"}})})]})})};Pt.Tab=Fe;var Pn=({className:e,style:t,children:n})=>jsxRuntime.jsx("div",{className:e,style:t,children:n});var it=ge.createContext(void 0),Rn=()=>{let e=ge.useContext(it);if(!e)throw new Error("usePaneContext must be used within a Pane component");return e},qo=({children:e,className:t,style:n})=>{let{activeTabId:a}=Rn(),{classNames:o,isTabPoppedOut:c}=re(),{dockTab:u}=ze(),i=ge.useRef(null),d=ge.useContext(Pe);if(!d)throw new Error("PaneContent must be used within a Zeugma provider");let{registerPortalTarget:f,registerRenderCallback:s}=d,b=ge.useMemo(()=>typeof e=="function"?e:()=>e,[e]);s(a,b),ge.useEffect(()=>{let m=i.current;return f(a,m),()=>{f(a,null,m);}},[a,f]);let g=c(a);return jsxRuntime.jsx("div",{ref:i,id:`zeugma-tab-target-${a}`,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(a),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"})]})})},ke=({id:e,children:t,style:n,locked:a=false})=>{let{layout:o,renderingLayout:c,activeId:u,activeType:i,classNames:d,fullscreenPaneId:f,onFullscreenChange:s,locked:b,poppedOutTabIds:g=[]}=re(),{removePane:m,updateMetadata:y,selectTab:P,removeTab:D,popoutTab:L,dockTab:v}=ze(),$=ge.useMemo(()=>{if(i==="tab"&&e===u){let k=U(o,e)?.tabsMetadata?.[e];return {type:"pane",id:e,tabIds:[e],activeTabId:e,tabsMetadata:k?{[e]:k}:void 0}}return $t(e===u?o:c,e)},[o,c,e,u,i]),E=$?.id??e,O=$?.tabIds??[e],Z=$?.activeTabId??e,r=$?.tabsMetadata,l=r?.[e],h=$?.locked??false,R=a||h,M=b||R||f!==null,q=b||R||f!==null,ne=u!==null&&u!==e&&(!O.includes(u)||O.length>1)&&!q,{attributes:J,listeners:A,setNodeRef:_}=core.useDraggable({id:e,disabled:M}),j=u!==null&&O.includes(u),V=f===e,B=ge.useMemo(()=>({isDragging:j,isFullscreen:V,toggleFullscreen:()=>s?.(V?null:e),remove:()=>{V&&s?.(null),m(E);},metadata:l,updateMetadata:z=>{y(e,z);},locked:M,tabIds:O,activeTabId:Z,selectTab:z=>P(E,z),removeTab:z=>{V&&z===Z&&s?.(null),D(z);},tabsMetadata:r,updateTabMetadata:(z,C)=>{y(z,C);},isActiveTabPoppedOut:g.includes(Z),popoutTab:z=>L(z||Z),dockTab:z=>v(z||Z)}),[j,V,s,e,D,l,y,M,O,Z,P,E,r,g,L,v]),N=ge.useMemo(()=>M?{disabled:true}:{...A,...J},[A,J,M]),w=`${d.pane||""} ${R&&d.paneLocked||""}`.trim();return jsxRuntime.jsx(it.Provider,{value:{id:e,...B},children:jsxRuntime.jsx(rt.Provider,{value:N,children:jsxRuntime.jsxs("div",{ref:_,id:e,className:w,style:{position:"relative",width:"100%",height:"100%",...n},children:[t,ne&&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(at,{id:`drop-${z}-${e}`,position:z,activeClassName:d.dropPreview},z)),i==="tab"&&jsxRuntime.jsx(at,{id:`drop-center-${e}`,position:"center",activeClassName:d.swapPreview??d.dropPreview})]}),u!==null&&u!==e&&q&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsxRuntime.jsx(at,{id:`drop-locked-${e}`,position:"full",activeClassName:d.lockedPreview||""})})]})})})};ke.Content=qo;ke.DragHandle=gn;ke.Tabs=Pt;ke.Tab=Fe;ke.Controls=Pn;exports.Pane=ke;exports.PaneTree=ht;exports.Zeugma=go;exports.usePaneContext=Rn;exports.useResizer=vt;exports.useZeugma=Hn;exports.useZeugmaContext=$n;//# sourceMappingURL=index.cjs.map
12
12
  //# sourceMappingURL=index.cjs.map