@principal-ade/panels 1.0.55 → 1.0.56
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.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("react"),require("react-resizable-panels"),require("react-dom"),require("@principal-ade/industry-theme")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","react","react-resizable-panels","react-dom","@principal-ade/industry-theme"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).A24ZPanels={},e["react/jsx-runtime"],e.React,e.ReactResizablePanels,e.ReactDOM,e.IndustryTheme)}(this,function(e,t,n,r,a,o){"use strict";function l(e){return{"--panel-background":e.colors.background,"--panel-border":e.colors.border,"--panel-handle":e.colors.backgroundSecondary,"--panel-handle-hover":e.colors.backgroundHover,"--panel-handle-active":e.colors.primary,"--panel-button-bg":e.colors.surface,"--panel-button-hover":e.colors.backgroundHover,"--panel-button-border":e.colors.border,"--panel-button-icon":e.colors.textSecondary,"--panel-accent-bg":e.colors.primary+"15"}}function i(e){return{"--tab-list-bg":e.colors.backgroundSecondary,"--tab-border":e.colors.border,"--tab-bg":e.colors.surface,"--tab-bg-hover":e.colors.backgroundHover,"--tab-bg-active":e.colors.primary,"--tab-text":e.colors.textSecondary,"--tab-text-hover":e.colors.text,"--tab-text-active":e.colors.background,"--tab-icon-color":e.colors.textTertiary,"--tab-icon-active":e.colors.background,"--tab-border-hover":e.colors.textSecondary,"--tab-border-active":e.colors.primary,"--tab-focus":e.colors.primary,"--tab-content-bg":e.colors.background,"--tab-empty-text":e.colors.textMuted,"--tab-font-family":e.fonts.body,"--tab-font-size":"11px","--tab-font-weight":String(e.fontWeights.medium),"--mobile-tab-text-active":e.colors.primary,"--mobile-tab-icon-active":e.colors.primary}}const s=({panelIds:e,panels:r,config:a={},className:o="",theme:l})=>{const{defaultActiveTab:s=0,tabPosition:c="top",centered:d=!0,hideTabList:u=!1,activeTabIndex:p,onTabChange:h}=a,[f,m]=n.useState(s),g=void 0!==p,b=g?p:f;n.useEffect(()=>{g||m(s)},[s,g]);const v=i(l),y=e.map(e=>r.find(t=>t.id===e)).filter(e=>void 0!==e),x=Math.min(b,y.length-1),w=y[x];if(0===y.length)return t.jsx("div",{className:"tab-group-empty",children:"No panels available"});const C="top"===c||"bottom"===c||d,S=t.jsx("div",{className:"tab-list "+(C?"centered":""),role:"tablist",children:y.map((e,n)=>t.jsx("button",{role:"tab","aria-selected":n===x,"aria-controls":`tabpanel-${e.id}`,id:`tab-${e.id}`,className:"tab-button "+(n===x?"active":""),onClick:()=>(e=>{g||m(e),h?.(e)})(n),title:e.icon?e.label:void 0,children:e.icon?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"tab-icon",children:e.icon}),t.jsx("span",{className:"tab-label",children:e.label})]}):e.label},e.id))}),R=w?t.jsx("div",{className:"tab-content",role:"tabpanel",id:`tabpanel-${w.id}`,"aria-labelledby":`tab-${w.id}`,children:w.content}):null;return t.jsxs("div",{className:`tab-group tab-position-${c} ${o}`,style:v,children:[!u&&("top"===c||"left"===c)&&S,R,!u&&("bottom"===c||"right"===c)&&S]})},c={x:0,y:0,width:0,height:0},d=n.createContext(null),u=({slot:e,children:r})=>{const a=n.useRef(null),[o,l]=n.useState(c),i=n.useCallback(()=>{if(a.current){const e=a.current.getBoundingClientRect();l({x:e.left,y:e.top,width:e.width,height:e.height})}},[]);n.useEffect(()=>{const e=a.current;if(!e)return;i();const t=new ResizeObserver(()=>{i()});return t.observe(e),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{t.disconnect(),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[i]);const s={slot:e,bounds:o};return t.jsx(d.Provider,{value:s,children:t.jsx("div",{ref:a,className:"panel-bounds-container",style:{width:"100%",height:"100%"},children:r})})};function p(){const e=n.useContext(d);return e?{slot:e.slot,bounds:e.bounds,isInPanel:!0}:{slot:null,bounds:c,isInPanel:!1}}const h=({panels:e,layout:o,slotDataAttributes:i={},collapsiblePanels:c={left:!0,middle:!1,right:!0},defaultSizes:d={left:20,middle:60,right:20},minSizes:p={left:5,middle:10,right:5},className:h="",collapsed:f={left:!1,middle:!1,right:!1},style:m,showCollapseButtons:g=!1,animationDuration:b=300,animationEasing:v="cubic-bezier(0.4, 0, 0.2, 1)",theme:y,onLeftCollapseStart:x,onLeftCollapseComplete:w,onLeftExpandStart:C,onLeftExpandComplete:S,onMiddleCollapseStart:R,onMiddleCollapseComplete:E,onMiddleExpandStart:k,onMiddleExpandComplete:N,onRightCollapseStart:j,onRightCollapseComplete:z,onRightExpandStart:D,onRightExpandComplete:M,onPanelResize:T})=>{const P=null!==o.left&&void 0!==o.left,A=null!==o.middle&&void 0!==o.middle,L=null!==o.right&&void 0!==o.right,F=[P,A,L].filter(Boolean).length,$={left:P?d?.left??(2===F?50:3===F?20:100):0,middle:A?d?.middle??(2===F?50:3===F?60:100):0,right:L?d?.right??(2===F?50:3===F?20:100):0},B={left:p?.left??5,middle:p?.middle??10,right:p?.right??5},[O,I]=n.useState(f.left||!P),[q,H]=n.useState(f.middle||!A),[W,U]=n.useState(f.right||!L),[K,V]=n.useState(!1),[X,Y]=n.useState(!1),[G,J]=n.useState(!1),[_,Q]=n.useState(!1),Z=O&&!K,ee=q&&!X,te=W&&!G,ne=n.useCallback(t=>{if(!t)return null;const n=e.find(e=>e.id===t);return n?.content||null},[e]),re=n.useCallback(n=>{if(null===n)return null;if("object"==typeof n&&"type"in n){const r=n;return"tabs"===r.type?t.jsx(s,{panelIds:r.panels,panels:e,config:r.config,theme:y}):null}return ne(n)},[e,ne,y]),ae=re(o.left??null),oe=re(o.middle??null),le=re(o.right??null),[ie,se]=n.useState(f.left||!P?0:$.left),[ce,de]=n.useState(f.middle||!A?0:$.middle),[ue,pe]=n.useState(f.right||!L?0:$.right),[he,fe]=n.useState($.left),[me,ge]=n.useState($.middle),[be,ve]=n.useState($.right),ye=n.useRef(null),xe=n.useRef(null),we=n.useRef(null),Ce=n.useRef(null),Se=n.useRef(void 0),Re=n.useRef(void 0),Ee=n.useRef(void 0),ke=n.useRef(void 0),Ne=n.useRef(void 0),je=n.useRef(void 0),ze=n.useCallback((e,t)=>{const n=e.filter(e=>e.panelRef.current);if(0===n.length)return;n.forEach(e=>{e.animationFrameRef.current&&cancelAnimationFrame(e.animationFrameRef.current)});let r=0;const a=()=>{r++;const e=r/10;if(e>=1)return n.forEach(e=>{e.panelRef.current&&(0===e.toSize?e.panelRef.current.collapse():e.panelRef.current.resize(e.toSize))}),void(t&&t());const o=e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;n.forEach(e=>{if(e.panelRef.current){const t=e.fromSize+(e.toSize-e.fromSize)*o;e.panelRef.current.resize(t)}}),n[0].animationFrameRef.current=requestAnimationFrame(()=>{setTimeout(a,b/10)})};a()},[b]),De=n.useCallback(()=>{K||_||!c.left||(a.flushSync(()=>{V(!0),Y(!0),J(!0),I(!0)}),x&&x(),Se.current&&cancelAnimationFrame(Se.current),Se.current=requestAnimationFrame(()=>{const e=ye.current?.getLayout(),t=Math.round(1e3*(e?.[0]??ie))/1e3,n=Math.round(1e3*(e?.[1]??ce))/1e3,r=Math.round(1e3*(e?.[2]??ue))/1e3,a=n+r,o=a>0?n/a*100:A?50:0,l=a>0?r/a*100:L?50:0;o>0&&ge(o),l>0&&ve(l),ze([{panelRef:xe,fromSize:t,toSize:0,animationFrameRef:Se,startTimeRef:ke},{panelRef:we,fromSize:n,toSize:o,animationFrameRef:Re,startTimeRef:Ne},{panelRef:Ce,fromSize:r,toSize:l,animationFrameRef:Ee,startTimeRef:je}],()=>{se(0),de(o),pe(l),V(!1),Y(!1),J(!1),w&&w()})}))},[K,_,ie,ce,ue,A,L,c.left,ze,x,w]),Me=n.useCallback(()=>{K||_||!c.left||(a.flushSync(()=>{V(!0),Y(!0),J(!0),I(!1)}),C&&C(),Se.current&&cancelAnimationFrame(Se.current),Se.current=requestAnimationFrame(()=>{const e=ye.current?.getLayout(),t=Math.round(1e3*(e?.[0]??0))/1e3,n=Math.round(1e3*(e?.[1]??ce))/1e3,r=Math.round(1e3*(e?.[2]??ue))/1e3,a=he||$.left,o=100-a,l=n+r,i=l>0?n/l*o:A?o/2:0,s=l>0?r/l*o:L?o/2:0;i>0&&ge(i),s>0&&ve(s),ze([{panelRef:xe,fromSize:t,toSize:a,animationFrameRef:Se,startTimeRef:ke},{panelRef:we,fromSize:n,toSize:i,animationFrameRef:Re,startTimeRef:Ne},{panelRef:Ce,fromSize:r,toSize:s,animationFrameRef:Ee,startTimeRef:je}],()=>{se(a),de(i),pe(s),V(!1),Y(!1),J(!1),S&&S()})}))},[K,_,ce,ue,$.left,he,A,L,c.left,ze,C,S]),Te=n.useCallback(()=>{G||_||!c.right||(a.flushSync(()=>{V(!0),Y(!0),J(!0),U(!0)}),j&&j(),Ee.current&&cancelAnimationFrame(Ee.current),Ee.current=requestAnimationFrame(()=>{const e=ye.current?.getLayout(),t=Math.round(1e3*(e?.[0]??ie))/1e3,n=Math.round(1e3*(e?.[1]??ce))/1e3,r=Math.round(1e3*(e?.[2]??ue))/1e3,a=t+n,o=a>0?t/a*100:P?50:0,l=a>0?n/a*100:A?50:0;o>0&&fe(o),l>0&&ge(l),ze([{panelRef:xe,fromSize:t,toSize:o,animationFrameRef:Se,startTimeRef:ke},{panelRef:we,fromSize:n,toSize:l,animationFrameRef:Re,startTimeRef:Ne},{panelRef:Ce,fromSize:r,toSize:0,animationFrameRef:Ee,startTimeRef:je}],()=>{se(o),de(l),pe(0),V(!1),Y(!1),J(!1),z&&z()})}))},[G,_,ie,ce,ue,P,A,c.right,ze,j,z]),Pe=n.useCallback(()=>{G||_||!c.right||(a.flushSync(()=>{V(!0),Y(!0),J(!0),U(!1)}),D&&D(),Ee.current&&cancelAnimationFrame(Ee.current),Ee.current=requestAnimationFrame(()=>{const e=ye.current?.getLayout(),t=Math.round(1e3*(e?.[0]??ie))/1e3,n=Math.round(1e3*(e?.[1]??ce))/1e3,r=Math.round(1e3*(e?.[2]??0))/1e3,a=be||$.right,o=100-a,l=t+n,i=l>0?t/l*o:P?o/2:0,s=l>0?n/l*o:A?o/2:0;i>0&&fe(i),s>0&&ge(s),ze([{panelRef:xe,fromSize:t,toSize:i,animationFrameRef:Se,startTimeRef:ke},{panelRef:we,fromSize:n,toSize:s,animationFrameRef:Re,startTimeRef:Ne},{panelRef:Ce,fromSize:r,toSize:a,animationFrameRef:Ee,startTimeRef:je}],()=>{se(i),de(s),pe(a),V(!1),Y(!1),J(!1),M&&M()})}))},[G,_,ie,ce,$.right,be,P,A,c.right,ze,D,M]),Ae=n.useCallback(()=>{O?Me():De()},[O,De,Me]),Le=n.useCallback(()=>{X||_||!c.middle||(a.flushSync(()=>{V(!0),Y(!0),J(!0),H(!0)}),R&&R(),Re.current&&cancelAnimationFrame(Re.current),Re.current=requestAnimationFrame(()=>{const e=ye.current?.getLayout(),t=Math.round(1e3*(e?.[0]??ie))/1e3,n=Math.round(1e3*(e?.[1]??ce))/1e3,r=Math.round(1e3*(e?.[2]??ue))/1e3,a=t+r,o=a>0?t/a*100:P?50:0,l=a>0?r/a*100:L?50:0;o>0&&fe(o),l>0&&ve(l),ze([{panelRef:xe,fromSize:t,toSize:o,animationFrameRef:Se,startTimeRef:ke},{panelRef:we,fromSize:n,toSize:0,animationFrameRef:Re,startTimeRef:Ne},{panelRef:Ce,fromSize:r,toSize:l,animationFrameRef:Ee,startTimeRef:je}],()=>{se(o),de(0),pe(l),V(!1),Y(!1),J(!1),E&&E()})}))},[X,_,ie,ce,ue,P,L,c.middle,ze,R,E]),Fe=n.useCallback(()=>{X||_||!c.middle||(a.flushSync(()=>{V(!0),Y(!0),J(!0),H(!1)}),k&&k(),Re.current&&cancelAnimationFrame(Re.current),Re.current=requestAnimationFrame(()=>{const e=ye.current?.getLayout(),t=Math.round(1e3*(e?.[0]??ie))/1e3,n=Math.round(1e3*(e?.[1]??0))/1e3,r=Math.round(1e3*(e?.[2]??ue))/1e3,a=me||$.middle,o=100-a,l=t+r,i=l>0?t/l*o:P?o/2:0,s=l>0?r/l*o:L?o/2:0;i>0&&fe(i),s>0&&ve(s),ze([{panelRef:xe,fromSize:t,toSize:i,animationFrameRef:Se,startTimeRef:ke},{panelRef:we,fromSize:n,toSize:a,animationFrameRef:Re,startTimeRef:Ne},{panelRef:Ce,fromSize:r,toSize:s,animationFrameRef:Ee,startTimeRef:je}],()=>{se(i),de(a),pe(s),V(!1),Y(!1),J(!1),N&&N()})}))},[X,_,ie,ue,$.middle,me,P,L,c.middle,ze,k,N]),$e=n.useCallback(()=>{W?Pe():Te()},[W,Te,Pe]),Be=n.useCallback(e=>{K||X||G||(se(e),e>0&&(fe(e),I(!1)))},[K,X,G]),Oe=n.useCallback(e=>{K||X||G||(de(e),e>0&&(ge(e),H(!1)))},[K,X,G]),Ie=n.useCallback(e=>{K||X||G||(pe(e),e>0&&(ve(e),U(!1)))},[K,X,G]),qe=n.useCallback(()=>{if(T){T({left:O?he:ie,middle:q?me:ce,right:W?be:ue})}},[ie,ce,ue,O,q,W,he,me,be,T]),He=n.useCallback(e=>{Q(e),e||qe()},[qe]);n.useEffect(()=>{void 0!==f.left&&f.left!==O&&queueMicrotask(()=>{f.left?De():Me()})},[f.left,O,De,Me]),n.useEffect(()=>{void 0!==f.middle&&f.middle!==q&&queueMicrotask(()=>{f.middle?Le():Fe()})},[f.middle,q,Le,Fe]),n.useEffect(()=>{void 0!==f.right&&f.right!==W&&queueMicrotask(()=>{f.right?Te():Pe()})},[f.right,W,Te,Pe]),n.useEffect(()=>()=>{Se.current&&cancelAnimationFrame(Se.current),Re.current&&cancelAnimationFrame(Re.current),Ee.current&&cancelAnimationFrame(Ee.current)},[]);const We=e=>{let t="three-panel-item";return"left"===e?!c.left&&P||(t+=" collapsible-panel",K&&!_&&(t+=" animating"),Z&&(t+=" collapsed")):"middle"===e?(t+=" middle-panel",!c.middle&&A||(t+=" collapsible-panel",X&&!_&&(t+=" animating"),ee&&(t+=" collapsed"))):"right"===e&&(!c.right&&L||(t+=" collapsible-panel",G&&!_&&(t+=" animating"),te&&(t+=" collapsed"))),t},Ue=K&&!_?{transition:`width ${b}ms ${v}`,width:O?"0%":`${$.left}%`}:void 0,Ke=X&&!_?{transition:`width ${b}ms ${v}`,width:q?"0%":`${$.middle}%`}:void 0,Ve=G&&!_?{transition:`width ${b}ms ${v}`,width:W?"0%":`${$.right}%`}:void 0,Xe=l(y),Ye=K||X||G?0:B.left,Ge=K||X||G?0:B.middle,Je=K||X||G?0:B.right;return t.jsx("div",{className:`three-panel-layout ${h}`,style:{...Xe,...m},children:t.jsxs(r.PanelGroup,{ref:ye,direction:"horizontal",onLayout:qe,children:[t.jsx(r.Panel,{ref:xe,collapsible:c.left||!P,defaultSize:f.left||!P?0:$.left,minSize:Ye,collapsedSize:0,onResize:Be,onCollapse:()=>I(!0),onExpand:()=>I(!1),className:We("left"),style:Ue,...i.left||{},children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:O?0:1,transition:K?`opacity ${.5*b}ms ${v}`:"none"},children:t.jsx(u,{slot:"left",children:ae})})}),t.jsx(r.PanelResizeHandle,{className:"resize-handle left-handle "+(!Z&&P&&A?"":"collapsed"),onDragging:He,disabled:Z||!P||!A,children:g&&c.left&&t.jsx("div",{className:"handle-bar",children:t.jsx("button",{onClick:Ae,className:"collapse-toggle",disabled:K,"aria-label":O?"Expand left panel":"Collapse left panel",children:O?"▸":"◂"})})}),t.jsx(r.Panel,{ref:we,collapsible:c.middle||!A,defaultSize:f.middle||!A?0:$.middle,minSize:Ge,collapsedSize:0,onResize:Oe,onCollapse:()=>H(!0),onExpand:()=>H(!1),className:We("middle"),style:Ke,...i.middle||{},children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:q?0:1,transition:X?`opacity ${.5*b}ms ${v}`:"none"},children:t.jsx(u,{slot:"middle",children:oe})})}),t.jsx(r.PanelResizeHandle,{className:"resize-handle right-handle "+(te||!L||!A&&!P?"collapsed":""),onDragging:He,disabled:te||!L||!A&&!P,children:g&&c.right&&t.jsx("div",{className:"handle-bar",children:t.jsx("button",{onClick:$e,className:"collapse-toggle",disabled:G,"aria-label":W?"Expand right panel":"Collapse right panel",children:W?"◂":"▸"})})}),t.jsx(r.Panel,{ref:Ce,collapsible:c.right||!L,defaultSize:f.right||!L?0:$.right,minSize:Je,collapsedSize:0,onResize:Ie,onCollapse:()=>U(!0),onExpand:()=>U(!1),className:We("right"),style:Ve,...i.right||{},children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:W?0:1,transition:G?`opacity ${.5*b}ms ${v}`:"none"},children:t.jsx(u,{slot:"right",children:le})})})]})})},f=n.forwardRef(({panels:e,className:r="",style:a,theme:o,minPanelWidth:i=350,idealPanelWidth:s=.333,showSeparator:c=!1,onPanelChange:d,preventKeyboardScroll:u=!0,disableSwipe:p=!1},h)=>{const f=n.useRef(null),m=n.useRef(!1),g=n.useRef(null),b=l(o);n.useImperativeHandle(h,()=>({scrollToPanel:e=>{if(!f.current)return;const t=f.current,n=t.children[e];if(n){m.current=!0,g.current&&clearTimeout(g.current);const e=n.offsetLeft;t.scrollTo({left:e,behavior:"smooth"}),g.current=setTimeout(()=>{m.current=!1},500)}},getCurrentPanel:()=>{if(!f.current||0===f.current.children.length)return 0;const e=f.current,t=e.getBoundingClientRect().left;let n=0,r=1/0;for(let a=0;a<e.children.length;a++){const o=e.children[a].getBoundingClientRect(),l=Math.abs(o.left-t);l<r&&(r=l,n=a)}return n}}));n.useEffect(()=>{if(!u||!f.current)return;const e=f.current,t=e=>{const t=e.target;if("INPUT"===t.tagName||"TEXTAREA"===t.tagName||"SELECT"===t.tagName||t.isContentEditable||null!==t.closest(".xterm")||null!==t.closest('[contenteditable="true"]'))return;[" ","Space","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown"].includes(e.key)&&e.preventDefault()};return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}},[u]),n.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);const v=e.length,y=2*i;let x;x=1===v||2===v?"100%":`max(${i}px, ${100*s}%)`;const w=n.useId().replace(/:/g,"_");return t.jsxs(t.Fragment,{children:[2===v&&t.jsx("style",{children:`\n .snap-carousel-container[data-carousel-id="${w}"][data-panel-count="2"] .snap-carousel-panel {\n width: 100%;\n }\n @container (min-width: ${y}px) {\n .snap-carousel-container[data-carousel-id="${w}"][data-panel-count="2"] .snap-carousel-panel {\n width: 50%;\n }\n }\n `}),t.jsx("div",{ref:f,className:`snap-carousel-container ${p?"swipe-disabled":""} ${r}`,style:{...b,...a,"--snap-carousel-min-width":`${i}px`,"--snap-carousel-ideal-width":100*s+"%","--snap-carousel-gap":c?"1px":"0px","--snap-carousel-panel-width":x,"--snap-carousel-panel-count":v,"--snap-carousel-two-panel-threshold":`${y}px`},onScroll:e=>{if(!d||!f.current||0===f.current.children.length)return;if(m.current)return;const t=f.current,n=t.getBoundingClientRect().left;let r=0,a=1/0;for(let o=0;o<t.children.length;o++){const e=t.children[o].getBoundingClientRect(),l=Math.abs(e.left-n);l<a&&(a=l,r=o)}d(r)},"data-panel-count":v,"data-carousel-id":w,children:e.map((e,n)=>t.jsx("div",{className:"snap-carousel-panel",children:e},n))})]})});function m(e){const[t,r]=n.useState(()=>"undefined"!=typeof window&&window.matchMedia(e).matches);return n.useEffect(()=>{if("undefined"==typeof window)return;const t=window.matchMedia(e),n=e=>{r(e.matches)};return r(t.matches),t.addEventListener?(t.addEventListener("change",n),()=>t.removeEventListener("change",n)):(t.addListener(n),()=>t.removeListener(n))},[e]),t}f.displayName="SnapCarousel";const g="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function b(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function v(e){return"nodeType"in e}function y(e){var t,n;return e?b(e)?e:v(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function x(e){const{Document:t}=y(e);return e instanceof t}function w(e){return!b(e)&&e instanceof y(e).HTMLElement}function C(e){return e instanceof y(e).SVGElement}function S(e){return e?b(e)?e.document:v(e)?x(e)?e:w(e)||C(e)?e.ownerDocument:document:document:document}const R=g?n.useLayoutEffect:n.useEffect;function E(e){const t=n.useRef(e);return R(()=>{t.current=e}),n.useCallback(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}function k(e,t){void 0===t&&(t=[e]);const r=n.useRef(e);return R(()=>{r.current!==e&&(r.current=e)},t),r}function N(e,t){const r=n.useRef();return n.useMemo(()=>{const t=e(r.current);return r.current=t,t},[...t])}function j(e){const t=E(e),r=n.useRef(null),a=n.useCallback(e=>{e!==r.current&&(null==t||t(e,r.current)),r.current=e},[]);return[r,a]}function z(e){const t=n.useRef();return n.useEffect(()=>{t.current=e},[e]),t.current}let D={};function M(e,t){return n.useMemo(()=>{if(t)return t;const n=null==D[e]?0:D[e]+1;return D[e]=n,e+"-"+n},[e,t])}function T(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((t,n)=>{const r=Object.entries(n);for(const[a,o]of r){const n=t[a];null!=n&&(t[a]=n+e*o)}return t},{...t})}}const P=T(1),A=T(-1);function L(e){if(!e)return!1;const{KeyboardEvent:t}=y(e.target);return t&&e instanceof t}function F(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=y(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const $="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function B(e){return e.matches($)?e:e.querySelector($)}const O={display:"none"};function I(e){let{id:t,value:r}=e;return n.createElement("div",{id:t,style:O},r)}function q(e){let{id:t,announcement:r,ariaLiveType:a="assertive"}=e;return n.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":a,"aria-atomic":!0},r)}const H=n.createContext(null);const W={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},U={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function K(e){let{announcements:t=U,container:r,hiddenTextDescribedById:o,screenReaderInstructions:l=W}=e;const{announce:i,announcement:s}=function(){const[e,t]=n.useState("");return{announce:n.useCallback(e=>{null!=e&&t(e)},[]),announcement:e}}(),c=M("DndLiveRegion"),[d,u]=n.useState(!1);if(n.useEffect(()=>{u(!0)},[]),function(e){const t=n.useContext(H);n.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}(n.useMemo(()=>({onDragStart(e){let{active:n}=e;i(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&i(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;i(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;i(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;i(t.onDragCancel({active:n,over:r}))}}),[i,t])),!d)return null;const p=n.createElement(n.Fragment,null,n.createElement(I,{id:o,value:l.draggable}),n.createElement(q,{id:c,announcement:s}));return r?a.createPortal(p,r):p}var V,X;function Y(){}(X=V||(V={})).DragStart="dragStart",X.DragMove="dragMove",X.DragEnd="dragEnd",X.DragCancel="dragCancel",X.DragOver="dragOver",X.RegisterDroppable="registerDroppable",X.SetDroppableDisabled="setDroppableDisabled",X.UnregisterDroppable="unregisterDroppable";const G=Object.freeze({x:0,y:0});function J(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function _(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Q(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Z(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const ee=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=Z(t,t.left,t.top),o=[];for(const l of r){const{id:e}=l,t=n.get(e);if(t){const n=J(Z(t),a);o.push({id:e,data:{droppableContainer:l,value:n}})}}return o.sort(_)};function te(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),l=a-r,i=o-n;if(r<a&&n<o){const n=t.width*t.height,r=e.width*e.height,a=l*i;return Number((a/(n+r-a)).toFixed(4))}return 0}const ne=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const o of r){const{id:e}=o,r=n.get(e);if(r){const n=te(r,t);n>0&&a.push({id:e,data:{droppableContainer:o,value:n}})}}return a.sort(Q)};function re(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:G}function ae(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}const oe=ae(1);const le={ignoreTransform:!1};function ie(e,t){void 0===t&&(t=le);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=y(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;const{scaleX:a,scaleY:o,x:l,y:i}=r,s=e.left-l-(1-a)*parseFloat(n),c=e.top-i-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=a?e.width/a:e.width,u=o?e.height/o:e.height;return{width:d,height:u,top:c,right:s+d,bottom:c+u,left:s}}(n,t,r))}const{top:r,left:a,width:o,height:l,bottom:i,right:s}=n;return{top:r,left:a,width:o,height:l,bottom:i,right:s}}function se(e){return ie(e,{ignoreTransform:!0})}function ce(e,t){const n=[];return e?function r(a){if(null!=t&&n.length>=t)return n;if(!a)return n;if(x(a)&&null!=a.scrollingElement&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!w(a)||C(a))return n;if(n.includes(a))return n;const o=y(e).getComputedStyle(a);return a!==e&&function(e,t){void 0===t&&(t=y(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(a,o)&&n.push(a),function(e,t){return void 0===t&&(t=y(e).getComputedStyle(e)),"fixed"===t.position}(a,o)?n:r(a.parentNode)}(e):n}function de(e){const[t]=ce(e,1);return null!=t?t:null}function ue(e){return g&&e?b(e)?e:v(e)?x(e)||e===S(e).scrollingElement?window:w(e)?e:null:null:null}function pe(e){return b(e)?e.scrollX:e.scrollLeft}function he(e){return b(e)?e.scrollY:e.scrollTop}function fe(e){return{x:pe(e),y:he(e)}}var me,ge;function be(e){return!(!g||!e)&&e===document.scrollingElement}function ve(e){const t={x:0,y:0},n=be(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}(ge=me||(me={}))[ge.Forward=1]="Forward",ge[ge.Backward=-1]="Backward";const ye={x:.2,y:.2};function xe(e,t,n,r,a){let{top:o,left:l,right:i,bottom:s}=n;void 0===r&&(r=10),void 0===a&&(a=ye);const{isTop:c,isBottom:d,isLeft:u,isRight:p}=ve(e),h={x:0,y:0},f={x:0,y:0},m=t.height*a.y,g=t.width*a.x;return!c&&o<=t.top+m?(h.y=me.Backward,f.y=r*Math.abs((t.top+m-o)/m)):!d&&s>=t.bottom-m&&(h.y=me.Forward,f.y=r*Math.abs((t.bottom-m-s)/m)),!p&&i>=t.right-g?(h.x=me.Forward,f.x=r*Math.abs((t.right-g-i)/g)):!u&&l<=t.left+g&&(h.x=me.Backward,f.x=r*Math.abs((t.left+g-l)/g)),{direction:h,speed:f}}function we(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function Ce(e){return e.reduce((e,t)=>P(e,fe(t)),G)}const Se=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+pe(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+he(t),0)}]];class Re{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=ce(t),r=Ce(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[a,o,l]of Se)for(const e of o)Object.defineProperty(this,e,{get:()=>{const t=l(n),o=r[a]-t;return this.rect[e]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ee{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function ke(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var Ne,je,ze,De;function Me(e){e.preventDefault()}function Te(e){e.stopPropagation()}(je=Ne||(Ne={})).Click="click",je.DragStart="dragstart",je.Keydown="keydown",je.ContextMenu="contextmenu",je.Resize="resize",je.SelectionChange="selectionchange",je.VisibilityChange="visibilitychange",(De=ze||(ze={})).Space="Space",De.Down="ArrowDown",De.Right="ArrowRight",De.Left="ArrowLeft",De.Up="ArrowUp",De.Esc="Escape",De.Enter="Enter",De.Tab="Tab";const Pe={start:[ze.Space,ze.Enter],cancel:[ze.Esc],end:[ze.Space,ze.Enter,ze.Tab]},Ae=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case ze.Right:return{...n,x:n.x+25};case ze.Left:return{...n,x:n.x-25};case ze.Down:return{...n,y:n.y+25};case ze.Up:return{...n,y:n.y-25}}};class Le{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new Ee(S(t)),this.windowListeners=new Ee(y(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ne.Resize,this.handleCancel),this.windowListeners.add(Ne.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ne.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=ie),!e)return;const{top:n,left:r,bottom:a,right:o}=t(e);de(e)&&(a<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(G)}handleKeyDown(e){if(L(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:a=Pe,coordinateGetter:o=Ae,scrollBehavior:l="smooth"}=r,{code:i}=e;if(a.end.includes(i))return void this.handleEnd(e);if(a.cancel.includes(i))return void this.handleCancel(e);const{collisionRect:s}=n.current,c=s?{x:s.left,y:s.top}:G;this.referenceCoordinates||(this.referenceCoordinates=c);const d=o(e,{active:t,context:n.current,currentCoordinates:c});if(d){const t=A(d,c),r={x:0,y:0},{scrollableAncestors:a}=n.current;for(const n of a){const a=e.code,{isTop:o,isRight:i,isLeft:s,isBottom:c,maxScroll:u,minScroll:p}=ve(n),h=we(n),f={x:Math.min(a===ze.Right?h.right-h.width/2:h.right,Math.max(a===ze.Right?h.left:h.left+h.width/2,d.x)),y:Math.min(a===ze.Down?h.bottom-h.height/2:h.bottom,Math.max(a===ze.Down?h.top:h.top+h.height/2,d.y))},m=a===ze.Right&&!i||a===ze.Left&&!s,g=a===ze.Down&&!c||a===ze.Up&&!o;if(m&&f.x!==d.x){const e=n.scrollLeft+t.x,o=a===ze.Right&&e<=u.x||a===ze.Left&&e>=p.x;if(o&&!t.y)return void n.scrollTo({left:e,behavior:l});r.x=o?n.scrollLeft-e:a===ze.Right?n.scrollLeft-u.x:n.scrollLeft-p.x,r.x&&n.scrollBy({left:-r.x,behavior:l});break}if(g&&f.y!==d.y){const e=n.scrollTop+t.y,o=a===ze.Down&&e<=u.y||a===ze.Up&&e>=p.y;if(o&&!t.x)return void n.scrollTo({top:e,behavior:l});r.y=o?n.scrollTop-e:a===ze.Down?n.scrollTop-u.y:n.scrollTop-p.y,r.y&&n.scrollBy({top:-r.y,behavior:l});break}}this.handleMove(e,P(A(d,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Fe(e){return Boolean(e&&"distance"in e)}function $e(e){return Boolean(e&&"delay"in e)}Le.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Pe,onActivation:a}=t,{active:o}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const t=o.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==a||a({event:e.nativeEvent}),!0)}return!1}}];class Be{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=y(e);return e instanceof t?e:S(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:a}=e,{target:o}=a;this.props=e,this.events=t,this.document=S(o),this.documentListeners=new Ee(this.document),this.listeners=new Ee(n),this.windowListeners=new Ee(y(o)),this.initialCoordinates=null!=(r=F(a))?r:G,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Ne.Resize,this.handleCancel),this.windowListeners.add(Ne.DragStart,Me),this.windowListeners.add(Ne.VisibilityChange,this.handleCancel),this.windowListeners.add(Ne.ContextMenu,Me),this.documentListeners.add(Ne.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($e(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(Fe(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Ne.Click,Te,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ne.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:a}=this,{onMove:o,options:{activationConstraint:l}}=a;if(!r)return;const i=null!=(t=F(e))?t:G,s=A(r,i);if(!n&&l){if(Fe(l)){if(null!=l.tolerance&&ke(s,l.tolerance))return this.handleCancel();if(ke(s,l.distance))return this.handleStart()}return $e(l)&&ke(s,l.tolerance)?this.handleCancel():void this.handlePending(l,s)}e.cancelable&&e.preventDefault(),o(i)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===ze.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Oe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Ie extends Be{constructor(e){const{event:t}=e,n=S(t.target);super(e,Oe,n)}}Ie.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const qe={move:{name:"mousemove"},end:{name:"mouseup"}};var He,We;(We=He||(He={}))[We.RightClick=2]="RightClick";(class extends Be{constructor(e){super(e,qe,S(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==He.RightClick&&(null==r||r({event:n}),!0)}}];const Ue={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var Ke,Ve,Xe,Ye;function Ge(e){let{acceleration:t,activator:r=Ke.Pointer,canScroll:a,draggingRect:o,enabled:l,interval:i=5,order:s=Xe.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:p,threshold:h}=e;const f=function(e){let{delta:t,disabled:n}=e;const r=z(t);return N(e=>{if(n||!r||!e)return Je;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[me.Backward]:e.x[me.Backward]||-1===a.x,[me.Forward]:e.x[me.Forward]||1===a.x},y:{[me.Backward]:e.y[me.Backward]||-1===a.y,[me.Forward]:e.y[me.Forward]||1===a.y}}},[n,t,r])}({delta:p,disabled:!l}),[m,g]=function(){const e=n.useRef(null);return[n.useCallback((t,n)=>{e.current=setInterval(t,n)},[]),n.useCallback(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),b=n.useRef({x:0,y:0}),v=n.useRef({x:0,y:0}),y=n.useMemo(()=>{switch(r){case Ke.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Ke.DraggableRect:return o}},[r,o,c]),x=n.useRef(null),w=n.useCallback(()=>{const e=x.current;if(!e)return;const t=b.current.x*v.current.x,n=b.current.y*v.current.y;e.scrollBy(t,n)},[]),C=n.useMemo(()=>s===Xe.TreeOrder?[...d].reverse():d,[s,d]);n.useEffect(()=>{if(l&&d.length&&y){for(const e of C){if(!1===(null==a?void 0:a(e)))continue;const n=d.indexOf(e),r=u[n];if(!r)continue;const{direction:o,speed:l}=xe(e,r,y,t,h);for(const e of["x","y"])f[e][o[e]]||(l[e]=0,o[e]=0);if(l.x>0||l.y>0)return g(),x.current=e,m(w,i),b.current=l,void(v.current=o)}b.current={x:0,y:0},v.current={x:0,y:0},g()}else g()},[t,w,a,g,l,i,JSON.stringify(y),JSON.stringify(f),m,d,C,u,JSON.stringify(h)])}(class extends Be{constructor(e){super(e,Ue)}static setup(){return window.addEventListener(Ue.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Ue.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return!(a.length>1)&&(null==r||r({event:n}),!0)}}],(Ve=Ke||(Ke={}))[Ve.Pointer=0]="Pointer",Ve[Ve.DraggableRect=1]="DraggableRect",(Ye=Xe||(Xe={}))[Ye.TreeOrder=0]="TreeOrder",Ye[Ye.ReversedTreeOrder=1]="ReversedTreeOrder";const Je={x:{[me.Backward]:!1,[me.Forward]:!1},y:{[me.Backward]:!1,[me.Forward]:!1}};var _e,Qe,Ze;(Qe=_e||(_e={}))[Qe.Always=0]="Always",Qe[Qe.BeforeDragging=1]="BeforeDragging",Qe[Qe.WhileDragging=2]="WhileDragging",(Ze||(Ze={})).Optimized="optimized";const et=new Map;function tt(e,t){return N(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function nt(e){let{callback:t,disabled:r}=e;const a=E(t),o=n.useMemo(()=>{if(r||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(a)},[r]);return n.useEffect(()=>()=>null==o?void 0:o.disconnect(),[o]),o}function rt(e){return new Re(ie(e),e)}function at(e,t,r){void 0===t&&(t=rt);const[a,o]=n.useState(null);function l(){o(n=>{if(!e)return null;var a;if(!1===e.isConnected)return null!=(a=null!=n?n:r)?a:null;const o=t(e);return JSON.stringify(n)===JSON.stringify(o)?n:o})}const i=function(e){let{callback:t,disabled:r}=e;const a=E(t),o=n.useMemo(()=>{if(r||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(a)},[a,r]);return n.useEffect(()=>()=>null==o?void 0:o.disconnect(),[o]),o}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){l();break}}}}),s=nt({callback:l});return R(()=>{l(),e?(null==s||s.observe(e),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==s||s.disconnect(),null==i||i.disconnect())},[e]),a}const ot=[];function lt(e,t){void 0===t&&(t=[]);const r=n.useRef(null);return n.useEffect(()=>{r.current=null},t),n.useEffect(()=>{const t=e!==G;t&&!r.current&&(r.current=e),!t&&r.current&&(r.current=null)},[e]),r.current?A(e,r.current):G}function it(e){return n.useMemo(()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null,[e])}const st=[];function ct(e){let{measure:t}=e;const[r,a]=n.useState(null),o=nt({callback:n.useCallback(e=>{for(const{target:n}of e)if(w(n)){a(e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),l=n.useCallback(e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return w(t)?t:e}(e);null==o||o.disconnect(),n&&(null==o||o.observe(n)),a(n?t(n):null)},[t,o]),[i,s]=j(l);return n.useMemo(()=>({nodeRef:i,rect:r,setRef:s}),[r,i,s])}const dt=[{sensor:Ie,options:{}},{sensor:Le,options:{}}],ut={current:{}},pt={draggable:{measure:se},droppable:{measure:se,strategy:_e.WhileDragging,frequency:Ze.Optimized},dragOverlay:{measure:ie}};class ht extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const ft={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ht,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Y},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:pt,measureDroppableContainers:Y,windowRect:null,measuringScheduled:!1},mt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Y,draggableNodes:new Map,over:null,measureDroppableContainers:Y},gt=n.createContext(mt),bt=n.createContext(ft);function vt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ht}}}function yt(e,t){switch(t.type){case V.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case V.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case V.DragEnd:case V.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case V.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new ht(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case V.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const l=new ht(e.droppable.containers);return l.set(n,{...o,disabled:a}),{...e,droppable:{...e.droppable,containers:l}}}case V.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const o=new ht(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function xt(e){let{disabled:t}=e;const{active:r,activatorEvent:a,draggableNodes:o}=n.useContext(gt),l=z(a),i=z(null==r?void 0:r.id);return n.useEffect(()=>{if(!t&&!a&&l&&null!=i){if(!L(l))return;if(document.activeElement===l.target)return;const e=o.get(i);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=B(e);if(t){t.focus();break}}})}},[a,t,o,i,l]),null}const wt=n.createContext({...G,scaleX:1,scaleY:1});var Ct,St;(St=Ct||(Ct={}))[St.Uninitialized=0]="Uninitialized",St[St.Initializing=1]="Initializing",St[St.Initialized=2]="Initialized";const Rt=n.memo(function(e){var t,r,o,l;let{id:i,accessibility:s,autoScroll:c=!0,children:d,sensors:u=dt,collisionDetection:p=ne,measuring:h,modifiers:f,...m}=e;const b=n.useReducer(yt,void 0,vt),[v,x]=b,[w,C]=function(){const[e]=n.useState(()=>new Set),t=n.useCallback(t=>(e.add(t),()=>e.delete(t)),[e]);return[n.useCallback(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]),t]}(),[S,E]=n.useState(Ct.Uninitialized),j=S===Ct.Initialized,{draggable:{active:z,nodes:D,translate:T},droppable:{containers:A}}=v,L=null!=z?D.get(z):null,$=n.useRef({initial:null,translated:null}),B=n.useMemo(()=>{var e;return null!=z?{id:z,data:null!=(e=null==L?void 0:L.data)?e:ut,rect:$}:null},[z,L]),O=n.useRef(null),[I,q]=n.useState(null),[W,U]=n.useState(null),X=k(m,Object.values(m)),Y=M("DndDescribedBy",i),J=n.useMemo(()=>A.getEnabled(),[A]),_=(Q=h,n.useMemo(()=>({draggable:{...pt.draggable,...null==Q?void 0:Q.draggable},droppable:{...pt.droppable,...null==Q?void 0:Q.droppable},dragOverlay:{...pt.dragOverlay,...null==Q?void 0:Q.dragOverlay}}),[null==Q?void 0:Q.draggable,null==Q?void 0:Q.droppable,null==Q?void 0:Q.dragOverlay]));var Q;const{droppableRects:Z,measureDroppableContainers:ee,measuringScheduled:te}=function(e,t){let{dragging:r,dependencies:a,config:o}=t;const[l,i]=n.useState(null),{frequency:s,measure:c,strategy:d}=o,u=n.useRef(e),p=function(){switch(d){case _e.Always:return!1;case _e.BeforeDragging:return r;default:return!r}}(),h=k(p),f=n.useCallback(function(e){void 0===e&&(e=[]),h.current||i(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[h]),m=n.useRef(null),g=N(t=>{if(p&&!r)return et;if(!t||t===et||u.current!==e||null!=l){const t=new Map;for(let n of e){if(!n)continue;if(l&&l.length>0&&!l.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new Re(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,l,r,p,c]);return n.useEffect(()=>{u.current=e},[e]),n.useEffect(()=>{p||f()},[r,p]),n.useEffect(()=>{l&&l.length>0&&i(null)},[JSON.stringify(l)]),n.useEffect(()=>{p||"number"!=typeof s||null!==m.current||(m.current=setTimeout(()=>{f(),m.current=null},s))},[s,p,f,...a]),{droppableRects:g,measureDroppableContainers:f,measuringScheduled:null!=l}}(J,{dragging:j,dependencies:[T.x,T.y],config:_.droppable}),ae=function(e,t){const n=null!=t?e.get(t):void 0,r=n?n.node.current:null;return N(e=>{var n;return null==t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(D,z),le=n.useMemo(()=>W?F(W):null,[W]),se=function(){const e=!1===(null==I?void 0:I.autoScrollEnabled),t="object"==typeof c?!1===c.enabled:!1===c,n=j&&!e&&!t;if("object"==typeof c)return{...c,enabled:n};return{enabled:n}}(),pe=function(e,t){return tt(e,t)}(ae,_.draggable.measure);!function(e){let{activeNode:t,measure:r,initialRect:a,config:o=!0}=e;const l=n.useRef(!1),{x:i,y:s}="boolean"==typeof o?{x:o,y:o}:o;R(()=>{if(!i&&!s||!t)return void(l.current=!1);if(l.current||!a)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const n=re(r(e),a);if(i||(n.x=0),s||(n.y=0),l.current=!0,Math.abs(n.x)>0||Math.abs(n.y)>0){const t=de(e);t&&t.scrollBy({top:n.y,left:n.x})}},[t,i,s,a,r])}({activeNode:null!=z?D.get(z):null,config:se.layoutShiftCompensation,initialRect:pe,measure:_.draggable.measure});const he=at(ae,_.draggable.measure,pe),me=at(ae?ae.parentElement:null),ge=n.useRef({activatorEvent:null,active:null,activeNode:ae,collisionRect:null,collisions:null,droppableRects:Z,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ve=A.getNodeFor(null==(t=ge.current.over)?void 0:t.id),ye=ct({measure:_.dragOverlay.measure}),xe=null!=(r=ye.nodeRef.current)?r:ae,we=j?null!=(o=ye.rect)?o:he:null,Se=Boolean(ye.nodeRef.current&&ye.rect),Ee=re(ke=Se?null:he,tt(ke));var ke;const Ne=it(xe?y(xe):null),je=function(e){const t=n.useRef(e),r=N(n=>e?n&&n!==ot&&e&&t.current&&e.parentNode===t.current.parentNode?n:ce(e):ot,[e]);return n.useEffect(()=>{t.current=e},[e]),r}(j?null!=ve?ve:ae:null),ze=function(e,t){void 0===t&&(t=ie);const[r]=e,a=it(r?y(r):null),[o,l]=n.useState(st);function i(){l(()=>e.length?e.map(e=>be(e)?a:new Re(t(e),e)):st)}const s=nt({callback:i});return R(()=>{null==s||s.disconnect(),i(),e.forEach(e=>null==s?void 0:s.observe(e))},[e]),o}(je),De=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}(f,{transform:{x:T.x-Ee.x,y:T.y-Ee.y,scaleX:1,scaleY:1},activatorEvent:W,active:B,activeNodeRect:he,containerNodeRect:me,draggingNodeRect:we,over:ge.current.over,overlayNodeRect:ye.rect,scrollableAncestors:je,scrollableAncestorRects:ze,windowRect:Ne}),Me=le?P(le,T):null,Te=function(e){const[t,r]=n.useState(null),a=n.useRef(e),o=n.useCallback(e=>{const t=ue(e.target);t&&r(e=>e?(e.set(t,fe(t)),new Map(e)):null)},[]);return n.useEffect(()=>{const t=a.current;if(e!==t){n(t);const l=e.map(e=>{const t=ue(e);return t?(t.addEventListener("scroll",o,{passive:!0}),[t,fe(t)]):null}).filter(e=>null!=e);r(l.length?new Map(l):null),a.current=e}return()=>{n(e),n(t)};function n(e){e.forEach(e=>{const t=ue(e);null==t||t.removeEventListener("scroll",o)})}},[o,e]),n.useMemo(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>P(e,t),G):Ce(e):G,[e,t])}(je),Pe=lt(Te),Ae=lt(Te,[he]),Le=P(De,Pe),Fe=we?oe(we,De):null,$e=B&&Fe?p({active:B,collisionRect:Fe,droppableRects:Z,droppableContainers:J,pointerCoordinates:Me}):null,Be=function(e,t){if(!e||0===e.length)return null;const[n]=e;return n[t]}($e,"id"),[Oe,Ie]=n.useState(null),qe=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(Se?De:P(De,Ae),null!=(l=null==Oe?void 0:Oe.rect)?l:null,he),He=n.useRef(null),We=n.useCallback((e,t)=>{let{sensor:n,options:r}=t;if(null==O.current)return;const o=D.get(O.current);if(!o)return;const l=e.nativeEvent,i=new n({active:O.current,activeNode:o,event:l,options:r,context:ge,onAbort(e){if(!D.get(e))return;const{onDragAbort:t}=X.current,n={id:e};null==t||t(n),w({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!D.get(e))return;const{onDragPending:a}=X.current,o={id:e,constraint:t,initialCoordinates:n,offset:r};null==a||a(o),w({type:"onDragPending",event:o})},onStart(e){const t=O.current;if(null==t)return;const n=D.get(t);if(!n)return;const{onDragStart:r}=X.current,o={activatorEvent:l,active:{id:t,data:n.data,rect:$}};a.unstable_batchedUpdates(()=>{null==r||r(o),E(Ct.Initializing),x({type:V.DragStart,initialCoordinates:e,active:t}),w({type:"onDragStart",event:o}),q(He.current),U(l)})},onMove(e){x({type:V.DragMove,coordinates:e})},onEnd:s(V.DragEnd),onCancel:s(V.DragCancel)});function s(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=ge.current;let i=null;if(t&&o){const{cancelDrop:a}=X.current;if(i={activatorEvent:l,active:t,collisions:n,delta:o,over:r},e===V.DragEnd&&"function"==typeof a){await Promise.resolve(a(i))&&(e=V.DragCancel)}}O.current=null,a.unstable_batchedUpdates(()=>{x({type:e}),E(Ct.Uninitialized),Ie(null),q(null),U(null),He.current=null;const t=e===V.DragEnd?"onDragEnd":"onDragCancel";if(i){const e=X.current[t];null==e||e(i),w({type:t,event:i})}})}}He.current=i},[D]),Ue=function(e,t){return n.useMemo(()=>e.reduce((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}))]},[]),[e,t])}(u,n.useCallback((e,t)=>(n,r)=>{const a=n.nativeEvent,o=D.get(r);if(null!==O.current||!o||a.dndKit||a.defaultPrevented)return;const l={active:o};!0===e(n,t.options,l)&&(a.dndKit={capturedBy:t.sensor},O.current=r,We(n,t))},[D,We]));!function(e){n.useEffect(()=>{if(!g)return;const t=e.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const e of t)null==e||e()}},e.map(e=>{let{sensor:t}=e;return t}))}(u),R(()=>{he&&S===Ct.Initializing&&E(Ct.Initialized)},[he,S]),n.useEffect(()=>{const{onDragMove:e}=X.current,{active:t,activatorEvent:n,collisions:r,over:o}=ge.current;if(!t||!n)return;const l={active:t,activatorEvent:n,collisions:r,delta:{x:Le.x,y:Le.y},over:o};a.unstable_batchedUpdates(()=>{null==e||e(l),w({type:"onDragMove",event:l})})},[Le.x,Le.y]),n.useEffect(()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=ge.current;if(!e||null==O.current||!t||!o)return;const{onDragOver:l}=X.current,i=r.get(Be),s=i&&i.rect.current?{id:i.id,rect:i.rect.current,data:i.data,disabled:i.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:s};a.unstable_batchedUpdates(()=>{Ie(s),null==l||l(c),w({type:"onDragOver",event:c})})},[Be]),R(()=>{ge.current={activatorEvent:W,active:B,activeNode:ae,collisionRect:Fe,collisions:$e,droppableRects:Z,draggableNodes:D,draggingNode:xe,draggingNodeRect:we,droppableContainers:A,over:Oe,scrollableAncestors:je,scrollAdjustedTranslate:Le},$.current={initial:we,translated:Fe}},[B,ae,$e,Fe,D,xe,we,Z,A,Oe,je,Le]),Ge({...se,delta:T,draggingRect:Fe,pointerCoordinates:Me,scrollableAncestors:je,scrollableAncestorRects:ze});const Ke=n.useMemo(()=>({active:B,activeNode:ae,activeNodeRect:he,activatorEvent:W,collisions:$e,containerNodeRect:me,dragOverlay:ye,draggableNodes:D,droppableContainers:A,droppableRects:Z,over:Oe,measureDroppableContainers:ee,scrollableAncestors:je,scrollableAncestorRects:ze,measuringConfiguration:_,measuringScheduled:te,windowRect:Ne}),[B,ae,he,W,$e,me,ye,D,A,Z,Oe,ee,je,ze,_,te,Ne]),Ve=n.useMemo(()=>({activatorEvent:W,activators:Ue,active:B,activeNodeRect:he,ariaDescribedById:{draggable:Y},dispatch:x,draggableNodes:D,over:Oe,measureDroppableContainers:ee}),[W,Ue,B,he,x,Y,D,Oe,ee]);return n.createElement(H.Provider,{value:C},n.createElement(gt.Provider,{value:Ve},n.createElement(bt.Provider,{value:Ke},n.createElement(wt.Provider,{value:qe},d)),n.createElement(xt,{disabled:!1===(null==s?void 0:s.restoreFocus)})),n.createElement(K,{...s,hiddenTextDescribedById:Y}))}),Et=n.createContext(null),kt="button";function Nt(e){let{id:t,data:r,disabled:a=!1,attributes:o}=e;const l=M("Draggable"),{activators:i,activatorEvent:s,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:p,over:h}=n.useContext(gt),{role:f=kt,roleDescription:m="draggable",tabIndex:g=0}=null!=o?o:{},b=(null==c?void 0:c.id)===t,v=n.useContext(b?wt:Et),[y,x]=j(),[w,C]=j(),S=function(e,t){return n.useMemo(()=>e.reduce((e,n)=>{let{eventName:r,handler:a}=n;return e[r]=e=>{a(e,t)},e},{}),[e,t])}(i,t),E=k(r);R(()=>(p.set(t,{id:t,key:l,node:y,activatorNode:w,data:E}),()=>{const e=p.get(t);e&&e.key===l&&p.delete(t)}),[p,t]);return{active:c,activatorEvent:s,activeNodeRect:d,attributes:n.useMemo(()=>({role:f,tabIndex:g,"aria-disabled":a,"aria-pressed":!(!b||f!==kt)||void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[a,f,g,b,m,u.draggable]),isDragging:b,listeners:a?void 0:S,node:y,over:h,setNodeRef:x,setActivatorNodeRef:C,transform:v}}const jt={timeout:25};const zt=({slotPosition:e,isEditing:r,isDragging:a,children:o})=>{const{attributes:l,listeners:i,setNodeRef:s,transform:c}=Nt({id:`slot-${e}`,data:{slotPosition:e},disabled:!r}),{setNodeRef:d,isOver:u}=function(e){let{data:t,disabled:r=!1,id:a,resizeObserverConfig:o}=e;const l=M("Droppable"),{active:i,dispatch:s,over:c,measureDroppableContainers:d}=n.useContext(gt),u=n.useRef({disabled:r}),p=n.useRef(!1),h=n.useRef(null),f=n.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:b}={...jt,...o},v=k(null!=g?g:a),y=nt({callback:n.useCallback(()=>{p.current?(null!=f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{d(Array.isArray(v.current)?v.current:[v.current]),f.current=null},b)):p.current=!0},[b]),disabled:m||!i}),x=n.useCallback((e,t)=>{y&&(t&&(y.unobserve(t),p.current=!1),e&&y.observe(e))},[y]),[w,C]=j(x),S=k(t);return n.useEffect(()=>{y&&w.current&&(y.disconnect(),p.current=!1,y.observe(w.current))},[w,y]),n.useEffect(()=>(s({type:V.RegisterDroppable,element:{id:a,key:l,disabled:r,node:w,rect:h,data:S}}),()=>s({type:V.UnregisterDroppable,key:l,id:a})),[a]),n.useEffect(()=>{r!==u.current.disabled&&(s({type:V.SetDroppableDisabled,id:a,key:l,disabled:r}),u.current.disabled=r)},[a,l,r,s]),{active:i,rect:h,isOver:(null==c?void 0:c.id)===a,node:w,over:c,setNodeRef:C}}({id:`drop-${e}`,data:{slotPosition:e}}),p={position:"relative",height:"100%",width:"100%",transform:c?`translate3d(${c.x}px, ${c.y}px, 0)`:void 0},h=n.useCallback(e=>{s(e),d(e)},[s,d]);return t.jsxs("div",{ref:h,style:p,className:`slot-with-overlay ${r?"edit-mode":""} ${a?"dragging":""} ${u?"drag-over":""}`,children:[o,r&&t.jsxs("div",{className:"slot-edit-overlay",...l,...i,children:[t.jsx("div",{className:"drag-indicator",children:"⋮⋮"}),t.jsx("div",{className:"slot-position-label",children:e.toUpperCase()})]})]})},Dt=({layout:e,activeSlot:r})=>{const[a,o]=n.useState(new Map);return n.useEffect(()=>{const e=()=>{const e=new Map;["left","middle","right"].forEach(t=>{const n=document.querySelector(`[data-slot="${t}"]`);if(n){const r=n.getBoundingClientRect();e.set(t,r)}}),o(e)};e(),window.addEventListener("resize",e);const t=setInterval(e,100);return()=>{window.removeEventListener("resize",e),clearInterval(t)}},[e]),t.jsx("div",{style:{pointerEvents:"none",position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:999},children:["left","middle","right"].map(n=>{if(!e[n])return null;const o=a.get(n);if(!o)return null;const l=r===n;return t.jsx("div",{style:{position:"fixed",top:o.top,left:o.left,width:o.width,height:o.height,pointerEvents:"auto"},children:t.jsx(zt,{slotPosition:n,isEditing:!0,isDragging:l,children:t.jsx("div",{style:{height:"100%"}})})},n)})})},Mt=e=>null!=e&&"object"==typeof e&&"type"in e,Tt=e=>null==e?[]:"string"==typeof e?[e]:Mt(e)?e.panels:[];e.AnimatedResizableLayout=({leftPanel:e,rightPanel:a,collapsibleSide:o="left",defaultSize:i=25,minSize:s=5,className:c="",collapsed:d=!1,style:u,showCollapseButton:p=!1,animationDuration:h=300,animationEasing:f="cubic-bezier(0.4, 0, 0.2, 1)",onCollapseStart:m,onCollapseComplete:g,onExpandStart:b,onExpandComplete:v,theme:y})=>{const[x,w]=n.useState(d),[C,S]=n.useState(!1),[R,E]=n.useState(!1),[k,N]=n.useState(d),[j,z]=n.useState(d?0:i),D=n.useRef(null),M=n.useRef(void 0),T=n.useRef(void 0),P=n.useRef(void 0),A=n.useCallback((e,t,n)=>{if(!D.current)return;M.current&&cancelAnimationFrame(M.current),T.current=performance.now();const r=a=>{if(!T.current||!D.current)return;const o=a-T.current,l=Math.min(o/h,1),i=l<.5?4*l*l*l:1-Math.pow(-2*l+2,3)/2,s=e+(t-e)*i;D.current.resize(s),l<1?M.current=requestAnimationFrame(r):(0===t?D.current.collapse():D.current.resize(t),S(!1),n&&n())};M.current=requestAnimationFrame(r)},[h]),L=n.useCallback(()=>{C||R||(S(!0),w(!0),m&&m(),A(j,0,()=>{z(0),N(!0),g&&g()}))},[C,R,j,A,m,g]),F=n.useCallback(()=>{C||R||(S(!0),w(!1),N(!1),b&&b(),A(0,i,()=>{z(i),v&&v()}))},[C,R,i,A,b,v]),$=n.useCallback(()=>{x?F():L()},[x,L,F]),B=n.useCallback(e=>{C||(z(e),e>0&&w(!1))},[C]),O=n.useCallback(()=>{E(!0)},[]),I=n.useCallback(()=>{E(!1)},[]);n.useEffect(()=>{d!==x&&(d?L():F())},[d]),n.useEffect(()=>{d&&!C?N(!0):d||C||N(!1)},[d,C]),n.useEffect(()=>{const e=M.current,t=P.current;return()=>{e&&cancelAnimationFrame(e),t&&clearTimeout(t)}},[]);const q="left"===o,H=x?q?"▸":"◂":q?"◂":"▸",W=l(y),U=C&&!R?{transition:`flex ${h}ms ${f}`}:void 0,K=e=>{let t="hybrid-panel";return e&&(t+=" collapsible-panel",C&&!R&&(t+=" animating"),x&&(t+=" collapsed")),t};return t.jsx("div",{className:`animated-resizable-layout ${c}`,style:{...W,...u},children:t.jsxs(r.PanelGroup,{direction:"horizontal",onLayout:I,children:[t.jsx(r.Panel,{ref:q?D:void 0,collapsible:q,defaultSize:q?d?0:i:void 0,minSize:q?s:30,collapsedSize:0,onResize:q?B:void 0,onCollapse:q?()=>w(!0):void 0,onExpand:q?()=>w(!1):void 0,className:K(q),style:q?U:void 0,children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:q&&x?0:1,transition:C?`opacity ${.5*h}ms ${f}`:"none"},children:e})}),t.jsx(r.PanelResizeHandle,{className:"resize-handle "+(k?"collapsed":""),onDragging:O,style:k?{visibility:"hidden",width:0}:void 0,children:p&&t.jsx("div",{className:"handle-bar",children:t.jsx("button",{onClick:$,className:"collapse-toggle",disabled:C,"aria-label":x?"Expand panel":"Collapse panel",children:H})})}),t.jsx(r.Panel,{ref:q?void 0:D,collapsible:!q,defaultSize:q?void 0:d?0:i,minSize:q?30:s,collapsedSize:0,onResize:q?void 0:B,onCollapse:q?void 0:()=>w(!0),onExpand:q?void 0:()=>w(!1),className:K(!q),style:q?void 0:U,children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:!q&&x?0:1,transition:C?`opacity ${.5*h}ms ${f}`:"none"},children:a})})]})})},e.AnimatedVerticalLayout=({topPanel:e,bottomPanel:a,collapsiblePanels:o={top:!0,bottom:!0},defaultSizes:i={top:30,bottom:30},minSizes:s={top:5,bottom:5},className:c="",collapsed:d={top:!1,bottom:!1},style:u,showCollapseButtons:p=!1,animationDuration:h=300,animationEasing:f="cubic-bezier(0.4, 0, 0.2, 1)",theme:m,onTopCollapseStart:g,onTopCollapseComplete:b,onTopExpandStart:v,onTopExpandComplete:y,onBottomCollapseStart:x,onBottomCollapseComplete:w,onBottomExpandStart:C,onBottomExpandComplete:S,onPanelResize:R})=>{const[E,k]=n.useState(d.top||!1),[N,j]=n.useState(!1),[z,D]=n.useState(d.top?0:i.top),M=n.useRef(null),T=n.useRef(void 0),P=n.useRef(void 0),[A,L]=n.useState(d.bottom||!1),[F,$]=n.useState(!1),[B,O]=n.useState(d.bottom?0:i.bottom),I=n.useRef(null),q=n.useRef(void 0),H=n.useRef(void 0),[W,U]=n.useState(!1),K=n.useCallback((e,t,n)=>{if(!M.current)return;T.current&&cancelAnimationFrame(T.current),P.current=performance.now();const r=a=>{if(!P.current||!M.current)return;const o=a-P.current,l=Math.min(o/h,1),i=l<.5?4*l*l*l:1-Math.pow(-2*l+2,3)/2,s=e+(t-e)*i;M.current.resize(s),l<1?T.current=requestAnimationFrame(r):(0===t?M.current.collapse():M.current.resize(t),j(!1),n&&n())};T.current=requestAnimationFrame(r)},[h]),V=n.useCallback((e,t,n)=>{if(!I.current)return;q.current&&cancelAnimationFrame(q.current),H.current=performance.now();const r=a=>{if(!H.current||!I.current)return;const o=a-H.current,l=Math.min(o/h,1),i=l<.5?4*l*l*l:1-Math.pow(-2*l+2,3)/2,s=e+(t-e)*i;I.current.resize(s),l<1?q.current=requestAnimationFrame(r):(0===t?I.current.collapse():I.current.resize(t),$(!1),n&&n())};q.current=requestAnimationFrame(r)},[h]),X=n.useCallback(()=>{N||W||!o.top||(j(!0),k(!0),g&&g(),K(z,0,()=>{D(0),b&&b()}))},[N,W,z,o.top,K,g,b]),Y=n.useCallback(()=>{N||W||!o.top||(j(!0),k(!1),v&&v(),K(0,i.top,()=>{D(i.top),y&&y()}))},[N,W,i.top,o.top,K,v,y]),G=n.useCallback(()=>{E?Y():X()},[E,X,Y]),J=n.useCallback(()=>{F||W||!o.bottom||($(!0),L(!0),x&&x(),V(B,0,()=>{O(0),w&&w()}))},[F,W,B,o.bottom,V,x,w]),_=n.useCallback(()=>{F||W||!o.bottom||($(!0),L(!1),C&&C(),V(0,i.bottom,()=>{O(i.bottom),S&&S()}))},[F,W,i.bottom,o.bottom,V,C,S]),Q=n.useCallback(()=>{A?_():J()},[A,J,_]),Z=n.useCallback(e=>{N||(D(e),e>0&&k(!1))},[N]),ee=n.useCallback(e=>{F||(O(e),e>0&&L(!1))},[F]),te=n.useCallback(()=>{U(!0)},[]),ne=n.useCallback(()=>{U(!1),R&&R({top:z,bottom:B})},[z,B,R]);n.useEffect(()=>{void 0!==d.top&&d.top!==E&&(d.top?X():Y())},[d.top]),n.useEffect(()=>{void 0!==d.bottom&&d.bottom!==A&&(d.bottom?J():_())},[d.bottom]),n.useEffect(()=>()=>{T.current&&cancelAnimationFrame(T.current),q.current&&cancelAnimationFrame(q.current)},[]);const re=l(m),ae=N&&!W?{transition:`flex ${h}ms ${f}`}:void 0,oe=F&&!W?{transition:`flex ${h}ms ${f}`}:void 0;return t.jsx("div",{className:`animated-vertical-layout ${c}`,style:{...re,...u},children:t.jsxs(r.PanelGroup,{direction:"vertical",onLayout:ne,children:[t.jsx(r.Panel,{ref:M,collapsible:o.top,defaultSize:d.top?0:i.top,minSize:s.top,collapsedSize:0,onResize:Z,onCollapse:()=>k(!0),onExpand:()=>k(!1),className:(()=>{let e="vertical-panel collapsible-panel";return N&&!W&&(e+=" animating"),E&&(e+=" collapsed"),e})(),style:ae,children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:E?0:1,transition:N?`opacity ${.5*h}ms ${f}`:"none"},children:e})}),t.jsx(r.PanelResizeHandle,{className:"vertical-resize-handle",onDragging:te,children:p&&t.jsxs("div",{className:"handle-bar",children:[o.top&&t.jsx("button",{onClick:G,className:"collapse-toggle collapse-toggle-top",disabled:N,"aria-label":E?"Expand top panel":"Collapse top panel",children:E?"▾":"▴"}),o.bottom&&t.jsx("button",{onClick:Q,className:"collapse-toggle collapse-toggle-bottom",disabled:F,"aria-label":A?"Expand bottom panel":"Collapse bottom panel",children:A?"▴":"▾"})]})}),t.jsx(r.Panel,{ref:I,collapsible:o.bottom,defaultSize:d.bottom?0:i.bottom,minSize:s.bottom,collapsedSize:0,onResize:ee,onCollapse:()=>L(!0),onExpand:()=>L(!1),className:(()=>{let e="vertical-panel collapsible-panel";return F&&!W&&(e+=" animating"),A&&(e+=" collapsed"),e})(),style:oe,children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:A?0:1,transition:F?`opacity ${.5*h}ms ${f}`:"none"},children:a})})]})})},e.CollapsibleSplitPane=({primaryContent:e,secondaryContent:a,collapsedHeader:o,collapsed:i,onCollapsedChange:s,ratio:c,onRatioChange:d,minRatio:u=.1,maxRatio:p=.8,collapsedHeight:h=28,theme:f,className:m="",style:g,animationDuration:b=200,onCollapseStart:v,onCollapseComplete:y,onExpandStart:x,onExpandComplete:w})=>{const[C,S]=n.useState(!1),[R,E]=n.useState(!1),k=n.useRef(null),N=n.useRef(void 0),j=n.useRef(void 0),z=n.useRef(c),D=e=>100*e;n.useEffect(()=>{!i&&c>0&&(z.current=c)},[i,c]);const M=n.useCallback((e,t,n)=>{if(!k.current)return;N.current&&cancelAnimationFrame(N.current),j.current=performance.now();const r=a=>{if(!j.current||!k.current)return;const o=a-j.current,l=Math.min(o/b,1),i=l<.5?4*l*l*l:1-Math.pow(-2*l+2,3)/2,s=e+(t-e)*i;k.current.resize(s),l<1?N.current=requestAnimationFrame(r):(0===t?k.current.collapse():k.current.resize(t),S(!1),n&&n())};N.current=requestAnimationFrame(r)},[b]),T=n.useCallback(()=>{if(C||R)return;S(!0),v?.();const e=D(c);M(e,0,()=>{s(!0),y?.()})},[C,R,c,M,s,v,y]),P=n.useCallback(()=>{if(C||R)return;S(!0),x?.();const e=z.current||c||.3,t=D(e);M(0,t,()=>{s(!1),d(e),w?.()})},[C,R,c,M,s,d,x,w]),A=n.useCallback(()=>{i?P():T()},[i,T,P]),L=n.useCallback(e=>{if(!C&&!i){const t=e/100;d(t)}},[C,i,d]),F=n.useCallback(()=>{E(!0)},[]),$=n.useCallback(()=>{E(!1)},[]);n.useEffect(()=>{if(i&&!C&&k.current){k.current.getSize()>0&&T()}else if(!i&&!C&&k.current){0===k.current.getSize()&&P()}},[i]),n.useEffect(()=>()=>{N.current&&cancelAnimationFrame(N.current)},[]);const B=l(f),O=["csp-secondary-panel",C&&!R?"csp-animating":"",i?"csp-collapsed":""].filter(Boolean).join(" ");return t.jsx("div",{className:`collapsible-split-pane ${m}`,style:{...B,...g},children:i?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"csp-collapsed-header",style:{height:h},onClick:A,role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),A())},"aria-expanded":!1,"aria-label":`Expand ${o.title}`,children:[o.icon&&t.jsx("span",{className:"csp-collapsed-header-icon",children:o.icon}),t.jsx("span",{className:"csp-collapsed-header-title",children:o.title}),t.jsx("button",{className:"csp-collapsed-header-expand",onClick:e=>{e.stopPropagation(),A()},"aria-label":`Expand ${o.title}`,children:t.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:t.jsx("path",{d:"M3 5L6 8L9 5"})})})]}),t.jsx("div",{className:"csp-primary-content-full",children:e})]}):t.jsxs(r.PanelGroup,{direction:"vertical",onLayout:$,children:[t.jsx(r.Panel,{ref:k,collapsible:!0,defaultSize:D(c),minSize:D(u),maxSize:D(p),collapsedSize:0,onResize:L,onCollapse:()=>s(!0),className:O,children:t.jsxs("div",{className:"csp-panel-content",children:[t.jsxs("div",{className:"csp-secondary-header",children:[o.icon&&t.jsx("span",{className:"csp-secondary-header-icon",children:o.icon}),t.jsx("span",{className:"csp-secondary-header-title",children:o.title}),t.jsx("button",{className:"csp-secondary-header-collapse",onClick:T,"aria-label":`Collapse ${o.title}`,children:t.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:t.jsx("path",{d:"M3 7L6 4L9 7"})})})]}),t.jsx("div",{className:"csp-secondary-body",children:a})]})}),t.jsx(r.PanelResizeHandle,{className:"csp-resize-handle",onDragging:F,children:t.jsx("div",{className:"csp-resize-handle-bar"})}),t.jsx(r.Panel,{className:"csp-primary-panel",minSize:20,children:t.jsx("div",{className:"csp-panel-content",children:e})})]})})},e.ConfigurablePanelLayout=h,e.EditableConfigurablePanelLayout=({isEditMode:e,onLayoutChange:r,panels:a,layout:o,...l})=>{const[i,s]=n.useState(null),[c,d]=n.useState({x:0,y:0}),u=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.useMemo(()=>[...t].filter(e=>null!=e),[...t])}((p=Ie,f={activationConstraint:{distance:8}},n.useMemo(()=>({sensor:p,options:null!=f?f:{}}),[p,f])));var p,f;const m=n.useCallback(e=>{const t=e.active.id;if(t.startsWith("slot-")){const e=t.replace("slot-","");s(e),d({x:0,y:0})}},[]),g=n.useCallback(e=>{const{delta:t}=e;d({x:t.x,y:t.y})},[]),b=n.useCallback(e=>{const{active:t,over:n}=e;if(s(null),d({x:0,y:0}),!n)return;const a=t.id,l=n.id,i=a.replace("slot-",""),c=l.replace("drop-","");if(i===c)return;const u={...o},p=u[i];u[i]=u[c],u[c]=p,r&&r(u)},[o,r]);n.useEffect(()=>{if(!i||!e)return;const t=document.querySelector(`[data-slot="${i}"]`);return t&&(t.setAttribute("data-dragging","true"),t.style.setProperty("transform",`scale(0.95) translate(${c.x}px, ${c.y}px)`,"important"),t.style.setProperty("z-index","1000","important"),t.style.setProperty("transition","none","important"),t.style.setProperty("opacity","0.95","important"),t.style.setProperty("box-shadow","0 12px 24px rgba(0, 0, 0, 0.25)","important")),()=>{t&&(t.removeAttribute("data-dragging"),t.style.removeProperty("transform"),t.style.removeProperty("z-index"),t.style.removeProperty("transition"),t.style.removeProperty("opacity"),t.style.removeProperty("box-shadow"))}},[i,c,e]);const v={left:{"data-slot":"left","data-edit-mode":e?"true":"false"},middle:{"data-slot":"middle","data-edit-mode":e?"true":"false"},right:{"data-slot":"right","data-edit-mode":e?"true":"false"}};return t.jsx(Rt,{sensors:u,collisionDetection:ee,onDragStart:m,onDragMove:g,onDragEnd:b,children:t.jsxs("div",{className:"editable-panel-layout "+(e?"edit-mode-active":""),children:[t.jsx(h,{...l,panels:a,layout:o,slotDataAttributes:v}),e&&t.jsx(Dt,{layout:o,activeSlot:i,onDragStart:()=>{},onDragEnd:()=>{}})]})})},e.PanelBoundsProvider=u,e.PanelConfigurator=({availablePanels:e,currentLayout:r,onChange:a,className:l="",theme:i})=>{const s=o.useTheme(),c=i||s.theme,[d,u]=n.useState(null),p=n.useCallback(t=>t&&e.find(e=>e.id===t)||null,[e]),h=n.useCallback(()=>[...e].sort((e,t)=>e.label.localeCompare(t.label)),[e]),f=n.useCallback(e=>{const t=Tt(r.left),n=Tt(r.middle),a=Tt(r.right);return t.includes(e)||n.includes(e)||a.includes(e)},[r]),m=n.useCallback((e,t)=>{const n={...e};return["left","middle","right"].forEach(e=>{const r=n[e];if(r===t)n[e]=null;else if(null!=r&&Mt(r)){const a=r.panels.filter(e=>e!==t);0===a.length?n[e]=null:1===a.length?n[e]=a[0]:n[e]={...r,panels:a}}}),n},[]),g=n.useCallback((e,t)=>{const n=r[e];if(!Mt(n)||"tabs"!==n.type)return;const o=n.panels.filter(e=>e!==t),l={...r};l[e]={...n,panels:o},a(l)},[r,a]),b=n.useCallback((e,t)=>{t.stopPropagation();const n=r[e];if(Mt(n)&&"tabs"===n.type){const t={...r};t[e]=n.panels.length>0?n.panels[0]:null,a(t),u(null)}else{const t=n&&"string"==typeof n?[n]:[],o={...r};o[e]={type:"tabs",panels:t,config:{defaultActiveTab:0,tabPosition:"top"}},a(o),u({type:"slot",position:e})}},[r,a]),v=n.useCallback(e=>{if(d)if("slot"===d.type){if(d.position===e)return;const t={...r},n=t[d.position];t[d.position]=t[e],t[e]=n,a(t),u(null)}else{const t=r[e];if(Mt(t)&&"tabs"===t.type){if(t.panels.includes(d.id))return void g(e,d.id);const n=t,o=m(r,d.id);return o[e]={...n,panels:[...n.panels,d.id]},void a(o)}{const t=m(r,d.id);t[e]=d.id,a(t),u(null)}}else u({type:"slot",position:e})},[d,r,a,m,g]),y=n.useCallback(e=>{if(d)if("slot"===d.type){const t=r[d.position];if(Mt(t)&&"tabs"===t.type){if(t.panels.includes(e))return void g(d.position,e);const n=t,o=m(r,e);return o[d.position]={...n,panels:[...n.panels,e]},void a(o)}{const t=m(r,e);t[d.position]=e,a(t),u(null)}}else u({type:"panel",id:e});else u({type:"panel",id:e})},[d,r,a,m,g]),x=n.useCallback((e,t)=>{t.stopPropagation();const n={...r};n[e]=null,a(n),u(null)},[r,a]),w=n.useCallback((e,t,n)=>{n.stopPropagation();const o=r[e];if(!Mt(o)||"tabs"!==o.type)return;const l=o.panels.filter(e=>e!==t),i={...r};i[e]={...o,panels:l},a(i)},[r,a]),C=n.useCallback((e,t)=>{const n=r[e];if(!Mt(n)||"tabs"!==n.type)return;const o={...r};o[e]={...n,config:{...n.config,...t}},a(o)},[r,a]),S=h(),R=e=>{const t=r[e];return Mt(t)&&"tabs"===t.type},E={"--configurator-bg":c.colors.background,"--configurator-title":c.colors.textSecondary,"--slot-bg":c.colors.backgroundSecondary,"--slot-border":c.colors.border,"--slot-border-hover":c.colors.textTertiary,"--slot-border-selected":c.colors.primary,"--slot-bg-selected":c.colors.backgroundLight,"--slot-label":c.colors.textTertiary,"--slot-content-text":c.colors.text,"--slot-preview-bg":c.colors.backgroundTertiary,"--slot-preview-border":c.colors.border,"--slot-preview-text":c.colors.textMuted,"--slot-empty-text":c.colors.textMuted,"--panel-bg":c.colors.backgroundSecondary,"--panel-border":c.colors.border,"--panel-border-hover":c.colors.textSecondary,"--panel-border-selected":c.colors.primary,"--panel-bg-selected":c.colors.backgroundLight,"--panel-label-text":c.colors.text,"--panel-preview-bg":c.colors.backgroundTertiary,"--panel-preview-text":c.colors.textMuted,"--clear-btn-bg":c.colors.error,"--clear-btn-text":c.colors.background,"--clear-btn-hover":c.colors.error,"--hint-bg":c.colors.backgroundLight,"--hint-border":c.colors.primary,"--hint-text":c.colors.text};return t.jsxs("div",{className:`panel-configurator ${l}`,style:E,children:[t.jsxs("div",{className:"configurator-section",children:[t.jsx("h3",{className:"section-title",children:"Panel Layout (3 Slots)"}),t.jsx("div",{className:"slots-container",children:["left","middle","right"].map(e=>{const n=r[e],a=(e=>"slot"===d?.type&&d.position===e)(e),o=Mt(n)&&"tabs"===n.type,l=null!==n;return t.jsxs("div",{"data-position":e,className:`slot ${a?"selected":""} ${l?"filled":"empty"} ${o?"tab-group":""}`,onClick:()=>v(e),children:[t.jsx("button",{className:"tab-mode-toggle "+(o?"active":""),onClick:t=>b(e,t),title:o?"Disable tab mode":"Enable tab mode",children:t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:t.jsx("path",{d:"M2 2h4v2H2V2zm5 0h4v2H7V2zm5 0h2v2h-2V2zM2 5h12v9H2V5zm1 1v7h10V6H3z"})})}),null===n?t.jsx("div",{className:"slot-empty-state",children:o?"Click panels to add tabs":"Empty"}):Mt(n)?t.jsxs("div",{className:"slot-content group-content",children:["tabs"===n.type&&n.panels.length>0&&t.jsx("div",{className:"tab-config-controls",children:t.jsxs("label",{className:"tab-config-label",children:["Tabs:",t.jsxs("select",{value:n.config?.tabPosition||"top",onChange:t=>C(e,{tabPosition:t.target.value}),onClick:e=>e.stopPropagation(),children:[t.jsx("option",{value:"top",children:"Top (centered)"}),t.jsx("option",{value:"bottom",children:"Bottom (centered)"}),t.jsx("option",{value:"left",children:"Left"}),t.jsx("option",{value:"right",children:"Right"})]})]})}),t.jsx("div",{className:"group-panels",children:0===n.panels.length?t.jsx("div",{className:"slot-empty-state",children:"Click panels to add tabs"}):n.panels.map((r,a)=>{const o=p(r),l="tabs"===n.type&&(n.config?.defaultActiveTab??0)===a;return o?t.jsxs("div",{className:"group-panel-item",children:[t.jsxs("span",{className:"group-panel-label",children:[o.label,l&&t.jsx("span",{className:"default-badge",children:"★"})]}),t.jsx("button",{className:"remove-from-group-btn",onClick:t=>w(e,r,t),title:`Remove ${o.label}`,children:"×"})]},r):null})})]}):t.jsxs("div",{className:"slot-content",children:["string"==typeof n&&p(n)?.preview&&t.jsx("div",{className:"slot-preview",children:p(n)?.preview}),t.jsx("div",{className:"slot-panel-label",children:"string"==typeof n?p(n)?.label:""}),t.jsx("button",{className:"slot-clear-btn",onClick:t=>x(e,t),"aria-label":`Remove ${"string"==typeof n?p(n)?.label:"panel"} from ${e} slot`,children:"×"})]})]},e)})})]}),t.jsxs("div",{className:"configurator-section",children:[t.jsx("h3",{className:"section-title",children:"Available Panels"}),t.jsx("div",{className:"available-panels",children:S.map(e=>{const n=(r=e.id,"panel"===d?.type&&d.id===r);var r;const a=f(e.id);return t.jsxs("div",{className:`available-panel ${n?"selected":""} ${a?"in-use":""}`,onClick:()=>y(e.id),children:[t.jsx("div",{className:"panel-label",children:e.label}),e.preview&&t.jsx("div",{className:"panel-preview",children:e.preview})]},e.id)})})]}),d&&t.jsx("div",{className:"selection-hint",children:"slot"===d.type?R(d.position)?t.jsxs(t.Fragment,{children:["Selected: ",d.position," slot (Tab Mode). Click panels to add them to the tab group."]}):t.jsxs(t.Fragment,{children:["Selected: ",d.position," slot. Click another slot to swap, or click a panel to assign."]}):t.jsxs(t.Fragment,{children:["Selected: ",p(d.id)?.label,". Click a slot to assign",R("left")||R("middle")||R("right")?" (or add to tab group)":"","."]})}),t.jsxs("div",{className:"usage-hint",children:[t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",style:{verticalAlign:"text-bottom",marginRight:"4px"},children:t.jsx("path",{d:"M8 1a7 7 0 100 14A7 7 0 008 1zm0 1a6 6 0 110 12A6 6 0 018 2zm.5 3.5v3h-1v-3h1zm0 4v1h-1v-1h1z"})}),t.jsx("strong",{children:"Tip:"})," Toggle the tab icon on a slot to enable tab mode, then click panels to add multiple tabs."]})]})},e.ResponsiveConfigurablePanelLayout=({mobileBreakpoint:e="(max-width: 768px)",mobileCarouselProps:r,onMobilePanelChange:a,theme:o,layout:l,panels:c,...d})=>{const u=m(e),p=n.useRef(null),[g,b]=n.useState(0),v=n.useMemo(()=>[l?.left,l?.middle,l?.right],[l]),y=["left","middle","right"],x=n.useMemo(()=>{const e=e=>{if(!e)return null;const t=c.find(t=>t.id===e);return t?.content??null},n=e=>{const t=c.find(t=>t.id===e);return t?.label??e},r=e=>{const t=c.find(t=>t.id===e);return t?.icon??null};return v.map((a,l)=>((a,l)=>{if(null==a)return null;if("object"==typeof a&&"type"in a){const e=a;if("tabs"===e.type){const a=e.panels[0],i=e.panels.length>0?n(a):"Tab Group",d=e.panels.length>0?r(a):null;return{content:t.jsx(s,{panelIds:e.panels,panels:c,config:e.config,theme:o}),label:i,icon:d,slot:l}}return null}return{content:e(a),label:n(a),icon:r(a),slot:l}})(a,y[l])).filter(e=>null!==e)},[v,c,o]),w=e=>{b(e),r?.onPanelChange?.(e);const t=x[e]?.slot;t&&a?.(e,t)},{onPanelChange:C,...S}=r??{},R=i(o);if(u){if(0===x.length)return null;const e=x.map(e=>e.content);return t.jsxs("div",{className:"mobile-tab-layout",style:R,children:[t.jsx("div",{className:"mobile-tab-content",children:t.jsx(f,{ref:p,theme:o,panels:e,minPanelWidth:0,idealPanelWidth:1,disableSwipe:!0,onPanelChange:w,...S})}),t.jsx("nav",{className:"mobile-tab-nav",role:"tablist",children:x.map((e,n)=>t.jsxs("button",{role:"tab","aria-selected":n===g,className:"mobile-tab-button "+(n===g?"active":""),onClick:()=>(e=>{b(e),p.current?.scrollToPanel(e);const t=x[e]?.slot;t&&a?.(e,t)})(n),children:[e.icon&&t.jsx("span",{className:"tab-icon",children:e.icon}),t.jsx("span",{className:"tab-label",children:e.label})]},n))})]})}return t.jsx(h,{theme:o,layout:l,panels:c,...d})},e.SnapCarousel=f,e.TabGroup=s,e.mapThemeToPanelVars=l,e.mapThemeToTabVars=i,e.useMediaQuery=m,e.usePanelBounds=p,e.usePanelOffset=function(){const{bounds:e}=p();return{offsetX:e.x,offsetY:e.y}},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("react"),require("react-resizable-panels"),require("react-dom"),require("@principal-ade/industry-theme")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","react","react-resizable-panels","react-dom","@principal-ade/industry-theme"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).A24ZPanels={},e["react/jsx-runtime"],e.React,e.ReactResizablePanels,e.ReactDOM,e.IndustryTheme)}(this,function(e,t,n,r,a,o){"use strict";function l(e){return{"--panel-background":e.colors.background,"--panel-border":e.colors.border,"--panel-handle":e.colors.backgroundSecondary,"--panel-handle-hover":e.colors.backgroundHover,"--panel-handle-active":e.colors.primary,"--panel-button-bg":e.colors.surface,"--panel-button-hover":e.colors.backgroundHover,"--panel-button-border":e.colors.border,"--panel-button-icon":e.colors.textSecondary,"--panel-accent-bg":e.colors.primary+"15"}}function i(e){return{"--tab-list-bg":e.colors.backgroundSecondary,"--tab-border":e.colors.border,"--tab-bg":e.colors.surface,"--tab-bg-hover":e.colors.backgroundHover,"--tab-bg-active":e.colors.primary,"--tab-text":e.colors.textSecondary,"--tab-text-hover":e.colors.text,"--tab-text-active":e.colors.background,"--tab-icon-color":e.colors.textTertiary,"--tab-icon-active":e.colors.background,"--tab-border-hover":e.colors.textSecondary,"--tab-border-active":e.colors.primary,"--tab-focus":e.colors.primary,"--tab-content-bg":e.colors.background,"--tab-empty-text":e.colors.textMuted,"--tab-font-family":e.fonts.body,"--tab-font-size":"11px","--tab-font-weight":String(e.fontWeights.medium),"--mobile-tab-text-active":e.colors.primary,"--mobile-tab-icon-active":e.colors.primary}}const s=({primaryContent:e,secondaryContent:a,collapsedHeader:o,collapsed:i,onCollapsedChange:s,ratio:c,onRatioChange:d,minRatio:u=.1,maxRatio:p=.8,collapsedHeight:h=28,theme:f,className:m="",style:g,animationDuration:b=200,onCollapseStart:v,onCollapseComplete:y,onExpandStart:x,onExpandComplete:C})=>{const[w,R]=n.useState(!1),[S,E]=n.useState(!1),k=n.useRef(null),N=n.useRef(void 0),j=n.useRef(void 0),z=n.useRef(c),D=e=>100*e;n.useEffect(()=>{!i&&c>0&&(z.current=c)},[i,c]);const M=n.useCallback((e,t,n)=>{if(!k.current)return;N.current&&cancelAnimationFrame(N.current),j.current=performance.now();const r=a=>{if(!j.current||!k.current)return;const o=a-j.current,l=Math.min(o/b,1),i=l<.5?4*l*l*l:1-Math.pow(-2*l+2,3)/2,s=e+(t-e)*i;k.current.resize(s),l<1?N.current=requestAnimationFrame(r):(0===t?k.current.collapse():k.current.resize(t),R(!1),n&&n())};N.current=requestAnimationFrame(r)},[b]),T=n.useCallback(()=>{if(w||S)return;R(!0),v?.();const e=D(c);M(e,0,()=>{s(!0),y?.()})},[w,S,c,M,s,v,y]),P=n.useCallback(()=>{if(w||S)return;R(!0),x?.();const e=z.current||c||.3,t=D(e);M(0,t,()=>{s(!1),d(e),C?.()})},[w,S,c,M,s,d,x,C]),A=n.useCallback(()=>{i?P():T()},[i,T,P]),L=n.useCallback(e=>{if(!w&&!i){const t=e/100;d(t)}},[w,i,d]),F=n.useCallback(()=>{E(!0)},[]),$=n.useCallback(()=>{E(!1)},[]);n.useEffect(()=>{if(i&&!w&&k.current){k.current.getSize()>0&&T()}else if(!i&&!w&&k.current){0===k.current.getSize()&&P()}},[i]),n.useEffect(()=>()=>{N.current&&cancelAnimationFrame(N.current)},[]);const B=l(f),O=["csp-secondary-panel",w&&!S?"csp-animating":"",i?"csp-collapsed":""].filter(Boolean).join(" ");return t.jsx("div",{className:`collapsible-split-pane ${m}`,style:{...B,...g},children:i?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"csp-collapsed-header",style:{height:h},onClick:A,role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),A())},"aria-expanded":!1,"aria-label":`Expand ${o.title}`,children:[o.icon&&t.jsx("span",{className:"csp-collapsed-header-icon",children:o.icon}),t.jsx("span",{className:"csp-collapsed-header-title",children:o.title}),t.jsx("button",{className:"csp-collapsed-header-expand",onClick:e=>{e.stopPropagation(),A()},"aria-label":`Expand ${o.title}`,children:t.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:t.jsx("path",{d:"M3 5L6 8L9 5"})})})]}),t.jsx("div",{className:"csp-primary-content-full",children:e})]}):t.jsxs(r.PanelGroup,{direction:"vertical",onLayout:$,children:[t.jsx(r.Panel,{ref:k,collapsible:!0,defaultSize:D(c),minSize:D(u),maxSize:D(p),collapsedSize:0,onResize:L,onCollapse:()=>s(!0),className:O,children:t.jsxs("div",{className:"csp-panel-content",children:[t.jsxs("div",{className:"csp-secondary-header",children:[o.icon&&t.jsx("span",{className:"csp-secondary-header-icon",children:o.icon}),t.jsx("span",{className:"csp-secondary-header-title",children:o.title}),t.jsx("button",{className:"csp-secondary-header-collapse",onClick:T,"aria-label":`Collapse ${o.title}`,children:t.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:t.jsx("path",{d:"M3 7L6 4L9 7"})})})]}),t.jsx("div",{className:"csp-secondary-body",children:a})]})}),t.jsx(r.PanelResizeHandle,{className:"csp-resize-handle",onDragging:F,children:t.jsx("div",{className:"csp-resize-handle-bar"})}),t.jsx(r.Panel,{className:"csp-primary-panel",minSize:20,children:t.jsx("div",{className:"csp-panel-content",children:e})})]})})},c=({panelIds:e,panels:r,config:a={},className:o="",theme:l})=>{const{defaultActiveTab:s=0,tabPosition:c="top",centered:d=!0,hideTabList:u=!1,activeTabIndex:p,onTabChange:h}=a,[f,m]=n.useState(s),g=void 0!==p,b=g?p:f;n.useEffect(()=>{g||m(s)},[s,g]);const v=i(l),y=e.map(e=>r.find(t=>t.id===e)).filter(e=>void 0!==e),x=Math.min(b,y.length-1),C=y[x];if(0===y.length)return t.jsx("div",{className:"tab-group-empty",children:"No panels available"});const w="top"===c||"bottom"===c||d,R=t.jsx("div",{className:"tab-list "+(w?"centered":""),role:"tablist",children:y.map((e,n)=>t.jsx("button",{role:"tab","aria-selected":n===x,"aria-controls":`tabpanel-${e.id}`,id:`tab-${e.id}`,className:"tab-button "+(n===x?"active":""),onClick:()=>(e=>{g||m(e),h?.(e)})(n),title:e.icon?e.label:void 0,children:e.icon?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"tab-icon",children:e.icon}),t.jsx("span",{className:"tab-label",children:e.label})]}):e.label},e.id))}),S=C?t.jsx("div",{className:"tab-content",role:"tabpanel",id:`tabpanel-${C.id}`,"aria-labelledby":`tab-${C.id}`,children:C.content}):null;return t.jsxs("div",{className:`tab-group tab-position-${c} ${o}`,style:v,children:[!u&&("top"===c||"left"===c)&&R,S,!u&&("bottom"===c||"right"===c)&&R]})},d={x:0,y:0,width:0,height:0},u=n.createContext(null),p=({slot:e,children:r})=>{const a=n.useRef(null),[o,l]=n.useState(d),i=n.useCallback(()=>{if(a.current){const e=a.current.getBoundingClientRect();l({x:e.left,y:e.top,width:e.width,height:e.height})}},[]);n.useEffect(()=>{const e=a.current;if(!e)return;i();const t=new ResizeObserver(()=>{i()});return t.observe(e),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{t.disconnect(),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[i]);const s={slot:e,bounds:o};return t.jsx(u.Provider,{value:s,children:t.jsx("div",{ref:a,className:"panel-bounds-container",style:{width:"100%",height:"100%"},children:r})})};function h(){const e=n.useContext(u);return e?{slot:e.slot,bounds:e.bounds,isInPanel:!0}:{slot:null,bounds:d,isInPanel:!1}}const f=({panels:e,layout:o,slotDataAttributes:i={},collapsiblePanels:s={left:!0,middle:!1,right:!0},defaultSizes:d={left:20,middle:60,right:20},minSizes:u={left:5,middle:10,right:5},className:h="",collapsed:f={left:!1,middle:!1,right:!1},style:m,showCollapseButtons:g=!1,animationDuration:b=300,animationEasing:v="cubic-bezier(0.4, 0, 0.2, 1)",theme:y,onLeftCollapseStart:x,onLeftCollapseComplete:C,onLeftExpandStart:w,onLeftExpandComplete:R,onMiddleCollapseStart:S,onMiddleCollapseComplete:E,onMiddleExpandStart:k,onMiddleExpandComplete:N,onRightCollapseStart:j,onRightCollapseComplete:z,onRightExpandStart:D,onRightExpandComplete:M,onPanelResize:T})=>{const P=null!==o.left&&void 0!==o.left,A=null!==o.middle&&void 0!==o.middle,L=null!==o.right&&void 0!==o.right,F=[P,A,L].filter(Boolean).length,$={left:P?d?.left??(2===F?50:3===F?20:100):0,middle:A?d?.middle??(2===F?50:3===F?60:100):0,right:L?d?.right??(2===F?50:3===F?20:100):0},B={left:u?.left??5,middle:u?.middle??10,right:u?.right??5},[O,I]=n.useState(f.left||!P),[q,H]=n.useState(f.middle||!A),[W,U]=n.useState(f.right||!L),[K,V]=n.useState(!1),[X,Y]=n.useState(!1),[G,J]=n.useState(!1),[_,Q]=n.useState(!1),Z=O&&!K,ee=q&&!X,te=W&&!G,ne=n.useCallback(t=>{if(!t)return null;const n=e.find(e=>e.id===t);return n?.content||null},[e]),re=n.useCallback(n=>{if(null===n)return null;if("object"==typeof n&&"type"in n){const r=n;return"tabs"===r.type?t.jsx(c,{panelIds:r.panels,panels:e,config:r.config,theme:y}):null}return ne(n)},[e,ne,y]),ae=re(o.left??null),oe=re(o.middle??null),le=re(o.right??null),[ie,se]=n.useState(f.left||!P?0:$.left),[ce,de]=n.useState(f.middle||!A?0:$.middle),[ue,pe]=n.useState(f.right||!L?0:$.right),[he,fe]=n.useState($.left),[me,ge]=n.useState($.middle),[be,ve]=n.useState($.right),ye=n.useRef(null),xe=n.useRef(null),Ce=n.useRef(null),we=n.useRef(null),Re=n.useRef(void 0),Se=n.useRef(void 0),Ee=n.useRef(void 0),ke=n.useRef(void 0),Ne=n.useRef(void 0),je=n.useRef(void 0),ze=n.useCallback((e,t)=>{const n=e.filter(e=>e.panelRef.current);if(0===n.length)return;n.forEach(e=>{e.animationFrameRef.current&&cancelAnimationFrame(e.animationFrameRef.current)});let r=0;const a=()=>{r++;const e=r/10;if(e>=1)return n.forEach(e=>{e.panelRef.current&&(0===e.toSize?e.panelRef.current.collapse():e.panelRef.current.resize(e.toSize))}),void(t&&t());const o=e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;n.forEach(e=>{if(e.panelRef.current){const t=e.fromSize+(e.toSize-e.fromSize)*o;e.panelRef.current.resize(t)}}),n[0].animationFrameRef.current=requestAnimationFrame(()=>{setTimeout(a,b/10)})};a()},[b]),De=n.useCallback(()=>{K||_||!s.left||(a.flushSync(()=>{V(!0),Y(!0),J(!0),I(!0)}),x&&x(),Re.current&&cancelAnimationFrame(Re.current),Re.current=requestAnimationFrame(()=>{const e=ye.current?.getLayout(),t=Math.round(1e3*(e?.[0]??ie))/1e3,n=Math.round(1e3*(e?.[1]??ce))/1e3,r=Math.round(1e3*(e?.[2]??ue))/1e3,a=n+r,o=a>0?n/a*100:A?50:0,l=a>0?r/a*100:L?50:0;o>0&&ge(o),l>0&&ve(l),ze([{panelRef:xe,fromSize:t,toSize:0,animationFrameRef:Re,startTimeRef:ke},{panelRef:Ce,fromSize:n,toSize:o,animationFrameRef:Se,startTimeRef:Ne},{panelRef:we,fromSize:r,toSize:l,animationFrameRef:Ee,startTimeRef:je}],()=>{se(0),de(o),pe(l),V(!1),Y(!1),J(!1),C&&C()})}))},[K,_,ie,ce,ue,A,L,s.left,ze,x,C]),Me=n.useCallback(()=>{K||_||!s.left||(a.flushSync(()=>{V(!0),Y(!0),J(!0),I(!1)}),w&&w(),Re.current&&cancelAnimationFrame(Re.current),Re.current=requestAnimationFrame(()=>{const e=ye.current?.getLayout(),t=Math.round(1e3*(e?.[0]??0))/1e3,n=Math.round(1e3*(e?.[1]??ce))/1e3,r=Math.round(1e3*(e?.[2]??ue))/1e3,a=he||$.left,o=100-a,l=n+r,i=l>0?n/l*o:A?o/2:0,s=l>0?r/l*o:L?o/2:0;i>0&&ge(i),s>0&&ve(s),ze([{panelRef:xe,fromSize:t,toSize:a,animationFrameRef:Re,startTimeRef:ke},{panelRef:Ce,fromSize:n,toSize:i,animationFrameRef:Se,startTimeRef:Ne},{panelRef:we,fromSize:r,toSize:s,animationFrameRef:Ee,startTimeRef:je}],()=>{se(a),de(i),pe(s),V(!1),Y(!1),J(!1),R&&R()})}))},[K,_,ce,ue,$.left,he,A,L,s.left,ze,w,R]),Te=n.useCallback(()=>{G||_||!s.right||(a.flushSync(()=>{V(!0),Y(!0),J(!0),U(!0)}),j&&j(),Ee.current&&cancelAnimationFrame(Ee.current),Ee.current=requestAnimationFrame(()=>{const e=ye.current?.getLayout(),t=Math.round(1e3*(e?.[0]??ie))/1e3,n=Math.round(1e3*(e?.[1]??ce))/1e3,r=Math.round(1e3*(e?.[2]??ue))/1e3,a=t+n,o=a>0?t/a*100:P?50:0,l=a>0?n/a*100:A?50:0;o>0&&fe(o),l>0&&ge(l),ze([{panelRef:xe,fromSize:t,toSize:o,animationFrameRef:Re,startTimeRef:ke},{panelRef:Ce,fromSize:n,toSize:l,animationFrameRef:Se,startTimeRef:Ne},{panelRef:we,fromSize:r,toSize:0,animationFrameRef:Ee,startTimeRef:je}],()=>{se(o),de(l),pe(0),V(!1),Y(!1),J(!1),z&&z()})}))},[G,_,ie,ce,ue,P,A,s.right,ze,j,z]),Pe=n.useCallback(()=>{G||_||!s.right||(a.flushSync(()=>{V(!0),Y(!0),J(!0),U(!1)}),D&&D(),Ee.current&&cancelAnimationFrame(Ee.current),Ee.current=requestAnimationFrame(()=>{const e=ye.current?.getLayout(),t=Math.round(1e3*(e?.[0]??ie))/1e3,n=Math.round(1e3*(e?.[1]??ce))/1e3,r=Math.round(1e3*(e?.[2]??0))/1e3,a=be||$.right,o=100-a,l=t+n,i=l>0?t/l*o:P?o/2:0,s=l>0?n/l*o:A?o/2:0;i>0&&fe(i),s>0&&ge(s),ze([{panelRef:xe,fromSize:t,toSize:i,animationFrameRef:Re,startTimeRef:ke},{panelRef:Ce,fromSize:n,toSize:s,animationFrameRef:Se,startTimeRef:Ne},{panelRef:we,fromSize:r,toSize:a,animationFrameRef:Ee,startTimeRef:je}],()=>{se(i),de(s),pe(a),V(!1),Y(!1),J(!1),M&&M()})}))},[G,_,ie,ce,$.right,be,P,A,s.right,ze,D,M]),Ae=n.useCallback(()=>{O?Me():De()},[O,De,Me]),Le=n.useCallback(()=>{X||_||!s.middle||(a.flushSync(()=>{V(!0),Y(!0),J(!0),H(!0)}),S&&S(),Se.current&&cancelAnimationFrame(Se.current),Se.current=requestAnimationFrame(()=>{const e=ye.current?.getLayout(),t=Math.round(1e3*(e?.[0]??ie))/1e3,n=Math.round(1e3*(e?.[1]??ce))/1e3,r=Math.round(1e3*(e?.[2]??ue))/1e3,a=t+r,o=a>0?t/a*100:P?50:0,l=a>0?r/a*100:L?50:0;o>0&&fe(o),l>0&&ve(l),ze([{panelRef:xe,fromSize:t,toSize:o,animationFrameRef:Re,startTimeRef:ke},{panelRef:Ce,fromSize:n,toSize:0,animationFrameRef:Se,startTimeRef:Ne},{panelRef:we,fromSize:r,toSize:l,animationFrameRef:Ee,startTimeRef:je}],()=>{se(o),de(0),pe(l),V(!1),Y(!1),J(!1),E&&E()})}))},[X,_,ie,ce,ue,P,L,s.middle,ze,S,E]),Fe=n.useCallback(()=>{X||_||!s.middle||(a.flushSync(()=>{V(!0),Y(!0),J(!0),H(!1)}),k&&k(),Se.current&&cancelAnimationFrame(Se.current),Se.current=requestAnimationFrame(()=>{const e=ye.current?.getLayout(),t=Math.round(1e3*(e?.[0]??ie))/1e3,n=Math.round(1e3*(e?.[1]??0))/1e3,r=Math.round(1e3*(e?.[2]??ue))/1e3,a=me||$.middle,o=100-a,l=t+r,i=l>0?t/l*o:P?o/2:0,s=l>0?r/l*o:L?o/2:0;i>0&&fe(i),s>0&&ve(s),ze([{panelRef:xe,fromSize:t,toSize:i,animationFrameRef:Re,startTimeRef:ke},{panelRef:Ce,fromSize:n,toSize:a,animationFrameRef:Se,startTimeRef:Ne},{panelRef:we,fromSize:r,toSize:s,animationFrameRef:Ee,startTimeRef:je}],()=>{se(i),de(a),pe(s),V(!1),Y(!1),J(!1),N&&N()})}))},[X,_,ie,ue,$.middle,me,P,L,s.middle,ze,k,N]),$e=n.useCallback(()=>{W?Pe():Te()},[W,Te,Pe]),Be=n.useCallback(e=>{K||X||G||(se(e),e>0&&(fe(e),I(!1)))},[K,X,G]),Oe=n.useCallback(e=>{K||X||G||(de(e),e>0&&(ge(e),H(!1)))},[K,X,G]),Ie=n.useCallback(e=>{K||X||G||(pe(e),e>0&&(ve(e),U(!1)))},[K,X,G]),qe=n.useCallback(()=>{if(T){T({left:O?he:ie,middle:q?me:ce,right:W?be:ue})}},[ie,ce,ue,O,q,W,he,me,be,T]),He=n.useCallback(e=>{Q(e),e||qe()},[qe]);n.useEffect(()=>{void 0!==f.left&&f.left!==O&&queueMicrotask(()=>{f.left?De():Me()})},[f.left,O,De,Me]),n.useEffect(()=>{void 0!==f.middle&&f.middle!==q&&queueMicrotask(()=>{f.middle?Le():Fe()})},[f.middle,q,Le,Fe]),n.useEffect(()=>{void 0!==f.right&&f.right!==W&&queueMicrotask(()=>{f.right?Te():Pe()})},[f.right,W,Te,Pe]),n.useEffect(()=>()=>{Re.current&&cancelAnimationFrame(Re.current),Se.current&&cancelAnimationFrame(Se.current),Ee.current&&cancelAnimationFrame(Ee.current)},[]);const We=e=>{let t="three-panel-item";return"left"===e?!s.left&&P||(t+=" collapsible-panel",K&&!_&&(t+=" animating"),Z&&(t+=" collapsed")):"middle"===e?(t+=" middle-panel",!s.middle&&A||(t+=" collapsible-panel",X&&!_&&(t+=" animating"),ee&&(t+=" collapsed"))):"right"===e&&(!s.right&&L||(t+=" collapsible-panel",G&&!_&&(t+=" animating"),te&&(t+=" collapsed"))),t},Ue=K&&!_?{transition:`width ${b}ms ${v}`,width:O?"0%":`${$.left}%`}:void 0,Ke=X&&!_?{transition:`width ${b}ms ${v}`,width:q?"0%":`${$.middle}%`}:void 0,Ve=G&&!_?{transition:`width ${b}ms ${v}`,width:W?"0%":`${$.right}%`}:void 0,Xe=l(y),Ye=K||X||G?0:B.left,Ge=K||X||G?0:B.middle,Je=K||X||G?0:B.right;return t.jsx("div",{className:`three-panel-layout ${h}`,style:{...Xe,...m},children:t.jsxs(r.PanelGroup,{ref:ye,direction:"horizontal",onLayout:qe,children:[t.jsx(r.Panel,{ref:xe,collapsible:s.left||!P,defaultSize:f.left||!P?0:$.left,minSize:Ye,collapsedSize:0,onResize:Be,onCollapse:()=>I(!0),onExpand:()=>I(!1),className:We("left"),style:Ue,...i.left||{},children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:O?0:1,transition:K?`opacity ${.5*b}ms ${v}`:"none"},children:t.jsx(p,{slot:"left",children:ae})})}),t.jsx(r.PanelResizeHandle,{className:"resize-handle left-handle "+(!Z&&P&&A?"":"collapsed"),onDragging:He,disabled:Z||!P||!A,children:g&&s.left&&t.jsx("div",{className:"handle-bar",children:t.jsx("button",{onClick:Ae,className:"collapse-toggle",disabled:K,"aria-label":O?"Expand left panel":"Collapse left panel",children:O?"▸":"◂"})})}),t.jsx(r.Panel,{ref:Ce,collapsible:s.middle||!A,defaultSize:f.middle||!A?0:$.middle,minSize:Ge,collapsedSize:0,onResize:Oe,onCollapse:()=>H(!0),onExpand:()=>H(!1),className:We("middle"),style:Ke,...i.middle||{},children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:q?0:1,transition:X?`opacity ${.5*b}ms ${v}`:"none"},children:t.jsx(p,{slot:"middle",children:oe})})}),t.jsx(r.PanelResizeHandle,{className:"resize-handle right-handle "+(te||!L||!A&&!P?"collapsed":""),onDragging:He,disabled:te||!L||!A&&!P,children:g&&s.right&&t.jsx("div",{className:"handle-bar",children:t.jsx("button",{onClick:$e,className:"collapse-toggle",disabled:G,"aria-label":W?"Expand right panel":"Collapse right panel",children:W?"◂":"▸"})})}),t.jsx(r.Panel,{ref:we,collapsible:s.right||!L,defaultSize:f.right||!L?0:$.right,minSize:Je,collapsedSize:0,onResize:Ie,onCollapse:()=>U(!0),onExpand:()=>U(!1),className:We("right"),style:Ve,...i.right||{},children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:W?0:1,transition:G?`opacity ${.5*b}ms ${v}`:"none"},children:t.jsx(p,{slot:"right",children:le})})})]})})},m=n.forwardRef(({panels:e,className:r="",style:a,theme:o,minPanelWidth:i=350,idealPanelWidth:s=.333,showSeparator:c=!1,onPanelChange:d,preventKeyboardScroll:u=!0,disableSwipe:p=!1},h)=>{const f=n.useRef(null),m=n.useRef(!1),g=n.useRef(null),b=l(o);n.useImperativeHandle(h,()=>({scrollToPanel:e=>{if(!f.current)return;const t=f.current,n=t.children[e];if(n){m.current=!0,g.current&&clearTimeout(g.current);const e=n.offsetLeft;t.scrollTo({left:e,behavior:"smooth"}),g.current=setTimeout(()=>{m.current=!1},500)}},getCurrentPanel:()=>{if(!f.current||0===f.current.children.length)return 0;const e=f.current,t=e.getBoundingClientRect().left;let n=0,r=1/0;for(let a=0;a<e.children.length;a++){const o=e.children[a].getBoundingClientRect(),l=Math.abs(o.left-t);l<r&&(r=l,n=a)}return n}}));n.useEffect(()=>{if(!u||!f.current)return;const e=f.current,t=e=>{const t=e.target;if("INPUT"===t.tagName||"TEXTAREA"===t.tagName||"SELECT"===t.tagName||t.isContentEditable||null!==t.closest(".xterm")||null!==t.closest('[contenteditable="true"]'))return;[" ","Space","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown"].includes(e.key)&&e.preventDefault()};return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}},[u]),n.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);const v=e.length,y=2*i;let x;x=1===v||2===v?"100%":`max(${i}px, ${100*s}%)`;const C=n.useId().replace(/:/g,"_");return t.jsxs(t.Fragment,{children:[2===v&&t.jsx("style",{children:`\n .snap-carousel-container[data-carousel-id="${C}"][data-panel-count="2"] .snap-carousel-panel {\n width: 100%;\n }\n @container (min-width: ${y}px) {\n .snap-carousel-container[data-carousel-id="${C}"][data-panel-count="2"] .snap-carousel-panel {\n width: 50%;\n }\n }\n `}),t.jsx("div",{ref:f,className:`snap-carousel-container ${p?"swipe-disabled":""} ${r}`,style:{...b,...a,"--snap-carousel-min-width":`${i}px`,"--snap-carousel-ideal-width":100*s+"%","--snap-carousel-gap":c?"1px":"0px","--snap-carousel-panel-width":x,"--snap-carousel-panel-count":v,"--snap-carousel-two-panel-threshold":`${y}px`},onScroll:e=>{if(!d||!f.current||0===f.current.children.length)return;if(m.current)return;const t=f.current,n=t.getBoundingClientRect().left;let r=0,a=1/0;for(let o=0;o<t.children.length;o++){const e=t.children[o].getBoundingClientRect(),l=Math.abs(e.left-n);l<a&&(a=l,r=o)}d(r)},"data-panel-count":v,"data-carousel-id":C,children:e.map((e,n)=>t.jsx("div",{className:"snap-carousel-panel",children:e},n))})]})});function g(e){const[t,r]=n.useState(()=>"undefined"!=typeof window&&window.matchMedia(e).matches);return n.useEffect(()=>{if("undefined"==typeof window)return;const t=window.matchMedia(e),n=e=>{r(e.matches)};return r(t.matches),t.addEventListener?(t.addEventListener("change",n),()=>t.removeEventListener("change",n)):(t.addListener(n),()=>t.removeListener(n))},[e]),t}m.displayName="SnapCarousel";const b="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function v(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function y(e){return"nodeType"in e}function x(e){var t,n;return e?v(e)?e:y(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function C(e){const{Document:t}=x(e);return e instanceof t}function w(e){return!v(e)&&e instanceof x(e).HTMLElement}function R(e){return e instanceof x(e).SVGElement}function S(e){return e?v(e)?e.document:y(e)?C(e)?e:w(e)||R(e)?e.ownerDocument:document:document:document}const E=b?n.useLayoutEffect:n.useEffect;function k(e){const t=n.useRef(e);return E(()=>{t.current=e}),n.useCallback(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}function N(e,t){void 0===t&&(t=[e]);const r=n.useRef(e);return E(()=>{r.current!==e&&(r.current=e)},t),r}function j(e,t){const r=n.useRef();return n.useMemo(()=>{const t=e(r.current);return r.current=t,t},[...t])}function z(e){const t=k(e),r=n.useRef(null),a=n.useCallback(e=>{e!==r.current&&(null==t||t(e,r.current)),r.current=e},[]);return[r,a]}function D(e){const t=n.useRef();return n.useEffect(()=>{t.current=e},[e]),t.current}let M={};function T(e,t){return n.useMemo(()=>{if(t)return t;const n=null==M[e]?0:M[e]+1;return M[e]=n,e+"-"+n},[e,t])}function P(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((t,n)=>{const r=Object.entries(n);for(const[a,o]of r){const n=t[a];null!=n&&(t[a]=n+e*o)}return t},{...t})}}const A=P(1),L=P(-1);function F(e){if(!e)return!1;const{KeyboardEvent:t}=x(e.target);return t&&e instanceof t}function $(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=x(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const B="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function O(e){return e.matches(B)?e:e.querySelector(B)}const I={display:"none"};function q(e){let{id:t,value:r}=e;return n.createElement("div",{id:t,style:I},r)}function H(e){let{id:t,announcement:r,ariaLiveType:a="assertive"}=e;return n.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":a,"aria-atomic":!0},r)}const W=n.createContext(null);const U={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},K={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function V(e){let{announcements:t=K,container:r,hiddenTextDescribedById:o,screenReaderInstructions:l=U}=e;const{announce:i,announcement:s}=function(){const[e,t]=n.useState("");return{announce:n.useCallback(e=>{null!=e&&t(e)},[]),announcement:e}}(),c=T("DndLiveRegion"),[d,u]=n.useState(!1);if(n.useEffect(()=>{u(!0)},[]),function(e){const t=n.useContext(W);n.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}(n.useMemo(()=>({onDragStart(e){let{active:n}=e;i(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&i(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;i(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;i(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;i(t.onDragCancel({active:n,over:r}))}}),[i,t])),!d)return null;const p=n.createElement(n.Fragment,null,n.createElement(q,{id:o,value:l.draggable}),n.createElement(H,{id:c,announcement:s}));return r?a.createPortal(p,r):p}var X,Y;function G(){}(Y=X||(X={})).DragStart="dragStart",Y.DragMove="dragMove",Y.DragEnd="dragEnd",Y.DragCancel="dragCancel",Y.DragOver="dragOver",Y.RegisterDroppable="registerDroppable",Y.SetDroppableDisabled="setDroppableDisabled",Y.UnregisterDroppable="unregisterDroppable";const J=Object.freeze({x:0,y:0});function _(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Q(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Z(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ee(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const te=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=ee(t,t.left,t.top),o=[];for(const l of r){const{id:e}=l,t=n.get(e);if(t){const n=_(ee(t),a);o.push({id:e,data:{droppableContainer:l,value:n}})}}return o.sort(Q)};function ne(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),l=a-r,i=o-n;if(r<a&&n<o){const n=t.width*t.height,r=e.width*e.height,a=l*i;return Number((a/(n+r-a)).toFixed(4))}return 0}const re=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const o of r){const{id:e}=o,r=n.get(e);if(r){const n=ne(r,t);n>0&&a.push({id:e,data:{droppableContainer:o,value:n}})}}return a.sort(Z)};function ae(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:J}function oe(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}const le=oe(1);const ie={ignoreTransform:!1};function se(e,t){void 0===t&&(t=ie);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=x(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;const{scaleX:a,scaleY:o,x:l,y:i}=r,s=e.left-l-(1-a)*parseFloat(n),c=e.top-i-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=a?e.width/a:e.width,u=o?e.height/o:e.height;return{width:d,height:u,top:c,right:s+d,bottom:c+u,left:s}}(n,t,r))}const{top:r,left:a,width:o,height:l,bottom:i,right:s}=n;return{top:r,left:a,width:o,height:l,bottom:i,right:s}}function ce(e){return se(e,{ignoreTransform:!0})}function de(e,t){const n=[];return e?function r(a){if(null!=t&&n.length>=t)return n;if(!a)return n;if(C(a)&&null!=a.scrollingElement&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!w(a)||R(a))return n;if(n.includes(a))return n;const o=x(e).getComputedStyle(a);return a!==e&&function(e,t){void 0===t&&(t=x(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(a,o)&&n.push(a),function(e,t){return void 0===t&&(t=x(e).getComputedStyle(e)),"fixed"===t.position}(a,o)?n:r(a.parentNode)}(e):n}function ue(e){const[t]=de(e,1);return null!=t?t:null}function pe(e){return b&&e?v(e)?e:y(e)?C(e)||e===S(e).scrollingElement?window:w(e)?e:null:null:null}function he(e){return v(e)?e.scrollX:e.scrollLeft}function fe(e){return v(e)?e.scrollY:e.scrollTop}function me(e){return{x:he(e),y:fe(e)}}var ge,be;function ve(e){return!(!b||!e)&&e===document.scrollingElement}function ye(e){const t={x:0,y:0},n=ve(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}(be=ge||(ge={}))[be.Forward=1]="Forward",be[be.Backward=-1]="Backward";const xe={x:.2,y:.2};function Ce(e,t,n,r,a){let{top:o,left:l,right:i,bottom:s}=n;void 0===r&&(r=10),void 0===a&&(a=xe);const{isTop:c,isBottom:d,isLeft:u,isRight:p}=ye(e),h={x:0,y:0},f={x:0,y:0},m=t.height*a.y,g=t.width*a.x;return!c&&o<=t.top+m?(h.y=ge.Backward,f.y=r*Math.abs((t.top+m-o)/m)):!d&&s>=t.bottom-m&&(h.y=ge.Forward,f.y=r*Math.abs((t.bottom-m-s)/m)),!p&&i>=t.right-g?(h.x=ge.Forward,f.x=r*Math.abs((t.right-g-i)/g)):!u&&l<=t.left+g&&(h.x=ge.Backward,f.x=r*Math.abs((t.left+g-l)/g)),{direction:h,speed:f}}function we(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function Re(e){return e.reduce((e,t)=>A(e,me(t)),J)}const Se=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+he(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+fe(t),0)}]];class Ee{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=de(t),r=Re(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[a,o,l]of Se)for(const e of o)Object.defineProperty(this,e,{get:()=>{const t=l(n),o=r[a]-t;return this.rect[e]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ke{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function Ne(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var je,ze,De,Me;function Te(e){e.preventDefault()}function Pe(e){e.stopPropagation()}(ze=je||(je={})).Click="click",ze.DragStart="dragstart",ze.Keydown="keydown",ze.ContextMenu="contextmenu",ze.Resize="resize",ze.SelectionChange="selectionchange",ze.VisibilityChange="visibilitychange",(Me=De||(De={})).Space="Space",Me.Down="ArrowDown",Me.Right="ArrowRight",Me.Left="ArrowLeft",Me.Up="ArrowUp",Me.Esc="Escape",Me.Enter="Enter",Me.Tab="Tab";const Ae={start:[De.Space,De.Enter],cancel:[De.Esc],end:[De.Space,De.Enter,De.Tab]},Le=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case De.Right:return{...n,x:n.x+25};case De.Left:return{...n,x:n.x-25};case De.Down:return{...n,y:n.y+25};case De.Up:return{...n,y:n.y-25}}};class Fe{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new ke(S(t)),this.windowListeners=new ke(x(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(je.Resize,this.handleCancel),this.windowListeners.add(je.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(je.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=se),!e)return;const{top:n,left:r,bottom:a,right:o}=t(e);ue(e)&&(a<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(J)}handleKeyDown(e){if(F(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:a=Ae,coordinateGetter:o=Le,scrollBehavior:l="smooth"}=r,{code:i}=e;if(a.end.includes(i))return void this.handleEnd(e);if(a.cancel.includes(i))return void this.handleCancel(e);const{collisionRect:s}=n.current,c=s?{x:s.left,y:s.top}:J;this.referenceCoordinates||(this.referenceCoordinates=c);const d=o(e,{active:t,context:n.current,currentCoordinates:c});if(d){const t=L(d,c),r={x:0,y:0},{scrollableAncestors:a}=n.current;for(const n of a){const a=e.code,{isTop:o,isRight:i,isLeft:s,isBottom:c,maxScroll:u,minScroll:p}=ye(n),h=we(n),f={x:Math.min(a===De.Right?h.right-h.width/2:h.right,Math.max(a===De.Right?h.left:h.left+h.width/2,d.x)),y:Math.min(a===De.Down?h.bottom-h.height/2:h.bottom,Math.max(a===De.Down?h.top:h.top+h.height/2,d.y))},m=a===De.Right&&!i||a===De.Left&&!s,g=a===De.Down&&!c||a===De.Up&&!o;if(m&&f.x!==d.x){const e=n.scrollLeft+t.x,o=a===De.Right&&e<=u.x||a===De.Left&&e>=p.x;if(o&&!t.y)return void n.scrollTo({left:e,behavior:l});r.x=o?n.scrollLeft-e:a===De.Right?n.scrollLeft-u.x:n.scrollLeft-p.x,r.x&&n.scrollBy({left:-r.x,behavior:l});break}if(g&&f.y!==d.y){const e=n.scrollTop+t.y,o=a===De.Down&&e<=u.y||a===De.Up&&e>=p.y;if(o&&!t.x)return void n.scrollTo({top:e,behavior:l});r.y=o?n.scrollTop-e:a===De.Down?n.scrollTop-u.y:n.scrollTop-p.y,r.y&&n.scrollBy({top:-r.y,behavior:l});break}}this.handleMove(e,A(L(d,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function $e(e){return Boolean(e&&"distance"in e)}function Be(e){return Boolean(e&&"delay"in e)}Fe.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Ae,onActivation:a}=t,{active:o}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const t=o.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==a||a({event:e.nativeEvent}),!0)}return!1}}];class Oe{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=x(e);return e instanceof t?e:S(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:a}=e,{target:o}=a;this.props=e,this.events=t,this.document=S(o),this.documentListeners=new ke(this.document),this.listeners=new ke(n),this.windowListeners=new ke(x(o)),this.initialCoordinates=null!=(r=$(a))?r:J,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(je.Resize,this.handleCancel),this.windowListeners.add(je.DragStart,Te),this.windowListeners.add(je.VisibilityChange,this.handleCancel),this.windowListeners.add(je.ContextMenu,Te),this.documentListeners.add(je.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Be(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if($e(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(je.Click,Pe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(je.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:a}=this,{onMove:o,options:{activationConstraint:l}}=a;if(!r)return;const i=null!=(t=$(e))?t:J,s=L(r,i);if(!n&&l){if($e(l)){if(null!=l.tolerance&&Ne(s,l.tolerance))return this.handleCancel();if(Ne(s,l.distance))return this.handleStart()}return Be(l)&&Ne(s,l.tolerance)?this.handleCancel():void this.handlePending(l,s)}e.cancelable&&e.preventDefault(),o(i)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===De.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Ie={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class qe extends Oe{constructor(e){const{event:t}=e,n=S(t.target);super(e,Ie,n)}}qe.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const He={move:{name:"mousemove"},end:{name:"mouseup"}};var We,Ue;(Ue=We||(We={}))[Ue.RightClick=2]="RightClick";(class extends Oe{constructor(e){super(e,He,S(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==We.RightClick&&(null==r||r({event:n}),!0)}}];const Ke={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var Ve,Xe,Ye,Ge;function Je(e){let{acceleration:t,activator:r=Ve.Pointer,canScroll:a,draggingRect:o,enabled:l,interval:i=5,order:s=Ye.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:p,threshold:h}=e;const f=function(e){let{delta:t,disabled:n}=e;const r=D(t);return j(e=>{if(n||!r||!e)return _e;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ge.Backward]:e.x[ge.Backward]||-1===a.x,[ge.Forward]:e.x[ge.Forward]||1===a.x},y:{[ge.Backward]:e.y[ge.Backward]||-1===a.y,[ge.Forward]:e.y[ge.Forward]||1===a.y}}},[n,t,r])}({delta:p,disabled:!l}),[m,g]=function(){const e=n.useRef(null);return[n.useCallback((t,n)=>{e.current=setInterval(t,n)},[]),n.useCallback(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),b=n.useRef({x:0,y:0}),v=n.useRef({x:0,y:0}),y=n.useMemo(()=>{switch(r){case Ve.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Ve.DraggableRect:return o}},[r,o,c]),x=n.useRef(null),C=n.useCallback(()=>{const e=x.current;if(!e)return;const t=b.current.x*v.current.x,n=b.current.y*v.current.y;e.scrollBy(t,n)},[]),w=n.useMemo(()=>s===Ye.TreeOrder?[...d].reverse():d,[s,d]);n.useEffect(()=>{if(l&&d.length&&y){for(const e of w){if(!1===(null==a?void 0:a(e)))continue;const n=d.indexOf(e),r=u[n];if(!r)continue;const{direction:o,speed:l}=Ce(e,r,y,t,h);for(const e of["x","y"])f[e][o[e]]||(l[e]=0,o[e]=0);if(l.x>0||l.y>0)return g(),x.current=e,m(C,i),b.current=l,void(v.current=o)}b.current={x:0,y:0},v.current={x:0,y:0},g()}else g()},[t,C,a,g,l,i,JSON.stringify(y),JSON.stringify(f),m,d,w,u,JSON.stringify(h)])}(class extends Oe{constructor(e){super(e,Ke)}static setup(){return window.addEventListener(Ke.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Ke.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return!(a.length>1)&&(null==r||r({event:n}),!0)}}],(Xe=Ve||(Ve={}))[Xe.Pointer=0]="Pointer",Xe[Xe.DraggableRect=1]="DraggableRect",(Ge=Ye||(Ye={}))[Ge.TreeOrder=0]="TreeOrder",Ge[Ge.ReversedTreeOrder=1]="ReversedTreeOrder";const _e={x:{[ge.Backward]:!1,[ge.Forward]:!1},y:{[ge.Backward]:!1,[ge.Forward]:!1}};var Qe,Ze,et;(Ze=Qe||(Qe={}))[Ze.Always=0]="Always",Ze[Ze.BeforeDragging=1]="BeforeDragging",Ze[Ze.WhileDragging=2]="WhileDragging",(et||(et={})).Optimized="optimized";const tt=new Map;function nt(e,t){return j(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function rt(e){let{callback:t,disabled:r}=e;const a=k(t),o=n.useMemo(()=>{if(r||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(a)},[r]);return n.useEffect(()=>()=>null==o?void 0:o.disconnect(),[o]),o}function at(e){return new Ee(se(e),e)}function ot(e,t,r){void 0===t&&(t=at);const[a,o]=n.useState(null);function l(){o(n=>{if(!e)return null;var a;if(!1===e.isConnected)return null!=(a=null!=n?n:r)?a:null;const o=t(e);return JSON.stringify(n)===JSON.stringify(o)?n:o})}const i=function(e){let{callback:t,disabled:r}=e;const a=k(t),o=n.useMemo(()=>{if(r||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(a)},[a,r]);return n.useEffect(()=>()=>null==o?void 0:o.disconnect(),[o]),o}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){l();break}}}}),s=rt({callback:l});return E(()=>{l(),e?(null==s||s.observe(e),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==s||s.disconnect(),null==i||i.disconnect())},[e]),a}const lt=[];function it(e,t){void 0===t&&(t=[]);const r=n.useRef(null);return n.useEffect(()=>{r.current=null},t),n.useEffect(()=>{const t=e!==J;t&&!r.current&&(r.current=e),!t&&r.current&&(r.current=null)},[e]),r.current?L(e,r.current):J}function st(e){return n.useMemo(()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null,[e])}const ct=[];function dt(e){let{measure:t}=e;const[r,a]=n.useState(null),o=rt({callback:n.useCallback(e=>{for(const{target:n}of e)if(w(n)){a(e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),l=n.useCallback(e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return w(t)?t:e}(e);null==o||o.disconnect(),n&&(null==o||o.observe(n)),a(n?t(n):null)},[t,o]),[i,s]=z(l);return n.useMemo(()=>({nodeRef:i,rect:r,setRef:s}),[r,i,s])}const ut=[{sensor:qe,options:{}},{sensor:Fe,options:{}}],pt={current:{}},ht={draggable:{measure:ce},droppable:{measure:ce,strategy:Qe.WhileDragging,frequency:et.Optimized},dragOverlay:{measure:se}};class ft extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const mt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ft,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:G},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ht,measureDroppableContainers:G,windowRect:null,measuringScheduled:!1},gt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:G,draggableNodes:new Map,over:null,measureDroppableContainers:G},bt=n.createContext(gt),vt=n.createContext(mt);function yt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ft}}}function xt(e,t){switch(t.type){case X.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case X.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case X.DragEnd:case X.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case X.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new ft(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case X.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const l=new ft(e.droppable.containers);return l.set(n,{...o,disabled:a}),{...e,droppable:{...e.droppable,containers:l}}}case X.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const o=new ft(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Ct(e){let{disabled:t}=e;const{active:r,activatorEvent:a,draggableNodes:o}=n.useContext(bt),l=D(a),i=D(null==r?void 0:r.id);return n.useEffect(()=>{if(!t&&!a&&l&&null!=i){if(!F(l))return;if(document.activeElement===l.target)return;const e=o.get(i);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=O(e);if(t){t.focus();break}}})}},[a,t,o,i,l]),null}const wt=n.createContext({...J,scaleX:1,scaleY:1});var Rt,St;(St=Rt||(Rt={}))[St.Uninitialized=0]="Uninitialized",St[St.Initializing=1]="Initializing",St[St.Initialized=2]="Initialized";const Et=n.memo(function(e){var t,r,o,l;let{id:i,accessibility:s,autoScroll:c=!0,children:d,sensors:u=ut,collisionDetection:p=re,measuring:h,modifiers:f,...m}=e;const g=n.useReducer(xt,void 0,yt),[v,y]=g,[C,w]=function(){const[e]=n.useState(()=>new Set),t=n.useCallback(t=>(e.add(t),()=>e.delete(t)),[e]);return[n.useCallback(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]),t]}(),[R,S]=n.useState(Rt.Uninitialized),k=R===Rt.Initialized,{draggable:{active:z,nodes:D,translate:M},droppable:{containers:P}}=v,L=null!=z?D.get(z):null,F=n.useRef({initial:null,translated:null}),B=n.useMemo(()=>{var e;return null!=z?{id:z,data:null!=(e=null==L?void 0:L.data)?e:pt,rect:F}:null},[z,L]),O=n.useRef(null),[I,q]=n.useState(null),[H,U]=n.useState(null),K=N(m,Object.values(m)),Y=T("DndDescribedBy",i),G=n.useMemo(()=>P.getEnabled(),[P]),_=(Q=h,n.useMemo(()=>({draggable:{...ht.draggable,...null==Q?void 0:Q.draggable},droppable:{...ht.droppable,...null==Q?void 0:Q.droppable},dragOverlay:{...ht.dragOverlay,...null==Q?void 0:Q.dragOverlay}}),[null==Q?void 0:Q.draggable,null==Q?void 0:Q.droppable,null==Q?void 0:Q.dragOverlay]));var Q;const{droppableRects:Z,measureDroppableContainers:ee,measuringScheduled:te}=function(e,t){let{dragging:r,dependencies:a,config:o}=t;const[l,i]=n.useState(null),{frequency:s,measure:c,strategy:d}=o,u=n.useRef(e),p=function(){switch(d){case Qe.Always:return!1;case Qe.BeforeDragging:return r;default:return!r}}(),h=N(p),f=n.useCallback(function(e){void 0===e&&(e=[]),h.current||i(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[h]),m=n.useRef(null),g=j(t=>{if(p&&!r)return tt;if(!t||t===tt||u.current!==e||null!=l){const t=new Map;for(let n of e){if(!n)continue;if(l&&l.length>0&&!l.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new Ee(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,l,r,p,c]);return n.useEffect(()=>{u.current=e},[e]),n.useEffect(()=>{p||f()},[r,p]),n.useEffect(()=>{l&&l.length>0&&i(null)},[JSON.stringify(l)]),n.useEffect(()=>{p||"number"!=typeof s||null!==m.current||(m.current=setTimeout(()=>{f(),m.current=null},s))},[s,p,f,...a]),{droppableRects:g,measureDroppableContainers:f,measuringScheduled:null!=l}}(G,{dragging:k,dependencies:[M.x,M.y],config:_.droppable}),ne=function(e,t){const n=null!=t?e.get(t):void 0,r=n?n.node.current:null;return j(e=>{var n;return null==t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(D,z),oe=n.useMemo(()=>H?$(H):null,[H]),ie=function(){const e=!1===(null==I?void 0:I.autoScrollEnabled),t="object"==typeof c?!1===c.enabled:!1===c,n=k&&!e&&!t;if("object"==typeof c)return{...c,enabled:n};return{enabled:n}}(),ce=function(e,t){return nt(e,t)}(ne,_.draggable.measure);!function(e){let{activeNode:t,measure:r,initialRect:a,config:o=!0}=e;const l=n.useRef(!1),{x:i,y:s}="boolean"==typeof o?{x:o,y:o}:o;E(()=>{if(!i&&!s||!t)return void(l.current=!1);if(l.current||!a)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const n=ae(r(e),a);if(i||(n.x=0),s||(n.y=0),l.current=!0,Math.abs(n.x)>0||Math.abs(n.y)>0){const t=ue(e);t&&t.scrollBy({top:n.y,left:n.x})}},[t,i,s,a,r])}({activeNode:null!=z?D.get(z):null,config:ie.layoutShiftCompensation,initialRect:ce,measure:_.draggable.measure});const he=ot(ne,_.draggable.measure,ce),fe=ot(ne?ne.parentElement:null),ge=n.useRef({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:Z,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),be=P.getNodeFor(null==(t=ge.current.over)?void 0:t.id),ye=dt({measure:_.dragOverlay.measure}),xe=null!=(r=ye.nodeRef.current)?r:ne,Ce=k?null!=(o=ye.rect)?o:he:null,we=Boolean(ye.nodeRef.current&&ye.rect),Se=ae(ke=we?null:he,nt(ke));var ke;const Ne=st(xe?x(xe):null),je=function(e){const t=n.useRef(e),r=j(n=>e?n&&n!==lt&&e&&t.current&&e.parentNode===t.current.parentNode?n:de(e):lt,[e]);return n.useEffect(()=>{t.current=e},[e]),r}(k?null!=be?be:ne:null),ze=function(e,t){void 0===t&&(t=se);const[r]=e,a=st(r?x(r):null),[o,l]=n.useState(ct);function i(){l(()=>e.length?e.map(e=>ve(e)?a:new Ee(t(e),e)):ct)}const s=rt({callback:i});return E(()=>{null==s||s.disconnect(),i(),e.forEach(e=>null==s?void 0:s.observe(e))},[e]),o}(je),De=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}(f,{transform:{x:M.x-Se.x,y:M.y-Se.y,scaleX:1,scaleY:1},activatorEvent:H,active:B,activeNodeRect:he,containerNodeRect:fe,draggingNodeRect:Ce,over:ge.current.over,overlayNodeRect:ye.rect,scrollableAncestors:je,scrollableAncestorRects:ze,windowRect:Ne}),Me=oe?A(oe,M):null,Te=function(e){const[t,r]=n.useState(null),a=n.useRef(e),o=n.useCallback(e=>{const t=pe(e.target);t&&r(e=>e?(e.set(t,me(t)),new Map(e)):null)},[]);return n.useEffect(()=>{const t=a.current;if(e!==t){n(t);const l=e.map(e=>{const t=pe(e);return t?(t.addEventListener("scroll",o,{passive:!0}),[t,me(t)]):null}).filter(e=>null!=e);r(l.length?new Map(l):null),a.current=e}return()=>{n(e),n(t)};function n(e){e.forEach(e=>{const t=pe(e);null==t||t.removeEventListener("scroll",o)})}},[o,e]),n.useMemo(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>A(e,t),J):Re(e):J,[e,t])}(je),Pe=it(Te),Ae=it(Te,[he]),Le=A(De,Pe),Fe=Ce?le(Ce,De):null,$e=B&&Fe?p({active:B,collisionRect:Fe,droppableRects:Z,droppableContainers:G,pointerCoordinates:Me}):null,Be=function(e,t){if(!e||0===e.length)return null;const[n]=e;return n[t]}($e,"id"),[Oe,Ie]=n.useState(null),qe=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(we?De:A(De,Ae),null!=(l=null==Oe?void 0:Oe.rect)?l:null,he),He=n.useRef(null),We=n.useCallback((e,t)=>{let{sensor:n,options:r}=t;if(null==O.current)return;const o=D.get(O.current);if(!o)return;const l=e.nativeEvent,i=new n({active:O.current,activeNode:o,event:l,options:r,context:ge,onAbort(e){if(!D.get(e))return;const{onDragAbort:t}=K.current,n={id:e};null==t||t(n),C({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!D.get(e))return;const{onDragPending:a}=K.current,o={id:e,constraint:t,initialCoordinates:n,offset:r};null==a||a(o),C({type:"onDragPending",event:o})},onStart(e){const t=O.current;if(null==t)return;const n=D.get(t);if(!n)return;const{onDragStart:r}=K.current,o={activatorEvent:l,active:{id:t,data:n.data,rect:F}};a.unstable_batchedUpdates(()=>{null==r||r(o),S(Rt.Initializing),y({type:X.DragStart,initialCoordinates:e,active:t}),C({type:"onDragStart",event:o}),q(He.current),U(l)})},onMove(e){y({type:X.DragMove,coordinates:e})},onEnd:s(X.DragEnd),onCancel:s(X.DragCancel)});function s(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=ge.current;let i=null;if(t&&o){const{cancelDrop:a}=K.current;if(i={activatorEvent:l,active:t,collisions:n,delta:o,over:r},e===X.DragEnd&&"function"==typeof a){await Promise.resolve(a(i))&&(e=X.DragCancel)}}O.current=null,a.unstable_batchedUpdates(()=>{y({type:e}),S(Rt.Uninitialized),Ie(null),q(null),U(null),He.current=null;const t=e===X.DragEnd?"onDragEnd":"onDragCancel";if(i){const e=K.current[t];null==e||e(i),C({type:t,event:i})}})}}He.current=i},[D]),Ue=function(e,t){return n.useMemo(()=>e.reduce((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}))]},[]),[e,t])}(u,n.useCallback((e,t)=>(n,r)=>{const a=n.nativeEvent,o=D.get(r);if(null!==O.current||!o||a.dndKit||a.defaultPrevented)return;const l={active:o};!0===e(n,t.options,l)&&(a.dndKit={capturedBy:t.sensor},O.current=r,We(n,t))},[D,We]));!function(e){n.useEffect(()=>{if(!b)return;const t=e.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const e of t)null==e||e()}},e.map(e=>{let{sensor:t}=e;return t}))}(u),E(()=>{he&&R===Rt.Initializing&&S(Rt.Initialized)},[he,R]),n.useEffect(()=>{const{onDragMove:e}=K.current,{active:t,activatorEvent:n,collisions:r,over:o}=ge.current;if(!t||!n)return;const l={active:t,activatorEvent:n,collisions:r,delta:{x:Le.x,y:Le.y},over:o};a.unstable_batchedUpdates(()=>{null==e||e(l),C({type:"onDragMove",event:l})})},[Le.x,Le.y]),n.useEffect(()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=ge.current;if(!e||null==O.current||!t||!o)return;const{onDragOver:l}=K.current,i=r.get(Be),s=i&&i.rect.current?{id:i.id,rect:i.rect.current,data:i.data,disabled:i.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:s};a.unstable_batchedUpdates(()=>{Ie(s),null==l||l(c),C({type:"onDragOver",event:c})})},[Be]),E(()=>{ge.current={activatorEvent:H,active:B,activeNode:ne,collisionRect:Fe,collisions:$e,droppableRects:Z,draggableNodes:D,draggingNode:xe,draggingNodeRect:Ce,droppableContainers:P,over:Oe,scrollableAncestors:je,scrollAdjustedTranslate:Le},F.current={initial:Ce,translated:Fe}},[B,ne,$e,Fe,D,xe,Ce,Z,P,Oe,je,Le]),Je({...ie,delta:M,draggingRect:Fe,pointerCoordinates:Me,scrollableAncestors:je,scrollableAncestorRects:ze});const Ke=n.useMemo(()=>({active:B,activeNode:ne,activeNodeRect:he,activatorEvent:H,collisions:$e,containerNodeRect:fe,dragOverlay:ye,draggableNodes:D,droppableContainers:P,droppableRects:Z,over:Oe,measureDroppableContainers:ee,scrollableAncestors:je,scrollableAncestorRects:ze,measuringConfiguration:_,measuringScheduled:te,windowRect:Ne}),[B,ne,he,H,$e,fe,ye,D,P,Z,Oe,ee,je,ze,_,te,Ne]),Ve=n.useMemo(()=>({activatorEvent:H,activators:Ue,active:B,activeNodeRect:he,ariaDescribedById:{draggable:Y},dispatch:y,draggableNodes:D,over:Oe,measureDroppableContainers:ee}),[H,Ue,B,he,y,Y,D,Oe,ee]);return n.createElement(W.Provider,{value:w},n.createElement(bt.Provider,{value:Ve},n.createElement(vt.Provider,{value:Ke},n.createElement(wt.Provider,{value:qe},d)),n.createElement(Ct,{disabled:!1===(null==s?void 0:s.restoreFocus)})),n.createElement(V,{...s,hiddenTextDescribedById:Y}))}),kt=n.createContext(null),Nt="button";function jt(e){let{id:t,data:r,disabled:a=!1,attributes:o}=e;const l=T("Draggable"),{activators:i,activatorEvent:s,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:p,over:h}=n.useContext(bt),{role:f=Nt,roleDescription:m="draggable",tabIndex:g=0}=null!=o?o:{},b=(null==c?void 0:c.id)===t,v=n.useContext(b?wt:kt),[y,x]=z(),[C,w]=z(),R=function(e,t){return n.useMemo(()=>e.reduce((e,n)=>{let{eventName:r,handler:a}=n;return e[r]=e=>{a(e,t)},e},{}),[e,t])}(i,t),S=N(r);E(()=>(p.set(t,{id:t,key:l,node:y,activatorNode:C,data:S}),()=>{const e=p.get(t);e&&e.key===l&&p.delete(t)}),[p,t]);return{active:c,activatorEvent:s,activeNodeRect:d,attributes:n.useMemo(()=>({role:f,tabIndex:g,"aria-disabled":a,"aria-pressed":!(!b||f!==Nt)||void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[a,f,g,b,m,u.draggable]),isDragging:b,listeners:a?void 0:R,node:y,over:h,setNodeRef:x,setActivatorNodeRef:w,transform:v}}const zt={timeout:25};const Dt=({slotPosition:e,isEditing:r,isDragging:a,children:o})=>{const{attributes:l,listeners:i,setNodeRef:s,transform:c}=jt({id:`slot-${e}`,data:{slotPosition:e},disabled:!r}),{setNodeRef:d,isOver:u}=function(e){let{data:t,disabled:r=!1,id:a,resizeObserverConfig:o}=e;const l=T("Droppable"),{active:i,dispatch:s,over:c,measureDroppableContainers:d}=n.useContext(bt),u=n.useRef({disabled:r}),p=n.useRef(!1),h=n.useRef(null),f=n.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:b}={...zt,...o},v=N(null!=g?g:a),y=rt({callback:n.useCallback(()=>{p.current?(null!=f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{d(Array.isArray(v.current)?v.current:[v.current]),f.current=null},b)):p.current=!0},[b]),disabled:m||!i}),x=n.useCallback((e,t)=>{y&&(t&&(y.unobserve(t),p.current=!1),e&&y.observe(e))},[y]),[C,w]=z(x),R=N(t);return n.useEffect(()=>{y&&C.current&&(y.disconnect(),p.current=!1,y.observe(C.current))},[C,y]),n.useEffect(()=>(s({type:X.RegisterDroppable,element:{id:a,key:l,disabled:r,node:C,rect:h,data:R}}),()=>s({type:X.UnregisterDroppable,key:l,id:a})),[a]),n.useEffect(()=>{r!==u.current.disabled&&(s({type:X.SetDroppableDisabled,id:a,key:l,disabled:r}),u.current.disabled=r)},[a,l,r,s]),{active:i,rect:h,isOver:(null==c?void 0:c.id)===a,node:C,over:c,setNodeRef:w}}({id:`drop-${e}`,data:{slotPosition:e}}),p={position:"relative",height:"100%",width:"100%",transform:c?`translate3d(${c.x}px, ${c.y}px, 0)`:void 0},h=n.useCallback(e=>{s(e),d(e)},[s,d]);return t.jsxs("div",{ref:h,style:p,className:`slot-with-overlay ${r?"edit-mode":""} ${a?"dragging":""} ${u?"drag-over":""}`,children:[o,r&&t.jsxs("div",{className:"slot-edit-overlay",...l,...i,children:[t.jsx("div",{className:"drag-indicator",children:"⋮⋮"}),t.jsx("div",{className:"slot-position-label",children:e.toUpperCase()})]})]})},Mt=({layout:e,activeSlot:r})=>{const[a,o]=n.useState(new Map);return n.useEffect(()=>{const e=()=>{const e=new Map;["left","middle","right"].forEach(t=>{const n=document.querySelector(`[data-slot="${t}"]`);if(n){const r=n.getBoundingClientRect();e.set(t,r)}}),o(e)};e(),window.addEventListener("resize",e);const t=setInterval(e,100);return()=>{window.removeEventListener("resize",e),clearInterval(t)}},[e]),t.jsx("div",{style:{pointerEvents:"none",position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:999},children:["left","middle","right"].map(n=>{if(!e[n])return null;const o=a.get(n);if(!o)return null;const l=r===n;return t.jsx("div",{style:{position:"fixed",top:o.top,left:o.left,width:o.width,height:o.height,pointerEvents:"auto"},children:t.jsx(Dt,{slotPosition:n,isEditing:!0,isDragging:l,children:t.jsx("div",{style:{height:"100%"}})})},n)})})},Tt=e=>null!=e&&"object"==typeof e&&"type"in e,Pt=e=>null==e?[]:"string"==typeof e?[e]:Tt(e)?e.panels:[];e.AnimatedResizableLayout=({leftPanel:e,rightPanel:a,collapsibleSide:o="left",defaultSize:i=25,minSize:s=5,className:c="",collapsed:d=!1,style:u,showCollapseButton:p=!1,animationDuration:h=300,animationEasing:f="cubic-bezier(0.4, 0, 0.2, 1)",onCollapseStart:m,onCollapseComplete:g,onExpandStart:b,onExpandComplete:v,theme:y})=>{const[x,C]=n.useState(d),[w,R]=n.useState(!1),[S,E]=n.useState(!1),[k,N]=n.useState(d),[j,z]=n.useState(d?0:i),D=n.useRef(null),M=n.useRef(void 0),T=n.useRef(void 0),P=n.useRef(void 0),A=n.useCallback((e,t,n)=>{if(!D.current)return;M.current&&cancelAnimationFrame(M.current),T.current=performance.now();const r=a=>{if(!T.current||!D.current)return;const o=a-T.current,l=Math.min(o/h,1),i=l<.5?4*l*l*l:1-Math.pow(-2*l+2,3)/2,s=e+(t-e)*i;D.current.resize(s),l<1?M.current=requestAnimationFrame(r):(0===t?D.current.collapse():D.current.resize(t),R(!1),n&&n())};M.current=requestAnimationFrame(r)},[h]),L=n.useCallback(()=>{w||S||(R(!0),C(!0),m&&m(),A(j,0,()=>{z(0),N(!0),g&&g()}))},[w,S,j,A,m,g]),F=n.useCallback(()=>{w||S||(R(!0),C(!1),N(!1),b&&b(),A(0,i,()=>{z(i),v&&v()}))},[w,S,i,A,b,v]),$=n.useCallback(()=>{x?F():L()},[x,L,F]),B=n.useCallback(e=>{w||(z(e),e>0&&C(!1))},[w]),O=n.useCallback(()=>{E(!0)},[]),I=n.useCallback(()=>{E(!1)},[]);n.useEffect(()=>{d!==x&&(d?L():F())},[d]),n.useEffect(()=>{d&&!w?N(!0):d||w||N(!1)},[d,w]),n.useEffect(()=>{const e=M.current,t=P.current;return()=>{e&&cancelAnimationFrame(e),t&&clearTimeout(t)}},[]);const q="left"===o,H=x?q?"▸":"◂":q?"◂":"▸",W=l(y),U=w&&!S?{transition:`flex ${h}ms ${f}`}:void 0,K=e=>{let t="hybrid-panel";return e&&(t+=" collapsible-panel",w&&!S&&(t+=" animating"),x&&(t+=" collapsed")),t};return t.jsx("div",{className:`animated-resizable-layout ${c}`,style:{...W,...u},children:t.jsxs(r.PanelGroup,{direction:"horizontal",onLayout:I,children:[t.jsx(r.Panel,{ref:q?D:void 0,collapsible:q,defaultSize:q?d?0:i:void 0,minSize:q?s:30,collapsedSize:0,onResize:q?B:void 0,onCollapse:q?()=>C(!0):void 0,onExpand:q?()=>C(!1):void 0,className:K(q),style:q?U:void 0,children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:q&&x?0:1,transition:w?`opacity ${.5*h}ms ${f}`:"none"},children:e})}),t.jsx(r.PanelResizeHandle,{className:"resize-handle "+(k?"collapsed":""),onDragging:O,style:k?{visibility:"hidden",width:0}:void 0,children:p&&t.jsx("div",{className:"handle-bar",children:t.jsx("button",{onClick:$,className:"collapse-toggle",disabled:w,"aria-label":x?"Expand panel":"Collapse panel",children:H})})}),t.jsx(r.Panel,{ref:q?void 0:D,collapsible:!q,defaultSize:q?void 0:d?0:i,minSize:q?30:s,collapsedSize:0,onResize:q?void 0:B,onCollapse:q?void 0:()=>C(!0),onExpand:q?void 0:()=>C(!1),className:K(!q),style:q?void 0:U,children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:!q&&x?0:1,transition:w?`opacity ${.5*h}ms ${f}`:"none"},children:a})})]})})},e.AnimatedVerticalLayout=({topPanel:e,bottomPanel:a,collapsiblePanels:o={top:!0,bottom:!0},defaultSizes:i={top:30,bottom:30},minSizes:s={top:5,bottom:5},className:c="",collapsed:d={top:!1,bottom:!1},style:u,showCollapseButtons:p=!1,animationDuration:h=300,animationEasing:f="cubic-bezier(0.4, 0, 0.2, 1)",theme:m,onTopCollapseStart:g,onTopCollapseComplete:b,onTopExpandStart:v,onTopExpandComplete:y,onBottomCollapseStart:x,onBottomCollapseComplete:C,onBottomExpandStart:w,onBottomExpandComplete:R,onPanelResize:S})=>{const[E,k]=n.useState(d.top||!1),[N,j]=n.useState(!1),[z,D]=n.useState(d.top?0:i.top),M=n.useRef(null),T=n.useRef(void 0),P=n.useRef(void 0),[A,L]=n.useState(d.bottom||!1),[F,$]=n.useState(!1),[B,O]=n.useState(d.bottom?0:i.bottom),I=n.useRef(null),q=n.useRef(void 0),H=n.useRef(void 0),[W,U]=n.useState(!1),K=n.useCallback((e,t,n)=>{if(!M.current)return;T.current&&cancelAnimationFrame(T.current),P.current=performance.now();const r=a=>{if(!P.current||!M.current)return;const o=a-P.current,l=Math.min(o/h,1),i=l<.5?4*l*l*l:1-Math.pow(-2*l+2,3)/2,s=e+(t-e)*i;M.current.resize(s),l<1?T.current=requestAnimationFrame(r):(0===t?M.current.collapse():M.current.resize(t),j(!1),n&&n())};T.current=requestAnimationFrame(r)},[h]),V=n.useCallback((e,t,n)=>{if(!I.current)return;q.current&&cancelAnimationFrame(q.current),H.current=performance.now();const r=a=>{if(!H.current||!I.current)return;const o=a-H.current,l=Math.min(o/h,1),i=l<.5?4*l*l*l:1-Math.pow(-2*l+2,3)/2,s=e+(t-e)*i;I.current.resize(s),l<1?q.current=requestAnimationFrame(r):(0===t?I.current.collapse():I.current.resize(t),$(!1),n&&n())};q.current=requestAnimationFrame(r)},[h]),X=n.useCallback(()=>{N||W||!o.top||(j(!0),k(!0),g&&g(),K(z,0,()=>{D(0),b&&b()}))},[N,W,z,o.top,K,g,b]),Y=n.useCallback(()=>{N||W||!o.top||(j(!0),k(!1),v&&v(),K(0,i.top,()=>{D(i.top),y&&y()}))},[N,W,i.top,o.top,K,v,y]),G=n.useCallback(()=>{E?Y():X()},[E,X,Y]),J=n.useCallback(()=>{F||W||!o.bottom||($(!0),L(!0),x&&x(),V(B,0,()=>{O(0),C&&C()}))},[F,W,B,o.bottom,V,x,C]),_=n.useCallback(()=>{F||W||!o.bottom||($(!0),L(!1),w&&w(),V(0,i.bottom,()=>{O(i.bottom),R&&R()}))},[F,W,i.bottom,o.bottom,V,w,R]),Q=n.useCallback(()=>{A?_():J()},[A,J,_]),Z=n.useCallback(e=>{N||(D(e),e>0&&k(!1))},[N]),ee=n.useCallback(e=>{F||(O(e),e>0&&L(!1))},[F]),te=n.useCallback(()=>{U(!0)},[]),ne=n.useCallback(()=>{U(!1),S&&S({top:z,bottom:B})},[z,B,S]);n.useEffect(()=>{void 0!==d.top&&d.top!==E&&(d.top?X():Y())},[d.top]),n.useEffect(()=>{void 0!==d.bottom&&d.bottom!==A&&(d.bottom?J():_())},[d.bottom]),n.useEffect(()=>()=>{T.current&&cancelAnimationFrame(T.current),q.current&&cancelAnimationFrame(q.current)},[]);const re=l(m),ae=N&&!W?{transition:`flex ${h}ms ${f}`}:void 0,oe=F&&!W?{transition:`flex ${h}ms ${f}`}:void 0;return t.jsx("div",{className:`animated-vertical-layout ${c}`,style:{...re,...u},children:t.jsxs(r.PanelGroup,{direction:"vertical",onLayout:ne,children:[t.jsx(r.Panel,{ref:M,collapsible:o.top,defaultSize:d.top?0:i.top,minSize:s.top,collapsedSize:0,onResize:Z,onCollapse:()=>k(!0),onExpand:()=>k(!1),className:(()=>{let e="vertical-panel collapsible-panel";return N&&!W&&(e+=" animating"),E&&(e+=" collapsed"),e})(),style:ae,children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:E?0:1,transition:N?`opacity ${.5*h}ms ${f}`:"none"},children:e})}),t.jsx(r.PanelResizeHandle,{className:"vertical-resize-handle",onDragging:te,children:p&&t.jsxs("div",{className:"handle-bar",children:[o.top&&t.jsx("button",{onClick:G,className:"collapse-toggle collapse-toggle-top",disabled:N,"aria-label":E?"Expand top panel":"Collapse top panel",children:E?"▾":"▴"}),o.bottom&&t.jsx("button",{onClick:Q,className:"collapse-toggle collapse-toggle-bottom",disabled:F,"aria-label":A?"Expand bottom panel":"Collapse bottom panel",children:A?"▴":"▾"})]})}),t.jsx(r.Panel,{ref:I,collapsible:o.bottom,defaultSize:d.bottom?0:i.bottom,minSize:s.bottom,collapsedSize:0,onResize:ee,onCollapse:()=>L(!0),onExpand:()=>L(!1),className:(()=>{let e="vertical-panel collapsible-panel";return F&&!W&&(e+=" animating"),A&&(e+=" collapsed"),e})(),style:oe,children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:A?0:1,transition:F?`opacity ${.5*h}ms ${f}`:"none"},children:a})})]})})},e.CollapsibleSplitPane=({primaryContent:e,secondaryContent:n,collapsedHeader:r,collapsed:a=!0,onCollapsedChange:o,ratio:i=.3,onRatioChange:c,minRatio:d=.1,maxRatio:u=.8,collapsedHeight:p=28,theme:h,className:f="",style:m,animationDuration:g=200,onCollapseStart:b,onCollapseComplete:v,onExpandStart:y,onExpandComplete:x})=>{const C=l(h);return n?t.jsx(s,{primaryContent:e,secondaryContent:n,collapsedHeader:r??{title:"Content"},collapsed:a,onCollapsedChange:o??(()=>{}),ratio:i,onRatioChange:c??(()=>{}),minRatio:d,maxRatio:u,collapsedHeight:p,theme:h,className:f,style:m,animationDuration:g,onCollapseStart:b,onCollapseComplete:v,onExpandStart:y,onExpandComplete:x}):t.jsx("div",{className:`collapsible-split-pane ${f}`,style:{...C,...m},children:t.jsx("div",{className:"csp-primary-content-full",children:e})})},e.ConfigurablePanelLayout=f,e.EditableConfigurablePanelLayout=({isEditMode:e,onLayoutChange:r,panels:a,layout:o,...l})=>{const[i,s]=n.useState(null),[c,d]=n.useState({x:0,y:0}),u=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.useMemo(()=>[...t].filter(e=>null!=e),[...t])}((p=qe,h={activationConstraint:{distance:8}},n.useMemo(()=>({sensor:p,options:null!=h?h:{}}),[p,h])));var p,h;const m=n.useCallback(e=>{const t=e.active.id;if(t.startsWith("slot-")){const e=t.replace("slot-","");s(e),d({x:0,y:0})}},[]),g=n.useCallback(e=>{const{delta:t}=e;d({x:t.x,y:t.y})},[]),b=n.useCallback(e=>{const{active:t,over:n}=e;if(s(null),d({x:0,y:0}),!n)return;const a=t.id,l=n.id,i=a.replace("slot-",""),c=l.replace("drop-","");if(i===c)return;const u={...o},p=u[i];u[i]=u[c],u[c]=p,r&&r(u)},[o,r]);n.useEffect(()=>{if(!i||!e)return;const t=document.querySelector(`[data-slot="${i}"]`);return t&&(t.setAttribute("data-dragging","true"),t.style.setProperty("transform",`scale(0.95) translate(${c.x}px, ${c.y}px)`,"important"),t.style.setProperty("z-index","1000","important"),t.style.setProperty("transition","none","important"),t.style.setProperty("opacity","0.95","important"),t.style.setProperty("box-shadow","0 12px 24px rgba(0, 0, 0, 0.25)","important")),()=>{t&&(t.removeAttribute("data-dragging"),t.style.removeProperty("transform"),t.style.removeProperty("z-index"),t.style.removeProperty("transition"),t.style.removeProperty("opacity"),t.style.removeProperty("box-shadow"))}},[i,c,e]);const v={left:{"data-slot":"left","data-edit-mode":e?"true":"false"},middle:{"data-slot":"middle","data-edit-mode":e?"true":"false"},right:{"data-slot":"right","data-edit-mode":e?"true":"false"}};return t.jsx(Et,{sensors:u,collisionDetection:te,onDragStart:m,onDragMove:g,onDragEnd:b,children:t.jsxs("div",{className:"editable-panel-layout "+(e?"edit-mode-active":""),children:[t.jsx(f,{...l,panels:a,layout:o,slotDataAttributes:v}),e&&t.jsx(Mt,{layout:o,activeSlot:i,onDragStart:()=>{},onDragEnd:()=>{}})]})})},e.PanelBoundsProvider=p,e.PanelConfigurator=({availablePanels:e,currentLayout:r,onChange:a,className:l="",theme:i})=>{const s=o.useTheme(),c=i||s.theme,[d,u]=n.useState(null),p=n.useCallback(t=>t&&e.find(e=>e.id===t)||null,[e]),h=n.useCallback(()=>[...e].sort((e,t)=>e.label.localeCompare(t.label)),[e]),f=n.useCallback(e=>{const t=Pt(r.left),n=Pt(r.middle),a=Pt(r.right);return t.includes(e)||n.includes(e)||a.includes(e)},[r]),m=n.useCallback((e,t)=>{const n={...e};return["left","middle","right"].forEach(e=>{const r=n[e];if(r===t)n[e]=null;else if(null!=r&&Tt(r)){const a=r.panels.filter(e=>e!==t);0===a.length?n[e]=null:1===a.length?n[e]=a[0]:n[e]={...r,panels:a}}}),n},[]),g=n.useCallback((e,t)=>{const n=r[e];if(!Tt(n)||"tabs"!==n.type)return;const o=n.panels.filter(e=>e!==t),l={...r};l[e]={...n,panels:o},a(l)},[r,a]),b=n.useCallback((e,t)=>{t.stopPropagation();const n=r[e];if(Tt(n)&&"tabs"===n.type){const t={...r};t[e]=n.panels.length>0?n.panels[0]:null,a(t),u(null)}else{const t=n&&"string"==typeof n?[n]:[],o={...r};o[e]={type:"tabs",panels:t,config:{defaultActiveTab:0,tabPosition:"top"}},a(o),u({type:"slot",position:e})}},[r,a]),v=n.useCallback(e=>{if(d)if("slot"===d.type){if(d.position===e)return;const t={...r},n=t[d.position];t[d.position]=t[e],t[e]=n,a(t),u(null)}else{const t=r[e];if(Tt(t)&&"tabs"===t.type){if(t.panels.includes(d.id))return void g(e,d.id);const n=t,o=m(r,d.id);return o[e]={...n,panels:[...n.panels,d.id]},void a(o)}{const t=m(r,d.id);t[e]=d.id,a(t),u(null)}}else u({type:"slot",position:e})},[d,r,a,m,g]),y=n.useCallback(e=>{if(d)if("slot"===d.type){const t=r[d.position];if(Tt(t)&&"tabs"===t.type){if(t.panels.includes(e))return void g(d.position,e);const n=t,o=m(r,e);return o[d.position]={...n,panels:[...n.panels,e]},void a(o)}{const t=m(r,e);t[d.position]=e,a(t),u(null)}}else u({type:"panel",id:e});else u({type:"panel",id:e})},[d,r,a,m,g]),x=n.useCallback((e,t)=>{t.stopPropagation();const n={...r};n[e]=null,a(n),u(null)},[r,a]),C=n.useCallback((e,t,n)=>{n.stopPropagation();const o=r[e];if(!Tt(o)||"tabs"!==o.type)return;const l=o.panels.filter(e=>e!==t),i={...r};i[e]={...o,panels:l},a(i)},[r,a]),w=n.useCallback((e,t)=>{const n=r[e];if(!Tt(n)||"tabs"!==n.type)return;const o={...r};o[e]={...n,config:{...n.config,...t}},a(o)},[r,a]),R=h(),S=e=>{const t=r[e];return Tt(t)&&"tabs"===t.type},E={"--configurator-bg":c.colors.background,"--configurator-title":c.colors.textSecondary,"--slot-bg":c.colors.backgroundSecondary,"--slot-border":c.colors.border,"--slot-border-hover":c.colors.textTertiary,"--slot-border-selected":c.colors.primary,"--slot-bg-selected":c.colors.backgroundLight,"--slot-label":c.colors.textTertiary,"--slot-content-text":c.colors.text,"--slot-preview-bg":c.colors.backgroundTertiary,"--slot-preview-border":c.colors.border,"--slot-preview-text":c.colors.textMuted,"--slot-empty-text":c.colors.textMuted,"--panel-bg":c.colors.backgroundSecondary,"--panel-border":c.colors.border,"--panel-border-hover":c.colors.textSecondary,"--panel-border-selected":c.colors.primary,"--panel-bg-selected":c.colors.backgroundLight,"--panel-label-text":c.colors.text,"--panel-preview-bg":c.colors.backgroundTertiary,"--panel-preview-text":c.colors.textMuted,"--clear-btn-bg":c.colors.error,"--clear-btn-text":c.colors.background,"--clear-btn-hover":c.colors.error,"--hint-bg":c.colors.backgroundLight,"--hint-border":c.colors.primary,"--hint-text":c.colors.text};return t.jsxs("div",{className:`panel-configurator ${l}`,style:E,children:[t.jsxs("div",{className:"configurator-section",children:[t.jsx("h3",{className:"section-title",children:"Panel Layout (3 Slots)"}),t.jsx("div",{className:"slots-container",children:["left","middle","right"].map(e=>{const n=r[e],a=(e=>"slot"===d?.type&&d.position===e)(e),o=Tt(n)&&"tabs"===n.type,l=null!==n;return t.jsxs("div",{"data-position":e,className:`slot ${a?"selected":""} ${l?"filled":"empty"} ${o?"tab-group":""}`,onClick:()=>v(e),children:[t.jsx("button",{className:"tab-mode-toggle "+(o?"active":""),onClick:t=>b(e,t),title:o?"Disable tab mode":"Enable tab mode",children:t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:t.jsx("path",{d:"M2 2h4v2H2V2zm5 0h4v2H7V2zm5 0h2v2h-2V2zM2 5h12v9H2V5zm1 1v7h10V6H3z"})})}),null===n?t.jsx("div",{className:"slot-empty-state",children:o?"Click panels to add tabs":"Empty"}):Tt(n)?t.jsxs("div",{className:"slot-content group-content",children:["tabs"===n.type&&n.panels.length>0&&t.jsx("div",{className:"tab-config-controls",children:t.jsxs("label",{className:"tab-config-label",children:["Tabs:",t.jsxs("select",{value:n.config?.tabPosition||"top",onChange:t=>w(e,{tabPosition:t.target.value}),onClick:e=>e.stopPropagation(),children:[t.jsx("option",{value:"top",children:"Top (centered)"}),t.jsx("option",{value:"bottom",children:"Bottom (centered)"}),t.jsx("option",{value:"left",children:"Left"}),t.jsx("option",{value:"right",children:"Right"})]})]})}),t.jsx("div",{className:"group-panels",children:0===n.panels.length?t.jsx("div",{className:"slot-empty-state",children:"Click panels to add tabs"}):n.panels.map((r,a)=>{const o=p(r),l="tabs"===n.type&&(n.config?.defaultActiveTab??0)===a;return o?t.jsxs("div",{className:"group-panel-item",children:[t.jsxs("span",{className:"group-panel-label",children:[o.label,l&&t.jsx("span",{className:"default-badge",children:"★"})]}),t.jsx("button",{className:"remove-from-group-btn",onClick:t=>C(e,r,t),title:`Remove ${o.label}`,children:"×"})]},r):null})})]}):t.jsxs("div",{className:"slot-content",children:["string"==typeof n&&p(n)?.preview&&t.jsx("div",{className:"slot-preview",children:p(n)?.preview}),t.jsx("div",{className:"slot-panel-label",children:"string"==typeof n?p(n)?.label:""}),t.jsx("button",{className:"slot-clear-btn",onClick:t=>x(e,t),"aria-label":`Remove ${"string"==typeof n?p(n)?.label:"panel"} from ${e} slot`,children:"×"})]})]},e)})})]}),t.jsxs("div",{className:"configurator-section",children:[t.jsx("h3",{className:"section-title",children:"Available Panels"}),t.jsx("div",{className:"available-panels",children:R.map(e=>{const n=(r=e.id,"panel"===d?.type&&d.id===r);var r;const a=f(e.id);return t.jsxs("div",{className:`available-panel ${n?"selected":""} ${a?"in-use":""}`,onClick:()=>y(e.id),children:[t.jsx("div",{className:"panel-label",children:e.label}),e.preview&&t.jsx("div",{className:"panel-preview",children:e.preview})]},e.id)})})]}),d&&t.jsx("div",{className:"selection-hint",children:"slot"===d.type?S(d.position)?t.jsxs(t.Fragment,{children:["Selected: ",d.position," slot (Tab Mode). Click panels to add them to the tab group."]}):t.jsxs(t.Fragment,{children:["Selected: ",d.position," slot. Click another slot to swap, or click a panel to assign."]}):t.jsxs(t.Fragment,{children:["Selected: ",p(d.id)?.label,". Click a slot to assign",S("left")||S("middle")||S("right")?" (or add to tab group)":"","."]})}),t.jsxs("div",{className:"usage-hint",children:[t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",style:{verticalAlign:"text-bottom",marginRight:"4px"},children:t.jsx("path",{d:"M8 1a7 7 0 100 14A7 7 0 008 1zm0 1a6 6 0 110 12A6 6 0 018 2zm.5 3.5v3h-1v-3h1zm0 4v1h-1v-1h1z"})}),t.jsx("strong",{children:"Tip:"})," Toggle the tab icon on a slot to enable tab mode, then click panels to add multiple tabs."]})]})},e.ResponsiveConfigurablePanelLayout=({mobileBreakpoint:e="(max-width: 768px)",mobileCarouselProps:r,onMobilePanelChange:a,theme:o,layout:l,panels:s,...d})=>{const u=g(e),p=n.useRef(null),[h,b]=n.useState(0),v=n.useMemo(()=>[l?.left,l?.middle,l?.right],[l]),y=["left","middle","right"],x=n.useMemo(()=>{const e=e=>{if(!e)return null;const t=s.find(t=>t.id===e);return t?.content??null},n=e=>{const t=s.find(t=>t.id===e);return t?.label??e},r=e=>{const t=s.find(t=>t.id===e);return t?.icon??null};return v.map((a,l)=>((a,l)=>{if(null==a)return null;if("object"==typeof a&&"type"in a){const e=a;if("tabs"===e.type){const a=e.panels[0],i=e.panels.length>0?n(a):"Tab Group",d=e.panels.length>0?r(a):null;return{content:t.jsx(c,{panelIds:e.panels,panels:s,config:e.config,theme:o}),label:i,icon:d,slot:l}}return null}return{content:e(a),label:n(a),icon:r(a),slot:l}})(a,y[l])).filter(e=>null!==e)},[v,s,o]),C=e=>{b(e),r?.onPanelChange?.(e);const t=x[e]?.slot;t&&a?.(e,t)},{onPanelChange:w,...R}=r??{},S=i(o);if(u){if(0===x.length)return null;const e=x.map(e=>e.content);return t.jsxs("div",{className:"mobile-tab-layout",style:S,children:[t.jsx("div",{className:"mobile-tab-content",children:t.jsx(m,{ref:p,theme:o,panels:e,minPanelWidth:0,idealPanelWidth:1,disableSwipe:!0,onPanelChange:C,...R})}),t.jsx("nav",{className:"mobile-tab-nav",role:"tablist",children:x.map((e,n)=>t.jsxs("button",{role:"tab","aria-selected":n===h,className:"mobile-tab-button "+(n===h?"active":""),onClick:()=>(e=>{b(e),p.current?.scrollToPanel(e);const t=x[e]?.slot;t&&a?.(e,t)})(n),children:[e.icon&&t.jsx("span",{className:"tab-icon",children:e.icon}),t.jsx("span",{className:"tab-label",children:e.label})]},n))})]})}return t.jsx(f,{theme:o,layout:l,panels:s,...d})},e.SnapCarousel=m,e.TabGroup=c,e.mapThemeToPanelVars=l,e.mapThemeToTabVars=i,e.useMediaQuery=g,e.usePanelBounds=h,e.usePanelOffset=function(){const{bounds:e}=h();return{offsetX:e.x,offsetY:e.y}},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=index.umd.js.map
|