react-zeugma 5.2.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
- 'use strict';var Ot=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 Ot__default=/*#__PURE__*/_interopDefault(Ot);function We(e){let t=Ot.useRef(null);return Ot.useEffect(()=>{if(!e){t.current=null;return}let n=r=>{t.current={x:r.clientX,y:r.clientY};},s=r=>{let o=r.touches[0]||r.changedTouches[0];o&&(t.current={x:o.clientX,y:o.clientY});};return window.addEventListener("pointermove",n,{passive:true}),window.addEventListener("touchmove",s,{passive:true}),()=>{window.removeEventListener("pointermove",n),window.removeEventListener("touchmove",s);}},[e]),t}function Ue(e){Ot.useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function _e(){let[e,t]=Ot.useState({}),n=Ot.useRef(true);Ot.useEffect(()=>(n.current=true,()=>{n.current=false;}),[]);let s=Ot.useCallback((r,o)=>{n.current&&t(i=>i[r]===o?i:{...i,[r]:o});},[]);return {portalTargets:e,registerPortalTarget:s}}var vt=8,ht=8,yn=4;function ce(){return "pane-"+Math.random().toString(36).substring(2,11)}function fe(e,t){if(e===null)return null;if(e.type==="pane")return e.id===t?null:e;let n=fe(e.first,t),s=fe(e.second,t);return n===null?s:s===null?n:{...e,first:n,second:s}}function de(e,t){if(e===null)return null;if(e.type==="pane"){if(e.tabs.includes(t)){let r=e.tabs.filter(a=>a!==t);if(r.length===0)return null;let o=e.activeTabId;e.activeTabId===t&&(o=r[0]);let i={...e.tabsMetadata};return delete i[t],{...e,tabs:r,activeTabId:o,tabsMetadata:Object.keys(i).length>0?i:void 0}}return e}let n=de(e.first,t),s=de(e.second,t);return n===null?s:s===null?n:{...e,first:n,second:s}}function ve(e,t,n,s,r){if(e===null)return typeof r=="string"?{type:"pane",id:ce(),tabs:[r],activeTabId:r}:r;if(e.type==="pane"){if(e.id===t){let o=typeof r=="string"?{type:"pane",id:ce(),tabs:[r],activeTabId:r}:r,i=s==="left"||s==="top";return {type:"split",direction:n,first:i?o:e,second:i?e:o,splitPercentage:50}}return e}return {...e,first:ve(e.first,t,n,s,r)||e.first,second:ve(e.second,t,n,s,r)||e.second}}function Ye(e,t,n){if(e===null)return {type:"pane",id:ce(),tabs:[t],activeTabId:t,tabsMetadata:n?{[t]:n}:void 0};function s(r,o){return r.type==="pane"?{type:"split",direction:o==="row"?"column":"row",splitPercentage:50,first:r,second:{type:"pane",id:ce(),tabs:[t],activeTabId:t,tabsMetadata:n?{[t]:n}:void 0}}:{...r,second:s(r.second,r.direction)}}return s(e,null)}function me(e,t,n){return e===null?null:e===t?{...e,splitPercentage:n}:e.type==="split"?{...e,first:me(e.first,t,n)||e.first,second:me(e.second,t,n)||e.second}:e}function Q(e,t){return e===null?null:e.type==="pane"?e.id===t?e:null:Q(e.first,t)??Q(e.second,t)}function _(e,t){return e===null?null:e.type==="pane"?e.tabs.includes(t)?e:null:_(e.first,t)??_(e.second,t)}function Xe(e,t){let n=_(e,t);if(!n)return null;let s=n.tabs.indexOf(t);return {id:t,paneId:n.id,isActive:n.activeTabId===t,index:s,metadata:n.tabsMetadata?.[t]}}function ye(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.tabs.includes(t)){let s=e.tabsMetadata||{},r=s[t],o=n(r),i={...s};return o===void 0?delete i[t]:i[t]=o,{...e,tabsMetadata:Object.keys(i).length>0?i:void 0}}return e}return {...e,first:ye(e.first,t,n)??e.first,second:ye(e.second,t,n)??e.second}}function xe(e,t,n,s){if(e===null)return null;if(e.type==="pane"){if(e.id===t){let r=[...e.tabs];r.includes(n)||r.push(n);let o=e.tabsMetadata;return s&&(o={...e.tabsMetadata,[n]:s}),{...e,tabs:r,activeTabId:n,tabsMetadata:o}}return e}return {...e,first:xe(e.first,t,n,s)||e.first,second:xe(e.second,t,n,s)||e.second}}function Se(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.id===t){if(n===false){let{locked:s,...r}=e;return r}return {...e,locked:n}}return e}return {...e,first:Se(e.first,t,n)??e.first,second:Se(e.second,t,n)??e.second}}function Re(e,t,n){return e===null?null:e.type==="pane"?e.id===t?{...e,activeTabId:n}:e:{...e,first:Re(e.first,t,n)??e.first,second:Re(e.second,t,n)??e.second}}function qe(e,t,n){if(e===null)return null;let r=_(e,t)?.tabsMetadata?.[t],o=de(e,t);if(o===null)return {type:"pane",id:ce(),tabs:[t],activeTabId:t,tabsMetadata:r?{[t]:r}:void 0};function i(a){if(a.type==="pane"){if(a.id===n){let u=[...a.tabs];u.includes(t)||u.push(t);let m={...a.tabsMetadata};return r&&(m[t]=r),{...a,tabs:u,activeTabId:t,tabsMetadata:Object.keys(m).length>0?m:void 0}}return a}return {...a,first:i(a.first),second:i(a.second)}}return i(o)}function Je(e,t,n,s="before"){if(e===null)return null;let o=_(e,t)?.tabsMetadata?.[t],i=de(e,t);if(i===null)return {type:"pane",id:ce(),tabs:[t],activeTabId:t,tabsMetadata:o?{[t]:o}:void 0};function a(u){if(u.type==="pane"){if(u.tabs.includes(n)){let E=[...u.tabs].filter(x=>x!==t),v=E.indexOf(n);v<0&&(v=0),s==="after"&&(v+=1),E.splice(v,0,t);let T={...u.tabsMetadata};return o&&(T[t]=o),{...u,tabs:E,activeTabId:t,tabsMetadata:Object.keys(T).length>0?T:void 0}}return u}return {...u,first:a(u.first),second:a(u.second)}}return a(i)}function le(e,t=0,n=0,s=100,r=100,o="root"){if(e===null)return {panes:[],splitters:[]};if(e.type==="pane")return {panes:[{paneId:e.id,left:t,top:n,width:s,height:r,node:e}],splitters:[]};let{direction:i,splitPercentage:a,first:u,second:m}=e,v={id:`splitter-${o}-${i}`,currentNode:e,direction:i,left:i==="row"?t+s*(a/100):t,top:i==="column"?n+r*(a/100):n,width:i==="row"?0:s,height:i==="column"?0:r,parentLeft:t,parentTop:n,parentWidth:s,parentHeight:r},T={panes:[],splitters:[]},x={panes:[],splitters:[]};if(i==="row"){let S=s*(a/100);T=le(u,t,n,S,r,`${o}-L`),x=le(m,t+S,n,s-S,r,`${o}-R`);}else {let S=r*(a/100);T=le(u,t,n,s,S,`${o}-T`),x=le(m,t,n+S,s,r-S,`${o}-B`);}return {panes:[...T.panes,...x.panes],splitters:[v,...T.splitters,...x.splitters]}}function Pe(e){try{return JSON.stringify(e)}catch{return ""}}function Tt(e){let{initialLayout:t,layout:n,onChange:s,fullscreenPaneId:r,onFullscreenChange:o,locked:i=false,dragActivationDistance:a=8,snapThreshold:u=8,minSplitPercentage:m=5,maxSplitPercentage:E=95,enableDragToDismiss:v=false,dismissThreshold:T=60,onRemove:x,onDragStart:S,onDragEnd:M,onResizeStart:f,onResize:R,onResizeEnd:g,onDismissIntentChange:D}=e,[b,I]=Ot.useState(()=>n!==void 0?n:t??null),[k,B]=Ot.useState(()=>Pe(n!==void 0?n:null)),[Y,$]=Ot.useState(r||null),[G,O]=Ot.useState(i),[X,ee]=Ot.useState(null),[te,p]=Ot.useState(null),[y,Z]=Ot.useState(null),w=Ot.useRef(null),C=Ot.useCallback(l=>{w.current=l;},[]),c=Ot.useCallback(l=>{$(l),o?.(l);},[o]);if(Ot.useEffect(()=>{O(i);},[i]),Ot.useEffect(()=>{r!==void 0&&$(r);},[r]),n!==void 0){let l=Pe(n);l!==k&&(B(l),I(n));}let d=Ot.useCallback(l=>(...h)=>{let F=b,W=l(F,...h);Pe(F)!==Pe(W)&&(I(W),s?.(W));},[b,s]),P=Ot.useCallback(d((l,h)=>typeof h=="function"?h(l):h),[d]),ne=Ot.useCallback(d((l,h)=>fe(l,h)),[d]),V=Ot.useCallback(d((l,h,F)=>Ye(l,h,F)),[d]),A=Ot.useCallback(d((l,h,F,W)=>{let ae=Q(l,h)??_(l,h);return ae?xe(l,ae.id,F,W):l}),[d]),J=Ot.useCallback(d((l,h,F,W,ae)=>{let Ve=Q(l,h)??_(l,h);if(!Ve)return l;let ft=Q(l,ae)??_(l,ae)??{type:"pane",id:ae,tabs:[ae],activeTabId:ae},mt=fe(l,ae);return ve(mt,Ve.id,F,W,ft)}),[d]),re=Ot.useCallback(d((l,h,F)=>me(l,h,F)),[d]),N=Ot.useCallback(d((l,h,F)=>ye(l,h,F)),[d]),L=Ot.useCallback(d((l,h,F)=>{let W=Q(l,h)??_(l,h);return W?Se(l,W.id,F):l}),[d]),z=Ot.useCallback(d((l,h,F)=>{let W=Q(l,h)??_(l,h);return W?Re(l,W.id,F):l}),[d]),oe=Ot.useCallback(d((l,h,F)=>{let W=Q(l,F)??_(l,F);return W?qe(l,h,W.id):l}),[d]),H=Ot.useCallback(d((l,h,F,W)=>Je(l,h,F,W)),[d]),K=Ot.useCallback(d((l,h)=>de(l,h)),[d]),j=Ot.useCallback(l=>Q(b,l),[b]),ie=Ot.useCallback(l=>_(b,l),[b]),ue=Ot.useCallback(l=>Xe(b,l),[b]);return {layout:b,setLayout:P,fullscreenPaneId:Y,setFullscreenPaneId:c,locked:G,setLocked:O,activeId:X,setActiveId:ee,activeType:te,setActiveType:p,dismissIntentId:y,setDismissIntentId:Z,containerRef:w,setContainerRef:C,dragActivationDistance:a,snapThreshold:u,minSplitPercentage:m,maxSplitPercentage:E,enableDragToDismiss:v,dismissThreshold:T,onRemove:x,onDragStart:S,onDragEnd:M,onResizeStart:f,onResize:R,onResizeEnd:g,onDismissIntentChange:D,removePane:ne,addPane:V,addTab:A,splitPane:J,updateSplitPercentage:re,updateTabMetadata:N,updatePaneLock:L,selectTab:z,mergeTab:oe,moveTab:H,removeTab:K,findPaneById:j,findPaneContainingTab:ie,findTabById:ue}}function De({cursor:e,resizerEl:t,onMove:n,onEnd:s}){document.body.classList.add("zeugma-resizing");let r=document.createElement("style");r.id="zeugma-global-cursor-style",r.textContent=`
1
+ 'use strict';var Xt=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 Xt__default=/*#__PURE__*/_interopDefault(Xt);function Ge(e){let t=Xt.useRef(null);return Xt.useEffect(()=>{if(!e){t.current=null;return}let n=r=>{t.current={x:r.clientX,y:r.clientY};},s=r=>{let o=r.touches[0]||r.changedTouches[0];o&&(t.current={x:o.clientX,y:o.clientY});};return window.addEventListener("pointermove",n,{passive:true}),window.addEventListener("touchmove",s,{passive:true}),()=>{window.removeEventListener("pointermove",n),window.removeEventListener("touchmove",s);}},[e]),t}function Ke(e){Xt.useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function Qe(){let[e,t]=Xt.useState({}),n=Xt.useRef(true);Xt.useEffect(()=>(n.current=true,()=>{n.current=false;}),[]);let s=Xt.useCallback((r,o)=>{n.current&&t(a=>a[r]===o?a:{...a,[r]:o});},[]);return {portalTargets:e,registerPortalTarget:s}}var Dt=8,Ct=8,Nn=4;function de(){return "pane-"+Math.random().toString(36).substring(2,11)}function me(e,t){if(e===null)return null;if(e.type==="pane")return e.id===t?null:e;let n=me(e.first,t),s=me(e.second,t);return n===null?s:s===null?n:{...e,first:n,second:s}}function pe(e,t){if(e===null)return null;if(e.type==="pane"){if(e.tabs.includes(t)){let r=e.tabs.filter(i=>i!==t);if(r.length===0)return null;let o=e.activeTabId;e.activeTabId===t&&(o=r[0]);let a={...e.tabsMetadata};return delete a[t],{...e,tabs:r,activeTabId:o,tabsMetadata:Object.keys(a).length>0?a:void 0}}return e}let n=pe(e.first,t),s=pe(e.second,t);return n===null?s:s===null?n:{...e,first:n,second:s}}function Pe(e,t,n,s,r){if(e===null)return typeof r=="string"?{type:"pane",id:de(),tabs:[r],activeTabId:r}:r;if(e.type==="pane"){if(e.id===t){let o=typeof r=="string"?{type:"pane",id:de(),tabs:[r],activeTabId:r}:r,a=s==="left"||s==="top";return {type:"split",direction:n,first:a?o:e,second:a?e:o,splitPercentage:50}}return e}return {...e,first:Pe(e.first,t,n,s,r)||e.first,second:Pe(e.second,t,n,s,r)||e.second}}function je(e,t,n){if(e===null)return {type:"pane",id:de(),tabs:[t],activeTabId:t,tabsMetadata:n?{[t]:n}:void 0};function s(r,o){return r.type==="pane"?{type:"split",direction:o==="row"?"column":"row",splitPercentage:50,first:r,second:{type:"pane",id:de(),tabs:[t],activeTabId:t,tabsMetadata:n?{[t]:n}:void 0}}:{...r,second:s(r.second,r.direction)}}return s(e,null)}function ge(e,t,n){return e===null?null:e===t?{...e,splitPercentage:n}:e.type==="split"?{...e,first:ge(e.first,t,n)||e.first,second:ge(e.second,t,n)||e.second}:e}function Q(e,t){return e===null?null:e.type==="pane"?e.id===t?e:null:Q(e.first,t)??Q(e.second,t)}function Y(e,t){return e===null?null:e.type==="pane"?e.tabs.includes(t)?e:null:Y(e.first,t)??Y(e.second,t)}function et(e,t){let n=Y(e,t);if(!n)return null;let s=n.tabs.indexOf(t);return {id:t,paneId:n.id,isActive:n.activeTabId===t,index:s,metadata:n.tabsMetadata?.[t]}}function Se(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.tabs.includes(t)){let s=e.tabsMetadata||{},r=s[t],o=n(r),a={...s};return o===void 0?delete a[t]:a[t]=o,{...e,tabsMetadata:Object.keys(a).length>0?a:void 0}}return e}return {...e,first:Se(e.first,t,n)??e.first,second:Se(e.second,t,n)??e.second}}function De(e,t,n,s){if(e===null)return null;if(e.type==="pane"){if(e.id===t){let r=[...e.tabs];r.includes(n)||r.push(n);let o=e.tabsMetadata;return s&&(o={...e.tabsMetadata,[n]:s}),{...e,tabs:r,activeTabId:n,tabsMetadata:o}}return e}return {...e,first:De(e.first,t,n,s)||e.first,second:De(e.second,t,n,s)||e.second}}function Ce(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.id===t){if(n===false){let{locked:s,...r}=e;return r}return {...e,locked:n}}return e}return {...e,first:Ce(e.first,t,n)??e.first,second:Ce(e.second,t,n)??e.second}}function we(e,t,n){return e===null?null:e.type==="pane"?e.id===t?{...e,activeTabId:n}:e:{...e,first:we(e.first,t,n)??e.first,second:we(e.second,t,n)??e.second}}function tt(e,t,n){if(e===null)return null;let r=Y(e,t)?.tabsMetadata?.[t],o=pe(e,t);if(o===null)return {type:"pane",id:de(),tabs:[t],activeTabId:t,tabsMetadata:r?{[t]:r}:void 0};function a(i){if(i.type==="pane"){if(i.id===n){let u=[...i.tabs];u.includes(t)||u.push(t);let p={...i.tabsMetadata};return r&&(p[t]=r),{...i,tabs:u,activeTabId:t,tabsMetadata:Object.keys(p).length>0?p:void 0}}return i}return {...i,first:a(i.first),second:a(i.second)}}return a(o)}function nt(e,t,n,s="before"){if(e===null)return null;let o=Y(e,t)?.tabsMetadata?.[t],a=pe(e,t);if(a===null)return {type:"pane",id:de(),tabs:[t],activeTabId:t,tabsMetadata:o?{[t]:o}:void 0};function i(u){if(u.type==="pane"){if(u.tabs.includes(n)){let b=[...u.tabs].filter(T=>T!==t),m=b.indexOf(n);m<0&&(m=0),s==="after"&&(m+=1),b.splice(m,0,t);let v={...u.tabsMetadata};return o&&(v[t]=o),{...u,tabs:b,activeTabId:t,tabsMetadata:Object.keys(v).length>0?v:void 0}}return u}return {...u,first:i(u.first),second:i(u.second)}}return i(a)}function ue(e,t=0,n=0,s=100,r=100,o="root"){if(e===null)return {panes:[],splitters:[]};if(e.type==="pane")return {panes:[{paneId:e.id,left:t,top:n,width:s,height:r,node:e}],splitters:[]};let{direction:a,splitPercentage:i,first:u,second:p}=e,m={id:`splitter-${o}-${a}`,currentNode:e,direction:a,left:a==="row"?t+s*(i/100):t,top:a==="column"?n+r*(i/100):n,width:a==="row"?0:s,height:a==="column"?0:r,parentLeft:t,parentTop:n,parentWidth:s,parentHeight:r},v={panes:[],splitters:[]},T={panes:[],splitters:[]};if(a==="row"){let y=s*(i/100);v=ue(u,t,n,y,r,`${o}-L`),T=ue(p,t+y,n,s-y,r,`${o}-R`);}else {let y=r*(i/100);v=ue(u,t,n,s,y,`${o}-T`),T=ue(p,t,n+y,s,r-y,`${o}-B`);}return {panes:[...v.panes,...T.panes],splitters:[m,...v.splitters,...T.splitters]}}function xe(e){try{return JSON.stringify(e)}catch{return ""}}function wt(e){let{initialLayout:t,layout:n,onChange:s,fullscreenPaneId:r,onFullscreenChange:o,locked:a=false,dragActivationDistance:i=8,snapThreshold:u=8,minSplitPercentage:p=5,maxSplitPercentage:b=95,enableDragToDismiss:m=false,dismissThreshold:v=60,onRemove:T,onDragStart:y,onDragEnd:L,onResizeStart:f,onResize:D,onResizeEnd:g,onDismissIntentChange:C}=e,[x,M]=Xt.useState(()=>n!==void 0?n:t??null),[A,W]=Xt.useState(()=>xe(n!==void 0?n:null)),[q,Z]=Xt.useState(r||null),[G,V]=Xt.useState(a),[J,j]=Xt.useState(null),[ee,d]=Xt.useState(null),[R,k]=Xt.useState(null),w=Xt.useRef(null),S=Xt.useCallback(c=>{w.current=c;},[]),l=Xt.useRef(x);l.current=x;let I=Xt.useRef(s);I.current=s;let U=Xt.useRef(o);U.current=o;let P=Xt.useCallback(c=>{Z(c),U.current?.(c);},[]);if(Xt.useEffect(()=>{V(a);},[a]),Xt.useEffect(()=>{r!==void 0&&Z(r);},[r]),n!==void 0){let c=xe(n);c!==A&&(W(c),M(n));}let h=Xt.useCallback(c=>(...E)=>{let H=l.current,B=c(H,...E);xe(H)!==xe(B)&&(l.current=B,M(B),I.current?.(B));},[]),O=Xt.useCallback(h((c,E)=>typeof E=="function"?E(c):E),[h]),K=Xt.useCallback(h((c,E)=>me(c,E)),[h]),oe=Xt.useCallback(h((c,E,H)=>je(c,E,H)),[h]),N=Xt.useCallback(h((c,E,H,B)=>{let ce=Q(c,E)??Y(c,E);if(!ce)return c;let ye=Y(c,H),Fe=ye&&ye.id===ce.id?c:pe(c,H)??c;return De(Fe,ce.id,H,B)}),[h]),z=Xt.useCallback(h((c,E,H,B,ce)=>{let ye=Q(c,E)??Y(c,E);if(!ye)return c;let qe=Q(c,ce)??Y(c,ce)??{type:"pane",id:ce,tabs:[ce],activeTabId:ce},Fe=me(c,ce);return Pe(Fe,ye.id,H,B,qe)}),[h]),$=Xt.useCallback(h((c,E,H)=>ge(c,E,H)),[h]),se=Xt.useCallback(h((c,E,H)=>Se(c,E,H)),[h]),ne=Xt.useCallback(h((c,E,H)=>{let B=Q(c,E)??Y(c,E);return B?Ce(c,B.id,H):c}),[h]),ae=Xt.useCallback(h((c,E,H)=>{let B=Q(c,E)??Y(c,E);return B?we(c,B.id,H):c}),[h]),ie=Xt.useCallback(h((c,E,H)=>{let B=Q(c,H)??Y(c,H);return B?tt(c,E,B.id):c}),[h]),F=Xt.useCallback(h((c,E,H,B)=>nt(c,E,H,B)),[h]),te=Xt.useCallback(h((c,E)=>pe(c,E)),[h]),re=Xt.useCallback(c=>Q(l.current,c),[]),he=Xt.useCallback(c=>Y(l.current,c),[]),xt=Xt.useCallback(c=>et(l.current,c),[]);return {layout:x,setLayout:O,fullscreenPaneId:q,setFullscreenPaneId:P,locked:G,setLocked:V,activeId:J,setActiveId:j,activeType:ee,setActiveType:d,dismissIntentId:R,setDismissIntentId:k,containerRef:w,setContainerRef:S,dragActivationDistance:i,snapThreshold:u,minSplitPercentage:p,maxSplitPercentage:b,enableDragToDismiss:m,dismissThreshold:v,onRemove:T,onDragStart:y,onDragEnd:L,onResizeStart:f,onResize:D,onResizeEnd:g,onDismissIntentChange:C,removePane:K,addPane:oe,addTab:N,splitPane:z,updateSplitPercentage:$,updateTabMetadata:se,updatePaneLock:ne,selectTab:ae,mergeTab:ie,moveTab:F,removeTab:te,findPaneById:re,findPaneContainingTab:he,findTabById:xt}}function Ne({cursor:e,resizerEl:t,onMove:n,onEnd:s}){document.body.classList.add("zeugma-resizing");let r=document.createElement("style");r.id="zeugma-global-cursor-style",r.textContent=`
2
2
  * {
3
3
  cursor: ${e} !important;
4
4
  user-select: none !important;
5
5
  }
6
- `,document.head.appendChild(r),t.setAttribute("data-resizing","true");let o=a=>{n(a);},i=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let a=document.getElementById("zeugma-global-cursor-style");a&&a.remove(),document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",i),s();};document.addEventListener("pointermove",o),document.addEventListener("pointerup",i);}var ke=Ot.createContext(void 0),He=Ot.createContext(void 0),Ce=Ot.createContext(void 0),se=()=>{let e=Ot.useContext(ke);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},we=()=>{let e=Ot.useContext(He);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e};var yt=()=>{let e=se(),t=we();return {...e,...t}};var Ee=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},Ne=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};function Ie(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 Qe(e){let{layout:t,setLayout:n,activeId:s,setActiveId:r,setActiveType:o,dismissIntentId:i,setDismissIntentId:a,setOverTabId:u,setOverTabPosition:m,containerRef:E,dragActivationDistance:v,enableDragToDismiss:T,dismissThreshold:x,onRemove:S,onDragStart:M,onDragEnd:f,onDismissIntentChange:R,removeTab:g,moveTab:D,selectTab:b}=e,I=Ot.useRef(null),k=We(s),[B,Y]=Ot.useState(false);Ue(B);let $=core.useSensors(core.useSensor(Ee,{activationConstraint:{distance:v}}),core.useSensor(Ne,{activationConstraint:{delay:250,tolerance:5}})),G=Ot.useCallback(p=>{let y=core.pointerWithin(p);if(y.length>0)return y;if(p.active.id.toString().startsWith("tab-header-")){let w=p.droppableContainers.filter(C=>C.id.toString().startsWith("tab-drop-"));return core.closestCenter({...p,droppableContainers:w})}return []},[]);return {sensors:$,collisionDetection:G,onDragStart:p=>{let y=p.active.id.toString(),Z=y.startsWith("tab-header-"),w=Z?y.substring(11):y;r(w),o(Z?"tab":"pane"),u(null),m(null);let C=p.activatorEvent;if(k.current=Ie(C),T&&E.current?I.current=E.current.getBoundingClientRect():I.current=null,Z){let c=_(t,w);c&&b(c.id,w);}M&&M(w);},onDragMove:p=>{let{over:y}=p,Z=y?.id.toString()||"",w=Z.startsWith("drop-locked-");Y(w);let C=Z.match(/^tab-drop-(.+)$/);if(C&&y){let[,N]=C,L=p.active.id.toString();if((L.startsWith("tab-header-")?L.substring(11):L)!==N){let H="before",K=y.rect,j=p.activatorEvent,ie=null;if(k.current)ie=k.current.x;else {let ue=Ie(j);ue&&(ie=ue.x+p.delta.x);}if(ie!==null){let ue=K.left+K.width/2;ie>ue&&(H="after");}u(N),m(H);}else u(null),m(null);}else u(null),m(null);if(!T)return;let c=p.active.id.toString(),q=c.startsWith("tab-header-")?c.substring(11):c,P=I.current;if(!P){i!==null&&(a(null),R?.(null));return}let ne=p.activatorEvent,V=null,A=null;if(k.current)V=k.current.x,A=k.current.y;else {let N=Ie(ne);N&&(V=N.x+p.delta.x,A=N.y+p.delta.y);}let J=0;if(V!==null&&A!==null){let N=0,L=0;V<P.left?N=P.left-V:V>P.right&&(N=V-P.right),A<P.top?L=P.top-A:A>P.bottom&&(L=A-P.bottom),J=Math.sqrt(N*N+L*L);}else {let N=p.active.rect.current.translated;if(N){let L=N.left+N.width/2,z=N.top+N.height/2,oe=0,H=0;L<P.left?oe=P.left-L:L>P.right&&(oe=L-P.right),z<P.top?H=P.top-z:z>P.bottom&&(H=z-P.bottom),J=Math.sqrt(oe*oe+H*H);}}J>x?i!==q&&(a(q),R?.(q)):i!==null&&(a(null),R?.(null));},onDragEnd:p=>{r(null),o(null),Y(false),u(null),m(null);let{active:y,over:Z}=p,w=y.id.toString(),C=w.startsWith("tab-header-"),c=C?w.substring(11):w,d=T&&i===c;if(a(null),R?.(null),I.current=null,d){S?S(c):g(c),f&&f(c,null,null);return}if(!Z){f&&f(c,null,null);return}let q=Z.id.toString();if(q.startsWith("drop-locked-")){f&&f(c,null,null);return}let P=q.match(/^tab-drop-(.+)$/);if(P){let[,K]=P;if(c!==K){let j="before",ie=Z.rect,ue=p.activatorEvent,l=null;if(k.current)l=k.current.x;else {let h=Ie(ue);h&&(l=h.x+p.delta.x);}if(l!==null){let h=ie.left+ie.width/2;l>h&&(j="after");}D(c,K,j),f&&f(c,K,{type:"move",position:"center"});}else f&&f(c,null,null);return}let ne=q.match(/^drop-(left|right|top|bottom)-(.+)$/);if(!ne){f&&f(c,null,null);return}let[,V,A]=ne,J=C?_(t,c):Q(t,c),re=J&&J.id===A,N=J&&J.tabs.length===1;if(c===A||re&&N){f&&f(c,null,null);return}let L=V==="left"||V==="right"?"row":"column",z;if(C){let j=_(t,c)?.tabsMetadata?.[c];z={type:"pane",id:ce(),tabs:[c],activeTabId:c,tabsMetadata:j?{[c]:j}:void 0};}else z=Q(t,c)??{type:"pane",id:ce(),tabs:[c],activeTabId:c};let oe=C?de(t,c):fe(t,c),H=ve(oe,A,L,V,z);n(H),f&&f(c,A,{type:"split",direction:L,position:V});},onDragCancel:()=>{r(null),o(null),Y(false),u(null),m(null),a(null),R?.(null),I.current=null;}}}var et=({activeId:e,render:t,className:n})=>{let s=Ot.useRef(null);return Ot.useEffect(()=>{let r=o=>{s.current&&(s.current.style.transform=`translate(${o.clientX+12}px, ${o.clientY+12}px)`);};return document.addEventListener("pointermove",r),()=>document.removeEventListener("pointermove",r)},[]),jsxRuntime.jsx("div",{ref:s,className:n,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var tt=({tabId:e,target:t,renderWidget:n})=>{let[s,r]=Ot.useState(false),o=Ot.useRef(null);if(Ot.useEffect(()=>{r(true);},[]),Ot.useEffect(()=>{if(!s||!o.current)return;let a=o.current;if(t)t.appendChild(a);else {let u=document.getElementById("zeugma-hidden-portal-container");u||(u=document.createElement("div"),u.id="zeugma-hidden-portal-container",u.style.display="none",document.body.appendChild(u)),u.appendChild(a);}},[t,s]),Ot.useEffect(()=>()=>{o.current&&o.current.remove();},[]),!s)return null;o.current||(o.current=document.createElement("div"),o.current.className=`zeugma-portal-wrapper-${e}`,o.current.style.width="100%",o.current.style.height="100%");let i=o.current;return !i||!n?null:reactDom.createPortal(n(e),i)};var Ht=e=>{let t=e,{renderPane:n,renderWidget:s,renderDragOverlay:r,classNames:o={},children:i,layout:a,setLayout:u,fullscreenPaneId:m,setFullscreenPaneId:E,locked:v,setLocked:T,findPaneById:x,findPaneContainingTab:S,findTabById:M,activeId:f,activeType:R,dismissIntentId:g,setContainerRef:D,snapThreshold:b,minSplitPercentage:I,maxSplitPercentage:k,onRemove:B,onResizeStart:Y,onResize:$,onResizeEnd:G,removePane:O,addPane:X,addTab:ee,updateTabMetadata:te,updatePaneLock:p,selectTab:y,mergeTab:Z,removeTab:w}=t,{portalTargets:C,registerPortalTarget:c}=_e(),[d,q]=Ot.useState(null),[P,ne]=Ot.useState(null),V=Qe({...t,setOverTabId:q,setOverTabPosition:ne}),A=Ot.useCallback(H=>n(H),[n]),J=Ot.useMemo(()=>o,[o.dashboard,o.dashboardDismissActive,o.pane,o.paneLocked,o.dropPreview,o.dragOverlay,o.resizer,o.dismissPreview,o.dashboardLocked,o.lockedPreview,o.tabDropPreview]),re=Ot.useCallback((H,K)=>{G&&G(H,K);},[G]),N=Ot.useMemo(()=>({layout:a,setLayout:u,renderPane:A,activeId:f,dismissIntentId:g,overTabId:d,overTabPosition:P,setContainerRef:D,fullscreenPaneId:m,classNames:J,onRemove:B,onFullscreenChange:E,snapThreshold:b,onResizeStart:Y,onResize:$,onResizeEnd:re,minSplitPercentage:I,maxSplitPercentage:k,locked:v,setLocked:T,findPaneById:x,findPaneContainingTab:S,findTabById:M}),[a,f,g,d,P,D,m,J,B,E,b,Y,$,I,k,u,A,re,v,T,x,S,M]),L=Ot.useMemo(()=>({removePane:O,addPane:X,addTab:ee,updateTabMetadata:te,updatePaneLock:p,selectTab:y,mergeTab:Z,removeTab:w}),[O,X,ee,te,p,y,Z,w]),z=Ot.useMemo(()=>{let H=[];function K(j){j&&(j.type==="pane"?H.push(...j.tabs):(K(j.first),K(j.second)));}return K(a),H},[a]),oe=Ot.useMemo(()=>({registerPortalTarget:c}),[c]);return jsxRuntime.jsx(He.Provider,{value:L,children:jsxRuntime.jsx(ke.Provider,{value:N,children:jsxRuntime.jsxs(Ce.Provider,{value:oe,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",...V,children:i}),f&&R&&r&&jsxRuntime.jsx(et,{activeId:f,render:H=>r(H,R),className:`${o.dragOverlay||""} ${f===g&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:z.map(H=>jsxRuntime.jsx(tt,{tabId:H,target:C[H]||null,renderWidget:s},H))})]})})})};function Fe({containerRef:e,isRow:t,direction:n,splitPercentage:s,resizerSize:r,snapThreshold:o,layout:i,currentNode:a,onLayoutChange:u,onResizeStart:m,onResizeEnd:E,parentLeft:v,parentTop:T,parentWidth:x,parentHeight:S}){let{onResizeStart:M,onResize:f,onResizeEnd:R,minSplitPercentage:g=5,maxSplitPercentage:D=95,locked:b=false}=se();return Ot.useCallback(I=>{if(b)return;I.preventDefault();let k=e.current;if(!k)return;m&&m(),M&&M(a);let B=k.getBoundingClientRect(),Y=I.clientX,$=I.clientY,G=s,O=I.currentTarget,X=B.left+B.width*(v/100),ee=B.top+B.height*(T/100),te=B.width*(x/100),p=B.height*(S/100),Z=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(C=>C!==O&&C.getAttribute("data-direction")===n).map(C=>{let c=C.getBoundingClientRect();return t?c.left+c.width/2:c.top+c.height/2}),w=G;De({cursor:t?"col-resize":"row-resize",resizerEl:O,onMove:C=>{let c=t?(C.clientX-Y)/te*100:(C.clientY-$)/p*100,d=G+c,q=t?X+(te-r)*(d/100)+r/2:ee+(p-r)*(d/100)+r/2,P=1/0,ne=null;for(let re of Z){let N=Math.abs(q-re);N<o&&N<P&&(P=N,ne=re);}let V=d;ne!==null&&(V=t?(ne-r/2-X)/(te-r)*100:(ne-r/2-ee)/(p-r)*100);let A=Math.max(g,Math.min(D,V));w=A;let J=me(i,a,A);if(J){let{panes:re,splitters:N}=le(J),L=e.current;if(L){for(let z of re)L.style.setProperty(`--pane-left-${z.paneId}`,`${z.left}%`),L.style.setProperty(`--pane-top-${z.paneId}`,`${z.top}%`),L.style.setProperty(`--pane-width-${z.paneId}`,`${z.width}%`),L.style.setProperty(`--pane-height-${z.paneId}`,`${z.height}%`);for(let z of N)L.style.setProperty(`--splitter-pos-${z.id}`,`${z.direction==="row"?z.left:z.top}%`);}}f&&f(a,A);},onEnd:()=>{let C=me(i,a,w),c=e.current;if(c){let{panes:d,splitters:q}=le(C);for(let P of d)c.style.removeProperty(`--pane-left-${P.paneId}`),c.style.removeProperty(`--pane-top-${P.paneId}`),c.style.removeProperty(`--pane-width-${P.paneId}`),c.style.removeProperty(`--pane-height-${P.paneId}`);for(let P of q)c.style.removeProperty(`--splitter-pos-${P.id}`);}u(C),E&&E(),R&&R(a,w);}});},[e,t,n,s,r,o,i,a,u,m,E,M,f,R,g,D,v,T,x,S])}var Ut=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:s})=>{let{layout:r,setLayout:o,classNames:i,locked:a}=se(),[u,m]=Ot.useState(false),{currentNode:E,direction:v,left:T,top:x,width:S,height:M,parentLeft:f,parentTop:R,parentWidth:g,parentHeight:D}=e,b=v==="row",I=Fe({containerRef:s,isRow:b,direction:v,splitPercentage:E.splitPercentage,resizerSize:t,snapThreshold:n,layout:r,currentNode:E,onLayoutChange:o,onResizeStart:()=>m(true),onResizeEnd:()=>m(false),parentLeft:f,parentTop:R,parentWidth:g,parentHeight:D}),k=b?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${T}%) - ${t/2}px)`,top:`calc(${x}% + ${t/2}px)`,width:`${t}px`,height:`calc(${M}% - ${t}px)`,cursor:a?"default":"col-resize",pointerEvents:a?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"}:{position:"absolute",left:`calc(${T}% + ${t/2}px)`,top:`calc(var(--splitter-pos-${e.id}, ${x}%) - ${t/2}px)`,width:`calc(${S}% - ${t}px)`,height:`${t}px`,cursor:a?"default":"row-resize",pointerEvents:a?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsxRuntime.jsx("div",{className:i.resizer||"","data-direction":v,"data-resizing":u||void 0,style:k,onPointerDown:I,role:"separator","aria-valuenow":E.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},_t=Ot__default.default.memo(({paneId:e,renderPane:t})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:t(e)}),(e,t)=>e.paneId===t.paneId&&e.renderPane===t.renderPane),Yt=({tree:e,resizerSize:t=4,snapThreshold:n})=>{let{layout:s,renderPane:r,activeId:o,dismissIntentId:i,setContainerRef:a,fullscreenPaneId:u,snapThreshold:m,locked:E,classNames:v}=se(),T=n!==void 0?n:m??8,x=e!==void 0?e:s,S=Ot.useRef(null),{panes:M,splitters:f}=Ot.useMemo(()=>x?le(x):{panes:[],splitters:[]},[x]);if(!x)return null;let R=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M.map(g=>{let D=u===g.paneId;return jsxRuntime.jsx("div",{style:{position:"absolute",left:D?"0%":`var(--pane-left-${g.paneId}, ${g.left}%)`,top:D?"0%":`var(--pane-top-${g.paneId}, ${g.top}%)`,width:D?"100%":`var(--pane-width-${g.paneId}, ${g.width}%)`,height:D?"100%":`var(--pane-height-${g.paneId}, ${g.height}%)`,overflow:"hidden",zIndex:D?20:1,display:u&&!D?"none":"block",padding:D?"0px":`${t/2}px`,boxSizing:"border-box"},children:jsxRuntime.jsx(_t,{paneId:g.paneId,renderPane:r})},g.paneId)}),!u&&f.map(g=>jsxRuntime.jsx(Ut,{splitter:g,resizerSize:t,snapThreshold:T,containerRef:S},g.id))]});if(e===void 0){let g=o!==null&&o===i,D=I=>{a(I),S.current=I;},b=`${v.dashboard||""} ${g&&v.dashboardDismissActive||""} ${E&&v.dashboardLocked||""}`.trim();return jsxRuntime.jsx("div",{ref:D,className:b,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:R()})}return jsxRuntime.jsx("div",{ref:S,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:R()})};var lt="zeugma-height:",Gt="default-pane";function Kt(e){try{let t=localStorage.getItem(lt+e);if(t!==null){let n=Number(t);if(Number.isFinite(n)&&n>0)return n}}catch{}return null}function at(e,t){try{localStorage.setItem(lt+e,String(Math.round(t)));}catch{}}var ct=({children:e,active:t=true,height:n,onHeightChange:s,minHeight:r=100,maxHeight:o=1/0,persist:i,localStorageKey:a,resizerHeight:u=6,className:m,resizerClassName:E})=>{let v=i?a||Gt:null,T=()=>{let b=(v?Kt(v):null)??n??400;return Me(b,r,o)},[x,S]=Ot.useState(T),M=Ot.useRef(null),f=v?x:n??x,R=Ot.useRef(n);Ot.useEffect(()=>{if(n!==void 0&&n!==R.current){let b=Me(n,r,o);S(b),v&&at(v,b);}R.current=n;},[n,r,o,v]);let g=Ot.useCallback(()=>o,[o]),D=Ot.useCallback(b=>{b.preventDefault();let I=b.clientY,k=f,B=g(),Y=b.currentTarget,$=ut(M.current),G=$?$.scrollTop:0,O=I,X=null,ee=(p,y)=>{let Z=y-G,C=p-I+Z,c=Me(k+C,r,B);return M.current&&(M.current.style.height=`${c}px`),c},te=()=>{if(!$)return;let p=$===document.documentElement||$===document.body?{top:0,bottom:window.innerHeight}:$.getBoundingClientRect(),y=40,Z=10,w=0;O>p.bottom-y?w=Math.min(1,(O-(p.bottom-y))/y)*Z:O<p.top+y&&(w=-Math.min(1,(p.top+y-O)/y)*Z),w!==0&&($.scrollTop+=w,ee(O,$.scrollTop)),X=requestAnimationFrame(te);};X=requestAnimationFrame(te),De({cursor:"row-resize",resizerEl:Y,onMove:p=>{O=p.clientY,$&&ee(O,$.scrollTop);},onEnd:()=>{X!==null&&cancelAnimationFrame(X);let p=k;M.current&&(p=M.current.getBoundingClientRect().height),p=Me(p,r,B),S(p),s&&s(p),v&&at(v,p);}});},[f,r,g,s,v]);return t?jsxRuntime.jsxs("div",{ref:M,className:`zeugma-resizable-container ${m||""}`.trim(),style:{height:`${f}px`,position:"relative",overflow:"hidden",boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{style:{height:`calc(100% - ${u}px)`,overflow:"hidden"},children:e}),jsxRuntime.jsx("div",{className:`zeugma-resizable-handle ${E||""}`.trim(),style:{height:`${u}px`,cursor:"row-resize",position:"relative",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box",flexShrink:0},onPointerDown:D,role:"separator","aria-orientation":"horizontal","aria-valuenow":Math.round(f),"aria-valuemin":r,"aria-valuemax":o===1/0?void 0:o})]}):jsxRuntime.jsx("div",{className:`zeugma-resizable-container disabled ${m||""}`.trim(),style:{height:"100%",position:"relative",overflow:"hidden",boxSizing:"border-box"},children:jsxRuntime.jsx("div",{style:{height:"100%",overflow:"hidden"},children:e})})};function Me(e,t,n){return Math.max(t,Math.min(n,e))}function ut(e){if(typeof window>"u"||!e)return null;let t=e.parentElement;if(!t)return document.documentElement;let s=window.getComputedStyle(t).overflowY;return s==="auto"||s==="scroll"?t:ut(t)}var ze=Ot.createContext(null);var an={top:{position:"absolute",top:0,left:"25%",width:"50%",height:"25%",zIndex:20,pointerEvents:"auto"},bottom:{position:"absolute",bottom:0,left:"25%",width:"50%",height:"25%",zIndex:20,pointerEvents:"auto"},left:{position:"absolute",top:"25%",left:0,width:"25%",height:"50%",zIndex:20,pointerEvents:"auto"},right:{position:"absolute",top:"25%",right:0,width:"25%",height:"50%",zIndex:20,pointerEvents:"auto"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:20,pointerEvents:"auto",cursor:"not-allowed"}},ln={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"}},dt=({id:e,position:t,activeClassName:n})=>{let{setNodeRef:s,isOver:r}=core.useDroppable({id:e});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:s,style:an[t]}),r&&jsxRuntime.jsx("div",{className:n,style:ln[t]})]})},cn=({id:e,children:t,style:n,locked:s=false})=>{let r=Ot.useRef(null),{layout:o,activeId:i,classNames:a,fullscreenPaneId:u,onFullscreenChange:m,locked:E}=se(),{removePane:v,updateTabMetadata:T,selectTab:x,removeTab:S}=we(),M=Ot.useContext(Ce);if(!M)throw new Error("Pane must be used within a Zeugma provider");let{registerPortalTarget:f}=M,R=Ot.useMemo(()=>Q(o,e),[o,e]),g=R?.id??e,D=R?.tabs??[e],b=R?.activeTabId??e,I=R?.tabsMetadata,k=I?.[e],B=R?.locked??false,Y=s||B,$=E||Y,G=E||Y,O=i!==null&&i!==e&&(!D.includes(i)||D.length>1)&&!G,{attributes:X,listeners:ee,setNodeRef:te}=core.useDraggable({id:e,disabled:$}),p=i!==null&&D.includes(i),y=u===e,Z=Ot.useCallback(()=>jsxRuntime.jsx("div",{ref:r,id:`zeugma-tab-target-${b}`,className:"zeugma-tab-content-wrapper",style:{height:"100%",width:"100%"}}),[b]);Ot.useEffect(()=>{let d=r.current;return f(b,d),()=>{f(b,null);}},[b,f]);let w=Ot.useMemo(()=>({isDragging:p,isFullscreen:y,toggleFullscreen:()=>m?.(y?null:e),remove:()=>{y&&m?.(null),v(g);},metadata:k,updateMetadata:d=>{T(e,d);},locked:$,tabs:D,activeTabId:b,selectTab:d=>x(g,d),removeTab:d=>{y&&d===b&&m?.(null),S(d);},tabsMetadata:I,updateTabMetadata:(d,q)=>{T(d,q);},renderActiveTab:Z}),[p,y,m,e,S,k,T,$,D,b,x,g,I,Z]),C=Ot.useMemo(()=>$?{disabled:true}:{...ee,...X},[ee,X,$]),c=`${a.pane||""} ${Y&&a.paneLocked||""}`.trim();return jsxRuntime.jsx(ze.Provider,{value:C,children:jsxRuntime.jsxs("div",{ref:te,className:c,style:{position:"relative",width:"100%",height:"100%",...n},children:[t(w),O&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:["top","bottom","left","right"].map(d=>jsxRuntime.jsx(dt,{id:`drop-${d}-${e}`,position:d,activeClassName:a.dropPreview},d))}),i!==null&&i!==e&&G&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsxRuntime.jsx(dt,{id:`drop-locked-${e}`,position:"full",activeClassName:a.lockedPreview||""})})]})})};var pn=({children:e,className:t,style:n})=>{let s=Ot.useContext(ze);if(!s)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:r,...o}=s;return jsxRuntime.jsx("div",{className:t,style:{cursor:r?"default":"grab",userSelect:r?"auto":"none",touchAction:r?"auto":"none",...n},...r?{}:o,children:e})};var bn=({id:e,locked:t=false,children:n,className:s,style:r})=>{let{locked:o,classNames:i={},overTabId:a,overTabPosition:u}=se(),m=t||o,{attributes:E,listeners:v,setNodeRef:T,isDragging:x}=core.useDraggable({id:`tab-header-${e}`,disabled:m}),{setNodeRef:S,isOver:M}=core.useDroppable({id:`tab-drop-${e}`,disabled:m}),f=D=>{T(D),S(D);},R=M&&a===e,g=R?u:null;return jsxRuntime.jsxs("div",{ref:f,className:s,style:{display:"inline-flex",position:"relative",cursor:m?"default":"grab",...r},...m?{}:v,...m?{}:E,children:[n({isDragging:x,isOver:R}),R&&g&&jsxRuntime.jsx("div",{className:i.tabDropPreview||"",style:{position:"absolute",top:0,bottom:0,width:"2px",backgroundColor:"#6366f1",left:g==="before"?0:void 0,right:g==="after"?0:void 0,pointerEvents:"none",zIndex:10}})]})};exports.DEFAULT_DRAG_ACTIVATION_DISTANCE=ht;exports.DEFAULT_RESIZER_SIZE=yn;exports.DEFAULT_SNAP_THRESHOLD=vt;exports.DragHandle=pn;exports.Pane=cn;exports.PaneTree=Yt;exports.PortalRegistryContext=Ce;exports.ResizableContainer=ct;exports.Tab=bn;exports.Zeugma=Ht;exports.ZeugmaActionsContext=He;exports.ZeugmaStateContext=ke;exports.createDragSession=De;exports.safeJsonStringify=Pe;exports.useResizer=Fe;exports.useZeugma=Tt;exports.useZeugmaActions=we;exports.useZeugmaContext=yt;exports.useZeugmaState=se;//# sourceMappingURL=index.cjs.map
6
+ `,document.head.appendChild(r),t.setAttribute("data-resizing","true");let o=i=>{n(i);},a=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let i=document.getElementById("zeugma-global-cursor-style");i&&i.remove(),document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",a),s();};document.addEventListener("pointermove",o),document.addEventListener("pointerup",a);}var Be=Xt.createContext(void 0),We=Xt.createContext(void 0),Le=Xt.createContext(void 0),le=()=>{let e=Xt.useContext(Be);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},Ie=()=>{let e=Xt.useContext(We);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e};var Et=()=>{let e=le(),t=Ie();return {...e,...t}};var Me=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},ze=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};function $e(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 at(e){let{layout:t,setLayout:n,activeId:s,setActiveId:r,setActiveType:o,dismissIntentId:a,setDismissIntentId:i,setOverTabId:u,setOverTabPosition:p,containerRef:b,dragActivationDistance:m,enableDragToDismiss:v,dismissThreshold:T,onRemove:y,onDragStart:L,onDragEnd:f,onDismissIntentChange:D,removeTab:g,moveTab:C,selectTab:x}=e,M=Xt.useRef(null),A=Ge(s),[W,q]=Xt.useState(false);Ke(W);let Z=core.useSensors(core.useSensor(Me,{activationConstraint:{distance:m}}),core.useSensor(ze,{activationConstraint:{delay:250,tolerance:5}})),G=Xt.useCallback(d=>{let R=core.pointerWithin(d);if(R.length>0)return R;if(d.active.id.toString().startsWith("tab-header-")){let w=d.droppableContainers.filter(S=>S.id.toString().startsWith("tab-drop-"));return core.closestCenter({...d,droppableContainers:w})}return []},[]);return {sensors:Z,collisionDetection:G,onDragStart:d=>{let R=d.active.id.toString(),k=R.startsWith("tab-header-"),w=k?R.substring(11):R;r(w),o(k?"tab":"pane"),u(null),p(null);let S=d.activatorEvent;if(A.current=$e(S),v&&b.current?M.current=b.current.getBoundingClientRect():M.current=null,k){let l=Y(t,w);l&&x(l.id,w);}L&&L(w);},onDragMove:d=>{let{over:R}=d,k=R?.id.toString()||"",w=k.startsWith("drop-locked-");q(w);let S=k.match(/^tab-drop-(.+)$/);if(S&&R){let[,N]=S,z=d.active.id.toString();if((z.startsWith("tab-header-")?z.substring(11):z)!==N){let ne="before",ae=R.rect,ie=d.activatorEvent,F=null;if(A.current)F=A.current.x;else {let te=$e(ie);te&&(F=te.x+d.delta.x);}if(F!==null){let te=ae.left+ae.width/2;F>te&&(ne="after");}u(N),p(ne);}else u(null),p(null);}else u(null),p(null);if(!v)return;let l=d.active.id.toString(),U=l.startsWith("tab-header-")?l.substring(11):l,P=M.current;if(!P){a!==null&&(i(null),D?.(null));return}let h=d.activatorEvent,_=null,O=null;if(A.current)_=A.current.x,O=A.current.y;else {let N=$e(h);N&&(_=N.x+d.delta.x,O=N.y+d.delta.y);}let K=0;if(_!==null&&O!==null){let N=0,z=0;_<P.left?N=P.left-_:_>P.right&&(N=_-P.right),O<P.top?z=P.top-O:O>P.bottom&&(z=O-P.bottom),K=Math.sqrt(N*N+z*z);}else {let N=d.active.rect.current.translated;if(N){let z=N.left+N.width/2,$=N.top+N.height/2,se=0,ne=0;z<P.left?se=P.left-z:z>P.right&&(se=z-P.right),$<P.top?ne=P.top-$:$>P.bottom&&(ne=$-P.bottom),K=Math.sqrt(se*se+ne*ne);}}K>T?a!==U&&(i(U),D?.(U)):a!==null&&(i(null),D?.(null));},onDragEnd:d=>{r(null),o(null),q(false),u(null),p(null);let{active:R,over:k}=d,w=R.id.toString(),S=w.startsWith("tab-header-"),l=S?w.substring(11):w,I=v&&a===l;if(i(null),D?.(null),M.current=null,I){y?y(l):g(l),f&&f(l,null,null);return}if(!k){f&&f(l,null,null);return}let U=k.id.toString();if(U.startsWith("drop-locked-")){f&&f(l,null,null);return}let P=U.match(/^tab-drop-(.+)$/);if(P){let[,ae]=P;if(l!==ae){let ie="before",F=k.rect,te=d.activatorEvent,re=null;if(A.current)re=A.current.x;else {let he=$e(te);he&&(re=he.x+d.delta.x);}if(re!==null){let he=F.left+F.width/2;re>he&&(ie="after");}C(l,ae,ie),f&&f(l,ae,{type:"move",position:"center"});}else f&&f(l,null,null);return}let h=U.match(/^drop-(left|right|top|bottom)-(.+)$/);if(!h){f&&f(l,null,null);return}let[,_,O]=h,K=S?Y(t,l):Q(t,l),oe=K&&K.id===O,N=K&&K.tabs.length===1;if(l===O||oe&&N){f&&f(l,null,null);return}let z=_==="left"||_==="right"?"row":"column",$;if(S){let ie=Y(t,l)?.tabsMetadata?.[l];$={type:"pane",id:de(),tabs:[l],activeTabId:l,tabsMetadata:ie?{[l]:ie}:void 0};}else $=Q(t,l)??{type:"pane",id:de(),tabs:[l],activeTabId:l};let se=S?pe(t,l):me(t,l),ne=Pe(se,O,z,_,$);n(ne),f&&f(l,O,{type:"split",direction:z,position:_});},onDragCancel:()=>{r(null),o(null),q(false),u(null),p(null),i(null),D?.(null),M.current=null;}}}var it=({activeId:e,render:t,className:n})=>{let s=Xt.useRef(null);return Xt.useEffect(()=>{let r=o=>{s.current&&(s.current.style.transform=`translate(${o.clientX+12}px, ${o.clientY+12}px)`);};return document.addEventListener("pointermove",r),()=>document.removeEventListener("pointermove",r)},[]),jsxRuntime.jsx("div",{ref:s,className:n,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var lt=({tabId:e,target:t,renderWidget:n})=>{let[s,r]=Xt.useState(false),o=Xt.useRef(null);if(Xt.useEffect(()=>{r(true);},[]),Xt.useEffect(()=>{if(!s||!o.current)return;let i=o.current;if(t)t.appendChild(i);else {let u=document.getElementById("zeugma-hidden-portal-container");u||(u=document.createElement("div"),u.id="zeugma-hidden-portal-container",u.style.display="none",document.body.appendChild(u)),u.appendChild(i);}},[t,s]),Xt.useEffect(()=>()=>{o.current&&o.current.remove();},[]),!s)return null;o.current||(o.current=document.createElement("div"),o.current.className=`zeugma-portal-wrapper-${e}`,o.current.style.width="100%",o.current.style.height="100%");let a=o.current;return !a||!n?null:reactDom.createPortal(n(e),a)};var Ut=e=>{let t=e,{renderPane:n,renderWidget:s,renderDragOverlay:r,classNames:o={},children:a,layout:i,setLayout:u,fullscreenPaneId:p,setFullscreenPaneId:b,locked:m,setLocked:v,findPaneById:T,findPaneContainingTab:y,findTabById:L,activeId:f,activeType:D,dismissIntentId:g,setContainerRef:C,snapThreshold:x,minSplitPercentage:M,maxSplitPercentage:A,onRemove:W,onResizeStart:q,onResize:Z,onResizeEnd:G,removePane:V,addPane:J,addTab:j,updateTabMetadata:ee,updatePaneLock:d,selectTab:R,mergeTab:k,removeTab:w,splitPane:S,updateSplitPercentage:l,moveTab:I}=t,{portalTargets:U,registerPortalTarget:P}=Qe(),[h,_]=Xt.useState(null),[O,K]=Xt.useState(null),oe=at({...t,setOverTabId:_,setOverTabPosition:K}),N=Xt.useCallback(F=>n(F),[n]),z=Xt.useMemo(()=>o,[o.dashboard,o.dashboardDismissActive,o.pane,o.paneLocked,o.dropPreview,o.dragOverlay,o.resizer,o.dismissPreview,o.dashboardLocked,o.lockedPreview,o.tabDropPreview]),$=Xt.useCallback((F,te)=>{G&&G(F,te);},[G]),se=Xt.useMemo(()=>({layout:i,setLayout:u,renderPane:N,activeId:f,dismissIntentId:g,overTabId:h,overTabPosition:O,setContainerRef:C,fullscreenPaneId:p,classNames:z,onRemove:W,onFullscreenChange:b,snapThreshold:x,onResizeStart:q,onResize:Z,onResizeEnd:$,minSplitPercentage:M,maxSplitPercentage:A,locked:m,setLocked:v,findPaneById:T,findPaneContainingTab:y,findTabById:L}),[i,f,g,h,O,C,p,z,W,b,x,q,Z,M,A,u,N,$,m,v,T,y,L]),ne=Xt.useMemo(()=>({removePane:V,addPane:J,addTab:j,updateTabMetadata:ee,updatePaneLock:d,selectTab:R,mergeTab:k,removeTab:w,setFullscreenPaneId:b,setLocked:v,splitPane:S,updateSplitPercentage:l,moveTab:I}),[V,J,j,ee,d,R,k,w,b,v,S,l,I]),ae=Xt.useMemo(()=>{let F=[];function te(re){re&&(re.type==="pane"?F.push(...re.tabs):(te(re.first),te(re.second)));}return te(i),F},[i]),ie=Xt.useMemo(()=>({registerPortalTarget:P}),[P]);return jsxRuntime.jsx(We.Provider,{value:ne,children:jsxRuntime.jsx(Be.Provider,{value:se,children:jsxRuntime.jsxs(Le.Provider,{value:ie,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",...oe,children:a}),f&&D&&r&&jsxRuntime.jsx(it,{activeId:f,render:F=>r(F,D),className:`${o.dragOverlay||""} ${f===g&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:ae.map(F=>jsxRuntime.jsx(lt,{tabId:F,target:U[F]||null,renderWidget:s},F))})]})})})};function _e({containerRef:e,isRow:t,direction:n,splitPercentage:s,resizerSize:r,snapThreshold:o,layout:a,currentNode:i,onLayoutChange:u,onResizeStart:p,onResizeEnd:b,parentLeft:m,parentTop:v,parentWidth:T,parentHeight:y}){let{onResizeStart:L,onResize:f,onResizeEnd:D,minSplitPercentage:g=5,maxSplitPercentage:C=95,locked:x=false}=le();return Xt.useCallback(M=>{if(x)return;M.preventDefault();let A=e.current;if(!A)return;p&&p(),L&&L(i);let W=A.getBoundingClientRect(),q=M.clientX,Z=M.clientY,G=s,V=M.currentTarget,J=W.left+W.width*(m/100),j=W.top+W.height*(v/100),ee=W.width*(T/100),d=W.height*(y/100),k=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(S=>S!==V&&S.getAttribute("data-direction")===n).map(S=>{let l=S.getBoundingClientRect();return t?l.left+l.width/2:l.top+l.height/2}),w=G;Ne({cursor:t?"col-resize":"row-resize",resizerEl:V,onMove:S=>{let l=t?(S.clientX-q)/ee*100:(S.clientY-Z)/d*100,I=G+l,U=t?J+(ee-r)*(I/100)+r/2:j+(d-r)*(I/100)+r/2,P=1/0,h=null;for(let oe of k){let N=Math.abs(U-oe);N<o&&N<P&&(P=N,h=oe);}let _=I;h!==null&&(_=t?(h-r/2-J)/(ee-r)*100:(h-r/2-j)/(d-r)*100);let O=Math.max(g,Math.min(C,_));w=O;let K=ge(a,i,O);if(K){let{panes:oe,splitters:N}=ue(K),z=e.current;if(z){for(let $ of oe)z.style.setProperty(`--pane-left-${$.paneId}`,`${$.left}%`),z.style.setProperty(`--pane-top-${$.paneId}`,`${$.top}%`),z.style.setProperty(`--pane-width-${$.paneId}`,`${$.width}%`),z.style.setProperty(`--pane-height-${$.paneId}`,`${$.height}%`);for(let $ of N)z.style.setProperty(`--splitter-pos-${$.id}`,`${$.direction==="row"?$.left:$.top}%`);}}f&&f(i,O);},onEnd:()=>{let S=ge(a,i,w),l=e.current;if(l){let{panes:I,splitters:U}=ue(S);for(let P of I)l.style.removeProperty(`--pane-left-${P.paneId}`),l.style.removeProperty(`--pane-top-${P.paneId}`),l.style.removeProperty(`--pane-width-${P.paneId}`),l.style.removeProperty(`--pane-height-${P.paneId}`);for(let P of U)l.style.removeProperty(`--splitter-pos-${P.id}`);}u(S),b&&b(),D&&D(i,w);}});},[e,t,n,s,r,o,a,i,u,p,b,L,f,D,g,C,m,v,T,y])}var Kt=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:s})=>{let{layout:r,setLayout:o,classNames:a,locked:i}=le(),[u,p]=Xt.useState(false),{currentNode:b,direction:m,left:v,top:T,width:y,height:L,parentLeft:f,parentTop:D,parentWidth:g,parentHeight:C}=e,x=m==="row",M=_e({containerRef:s,isRow:x,direction:m,splitPercentage:b.splitPercentage,resizerSize:t,snapThreshold:n,layout:r,currentNode:b,onLayoutChange:o,onResizeStart:()=>p(true),onResizeEnd:()=>p(false),parentLeft:f,parentTop:D,parentWidth:g,parentHeight:C}),A=x?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${v}%) - ${t/2}px)`,top:`calc(${T}% + ${t/2}px)`,width:`${t}px`,height:`calc(${L}% - ${t}px)`,cursor:i?"default":"col-resize",pointerEvents:i?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"}:{position:"absolute",left:`calc(${v}% + ${t/2}px)`,top:`calc(var(--splitter-pos-${e.id}, ${T}%) - ${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:a.resizer||"","data-direction":m,"data-resizing":u||void 0,style:A,onPointerDown:M,role:"separator","aria-valuenow":b.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},Qt=Xt__default.default.memo(({paneId:e,renderPane:t})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:t(e)}),(e,t)=>e.paneId===t.paneId&&e.renderPane===t.renderPane),jt=({tree:e,resizerSize:t=4,snapThreshold:n})=>{let{layout:s,renderPane:r,activeId:o,dismissIntentId:a,setContainerRef:i,fullscreenPaneId:u,snapThreshold:p,locked:b,classNames:m}=le(),v=n!==void 0?n:p??8,T=e!==void 0?e:s,y=Xt.useRef(null),{panes:L,splitters:f}=Xt.useMemo(()=>T?ue(T):{panes:[],splitters:[]},[T]);if(!T)return null;let D=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[L.map(g=>{let C=u===g.paneId;return jsxRuntime.jsx("div",{style:{position:"absolute",left:C?"0%":`var(--pane-left-${g.paneId}, ${g.left}%)`,top:C?"0%":`var(--pane-top-${g.paneId}, ${g.top}%)`,width:C?"100%":`var(--pane-width-${g.paneId}, ${g.width}%)`,height:C?"100%":`var(--pane-height-${g.paneId}, ${g.height}%)`,overflow:"hidden",zIndex:C?20:1,display:u&&!C?"none":"block",padding:C?"0px":`${t/2}px`,boxSizing:"border-box"},children:jsxRuntime.jsx(Qt,{paneId:g.paneId,renderPane:r})},g.paneId)}),!u&&f.map(g=>jsxRuntime.jsx(Kt,{splitter:g,resizerSize:t,snapThreshold:v,containerRef:y},g.id))]});if(e===void 0){let g=o!==null&&o===a,C=M=>{i(M),y.current=M;},x=`${m.dashboard||""} ${g&&m.dashboardDismissActive||""} ${b&&m.dashboardLocked||""}`.trim();return jsxRuntime.jsx("div",{ref:C,className:x,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:D()})}return jsxRuntime.jsx("div",{ref:y,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:D()})};var gt="zeugma-height:",rn="default-pane";function on(e){try{let t=localStorage.getItem(gt+e);if(t!==null){let n=Number(t);if(Number.isFinite(n)&&n>0)return n}}catch{}return null}function mt(e,t){try{localStorage.setItem(gt+e,String(Math.round(t)));}catch{}}var bt=({children:e,active:t=true,height:n,onHeightChange:s,minHeight:r=100,maxHeight:o=1/0,persist:a,localStorageKey:i,resizerHeight:u=6,className:p,resizerClassName:b})=>{let m=a?i||rn:null,v=()=>{let x=(m?on(m):null)??n??400;return Ze(x,r,o)},[T,y]=Xt.useState(v),L=Xt.useRef(null),f=m?T:n??T,D=Xt.useRef(n);Xt.useEffect(()=>{if(n!==void 0&&n!==D.current){let x=Ze(n,r,o);y(x),m&&mt(m,x);}D.current=n;},[n,r,o,m]);let g=Xt.useCallback(()=>o,[o]),C=Xt.useCallback(x=>{x.preventDefault();let M=x.clientY,A=f,W=g(),q=x.currentTarget,Z=vt(L.current),G=Z?Z.scrollTop:0,V=M,J=null,j=(d,R)=>{let k=R-G,S=d-M+k,l=Ze(A+S,r,W);return L.current&&(L.current.style.height=`${l}px`),l},ee=()=>{if(!Z)return;let d=Z===document.documentElement||Z===document.body?{top:0,bottom:window.innerHeight}:Z.getBoundingClientRect(),R=40,k=10,w=0;V>d.bottom-R?w=Math.min(1,(V-(d.bottom-R))/R)*k:V<d.top+R&&(w=-Math.min(1,(d.top+R-V)/R)*k),w!==0&&(Z.scrollTop+=w,j(V,Z.scrollTop)),J=requestAnimationFrame(ee);};J=requestAnimationFrame(ee),Ne({cursor:"row-resize",resizerEl:q,onMove:d=>{V=d.clientY,Z&&j(V,Z.scrollTop);},onEnd:()=>{J!==null&&cancelAnimationFrame(J);let d=A;L.current&&(d=L.current.getBoundingClientRect().height),d=Ze(d,r,W),y(d),s&&s(d),m&&mt(m,d);}});},[f,r,g,s,m]);return t?jsxRuntime.jsxs("div",{ref:L,className:`zeugma-resizable-container ${p||""}`.trim(),style:{height:`${f}px`,position:"relative",overflow:"hidden",boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{style:{height:`calc(100% - ${u}px)`,overflow:"hidden"},children:e}),jsxRuntime.jsx("div",{className:`zeugma-resizable-handle ${b||""}`.trim(),style:{height:`${u}px`,cursor:"row-resize",position:"relative",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box",flexShrink:0},onPointerDown:C,role:"separator","aria-orientation":"horizontal","aria-valuenow":Math.round(f),"aria-valuemin":r,"aria-valuemax":o===1/0?void 0:o})]}):jsxRuntime.jsx("div",{className:`zeugma-resizable-container disabled ${p||""}`.trim(),style:{height:"100%",position:"relative",overflow:"hidden",boxSizing:"border-box"},children:jsxRuntime.jsx("div",{style:{height:"100%",overflow:"hidden"},children:e})})};function Ze(e,t,n){return Math.max(t,Math.min(n,e))}function vt(e){if(typeof window>"u"||!e)return null;let t=e.parentElement;if(!t)return document.documentElement;let s=window.getComputedStyle(t).overflowY;return s==="auto"||s==="scroll"?t:vt(t)}var Ae=Xt.createContext(null),He=Xt.createContext(null);var fn={top:{position:"absolute",top:0,left:"25%",width:"50%",height:"25%",zIndex:20,pointerEvents:"auto"},bottom:{position:"absolute",bottom:0,left:"25%",width:"50%",height:"25%",zIndex:20,pointerEvents:"auto"},left:{position:"absolute",top:"25%",left:0,width:"25%",height:"50%",zIndex:20,pointerEvents:"auto"},right:{position:"absolute",top:"25%",right:0,width:"25%",height:"50%",zIndex:20,pointerEvents:"auto"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:20,pointerEvents:"auto",cursor:"not-allowed"}},mn={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"}},Pt=({id:e,position:t,activeClassName:n})=>{let{setNodeRef:s,isOver:r}=core.useDroppable({id:e});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:s,style:fn[t]}),r&&jsxRuntime.jsx("div",{className:n,style:mn[t]})]})},gn=({id:e,children:t,style:n,locked:s=false})=>{let r=Xt.useRef(null),{layout:o,activeId:a,classNames:i,fullscreenPaneId:u,onFullscreenChange:p,locked:b}=le(),{removePane:m,updateTabMetadata:v,selectTab:T,removeTab:y}=Ie(),L=Xt.useContext(Le);if(!L)throw new Error("Pane must be used within a Zeugma provider");let{registerPortalTarget:f}=L,D=Xt.useMemo(()=>Q(o,e),[o,e]),g=D?.id??e,C=D?.tabs??[e],x=D?.activeTabId??e,M=D?.tabsMetadata,A=M?.[e],W=D?.locked??false,q=s||W,Z=b||q,G=b||q,V=a!==null&&a!==e&&(!C.includes(a)||C.length>1)&&!G,{attributes:J,listeners:j,setNodeRef:ee}=core.useDraggable({id:e,disabled:Z}),d=a!==null&&C.includes(a),R=u===e,k=Xt.useCallback(()=>jsxRuntime.jsx("div",{ref:r,id:`zeugma-tab-target-${x}`,className:"zeugma-tab-content-wrapper",style:{height:"100%",width:"100%"}}),[x]);Xt.useEffect(()=>{let I=r.current;return f(x,I),()=>{f(x,null);}},[x,f]);let w=Xt.useMemo(()=>({isDragging:d,isFullscreen:R,toggleFullscreen:()=>p?.(R?null:e),remove:()=>{R&&p?.(null),m(g);},metadata:A,updateMetadata:I=>{v(e,I);},locked:Z,tabs:C,activeTabId:x,selectTab:I=>T(g,I),removeTab:I=>{R&&I===x&&p?.(null),y(I);},tabsMetadata:M,updateTabMetadata:(I,U)=>{v(I,U);},renderActiveTab:k}),[d,R,p,e,y,A,v,Z,C,x,T,g,M,k]),S=Xt.useMemo(()=>Z?{disabled:true}:{...j,...J},[j,J,Z]),l=`${i.pane||""} ${q&&i.paneLocked||""}`.trim();return jsxRuntime.jsx(Ae.Provider,{value:S,children:jsxRuntime.jsx(He.Provider,{value:w,children:jsxRuntime.jsxs("div",{ref:ee,className:l,style:{position:"relative",width:"100%",height:"100%",...n},children:[t(w),V&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:["top","bottom","left","right"].map(I=>jsxRuntime.jsx(Pt,{id:`drop-${I}-${e}`,position:I,activeClassName:i.dropPreview},I))}),a!==null&&a!==e&&G&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsxRuntime.jsx(Pt,{id:`drop-locked-${e}`,position:"full",activeClassName:i.lockedPreview||""})})]})})})};var hn=({children:e,className:t,style:n})=>{let s=Xt.useContext(Ae);if(!s)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:r,...o}=s;return jsxRuntime.jsx("div",{className:t,style:{cursor:r?"default":"grab",userSelect:r?"auto":"none",touchAction:r?"auto":"none",...n},...r?{}:o,children:e})};var Xe=({id:e,locked:t=false,children:n,className:s,style:r})=>{let{locked:o,classNames:a={},overTabId:i,overTabPosition:u}=le(),p=t||o,{attributes:b,listeners:m,setNodeRef:v,isDragging:T}=core.useDraggable({id:`tab-header-${e}`,disabled:p}),{setNodeRef:y,isOver:L}=core.useDroppable({id:`tab-drop-${e}`,disabled:p}),f=C=>{v(C),y(C);},D=L&&i===e,g=D?u:null;return jsxRuntime.jsxs("div",{ref:f,className:s,style:{display:"inline-flex",position:"relative",cursor:p?"default":"grab",...r},...p?{}:m,...p?{}:b,children:[n({isDragging:T,isOver:D}),D&&g&&jsxRuntime.jsx("div",{className:a.tabDropPreview||"",style:{position:"absolute",top:0,bottom:0,width:"2px",backgroundColor:"#6366f1",left:g==="before"?0:void 0,right:g==="after"?0:void 0,pointerEvents:"none",zIndex:10}})]})};var Dn=({children:e,className:t,style:n})=>{let s=Xt.useContext(He);if(!s)throw new Error("<TabsList> must be rendered inside a <Pane> component.");let{tabs:r,activeTabId:o,selectTab:a,removeTab:i,tabsMetadata:u,locked:p}=s;return jsxRuntime.jsx(jsxRuntime.Fragment,{children:r.map((b,m)=>{let v=b===o,T=m===r.length-1,y=u?.[b];return jsxRuntime.jsx(Xe,{id:b,locked:p,className:t,style:n,children:L=>e({...L,tabId:b,isActive:v,index:m,isLast:T,select:()=>a(b),remove:()=>i(b),metadata:y})},b)})})};exports.DEFAULT_DRAG_ACTIVATION_DISTANCE=Ct;exports.DEFAULT_RESIZER_SIZE=Nn;exports.DEFAULT_SNAP_THRESHOLD=Dt;exports.DragHandle=hn;exports.Pane=gn;exports.PaneTree=jt;exports.PortalRegistryContext=Le;exports.ResizableContainer=bt;exports.Tab=Xe;exports.TabsList=Dn;exports.Zeugma=Ut;exports.ZeugmaActionsContext=We;exports.ZeugmaStateContext=Be;exports.createDragSession=Ne;exports.safeJsonStringify=xe;exports.useResizer=_e;exports.useZeugma=wt;exports.useZeugmaActions=Ie;exports.useZeugmaContext=Et;exports.useZeugmaState=le;//# sourceMappingURL=index.cjs.map
7
7
  //# sourceMappingURL=index.cjs.map