@vuu-ui/vuu-layout 0.5.10 → 0.5.11

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.
Files changed (114) hide show
  1. package/LICENSE +201 -0
  2. package/cjs/index.js +20 -0
  3. package/cjs/index.js.map +7 -0
  4. package/esm/index.js +20 -0
  5. package/esm/index.js.map +7 -0
  6. package/index.css +2 -0
  7. package/index.css.map +7 -0
  8. package/package.json +13 -10
  9. package/src/Component.css +0 -0
  10. package/src/Component.tsx +0 -20
  11. package/src/DraggableLayout.css +0 -18
  12. package/src/DraggableLayout.tsx +0 -26
  13. package/src/__tests__/flexbox-utils.spec.js +0 -90
  14. package/src/chest-of-drawers/Chest.css +0 -36
  15. package/src/chest-of-drawers/Chest.tsx +0 -42
  16. package/src/chest-of-drawers/Drawer.css +0 -159
  17. package/src/chest-of-drawers/Drawer.tsx +0 -118
  18. package/src/chest-of-drawers/index.ts +0 -2
  19. package/src/common-types.ts +0 -9
  20. package/src/debug.ts +0 -16
  21. package/src/drag-drop/BoxModel.ts +0 -551
  22. package/src/drag-drop/DragState.ts +0 -219
  23. package/src/drag-drop/Draggable.ts +0 -282
  24. package/src/drag-drop/DropMenu.css +0 -71
  25. package/src/drag-drop/DropMenu.tsx +0 -61
  26. package/src/drag-drop/DropTarget.ts +0 -393
  27. package/src/drag-drop/DropTargetRenderer.css +0 -40
  28. package/src/drag-drop/DropTargetRenderer.tsx +0 -277
  29. package/src/drag-drop/dragDropTypes.ts +0 -47
  30. package/src/drag-drop/index.ts +0 -5
  31. package/src/editable-label/EditableLabel.css +0 -28
  32. package/src/editable-label/EditableLabel.tsx +0 -99
  33. package/src/editable-label/index.ts +0 -1
  34. package/src/flexbox/Flexbox.css +0 -45
  35. package/src/flexbox/Flexbox.tsx +0 -70
  36. package/src/flexbox/FlexboxLayout.tsx +0 -28
  37. package/src/flexbox/FluidGrid.css +0 -134
  38. package/src/flexbox/FluidGrid.tsx +0 -82
  39. package/src/flexbox/FluidGridLayout.tsx +0 -9
  40. package/src/flexbox/Splitter.css +0 -140
  41. package/src/flexbox/Splitter.tsx +0 -127
  42. package/src/flexbox/flexbox-utils.ts +0 -128
  43. package/src/flexbox/flexboxTypes.ts +0 -68
  44. package/src/flexbox/index.ts +0 -5
  45. package/src/flexbox/useResponsiveSizing.ts +0 -82
  46. package/src/flexbox/useSplitterResizing.ts +0 -270
  47. package/src/index.ts +0 -19
  48. package/src/layout-action.ts +0 -21
  49. package/src/layout-header/ActionButton.tsx +0 -23
  50. package/src/layout-header/Header.css +0 -8
  51. package/src/layout-header/Header.tsx +0 -216
  52. package/src/layout-header/index.ts +0 -1
  53. package/src/layout-provider/LayoutProvider.tsx +0 -161
  54. package/src/layout-provider/LayoutProviderContext.ts +0 -17
  55. package/src/layout-provider/index.ts +0 -3
  56. package/src/layout-provider/useLayoutDragDrop.ts +0 -210
  57. package/src/layout-reducer/flexUtils.ts +0 -276
  58. package/src/layout-reducer/index.ts +0 -5
  59. package/src/layout-reducer/insert-layout-element.ts +0 -365
  60. package/src/layout-reducer/layout-reducer.ts +0 -237
  61. package/src/layout-reducer/layoutTypes.ts +0 -159
  62. package/src/layout-reducer/layoutUtils.ts +0 -288
  63. package/src/layout-reducer/remove-layout-element.ts +0 -226
  64. package/src/layout-reducer/replace-layout-element.ts +0 -113
  65. package/src/layout-reducer/resize-flex-children.ts +0 -55
  66. package/src/layout-reducer/wrap-layout-element.ts +0 -307
  67. package/src/layout-view/View.css +0 -61
  68. package/src/layout-view/View.tsx +0 -143
  69. package/src/layout-view/ViewContext.ts +0 -30
  70. package/src/layout-view/index.ts +0 -5
  71. package/src/layout-view/useView.tsx +0 -104
  72. package/src/layout-view/useViewActionDispatcher.ts +0 -123
  73. package/src/layout-view/useViewResize.ts +0 -53
  74. package/src/layout-view/viewTypes.ts +0 -35
  75. package/src/palette/Palette.css +0 -33
  76. package/src/palette/Palette.tsx +0 -140
  77. package/src/palette/PaletteSalt.css +0 -9
  78. package/src/palette/PaletteSalt.tsx +0 -79
  79. package/src/palette/index.ts +0 -3
  80. package/src/placeholder/Placeholder.css +0 -10
  81. package/src/placeholder/Placeholder.tsx +0 -38
  82. package/src/placeholder/index.ts +0 -1
  83. package/src/registry/ComponentRegistry.ts +0 -44
  84. package/src/registry/index.ts +0 -1
  85. package/src/responsive/breakpoints.ts +0 -62
  86. package/src/responsive/index.ts +0 -3
  87. package/src/responsive/measureMinimumNodeSize.ts +0 -23
  88. package/src/responsive/overflowUtils.js +0 -14
  89. package/src/responsive/use-breakpoints.ts +0 -101
  90. package/src/responsive/useResizeObserver.ts +0 -154
  91. package/src/responsive/utils.ts +0 -37
  92. package/src/stack/Stack.css +0 -39
  93. package/src/stack/Stack.tsx +0 -173
  94. package/src/stack/StackLayout.tsx +0 -119
  95. package/src/stack/index.ts +0 -4
  96. package/src/stack/stackTypes.ts +0 -22
  97. package/src/tabs/TabPanel.css +0 -12
  98. package/src/tabs/TabPanel.tsx +0 -17
  99. package/src/tabs/index.ts +0 -1
  100. package/src/tools/config-wrapper/ConfigWrapper.tsx +0 -55
  101. package/src/tools/config-wrapper/index.ts +0 -1
  102. package/src/tools/devtools-box/layout-configurator.css +0 -112
  103. package/src/tools/devtools-box/layout-configurator.jsx +0 -369
  104. package/src/tools/devtools-tree/layout-tree-viewer.css +0 -15
  105. package/src/tools/devtools-tree/layout-tree-viewer.jsx +0 -36
  106. package/src/tools/index.ts +0 -4
  107. package/src/use-persistent-state.ts +0 -112
  108. package/src/utils/index.ts +0 -5
  109. package/src/utils/pathUtils.ts +0 -283
  110. package/src/utils/propUtils.ts +0 -26
  111. package/src/utils/refUtils.ts +0 -16
  112. package/src/utils/styleUtils.ts +0 -13
  113. package/src/utils/typeOf.ts +0 -25
  114. package/tsconfig-emit-types.json +0 -11
package/esm/index.js ADDED
@@ -0,0 +1,20 @@
1
+ import{Scrim as _r,Toolbar as Gr,ToolbarButton as Ur}from"@heswell/salt-lab";import{Text as Xr}from"@salt-ds/core";import Yr from"classnames";import{useCallback as yo,useRef as Zr,useState as bo}from"react";import{useLayoutEffect as fo,useMemo as Wr}from"react";import*as ho from"react-dom";import*as uo from"react-dom";import{SaltProvider as Hr}from"@salt-ds/core";import{jsx as Vr}from"react/jsx-runtime";var $r=1,Nr=(e=0,t=0,o=window)=>{let n=o.document.createElement("div");return n.className="vuuPopup "+$r++,n.style.cssText=`left:${e}px; top:${t}px;`,o.document.body.appendChild(n),n},Fr=(e,t)=>Nr(e,t),Ve=(e,t,o,n,r)=>{t.style.cssText=`left:${o}px; top:${n}px;position: absolute;`,uo.render(Vr(Hr,{applyClassesTo:"child",children:e}),t,r)},mo=Fr;var go=function({children:t,x:o=0,y:n=0,onRender:r}){let i=Wr(()=>mo(),[]);return fo(()=>{Ve(t,i,o,n,r)},[t,r,i,o,n]),fo(()=>()=>{var s;i&&(ho.unmountComponentAtNode(i),i.classList.contains("vuuPopup")&&((s=i.parentElement)==null||s.removeChild(i)))},[i]),null};import{jsx as We,jsxs as xo}from"react/jsx-runtime";var xt="vuuDialog",oc=({children:e,className:t,isOpen:o=!1,onClose:n,title:r,...i})=>{let s=Zr(null),[a]=bo(0),[l]=bo(0),c=yo(()=>{n==null||n()},[n]),p=yo(()=>{},[]);return o?We(go,{onRender:p,x:a,y:l,children:We(_r,{className:`${xt}-scrim`,open:o,children:xo("div",{...i,className:Yr(xt,t),ref:s,children:[xo(Gr,{className:`${xt}-header`,children:[We(Xr,{children:r}),We(Ur,{onClick:c,"data-align-end":!0,"data-icon":"close"},"close")]}),e]})})}):null};import ei from"classnames";import{Button as Ro,useControlled as qr}from"@salt-ds/core";import Eo from"classnames";import{useCallback as Jr}from"react";import{jsx as De,jsxs as jr}from"react/jsx-runtime";var oe="vuuDrawer",So=e=>typeof e=="string"?e:e+"px",Kr=(e,t,o)=>{let n=t!==void 0,r=o!==void 0;if(!(!e&&!r&&!n))return!r&&!n?e:{...e,"--drawer-size":n?So(t):void 0,"--drawer-peek-size":r?So(o):void 0}},To=({children:e,className:t,clickToOpen:o,defaultOpen:n,sizeOpen:r,sizeClosed:i,style:s,open:a,position:l="left",inline:c,onClick:p,peekaboo:m=!1,toggleButton:u,...f})=>{let[h,g]=qr({controlled:a,default:n!=null?n:!1,name:"Drawer",state:"open"}),y=Eo(oe,t,`${oe}-${l}`,{[`${oe}-open`]:h,[`${oe}-inline`]:c,[`${oe}-over`]:!c,[`${oe}-peekaboo`]:m}),d=Jr(()=>{console.log("toggleDrawer"),g(!h)},[h,g]),b=Kr(s,r,i),E=o?d:p,R=()=>De("div",{className:Eo("vuuToggleButton-container"),children:h?De(Ro,{"aria-label":"close",onClick:d,"data-icon":"close",variant:"secondary"}):De(Ro,{"aria-label":"open",onClick:d,"data-icon":"close",variant:"secondary"})});return jr("div",{...f,className:y,onClick:E,style:b,children:[u=="start"?R():null,De("div",{className:`${oe}-liner`,children:De("div",{className:`${oe}-content`,children:e})}),u=="end"?R():null]})};To.displayName="Drawer";var Rt=To;import{partition as vo}from"@vuu-ui/vuu-utils";var Do={},wo={},ne={};function $(e){return Do[e]===!0}function Qr(e){return wo[e]===!0}var Po=e=>$(e)||Qr(e),yc=e=>!!ne[e];function z(e,t,o="component"){ne[e]=t,o==="container"?Do[e]=!0:o==="view"&&(wo[e]=!0)}import{jsx as ri,jsxs as ii}from"react/jsx-runtime";var ti=e=>e.type===Rt,oi=({props:{position:e="left"}})=>e.match(/top|bottom/),Et=e=>{let{children:t,className:o,id:n,style:r}=e,i="hwChest",[s,a]=vo(t,ti),[l,c]=vo(s,oi),p=l.length===0?"horizontal":c.length===0?"vertical":"both",m=ei(i,o,`${i}-${p}`);return ii("div",{className:m,id:n,style:r,children:[s,ri("div",{className:`${i}-content`,children:a})]})};Et.displayName="Chest";var ni=Et;z("Chest",Et,"container");import{forwardRef as si}from"react";import{jsx as ai}from"react/jsx-runtime";var St=si(function({resizeable:t,...o},n){return ai("div",{...o,className:"Component",ref:n})});St.displayName="Component";var Tt=St;z("Component",St);import pe from"react";var li={},w=(e,t)=>{var n;let o=D(e);return(n=o[t])!=null?n:o[`data-${t}`]},D=e=>(e==null?void 0:e.props)||e||li,Lo=e=>{let t=D(e);if(t.children){let{children:[o,...n]}=t;return n.length>0&&console.warn(`getChild expected a single child, found ${n.length+1}`),o}};function P(e){var t;if(e){let o=e.type;if(typeof o=="function"||typeof o=="object"){let n=o.displayName||o.name||((t=o.type)==null?void 0:t.name);if(typeof n=="string")return n}if(typeof e.type=="string")return e.type;if(e.constructor)return e.constructor.displayName;throw Error("typeOf unable to determine type of element")}}var Vc=(e,t)=>P(e)===t;var ci=e=>{let t=e.lastIndexOf(".");return t===-1?e:e.slice(0,t)};function Q(e,t){let{"data-path":o,path:n=o}=D(e);return t==="0"||t===n?null:V(e,ci(t),!0)}function ee(e,t){let{children:o,...n}=D(e);if(t(n))return e;if(pe.Children.count(o)>0){let r=pe.isValidElement(o)?[o]:o;for(let i of r){let s=ee(i,t);if(s)return s}}}function pi(e,t){if(t===e)return null;let{path:o,children:n}=D(e),{idx:r,finalStep:i}=Z(o,w(t,"path"));return i?e:n===void 0||n[r]===void 0?null:pi(n[r],t)}var ui=(e,t)=>{if(pe.isValidElement(e)&&t==0)return e;if(Array.isArray(e))return e[t]};function Mo(e,t){let o=t.split("."),n=[e],r=i=>pe.isValidElement(i.props.children)?[i.props.children]:i.props.children;for(let i=0;i<o.length;i++){let s=parseInt(o[i]),a=n[s];if(i===o.length-1)return a;n=r(a)}}function V(e,t,o=!1){let{"data-path":n,path:r=n}=D(e);if(t.indexOf(r)!==0)throw Error(`pathUtils.followPath path ${t} is not within source path ${r}`);let i=t.slice(r.length+1);if(i==="")return e;let s=e,a=i.split(".");for(let l=0;l<a.length;l++){if(pe.Children.count(s.props.children)===0){let c=`element at 0.${a.slice(0,l).join(".")} has no children, so cannot fulfill rest of path ${a.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c);return}if(s=ui(s.props.children,parseInt(a[l])),s===void 0){let c=`model at 0.${a.slice(0,l).join(".")} has no children that fulfill next step of path ${a.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c)}}return s}function Zc(e,t){let o=Q(e,t),n=t.split(".").map(r=>parseInt(r,10));if(o){let r=n.pop(),{children:i}=o.props;if(i.length-1>r)return _e(i[r+1]);{let s=n.pop(),a=Q(e,w(o,"path"));if(a&&typeof s=="number"&&(n=a.props.path.split(".").map(l=>parseInt(l,10)),a.props.children.length-1>s)){let l=a.props.children[s+1];return $(P(l))?_e(l):l}}}return _e(e)}function qc(e,t){let o=t.split(".").map(i=>parseInt(i,10)),n=o.pop(),r=Q(e,t);if(r!=null&&typeof n=="number"){let{children:i}=r.props;if(n>0)return Ge(i[n-1]);for(;o.length>1;)if(n=o.pop(),r=Q(e,w(r,"path")),n>0){let s=r.props.children[n-1];return $(P(s))?Ge(s):s}}return Ge(e)}function _e(e){if($(P(e))){let{children:t}=e.props||e;return _e(t[0])}return e}function Ge(e){if($(P(e))){let{children:t}=e.props||e;return Ge(t[t.length-1])}return e}function Z(e,t,o=!1){if(e===t)return{idx:-1,finalStep:!0};let n=`${e}.`;if(!t.startsWith(n))throw Error("pathUtils nextStep has strayed from the path");let r=o?0:1,i=t.replace(n,"").split(".").map(s=>parseInt(s,10));return{idx:i[0],finalStep:i.length===r}}function O(e,t,o){if(w(e,"path")===t)return e;let n=[];pe.Children.forEach(e.props.children,(i,s)=>{w(i,"path")?n.push(O(i,`${t}.${s}`)):n.push(i)});let r=e.props["data-path"]?"data-path":"path";return pe.cloneElement(e,{[r]:t,...o},n)}function Kc(e,t){typeof e=="function"?e(t):e&&(e.current=t)}var Dt=e=>{if(typeof e!="number")throw Error(`"no support yet for flex value ${e}`);return{flexBasis:0,flexGrow:1,flexShrink:1}};var me={north:1,east:2,south:4,west:8,header:16,centre:32,absolute:64},we={AFTER:"after",BEFORE:"before"},N=Object.freeze({North:ue("north"),East:ue("east"),South:ue("south"),West:ue("west"),Header:ue("header"),Centre:ue("centre"),Absolute:ue("absolute")});function ue(e){return Object.freeze({offset:e==="north"||e==="west"?0:e==="south"||e==="east"?1:NaN,valueOf:function(){return me[e]},toString:function(){return e},North:e==="north",South:e==="south",East:e==="east",West:e==="west",Header:e==="header",Centre:e==="centre",NorthOrSouth:e==="north"||e==="south",EastOrWest:e==="east"||e==="west",NorthOrWest:e==="north"||e==="west",SouthOrEast:e==="east"||e==="south",Absolute:e==="absolute"})}var Co=N.North,Ao=N.South,wt=N.East,Pt=N.West,mi=N.Header,di=N.Centre,ye=class{static measure(t,o=[]){let n={};return gi(t,n,o),n}static allBoxesContainingPoint(t,o,n,r,i){return Bo(t,o,n,r,i).reverse()}};function vt(e,t,o,n=30){let r=o.right-o.left,i=o.bottom-o.top,s=e-o.left,a=t-o.top,l=0;return s<n&&(l+=8),s>r-n&&(l+=2),a<n&&(l+=1),a>i-n&&(l+=4),{pctX:s/r,pctY:a/i,closeToTheEdge:l}}function Lt(e,t,o,n){let{BEFORE:r,AFTER:i}=we,{pctX:s,pctY:a,closeToTheEdge:l}=vt(e,t,o),c,p;if(n==="row")c=s<.5?Pt:wt;else if(o.header&&Ue(o.header,e,t))if(c=mi,o.Stack){let m=o.Stack.length;if(m===0)p={index:-1,left:o.left,positionRelativeToTab:i,width:0};else{let u=o.Stack.find(({left:f,right:h})=>e>=f&&e<=h);if(u){let f=u.right-u.left;p={index:o.Stack.indexOf(u),left:u.left,positionRelativeToTab:(e-u.left)/f<.5?r:i,width:f}}else p={left:o.Stack[m-1].right,width:0,index:m,positionRelativeToTab:i}}}else if(o.header.titleWidth){let m=o.header.titleWidth;p={index:-1,left:o.left,positionRelativeToTab:(e-o.left)/m<.5?r:i,width:m}}else p={left:o.left,width:0,positionRelativeToTab:r,index:-1};else c=fi(e,t,o,s,a);return{position:c,x:e,y:t,closeToTheEdge:l,tab:p}}function fi(e,t,o,n,r){let i=hi(o,.2);if(Ue(i,e,t))return di;switch(`${r<.5?"north":"south"}${n<.5?"west":"east"}`){case"northwest":return n>r?Co:Pt;case"northeast":return 1-n>r?Co:wt;case"southeast":return n>r?wt:Ao;case"southwest":return 1-n>r?Pt:Ao;default:}}function hi({right:e,left:t,top:o,bottom:n},r){let i=(1-r)/2,s=(e-t)*i,a=(n-o)*i;return{left:t+s,top:o+a,right:e-s,bottom:n-a}}function gi(e,t,o){let{id:n,"data-path":r,path:i=r}=D(e),s=P(e);if(n&&i){let[a,l]=Io(e);ko(e,a,l,t),$(s)&&zo(e,t,o)}}function ko(e,t,o,n){let{"data-path":r,path:i=r,header:s}=D(e);n[i]=t;let a=P(e);if(s||a==="Stack"){let l=o.querySelector(".vuuHeader");if(l){let{top:c,left:p,right:m,bottom:u}=l.getBoundingClientRect();if(n[i].header={top:Math.round(c),left:Math.round(p),right:Math.round(m),bottom:Math.round(u)},a==="Stack")n[i].Stack=Array.from(l.querySelectorAll(".saltTab")).map(f=>f.getBoundingClientRect()).map(({left:f,right:h})=>({left:f,right:h}));else{let f=l.querySelector('[class^="vuuHeader-title"]'),{header:h}=n[i];f&&h&&(h.titleWidth=f.clientWidth)}}}return n[i]}function zo(e,t,o,n=0,r=0,i=0,s=0){let{children:a,"data-path":l,path:c=l,style:p,active:m=0}=D(e),u=P(e),f=u==="Flexbox",h=u==="Stack",g=f&&p.flexDirection==="column",y=f&&p.flexDirection==="row",b=(h?a.filter((R,S)=>S===m):a.filter(yi)).map(R=>{let[S,x]=Io(R);return[{...S,top:S.top-i,right:S.right+r,bottom:S.bottom+s,left:S.left-n},x,R]}),E=b.map(([R,S,x],T,v)=>{let C,B,L,I,M,A,k=v.length-1;y?(M=T===0?0:R.left-v[T-1][0].right,A=T===k?0:v[T+1][0].left-R.right,C=T===0||M===0?0:M,B=T===k||A===0?0:A-A/2,R.left-=C,R.right+=B,L=i,I=s):g&&(M=T===0?0:R.top-v[T-1][0].bottom,A=T===k?0:v[T+1][0].top-R.bottom,L=T===0||M===0?0:M,I=T===k||A===0?0:A-A/2,R.top-=L,R.bottom+=I,C=n,B=r);let Y=ko(x,R,S,t),W=P(x);return $(W)&&zo(x,t,o,C,B,L,I),Y});b.length&&(t[c].children=E)}function yi(e){let{id:t}=D(e),o=document.getElementById(t);return o?o.dataset.dragging!=="true":(console.warn(`BoxModel: no element found with id #${t}`),!1)}function Io(e){let{id:t}=D(e);if(t===void 0)throw Error("`BoxModel.measureComponentElement, component has no id");let o=document.getElementById(t);if(!o)throw Error("BoxModel.measureComponentElement, no DOM element found for component");let{top:n,left:r,right:i,bottom:s,height:a,width:l}=o.getBoundingClientRect(),c,p=P(e);if($(p)){let m=o.scrollHeight;m>a&&(c={id:t,scrollHeight:m,scrollTop:o.scrollTop})}return[{top:Math.round(n),left:Math.round(r),right:Math.round(i),bottom:Math.round(s),height:Math.round(a),width:Math.round(l),scrolling:c},o,e]}function Bo(e,t,o,n,r,i=[]){let{children:s,"data-path":a,path:l=a}=D(e),c=P(e),p=t[l];if(!Ue(p,o,n))return i;if(r&&r.length){if(r.includes(l))i.push(e);else if(!r.some(m=>m.startsWith(l)))return i}else i.push(e);if(!$(c)||p.header&&Ue(p.header,o,n))return i;p.scrolling&&bi(p,o,n);for(let m=0;m<s.length;m++){if(c==="Stack"&&e.props.active!==m)continue;let u=Bo(s[m],t,o,n,r);if(u.length)return i.concat(u)}return i}function Ue(e,t,o){if(e)return t>=e.left&&t<e.right&&o>=e.top&&o<e.bottom}function bi({top:e,bottom:t,scrolling:o},n,r){if(o){let{id:i,scrollTop:s,scrollHeight:a}=o,l=t-e;if(s===0&&t-r<50){let c=a-l;document.getElementById(i).scrollTo({left:0,top:c,behavior:"smooth"}),o.scrollTop=c}else if(s>0&&r-e<50)document.getElementById(i).scrollTo({left:0,top:0,behavior:"smooth"}),o.scrollTop=0;else return!1}else return!1}var xi=.4,Xe=class{constructor(t,o,n,r,i){this.init(t,o,n,r,i)}init(t,o,n,r,i){let{left:s,top:a}=r,{pctX:l,pctY:c}=vt(o,n,r),p=xi,m=l*r.width,u=r.width-m,f=c*r.height,h=r.height-f,g=r.width*p,y=r.height*p,d=1-p,b=m*d,E=f*d,R=u*d,S=h*d;this.intrinsicSize=i,this.constraint={zone:{x:{lo:t.left,hi:t.right},y:{lo:t.top,hi:t.bottom}},pos:{x:{lo:t.left-b,hi:t.right-r.width+R},y:{lo:t.top-E,hi:t.bottom-r.height+S}},mouse:{x:{lo:t.left+g*l,hi:t.right-g*(1-l)},y:{lo:t.top+y*c,hi:t.bottom-y*(1-c)}}},this.x={pos:s,lo:!1,hi:!1,mousePos:o,mousePct:l},this.y={pos:a,lo:!1,hi:!1,mousePos:n,mousePct:c}}outOfBounds(){return this.x.lo||this.x.hi||this.y.lo||this.y.hi}inBounds(){return!this.outOfBounds()}dropX(){return this.dropXY("x")}dropY(){return this.dropXY("y")}hasIntrinsicSize(){var t,o;return((t=this==null?void 0:this.intrinsicSize)==null?void 0:t.height)&&((o=this==null?void 0:this.intrinsicSize)==null?void 0:o.width)}update(t,o){let n=this[t],r=this.constraint.mouse[t],i=this.constraint.pos[t],s=n.pos,a=o-n.mousePos;return a<0?n.lo||(o<r.lo?(n.lo=!0,n.pos=i.lo):n.hi?o<r.hi&&(n.hi=!1,n.pos+=a):n.pos+=a):a>0&&(n.hi||(o>r.hi?(n.hi=!0,n.pos=i.hi):n.lo?o>r.lo&&(n.lo=!1,n.pos+=a):n.pos+=a)),n.mousePos=o,s!==n.pos}dropXY(t){let o=this[t],n=this.constraint.zone[t];return o.lo?Math.max(n.lo,o.mousePos):o.hi?Math.min(o.mousePos,Math.round(n.hi)-1):o.mousePos}};var fp=e=>e.pos.tab&&P(e.component)==="Stack"&&e.pos.position.Header,{north:Ri,south:Ei,east:Si,west:Ti}=me,Di=Si+Ti,wi=Ri+Ei,re=class{constructor({component:t,pos:o,clientRect:n,nextDropTarget:r}){this.component=t,this.pos=o,this.clientRect=n,this.nextDropTarget=r,this.active=!1,this.dropRect=void 0}targetTabPos(t){let{left:o,width:n,positionRelativeToTab:r}=t;return r===we.BEFORE?o:o+n}getTargetDropOutline(t,o){if(this.pos.tab)return this.getDropTabOutline(t,this.pos.tab);if(o&&o.hasIntrinsicSize())return this.getIntrinsicDropRect(o);{let[n,r,i,s]=this.getDropRectOutline(t,o);return{l:n,t:r,r:i,b:s}}}getDropTabOutline(t,o){var d,b;let{clientRect:{top:n,left:r,right:i,bottom:s,header:a}}=this,l=0,c=Math.round(t/2)+l,p=Math.round(n),m=Math.round(r+c),u=Math.round(i-c),f=Math.round(s-c),h=this.targetTabPos(o),g=60,y=((d=a==null?void 0:a.bottom)!=null?d:0)-((b=a==null?void 0:a.top)!=null?b:0);return{l:m,t:p,r:u,b:f,tabLeft:h,tabWidth:g,tabHeight:y}}getIntrinsicDropRect(t){var g,y,d,b;let{pos:o,clientRect:n}=this,{x:r,y:i}=t,s=(y=(g=t.intrinsicSize)==null?void 0:g.height)!=null?y:0,a=(b=(d=t.intrinsicSize)==null?void 0:d.height)!=null?b:0;s&&s>n.height?(console.log("DropTarget: we're going to blow the gaff"),s=n.height):a&&a>n.width&&(console.log("DropTarget: we're going to blow the gaff"),a=n.width);let l=Math.min(n.right-a,Math.max(n.left,Math.round(o.x-r.mousePct*a))),c=Math.min(n.bottom-s,Math.max(n.top,Math.round(o.y-i.mousePct*s))),[p,m,u,f]=this.dropRect=[l,c,l+a,c+s],h=o.position.EastOrWest?[p,n.top,p,n.bottom,u,n.top,u,n.bottom]:[n.left,m,n.right,m,n.left,f,n.right,f];return{l:p,r:u,t:m,b:f,guideLines:h}}getDropRectOutline(t,o){var b,E,R;let{pos:n,clientRect:r}=this,{width:i,height:s,position:a}=n,{width:l,height:c}=(b=o==null?void 0:o.intrinsicSize)!=null?b:{},p=(E=c!=null?c:s)!=null?E:0,m=(R=l!=null?l:i)!=null?R:0;this.dropRect=void 0;let{top:u,left:f,right:h,bottom:g}=r,y=0,d=Math.round(t/2)+y;switch(a){case N.North:case N.Header:{let S=Math.round((g-u)/2),x=p?Math.min(S,Math.round(p)):S;return m&&f+m<h?[f+d,u+d,f+m-d,u+d+x]:[f+d,u+d,h-d,u+d+x]}case N.West:{let S=Math.round((h-f)/2),x=m?Math.min(S,Math.round(m)):S;return p&&u+p<g?[f+d,u+d,f-d+x,u+p+d]:[f+d,u+d,f-d+x,g-d]}case N.East:{let S=Math.round((h-f)/2),x=m?Math.min(S,Math.round(m)):S;return p&&u+p<g?[h-d-x,u+d,h-d,u+p+d]:[h-d-x,u+d,h-d,g-d]}case N.South:{let S=Math.round((g-u)/2),x=p?Math.min(S,Math.round(p)):S;return m&&f+m<h?[f+d,g-d-x,f+m-d,g-d]:[f+d,g-d-x,h-d,g-d]}case N.Centre:return[f+d,u+d,h-d,g-d];default:return console.warn(`DropTarget does not recognize position ${a}`),null}}activate(){return this.active=!0,this}toArray(){let t=this,o=[t];for(;t=t.nextDropTarget;)o.push(t);return o}static getActiveDropTarget(t){return t===null?null:t!=null&&t.active?t:re.getActiveDropTarget(t.nextDropTarget)}};function Mt(e,t,o,n,r,i){var l;let s=null,a=ye.allBoxesContainingPoint(o,n,e,t,i);if(a.length){let[c,...p]=a,{"data-path":m,path:u=m,"data-row-placeholder":f}=D(c),h=n[u],y=Lt(e,t,h,r&&f?"row":void 0),d=n[u],b=([E,...R])=>{var S,x;if(((S=y.position)==null?void 0:S.Header)||y.closeToTheEdge){let T=Pi(E,y,d,n,e,t);if(T){let[v,C]=T;return new re({component:E,pos:v,clientRect:C,nextDropTarget:(x=b(R))!=null?x:null})}else if(R.length)return b(R)}};s=new re({component:c,pos:y,clientRect:h,nextDropTarget:(l=b(p))!=null?l:null}).activate()}return s}function Pi(e,{closeToTheEdge:t,position:o},n,r,i,s){if(!e||e.type==="DraggableLayout")return;let a=r[e.props.path],l=t&me.north,c=t&me.east,p=t&me.south,m=t&me.west,u=(l||o.Header)&&Math.round(n.top)===Math.round(a.top),f=c&&Math.round(n.right)===Math.round(a.right),h=p&&Math.round(n.bottom)===Math.round(a.bottom),g=m&&Math.round(n.left)===Math.round(a.left);if(u||f||h||g){let{"data-path":y,path:d=y}=e.props,b=r[d],E=Lt(i,s,b);if((vi(e)||Oo(e))&&t&Di)return E.width=120,[E,b];if((Li(e)||Oo(e))&&(o.Header||t&wi))return E.height=120,[E,b]}}function Oo(e){return P(e)==="Stack"}function vi(e){return P(e)==="Flexbox"&&e.props.style.flexDirection==="column"}function Li(e){return P(e)==="Flexbox"&&e.props.style.flexDirection==="row"}import Mi from"classnames";import Rp,{createElement as Ho,useEffect as Dp,useRef as wp}from"react";import Ct from"react-dom";var At=!1,q=[];function $o(e){if(e.key==="Esc"){if(q.length)Fo();else if(At){let t=document.body.querySelector(".vuuDialog");t&&Ct.unmountComponentAtNode(t)}}}function No(e){if(q.length){let t=document.body.querySelectorAll(".vuuPopup");for(let o=0;o<t.length;o++)if(t[o].contains(e.target))return;Fo()}}function Fo(){if(q.length){let e=document.body.querySelectorAll(".vuuPopup");for(let t=0;t<e.length;t++)Ct.unmountComponentAtNode(e[t]);Vo("*")}}function Ci(e){q.indexOf(e)===-1&&(q.push(e),At===!1&&(window.addEventListener("keydown",$o,!0),window.addEventListener("click",No,!0)))}function Vo(e){if(q.length){if(e==="*")q.length=0;else{let t=q.indexOf(e);t!==-1&&q.splice(t,1)}q.length===0&&At===!1&&(window.removeEventListener("keydown",$o,!0),window.removeEventListener("click",No,!0))}}var Ai=({children:e,position:t,style:o})=>{let n=Mi("hwPopup","hwPopupContainer",t);return Ho("div",{className:n,style:o},e)},ki=1,ie=class{static showPopup({name:t="anon",group:o="all",position:n="",left:r=0,right:i="auto",top:s=0,width:a="auto",component:l}){if(!l)throw Error("PopupService showPopup, no component supplied");Ci(t);let c=document.body.querySelector(".vuuPopup."+o);c===null&&(c=document.createElement("div"),c.className="vuuPopup "+o,document.body.appendChild(c));let p={width:a};Ve(Ho(Ai,{key:ki++,position:n,style:p},l),c,r,s,()=>{ie.keepWithinThePage(c,i)})}static hidePopup(t="anon",o="all"){if(q.indexOf(t)!==-1){Vo(t);let n=document.body.querySelector(`.vuuPopup.${o}`);n&&Ct.unmountComponentAtNode(n)}}static keepWithinThePage(t,o="auto"){let n=t.querySelector(".vuuPopupContainer > *");if(n){let{top:r,left:i,width:s,height:a,right:l}=n.getBoundingClientRect(),c=window.innerWidth,m=window.innerHeight-(r+a);m<0&&(n.style.top=Math.round(r)+m+"px");let u=c-(i+s);if(u<0&&(n.style.left=Math.round(i)+u+"px"),typeof o=="number"&&o!==l){let f=o-l;n.style.left=i+f+"px"}}}};import zi from"classnames";import{jsx as Wo}from"react/jsx-runtime";function _o(e,t=0,o=0){let{pos:n,clientRect:r}=e,i=20;return n.position.West?[r.left-o+i,n.y-t,"left"]:n.position.South?[n.x-o,r.bottom-t-i,"bottom"]:n.position.East?[r.right-o-i,n.y-t,"right"]:[n.x-o,r.top-t+i,"top"]}var kt="vuuDropMenu",Go=({className:e,dropTarget:t,onHover:o,orientation:n})=>{let r=t.toArray();return Wo("div",{className:zi(kt,e,`${kt}-${n}`),onMouseLeave:()=>o(null),children:r.map((i,s)=>Wo("div",{className:`${kt}-item`,"data-icon":s===0?"column-2A":"column-2B",onMouseEnter:()=>o(i)},s))})};import{jsx as Fi}from"react/jsx-runtime";var zt=!1,Pe=null,J=null,Ii=e=>Pe=e,Bi=([e,t])=>`M${e},${t}`,Oi=([e,t])=>`L${e},${t}`,Uo=([e,...t])=>`${Bi(e)} ${t.map(Oi)}Z`,Hi=e=>{if(e){let[t,o,n,r,i,s,a,l]=e;return`M${t},${o} L${n},${r} M${i},${s} L${a},${l}`}else return""};function $i(){if(document.getElementById("hw-drag-canvas")===null){let e=document.getElementById("root"),t=document.createElement("div");t.id="hw-drag-canvas",t.innerHTML=`
2
+ <svg width="100%" height="100%">
3
+ <path id="hw-drop-guides" />
4
+ <path
5
+ id="vuu-drop-outline"
6
+ d="M300,132 L380,132 L380,100 L460,100 L460,132, L550,132 L550,350 L300,350z">
7
+ <animate
8
+ attributeName="d"
9
+ id="hw-drop-outline-animate"
10
+ begin="indefinite"
11
+ dur="300ms"
12
+ fill="freeze"
13
+ to="M255,33 L255,33,L255,1,L315,1,L315,1,L794,1,L794,164,L255,164Z"
14
+ />
15
+ </path>
16
+ </svg>
17
+ `,document.body.insertBefore(t,e)}}var ve=class{constructor(){this.currentPath=null;this.tabMode=null;$i()}prepare(t,o="full-view"){document.body.classList.add("drawing"),this.currentPath=null,this.tabMode=o;let n=this.getPoints(0,0,0,0),r=Uo(n),i=document.getElementById("vuu-drop-outline");i==null||i.setAttribute("d",r),this.currentPath=r}clear(){Pe=null,Ye(),document.body.classList.remove("drawing"),ie.hidePopup()}get hoverDropTarget(){return Pe}getPoints(t,o,n,r,i=0,s=0,a=0){let l=this.tabMode==="tab-only";if(s===0)return[[t,o+a],[t,o+a],[t,o],[t+s,o],[t+s,o],[t+n,o],[t+n,o+r],[t,o+r]];if(l){let c=i;return[[c,o],[c,o],[c+s,o],[c+s,o],[c+s,o+a],[c+s,o+a],[c,o+a],[c,o+a]]}else return i===0?[[t,o+a],[t,o+a],[t,o],[t+s,o],[t+s,o+a],[t+n,o+a],[t+n,o+r],[t,o+r]]:[[t,o+a],[t+i,o+a],[t+i,o],[t+i,o],[t+i,o+a],[t+n,o+a],[t+n,o+r],[t,o+r]]}draw(t,o){let r=zt;if(Pe!==null)this.drawTarget(Pe);else if(zt=t.nextDropTarget!=null,t.pos.tab?Ni(t):J&&Ye(),this.drawTarget(t,o),zt){let[i,s,a]=_o(t);{let l=Fi(Go,{dropTarget:t,onHover:Ii,orientation:a});ie.showPopup({left:i,top:s,component:l})}}else ie.hidePopup()}drawTarget(t,o){let r=t.getTargetDropOutline(6,o);if(r){let{l:i,t:s,r:a,b:l,tabLeft:c,tabWidth:p,tabHeight:m,guideLines:u}=r,f=a-i,h=l-s;if(this.currentPath){let E=document.getElementById("vuu-drop-outline");E==null||E.setAttribute("d",this.currentPath)}let g=this.getPoints(i,s,f,h,c,p,m),y=Uo(g),d=document.getElementById("hw-drop-outline-animate");d==null||d.setAttribute("to",y),d==null||d.beginElement(),this.currentPath=y;let b=document.getElementById("hw-drop-guides");b==null||b.setAttribute("d",Hi(u))}}},Xo="transition:margin-left .4s ease-out;margin-left: 63px",Yo="transition:margin-left .4s ease-out;margin-left: 0px";function Ni(e){var a,l;let{AFTER:t,BEFORE:o}=we,{clientRect:{Stack:n},pos:{tab:r}}=e,{id:i}=e.component.props,s=null;if(n&&r&&r.positionRelativeToTab!==t){let c=r.positionRelativeToTab===o?1:2,p=`:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${r.index+c})`;s=(a=document.getElementById(i))==null?void 0:a.querySelector(p),s?(J===null||J!==s)&&(s.style.cssText=Xo,J&&(J.style.cssText=Yo),J=s):Ye()}else if((r==null?void 0:r.positionRelativeToTab)===o){if(J===null){let c=".vuuHeader-title";s=(l=document.getElementById(i))==null?void 0:l.querySelector(c),s.style.cssText=Xo,J=s}}else Ye()}function Ye(){J&&(J.style.cssText=Yo,J=null)}var te,Le,se,qo,Jo,ae,Ze,be=null,Bt,Ko,Me,jo,It,qe=null,Vi=3,Je=new ve,Zo=.4;function Wi(e,t){return t?V(e,t):ee(e,o=>o.dropTarget)}var Ot={handleMousedown(e,t,o={}){te=t,Ko=o,qo=e.clientX,Jo=e.clientY,It=o.dragThreshold===void 0?Vi:o.dragThreshold,It===0?te(e,0,0):(window.addEventListener("mousemove",Ke,!1),window.addEventListener("mouseup",je,!1),qe=window.setTimeout(()=>{console.log("mousedownTimer fires"),window.removeEventListener("mousemove",Ke,!1),window.removeEventListener("mouseup",je,!1),te==null||te(e,0,0)},500)),e.preventDefault()},initDrag(e,t,{top:o,left:n,right:r,bottom:i},s,a,l,c){return{drag:Le,drop:se}=a,_i(e,t,{top:o,left:n,right:r,bottom:i},s,l,c)}};function Ke(e){let n=e.clientX-qo,r=e.clientY-Jo;Math.max(Math.abs(n),Math.abs(r))>It&&(window.removeEventListener("mousemove",Ke,!1),window.removeEventListener("mouseup",je,!1),te==null||te(e,n,r),te=null)}function je(){qe&&(window.clearTimeout(qe),qe=null),window.removeEventListener("mousemove",Ke,!1),window.removeEventListener("mouseup",je,!1)}function _i(e,t,o,n,r,i){ae=Wi(e,t);let{"data-path":s,path:a=s}=D(ae);i&&(Bt=i.map(u=>ee(e,f=>f.id===u)).map(u=>u.props.path)),Me=ye.measure(ae,i),console.log({_measurements:Me});let l=Me[a];Ze=new Xe(l,n.x,n.y,o,r);let c=Math.round(Ze.x.mousePct*100),p=Math.round(Ze.y.mousePct*100);return window.addEventListener("mousemove",Qo,!1),window.addEventListener("mouseup",en,!1),jo=!1,Je.prepare(o,"tab-only"),Ko.DoNotTransform?"transform:none":`transform:scale(${Zo},${Zo});transform-origin:${c}% ${p}%;`}function Qo(e){let t=e.clientX,o=e.clientY,n=Ze,r=be,i,s,a;n.update("x",t)&&(s=n.x.pos),n.update("y",o)&&(a=n.y.pos),s===void 0&&a===void 0||Le==null||Le(s,a),!(jo||ae===void 0)&&(n.inBounds()?i=Mt(t,o,ae,Me,n.hasIntrinsicSize(),Bt):i=Mt(n.dropX(),n.dropY(),ae,Me),r&&(i==null||i.box!==r.box)&&(be=null),i&&(Je.draw(i,n),be=i))}function en(){Gi()}function Gi(){if(be){let e=Je.hoverDropTarget||re.getActiveDropTarget(be);se==null||se(e),be=null}else se==null||se({component:ae,pos:{position:N.Absolute}});Le=null,se=null,ae=void 0,Je.clear(),Bt=void 0,window.removeEventListener("mousemove",Qo,!1),window.removeEventListener("mouseup",en,!1)}import Ui from"classnames";import{useRef as Xi}from"react";import{jsx as Yi}from"react/jsx-runtime";var tn=function(t){let o=Xi();o.current=t;let{className:n,id:r,style:i}=t,s=Ui("DraggableLayout",n);return Yi("div",{className:s,id:r,style:i,children:t.children})},on="DraggableLayout";tn.displayName=on;z(on,tn,"container");import{useForkRef as gs}from"@salt-ds/core";import ys from"classnames";import{forwardRef as bs}from"react";import{getUniqueId as cs}from"@vuu-ui/vuu-utils";import Ie,{useCallback as nt,useMemo as hn,useRef as rt,useState as ps}from"react";import Zi from"classnames";import{jsx as qi}from"react/jsx-runtime";var nn="vuuPlaceholder",Qe=({className:e,closeable:t,flexFill:o,resizeable:n,shim:r,...i})=>qi("div",{className:Zi(nn,e,{[`${nn}-shim`]:r}),...i,"data-placeholder":!0,"data-resizeable":!0});Qe.displayName="Placeholder";z("Placeholder",Qe);import Ji from"classnames";import Ki,{useCallback as Ce,useRef as et,useState as ji}from"react";import{jsx as rn}from"react/jsx-runtime";var sn=Ki.memo(function({column:t,index:o,onDrag:n,onDragEnd:r,onDragStart:i,style:s}){let a=et(),l=et(null),c=et(0),[p,m]=ji(!1),u=Ce(({key:x,shiftKey:T})=>{let v=T?10:1;t&&x==="ArrowDown"?n(o,v):t&&x==="ArrowUp"||!t&&x==="ArrowLeft"?n(o,-v):!t&&x==="ArrowRight"&&n(o,v)},[t,o,n]),f=Ce(x=>{let{key:T}=x;(t&&(T==="ArrowUp"||T==="ArrowDown")||!t&&(T==="ArrowLeft"||T==="ArrowRIght"))&&(i(o),u(x),h.current=u)},[t,u,o,i]),h=et(f),g=x=>h.current(x),y=Ce(x=>{a.current=!0;let T=x[t?"clientY":"clientX"],v=T-c.current;T&&T!==c.current&&n(o,v),c.current=T},[t,o,n]),d=Ce(()=>{var x;window.removeEventListener("mousemove",y,!1),window.removeEventListener("mouseup",d,!1),r(),m(!1),(x=l.current)==null||x.focus()},[y,r,m]),b=Ce(x=>{c.current=t?x.clientY:x.clientX,i(o),window.addEventListener("mousemove",y,!1),window.addEventListener("mouseup",d,!1),x.preventDefault(),m(!0)},[t,y,d,o,i,m]),E=()=>{var x;a.current?a.current=!1:(x=l.current)==null||x.focus()},R=()=>{h.current=f},S=Ji("Splitter","focusable",{active:p,column:t});return rn("div",{className:S,"data-splitter":!0,ref:l,role:"separator",style:s,onBlur:R,onClick:E,onKeyDown:g,onMouseDown:b,tabIndex:0,children:rn("div",{className:"grab-zone"})})});import{uuid as an}from"@vuu-ui/vuu-utils";import ln from"react";var Qi={"data-placeholder":!0,"data-resizeable":!0},tt={},le="auto",Ht={flexBasis:0,flexGrow:1,flexShrink:1,height:le,width:le},cn={height:"width",width:"height"},pn=(e="row")=>e==="row"?["width","height","column"]:["height","width","row"],es=e=>typeof e=="string"&&e.endsWith("%"),_=e=>{let{style:{width:t=le,height:o=le}=tt}=e.props,n=typeof o=="number",r=typeof t=="number";return n&&r?{height:o,width:t}:n?{height:o}:r?{width:t}:void 0};function $t(e,t,o){let n=cn[t],{style:{[n]:r=le,...i}=tt}=e.props;return o&&o[t]?{...i,...Ht,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...i,...Ht,[n]:r}}function un(e){let{style:{flex:t,flexGrow:o,flexShrink:n,flexBasis:r}=tt}=e.props;return typeof t=="number"||r===0&&o===1&&n===1?!0:typeof r!="number"}function Nt(e,t,o){let n=cn[t],{style:{[t]:r=le,[n]:i=le,...s}=tt}=e.props;return r!==le?es(r)?{flexBasis:0,flexGrow:1,flexShrink:1,[t]:void 0,[n]:i}:{flexBasis:r,flexGrow:0,flexShrink:0,[t]:r,[n]:i}:o&&o[t]?{...s,...Ht,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...s,[n]:i}}function Ae(e,t,o,n,r){let i=[],s=0,a;if(n&&r){let p,[m,u,f,h]=r;[p,a]=t==="column"?[u-n.top,n.bottom-h]:[m-n.left,n.right-f],p&&i.push(j(`${o}.${s++}`,p,{flexGrow:0,flexShrink:0}))}else a=!0;let{version:l=0,style:c}=D(e);return i.push(O(e,`${o}.${s++}`,{version:l+1,style:{...c,flexBasis:"auto",flexGrow:0,flexShrink:0}})),a&&i.push(j(`${o}.${s++}`,0,void 0,{[`data-${t}-placeholder`]:!0})),Ft(t,{resizeable:!1,style:{flexBasis:"auto"}},i,o)}var ts=(e,t)=>{if(!t)return e===0?1:0};function Ft(e,t,o,n){let r=an(),{flexFill:i,style:s,resizeable:a=!0}=t,{flexBasis:l=i?void 0:"auto"}=s,c=ts(l,i);return ln.createElement(ne.Flexbox,{id:r,key:r,path:n,flexFill:i,style:{...s,flexDirection:e,flexBasis:l,flexGrow:c,flexShrink:c},resizeable:a},o)}var os={flexGrow:1,flexShrink:1};function j(e,t,o,n){let r=an();return ln.createElement("div",{...Qi,...n,"data-path":e,id:r,key:r,style:{...os,...o,flexBasis:t}})}var ns={},ke=1,ze=2,rs=e=>typeof e.intrinsicSize=="number",is=(e,t)=>{let o={};return e.forEach(n=>{o[n]=w(t,n)}),o},ot=(e,t,o)=>e.map((n,r)=>{var l;let i=w(n,"resizeable"),{[t]:s}=(l=_(n))!=null?l:ns,a=un(n);return o?{index:r,flexOpen:a,intrinsicSize:s,resizeable:i,...is(o,n)}:{index:r,flexOpen:a,intrinsicSize:s,resizeable:i}}),mn=e=>{let t=e.length,o=e.every(rs),n=Array(t).fill(0);if(o&&(n[0]=ze,n[t-1]=ze),t<2)return n;for(let r=0,i=0;r<t-1;r++)e[r].resizeable&&!i&&(i=ke),n[r]+=i;for(let r=t-1;r>0&&(n[r]&ke&&(n[r]-=ke),!e[r].resizeable);r--);return n},dn=(e,t)=>{let o=as(e,t),n=ls(e,t),r=o!==-1&&n!==-1?[o,n]:void 0,i=ss(e,r);return[r,i]};function ss(e,t){if(t){let o=[];for(let n=0;n<e.length;n++)e[n].flexOpen&&!t.includes(n)&&o.push(n);return o}}function as(e,t){let o=t,n=!1;for(;o>=1&&!n;)o=o-1,n=fn(e,o);return o}function ls(e,t){let o=t,n=!1,r=e.length;for(;o<r&&!n;)o=o+1,n=fn(e,o);return o===r?-1:o}function fn(e,t){let{placeholder:o,splitter:n,resizeable:r,intrinsicSize:i}=e[t];return Boolean(!n&&!i&&(o||r))}var us=e=>!e.splitter&&!e.placeholder,yn=({children:e,onSplitterMoved:t,style:o})=>{let n=rt(null),r=rt(),i=rt(),s=rt([]),[,a]=ps({}),l=y=>{i.current=y,a({})},c=(o==null?void 0:o.flexDirection)==="column",p=c?"height":"width",m=hn(()=>Array.isArray(e)?e:Ie.isValidElement(e)?[e]:[],[e]),u=nt(y=>{let{current:d}=r;if(d){let[b,E]=dn(d,y);b&&(b.forEach(R=>{var x;let S=(x=n.current)==null?void 0:x.childNodes[R];if(S){let{size:T,minSize:v}=hs(S,p);d[R].currentSize=T,d[R].minSize=v}}),E&&E.forEach(R=>{var x;let S=(x=n.current)==null?void 0:x.childNodes[R];if(S){let{[p]:T}=S.getBoundingClientRect();d[R].flexBasis=T}}))}},[p]),f=nt((y,d)=>{i.current&&r.current&&l(ds(i.current,r.current,d,p))},[p]),h=nt(()=>{let y=r.current;y&&(t==null||t(y.filter(us))),y==null||y.forEach(d=>{d.currentSize=void 0,d.flexBasis=void 0,d.flexOpen=!1})},[t]),g=nt(y=>Ie.createElement(sn,{column:c,index:y,key:`splitter-${y}`,onDrag:f,onDragEnd:h,onDragStart:u}),[f,h,u,c]);return hn(()=>{let[y,d]=ms(m,p,g,s.current);r.current=d,i.current=y},[m,g,p]),{content:i.current||[],rootRef:n}};function ms(e,t,o,n){let r=ot(e,t),i=mn(r),s=[],a=[];for(let l=0;l<e.length;l++){let c=e[l];if(l===0&&i[l]&ze&&(s.push(gn(l)),a.push({placeholder:!0,shim:!0})),c.key==null){let p=n[l]||(n[l]=cs());s.push(Ie.cloneElement(c,{key:p}))}else s.push(c);a.push(r[l]),l>0&&i[l]&ze?(s.push(gn(l)),a.push({placeholder:!0})):i[l]&ke&&(s.push(o(s.length)),a.push({splitter:!0}))}return[s,a]}function ds(e,t,o,n){return fs(t,o)?e.map((i,s)=>{let a=t[s],{currentSize:l,flexOpen:c,flexBasis:p}=a,m=l!==void 0;if(m||c){let{flexBasis:u}=i.props.style||{},f=m?a.currentSize:p;return f!==u?Ie.cloneElement(i,{style:{...i.props.style,flexBasis:f,[n]:"auto"}}):i}else return i}):e}function fs(e,t){let o=[];e.forEach((p,m)=>{p.currentSize!==void 0&&o.push(m)});let n=t<0?o[0]:o[1],{currentSize:r=0,minSize:i=0}=e[n];if(r===i)return!1;if(Math.abs(t)>r-i){let p=t<0?-1:1;t=Math.max(0,r-i)*p}let s=e[o[0]],{currentSize:a=0}=s;s.currentSize=a+t;let l=e[o[1]],{currentSize:c=0}=l;return l.currentSize=c-t,!0}function gn(e){return Ie.createElement(Qe,{shim:e===0,key:`placeholder-${e}`})}function hs(e,t){let{[t]:o}=e.getBoundingClientRect(),r=getComputedStyle(e).getPropertyValue(`min-${t}`),i=r.endsWith("px")?parseInt(r,10):0;return{size:o,minSize:i}}import{jsx as xs}from"react/jsx-runtime";var Vt="hwFlexbox",bn=bs(function(t,o){let{breakPoints:n,children:r,column:i,className:s,flexFill:a,gap:l,fullPage:c,id:p,onSplitterMoved:m,resizeable:u,row:f,spacing:h,splitterSize:g,style:y,...d}=t,{content:b,rootRef:E}=yn({children:r,onSplitterMoved:m,style:y}),R=ys(Vt,s,{[`${Vt}-column`]:i,[`${Vt}-row`]:f,"flex-fill":a,"full-page":c});return xs("div",{...d,className:R,"data-resizeable":u||void 0,id:p,ref:gs(E,o),style:{...y,gap:l,"--spacing":h},children:b})});bn.displayName="Flexbox";var Wt=bn;import{useCallback as sa}from"react";var xe={ADD:"add",BLUR:"blur",BLUR_SPLITTER:"blur-splitter",DRAG_START:"drag-start",DRAG_STARTED:"drag-started",DRAG_DROP:"drag-drop",FOCUS:"focus",FOCUS_SPLITTER:"focus-splitter",INITIALIZE:"initialize",MAXIMIZE:"maximize",MINIMIZE:"minimize",REMOVE:"remove",REPLACE:"replace",RESTORE:"restore",SAVE:"save",SET_TITLE:"set-title",SPLITTER_RESIZE:"splitter-resize",SWITCH_TAB:"switch-tab",TEAR_OUT:"tear-out"};import{useCallback as qt,useContext as qn,useEffect as oa,useRef as Yn,useState as na}from"react";import _n from"react";import{uuid as Pn}from"@vuu-ui/vuu-utils";import He from"react";import{uuid as Sn}from"@vuu-ui/vuu-utils";import Be,{cloneElement as Rs}from"react";import{useCallback as Re}from"react";var F=new Map,G=new Map,xn=e=>F.get(e),Rn=e=>F.has(e),En=(e,t)=>F.set(e,t),Ee=()=>{let e=Re((s,a)=>{let l=G.get(s);if(l)return a!==void 0&&l[a]!==void 0?l[a]:a!==void 0?void 0:l},[]),t=Re((s,a,l)=>{if(a===void 0)G.set(s,l);else if(G.has(s)){let c=G.get(s);G.set(s,{...c,[a]:l})}else G.set(s,{[a]:l})},[]),o=Re((s,a)=>{if(G.has(s)){if(a===void 0)G.delete(s);else if(G.get(s)[a]){let{[a]:c,...p}=G.get(s);Object.keys(p).length>0?G.set(s,p):G.delete(s)}}},[]),n=Re((s,a)=>{let l=F.get(s);if(l)return a!==void 0?l[a]:l},[]),r=Re((s,a,l)=>{if(a===void 0)F.set(s,l);else if(F.has(s)){let c=F.get(s);F.set(s,{...c,[a]:l})}else F.set(s,{[a]:l})},[]),i=Re((s,a)=>{if(F.has(s)){if(a===void 0)F.delete(s);else if(F.get(s)[a]){let{[a]:c,...p}=F.get(s);Object.keys(p).length>0?F.set(s,p):F.delete(s)}}},[]);return{loadSessionState:e,loadState:n,saveSessionState:t,saveState:r,purgeState:i,purgeSessionState:o}};var Tn=e=>e.flexDirection==="column"?["height","width"]:["width","height"],Es={},Oe=(e,t="0")=>{let[o,n]=Ut(P(e),e.props,t);return Be.cloneElement(e,o,n)},Gt=(e,t)=>{let o=P(e),[n,r]=Ut(o,e.props,"0",void 0,t);return Rs(e,n,r)};function Ss(e,t,o="0",n=null,r){var g,y;let{active:i=0,"data-path":s,path:a=s,id:l,style:c}=D(r),p=P(r)===e&&o===a,m=p?l:(g=t.id)!=null?g:Sn(),u=e==="Stack"?(y=t.active)!=null?y:i:void 0,f=m,h=p?c:Ds(e,t,n);return Po(e)?{id:m,key:f,path:o,style:h,type:e,active:u}:{id:m,key:f,style:h,"data-path":o}}function Ut(e,t,o,n=null,r){var c,p;let i=Ss(e,t,o,n,r);if(t.layout&&!r)return[i,[it(t.layout,`${o}.0`)]];let s=(p=r==null?void 0:r.children)!=null?p:(c=r==null?void 0:r.props)==null?void 0:c.children,l=t.dropTarget&&s?s:Ts(e,t.children,o,s);return[i,l]}function Ts(e,t,o="0",n){let r=Array.isArray(t)?t:Be.isValidElement(t)?[t]:[];return $(e)?r.map((i,s)=>{let a=P(i),l=P(n==null?void 0:n[s]);if(!l||a===l){let[c,p]=Ut(a,i.props,`${o}.${s}`,e,n==null?void 0:n[s]);return Be.cloneElement(i,c,p)}return n==null?void 0:n[s]}):t}var Ds=(e,t,o)=>{let{style:n=Es}=t;if(e==="Flexbox"&&(n={flexDirection:t.column?"column":"row",...n,display:"flex"}),n.flex){let{flex:r,...i}=n;n={...i,...Dt(typeof r=="number"?r:0)}}else o==="Stack"?n={...n,...Dt(1)}:o==="Flexbox"&&(n.width||n.height)&&n.flexBasis===void 0&&(n={...n,flexBasis:"auto",flexGrow:0,flexShrink:0});return n};function it({id:e=Sn(),type:t,children:o,props:n,state:r},i){let s=t.match(/^[a-z]/)?t:ne[t];if(s===void 0)throw Error(`layoutUtils unable to create component from JSON, unknown type ${t}`);return r&&En(e,r),Be.createElement(s,{id:e,...n,key:e,path:i},o?o.map((a,l)=>it(a,`${i}.${l}`)):void 0)}function Dn(e){return wn(e)}function wn(e){let t=P(e),{id:o,children:n,type:r,...i}=D(e),s=Rn(o)?xn(o):void 0;return{id:o,type:t,props:ws(i),state:s,children:Be.Children.map(n,wn)}}function ws(e){if(e){let{path:t,...o}=e,n={};for(let[r,i]of Object.entries(o))n[r]=_t(i);return n}}function _t(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(_t);if(typeof e=="object"&&e!==null){let t={};for(let[o,n]of Object.entries(e))t[o]=_t(n);return t}}function vn(e,t){var s;let o=e.props.children,n=o.length,{index:r=-1,positionRelativeToTab:i="after"}=t.tab||{};return r===-1||r>=n?[o[n-1],"after"]:[(s=o[r])!=null?s:null,i]}function st(e,t,o){let{active:n,children:r=[],path:i}=D(e),s=w(t,"path"),{idx:a,finalStep:l}=Z(i,s,!0),[c,p]=l?Ps(e,r,o):[n,r==null?void 0:r.map((u,f)=>f===a?st(u,t,o):u)],m=P(e)==="Stack"?Array.isArray(c)?c[0]:c:n;return He.cloneElement(e,{active:m},p)}function Ps(e,t,o){let n=w(e,"path"),r=t==null?void 0:t.length,{id:i=Pn()}=D(o);return r?[r,t.concat(O(o,`${n}.${r}`,{id:i,key:i}))]:[0,[O(o,`${n}.0`,{id:i})]]}function at(e,t,o,n,r,i,s){let{active:a,children:l,path:c}=D(e),p=w(t,"path"),{idx:m,finalStep:u}=Z(c,p),[f,h]=u?vs(e,l,m,o,n,r,i,s):[a,l.map((y,d)=>d===m?at(y,t,o,n,r,i,s):y)],g=P(e)==="Stack"?f:a;return He.cloneElement(e,{active:g},h)}function vs(e,t,o,n,r,i,s,a){let l=_(n);return(l==null?void 0:l.width)&&(l==null?void 0:l.height)?Ms(e,t,o,n,r,s,a):Ln(e,t,o,n,r,(i==null?void 0:i.width)||(i==null?void 0:i.height),s)}var Ls=(e,t,{top:o,right:n,bottom:r,left:i},[s,a,l,c])=>{if(e==="column"&&t==="before")return a-o;if(e==="column")return r-c;if(e==="row"&&t==="before")return s-i;if(e==="row")return n-l};function Ms(e,t,o,n,r,i,s){let{style:{flexDirection:a}}=D(e),[l,c,p]=pn(a),{[c]:m,[l]:u}=_(n),f=w(t[o],"path"),h=Ls(a,r,i,s),[g,y]=m<i[c]?[Ae(n,p,f,i,s),u]:[n,void 0],d=h?j(f,h,{flexGrow:0,flexShrink:0}):void 0;return m>i[c]&&(t=t.map(b=>{if(w(b,"placeholder"))return b;{let{[c]:E}=_(b);return E&&E<m?Ae(b,p,w(b,"path")):b}})),Ln(e,t,o,g,r,y,i,d)}function Ln(e,t,o,n,r,i,s,a){let l=w(e,"path"),c=0,p=!t||t.length===0?[n]:t.reduce((m,u,f)=>{if(o===f){let[h,g]=Cs(e,u,n,s);r==="before"?a?m.push(a,g,h):m.push(g,h):a?m.push(h,g,a):m.push(h,g),c=m.indexOf(g)}else m.push(u);return m},[]).map((m,u)=>u<c?m:O(m,`${l}.${u}`));return[c,p]}function Cs(e,t,o,n){let r=Pn(),{version:i=0}=D(o);if(i+=1,P(e)==="Flexbox"){let[s]=Tn(e.props.style),a=6,l={[s]:(n[s]-a)/2},c=Nt(t,s,l),p=Nt(o,s,l);return[He.cloneElement(t,{style:c}),He.cloneElement(o,{id:r,version:i,style:p})]}else{let{style:{left:s,top:a,flex:l,...c}={left:void 0,top:void 0,flex:void 0}}=D(o);return[t,He.cloneElement(o,{id:r,version:i,style:c})]}}var U={ADD:"add",DRAG_START:"drag-start",DRAG_DROP:"drag-drop",MAXIMIZE:"maximize",MINIMIZE:"minimize",REMOVE:"remove",REPLACE:"replace",RESTORE:"restore",SAVE:"save",SET_TITLE:"set-title",SPLITTER_RESIZE:"splitter-resize",SWITCH_TAB:"switch-tab",TEAROUT:"tearout"};import de from"react";import lt from"react";function Mn(e,{target:t,replacement:o}){return Xt(e,t,o)}function Xt(e,t,o){let n=w(t,"path"),r=w(t,"resizeable"),{style:i}=D(t),s=Oe(lt.cloneElement(o,{resizeable:r,style:{...i,...o.props.style}}),n);return K(e,t,s)}function K(e,t,o,n){if(e===t)return o;let{idx:r,finalStep:i}=Z(w(e,"path"),w(t,"path")),s=e.props.children.slice();return i?n?n===xe.MINIMIZE?s[r]=As(e,s[r]):n===xe.RESTORE&&(s[r]=ks(s[r])):s[r]=o:s[r]=K(s[r],t,o,n),lt.cloneElement(e,void 0,s)}function As(e,t){let{style:o}=D(e),{style:n}=D(t),{width:r,height:i,flexBasis:s,flexShrink:a,flexGrow:l,...c}=n,p={width:r,height:i,flexBasis:s,flexShrink:a,flexGrow:l},m={...c,flexBasis:0,flexGrow:0,flexShrink:0},u=o.flexDirection==="row"?"vertical":o.flexDirection==="column"?"horizontal":!1;return u?lt.cloneElement(t,{collapsed:u,restoreStyle:p,style:m}):t}function ks(e){let{style:t,restoreStyle:o}=D(e),{flexBasis:n,flexShrink:r,flexGrow:i,...s}=t,a={...s,...o};return lt.cloneElement(e,{collapsed:!1,style:a,restoreStyle:void 0})}function Yt(e,{path:t}){let o=V(e,t),n=Q(e,t);if(n===null)return e;let{children:r}=D(n);if(r.length>1&&An(r,t)){let{style:{flexBasis:i,display:s,flexDirection:a,...l}}=D(n),c=w(n,"path"),p=K(e,n,j(c,i,l));for(;(n=Q(p,c))&&w(n,"path")!=="0";){let{children:m}=D(n);if(An(m)){c=w(n,"path");let{style:{flexBasis:u,display:f,flexDirection:h,...g}}=D(n);p=K(e,n,j(c,u,g))}else if(Os(m))p=In(e,n);else break}return p}return kn(e,o)}function kn(e,t){let o=D(e),{children:n,path:r,preserve:i}=o,{active:s}=o,{idx:a,finalStep:l}=Z(r,w(t,"path")),c=P(e),p=n.slice();if(l){if(p.splice(a,1),s!==void 0&&s>=a&&(s=Math.max(0,s-1)),p.length===1&&!i&&r!=="0"&&c.match(/Flexbox|Stack/))return zs(e,p[0]);!p.some(Is)&&p.some(zn)&&(p=Bs(p))}else p[a]=kn(p[a],t);return p=p.map((m,u)=>O(m,`${r}.${u}`)),de.cloneElement(e,{active:s},p)}function zs(e,t){let o=P(e),{path:n,style:{flexBasis:r,flexGrow:i,flexShrink:s,width:a,height:l}}=D(e),c=O(t,n);if(n==="0")c=de.cloneElement(c,{style:{...t.props.style,width:a,height:l}});else if(o==="Flexbox"){let p=e.props.style.flexDirection==="column"?"height":"width",{style:{[p]:m,...u}}=c.props;c=de.cloneElement(c,{flexFill:void 0,style:{...u,flexGrow:i,flexShrink:s,flexBasis:r,width:a,height:l}})}return c}var Is=e=>e.props.style.flexGrow>0,zn=e=>{let{width:t,height:o,flexGrow:n}=e.props.style;return n===0&&typeof t!="number"&&typeof o!="number"},Bs=e=>e.map(t=>zn(t)?de.cloneElement(t,{style:{...t.props.style,flexGrow:1}}):t),Os=e=>{if(e&&e.length>0){let t=w(e[0],"placeholder"),o=!1;for(let n=1;n<e.length;n++){if(o=w(e[n],"placeholder"),t&&o)return!0;t=o}}},In=(e,t)=>{let{children:o,path:n}=D(e),{idx:r,finalStep:i}=Z(n,w(t,"path")),s=o.slice();return i?s[r]=Hs(t):s[r]=In(s[r],t),s=s.map((a,l)=>O(a,`${n}.${l}`)),de.cloneElement(e,void 0,s)},Hs=e=>{let{children:t}=D(e),o=[],n=[];for(let i=0;i<t.length;i++)w(t[i],"placeholder")?n.push(t[i]):(n.length===1?o.push(n.pop()):n.length>0&&(o.push(Cn(n)),n.length=0),o.push(t[i]));n.length===1?o.push(n.pop()):n.length>0&&o.push(Cn(n));let r=w(e,"path");return de.cloneElement(e,void 0,o.map((i,s)=>O(i,`${r}.${s}`)))},Cn=([e,...t])=>{let o=w(e,"style"),{flexBasis:n,flexGrow:r,flexShrink:i}=o;for(let{props:{style:s}}of t)n+=s.flexBasis,r=Math.max(r,s.flexGrow),i=Math.max(i,s.flexShrink);return de.cloneElement(e,{style:{...o,flexBasis:n,flexGrow:r,flexShrink:i}})},An=(e,t)=>e.every(o=>w(o,"placeholder")||t&&w(o,"path")===t);import Bn from"react";function On(e,{path:t,sizes:o}){let n=V(e,t,!0),{children:r,style:i}=D(n),s=i.flexDirection==="column"?"height":"width",a=$s(r,o,s),l=Bn.cloneElement(n,void 0,a);return K(e,n,l)}function $s(e,t,o){return e.map((n,r)=>{let{style:{[o]:i,flexBasis:s}}=D(n),a=t[r],{currentSize:l,flexBasis:c}=a,m=l!==void 0?a.currentSize:c;return m===void 0||i===m||s===m?n:Bn.cloneElement(n,{style:Ns(n.props.style,o,m)})})}function Ns(e,t,o){let n=typeof e[t]=="number",{flexShrink:r=1,flexGrow:i=1}=e;return{...e,[t]:n?o:"auto",flexBasis:n?"auto":o,flexShrink:r,flexGrow:i}}import{uuid as Fs}from"@vuu-ui/vuu-utils";import ct from"react";var Hn=e=>{let[t]=P(e);return t===t.toLowerCase()};function $e(e,t,o,n,r,i){let{children:s,path:a}=D(e),l=w(t,"path"),{idx:c,finalStep:p}=Z(a,l),m=p?Vs(e,s,t,o,n,r,i):s.map((u,f)=>f===c?$e(u,t,o,n,r,i):u);return ct.cloneElement(e,void 0,m)}function Vs(e,t,o,n,r,i,s){let a=_(n);if((a==null?void 0:a.width)&&(a==null?void 0:a.height)){if(i===void 0||s===void 0)throw Error("wrap-layout-element, updateChildren clientRect and dropRect must both be available");return _s(t,o,n,r,i,s)}return Ws(e,t,o,n,r)}function Ws(e,t,o,n,r){var x;let{version:i=0}=D(n),s=w(o,"path"),{type:a,flexDirection:l,showTabs:c}=Nn(r),[p,m,u]=Gs(a,o,n,l,r),f=$n(r),h=f?1:0,g={resizeable:!0,style:u,version:i+1},d={[Hn(o)?"data-resizeable":"resizeable"]:!0,style:m},b=a==="Stack"?{showTabs:c}:void 0,E=a==="Flexbox"?{splitterSize:(x=P(e)==="Flexbox"&&e.props.splitterSize)!=null?x:void 0}:void 0,R=Fs(),S=ct.createElement(ne[a],{active:h,id:R,key:R,path:w(o,"path"),flexFill:w(o,"flexFill"),...E,...b,style:p,resizeable:w(o,"resizeable")},f?[O(o,`${s}.0`,d),Oe(ct.cloneElement(n,g),`${s}.1`)]:[Oe(ct.cloneElement(n,g),`${s}.0`),O(o,`${s}.1`,d)]);return t.map(T=>T===o?S:T)}function _s(e,t,o,n,r,i){let{flexDirection:s}=Nn(n),a=s==="column"?"row":"column",l=$n(n),[c,p,m,u]=i,[f,h]=s==="column"?[p-r.top,r.bottom-u]:[c-r.left,r.right-m],g=w(t,"path"),y=0,d=Hn(t)?"data-resizeable":"resizeable",b=[];f&&b.push(l?O(t,`${g}.${y++}`,{[d]:!0,style:{flexBasis:f,flexGrow:1,flexShrink:1}}):j(`${g}.${y++}`,f,{flexGrow:0,flexShrink:0})),b.push(Ae(o,a,`${g}.${y++}`,r,i)),h&&b.push(l?j(`${g}.${y++}`,0):O(t,`${g}.${y++}`,{[d]:!0,style:{flexBasis:0,flexGrow:1,flexShrink:1}}));let E=Ft(s,t.props,b,g);return e.map(R=>R===t?E:R)}function Gs(e,t,o,n,r){let i={...t.props.style,flexDirection:n},s=e==="Flexbox"&&n==="column"?"height":"width",a=$t(o,s,r),l=$t(t,s);return[i,l,a]}var $n=e=>{var t;return e.position.SouthOrEast?!0:((t=e==null?void 0:e.tab)==null?void 0:t.positionRelativeToTab)==="before"?!1:!!e.position.Header};function Nn(e){return e.position.Header?{type:"Stack",flexDirection:"column",showTabs:!0}:{type:"Flexbox",flexDirection:e.position.EastOrWest?"row":"column"}}var Gn=(e,t)=>{switch(t.type){case U.ADD:return qs(e,t);case U.DRAG_DROP:return Zs(e,t);case U.MAXIMIZE:return Ys(e,t);case U.REMOVE:return Yt(e,t);case U.REPLACE:return Mn(e,t);case U.SET_TITLE:return Xs(e,t);case U.SPLITTER_RESIZE:return On(e,t);case U.SWITCH_TAB:return Us(e,t);default:return e}},Us=(e,{path:t,nextIdx:o})=>{let n=V(e,t,!0),r=_n.cloneElement(n,{active:o});return K(e,n,r)},Xs=(e,{path:t,title:o})=>{let n=V(e,t,!0),r=_n.cloneElement(n,{title:o});return K(e,n,r)},Ys=(e,{path:t,type:o})=>{if(t){let n=V(e,t,!0);return K(e,n,n,o)}else return e},Zs=(e,t)=>{var h,g;console.log("drag drop");let{draggedReactElement:o,dragInstructions:n,dropTarget:r}=t,i=r.component,{pos:s}=r,a=((h=s==null?void 0:s.position)==null?void 0:h.Header)&&P(i)==="Stack",{id:l,version:c}=D(o),p=_(o),m;if(a){let[y,d]=vn(i,s);y===void 0?m=st(e,i,o):m=at(e,y,o,d)}else!p&&((g=s==null?void 0:s.position)==null?void 0:g.Centre)?m=Xt(e,i,o):m=Js(e,r,o);if(n.DoNotRemove)return m;let u=ee(m,y=>y.id===l&&y.version===c),f=w(u,"path");return Yt(m,{path:f,type:"remove"})},qs=(e,{path:t,component:o})=>st(e,V(e,t),o),Js=(e,t,o)=>{let{component:n,pos:r,clientRect:i,dropRect:s}=t,a=w(n,"path");if(a==="0.0")return $e(e,n,o,r);let l=Q(e,a);if(Fn(r,l)){let c=r.position.SouthOrEast?"after":"before";return at(e,n,o,c,r,i,s)}if(!Fn(r,l))return $e(e,n,o,r,i,s);if($(P(l)))return $e(e,n,o,r);throw Error(`no support right now for position = ${r.position}`)},Fn=(e,t)=>e.position.Centre?Wn(t)||Vn(t):e.position.NorthOrSouth?Vn(t):e.position.EastOrWest?Wn(t):!1,Vn=e=>P(e)==="Flexbox"&&e.props.style.flexDirection==="column",Wn=e=>P(e)==="Flexbox"&&e.props.style.flexDirection!=="column";import{createContext as Ks}from"react";var js=e=>console.log(`dispatch ${e.type}, have you forgotten to provide a LayoutProvider ?`),Ne=Ks({dispatchLayoutProvider:js,version:-1});import{useCallback as pt,useRef as Zt}from"react";var Qs={},Un=[0,0],ea=(e,t,o)=>{let n=document.createElement("div");n.className="vuuSimpleDraggableWrapper",n.classList.add("vuuSimpleDraggableWrapper","salt-theme","salt-density-medium"),n.dataset.dragging="true";let r=o!=null?o:document.createElement("div");r.id=t,n.appendChild(r),document.body.appendChild(n);let i=`top:${e.top}px;left:${e.left}px;width:${e.width}px;height:${e.height}px;`;return[n,i,e.left,e.top]},ta=e=>{let{offsetParent:t}=e;if(t===null)return Un;{let{left:o,top:n}=t.getBoundingClientRect();return[o,n]}},Xn=(e,t)=>{let o=Zt(),n=Zt(),r=Zt(),i=pt((c,p)=>{if(n.current&&r.current){let{dragOffsets:[m,u],targetPosition:f}=n.current,h=typeof c=="number"?c-m:f.left,g=typeof p=="number"?p-u:f.top;(h!==f.left||g!==f.top)&&(n.current.targetPosition.left=h,n.current.targetPosition.top=g,r.current.style.top=g+"px",r.current.style.left=h+"px")}},[]),s=pt(c=>{if(n.current){let{dragInstructions:p,payload:m,originalCSS:u}=n.current;t({type:"drag-drop",draggedReactElement:m,dragInstructions:p,dropTarget:c}),console.log("[useLayoutDragDrop]",{dragInstructions:p}),r.current&&(p.RemoveDraggableOnDragEnd?document.body.removeChild(r.current):(r.current.style.cssText=u,delete r.current.dataset.dragging)),o.current=void 0,n.current=void 0,r.current=void 0}},[t]),a=pt(c=>{if(o.current){let{payload:p,dragContainerPath:m,dragElement:u,dragRect:f,instructions:h=Qs,path:g}=o.current,{current:y}=e,d={x:c.clientX,y:c.clientY},b=p!=null?p:V(y,g,!0),{id:E}=b.props,R=_(b),S="",x="",T="",v=-1,C=-1,B=Un,L=document.getElementById(E);if(L===null)[L,x,v,C]=ea(f,E,u);else{B=ta(L);let[I,M]=B,{width:A,height:k,left:Y,top:W}=L.getBoundingClientRect();v=Y-I,C=W-M,x=`width:${A}px;height:${k}px;left:${v}px;top:${C}px;z-index: 100;background-color:#ccc;opacity: 0.6;`,L.dataset.dragging="true",S=L.style.cssText}T=Ot.initDrag(e.current,m,f,d,{drag:i,drop:s},R),L.style.cssText=x+T,r.current=L,n.current={payload:b,originalCSS:S,dragRect:f,dragOffsets:B,dragInstructions:h,targetPosition:{left:v,top:C}}}},[i,s,e]);return pt(c=>{let{evt:p,...m}=c;console.log("prepare to drag",{options:m}),o.current={...m,dragContainerPath:""},Ot.handleMousedown(p,a,m.instructions)},[a])};import{jsx as Jn}from"react/jsx-runtime";var Zn=e=>e.dropTarget,ra=e=>["drag-drop","remove","set-title","splitter-resize","switch-tab"].includes(e.type),qd=()=>{let e=ia();return Jn("div",{children:`Context: ${e} `})},Jd=e=>{let{children:t,layout:o,onLayoutChange:n}=e,r=Yn(void 0),i=Yn(t),[,s]=na(null),a=qt(m=>{if(n){let u=ee(m,Zn)||r.current,h=P(u)==="DraggableLayout"?D(u).children[0]:u,g=Dn(h);n(g,"drag-root")}},[n]),l=qt((m,u=!1)=>{let f=Gn(r.current,m);f!==r.current&&(r.current=f,s({}),!u&&ra(m)&&a(f))},[a]),c=qt(m=>{switch(m.type){case"drag-start":{p(m);break}case"save":{a(r.current);break}default:{l(m);break}}},[l,a]),p=Xn(r,c);return oa(()=>{if(o){let m=ee(r.current,Zn),u=Lo(m),f=it(o,`${m.props.path}.0`),h=u?{type:U.REPLACE,target:u,replacement:f}:{type:U.ADD,path:m.props.path,component:f};l(h,!0)}},[l,o]),r.current===void 0?r.current=Gt(t):t!==i.current&&(r.current=Gt(t,r.current),i.current=t),Jn(Ne.Provider,{value:{dispatchLayoutProvider:c,version:0},children:r.current})},X=()=>{let{dispatchLayoutProvider:e}=qn(Ne);return e},ia=()=>{console.log({LayoutProviderContext:Ne});let{version:e}=qn(Ne);return e};import{jsx as aa}from"react/jsx-runtime";var Kn=function(t){let{path:o}=t,n=X(),r=sa(i=>{n({type:xe.SPLITTER_RESIZE,path:o,sizes:i})},[n,o]);return aa(Wt,{...t,onSplitterMoved:r})};Kn.displayName="Flexbox";z("Flexbox",Kn,"container");import{useForkRef as va}from"@salt-ds/core";import La from"classnames";import{forwardRef as Ma}from"react";import{useCallback as nr,useEffect as da,useRef as jt,useState as fa}from"react";import{useCallback as la,useLayoutEffect as jn,useRef as ca}from"react";var mf=["height","width"],df=["height"],ff=["width"],fe=new WeakMap,er=(e,t,o)=>{switch(o){case"height":return t.height;case"scrollHeight":return e.scrollHeight;case"scrollWidth":return e.scrollWidth;case"width":return t.width;default:return 0}},Qn=new ResizeObserver(e=>{for(let t of e){let{target:o,contentRect:n}=t,r=fe.get(o);if(r){let{onResize:i,measurements:s}=r,a=!1;for(let[l,c]of Object.entries(s)){let p=er(o,n,l);p!==c&&(a=!0,s[l]=p)}a&&i&&i(s)}}});function tr(e,t,o,n=!1){let r=ca(t),i=la(s=>{let a=s.getBoundingClientRect();return r.current.reduce((l,c)=>(l[c]=er(s,a,c),l),{})},[]);jn(()=>{let s=e.current,a=!1;async function l(){fe.set(s,{measurements:{}}),a=!1;let{fonts:c}=document;if(c&&await c.ready,!a){let p=fe.get(s);if(p){let m=i(s);p.measurements=m,Qn.observe(s),n&&o(m)}}}if(s){if(fe.has(s))throw Error("useResizeObserver attemping to observe same element twice");l()}return()=>{s&&fe.has(s)&&(Qn.unobserve(s),fe.delete(s),a=!0)}},[e,i]),jn(()=>{let s=e.current,a=fe.get(s);if(a){if(r.current!==t){r.current=t;let l=i(s);a.measurements=l}a.onResize=o}},[t,i,e,o])}function pa(e,t){let o=document.body.querySelector(`.${e}`),n={get:function(r,i){let s=r.getPropertyValue(`--${e}-breakpoint-${i}`);return s?parseInt(s):void 0}};return o?new Proxy(getComputedStyle(o),n):t!=null?t:{}}var ua=([,e],[,t])=>t-e,Kt=e=>Object.entries(e).sort(ua).map(([t,o],n,r)=>[t,o,n<r.length-1?r[n+1][1]:9999]),Jt=null,ma=(e="salt")=>{let{xs:t,sm:o,md:n,lg:r,xl:i}=pa(e);return Kt({xs:t,sm:o,md:n,lg:r,xl:i})},or=e=>(Jt===null&&(Jt=ma(e)),Jt);var ha=[],rr=({breakPoints:e,smallerThan:t},o)=>{let[n,r]=fa(t?!1:"lg"),i=jt(document.body),s=jt(e?Kt(e):or()),a=jt("lg"),l=nr(p=>{if(s.current){for(let[m,u]of s.current)if(p>=u)return m}},[s]),c=nr(p=>{if(t){let m=s.current.find(([u])=>u===t);if(m){let[,,u]=m;return p<u}}else return l(p);return p},[t,l]);return tr(o||i,s.current?["width"]:ha,({width:p})=>{let m=c(p);m!==a.current&&(a.current=m,r(m))},!0),da(()=>{let p=o||i;if(p.current){let m=a.current;if(s.current){let{clientWidth:u}=p.current,f=c(u);a.current=f,f!==m&&r(f)}}},[r,c,o]),n};var ir="data-collapsible",ga={[ir]:!0,"data-pad-start":!0,"data-pad-end":!0},ya=e=>{var t;return(t=ga[e])!=null?t:!1},ba=e=>e===ir,xa={dynamic:"dynamic",instant:"instant",true:"instant"},Ra=e=>{var t;return(t=xa[e])!=null?t:"none"},Tf=e=>Object.keys(e).reduce((t,o)=>{let[n,r]=t;if(ya(o)){let i=ba(o)?Ra(e[o]):e[o];n[o]=i,r[o]=void 0}return t},[{},{}]);import{getUniqueId as Ea}from"@vuu-ui/vuu-utils";import{cloneElement as Sa,isValidElement as Ta,useCallback as Da,useMemo as sr,useRef as Qt}from"react";var wa=["xs","sm","md","lg","xl"],Pa=12,ar=({children:e,cols:t,style:o})=>{let n=Qt(null),r=Qt(null),i=Qt(),s=t!=null?t:Pa,l=(o==null?void 0:o.flexDirection)==="column"?"height":"width",c=sr(()=>Array.isArray(e)?e:Ta(e)?[e]:[],[e]),p=Da((m,u)=>{let f=ot(m,u,wa),h=[],g=[];for(let y=0;y<m.length;y++){let d=m[y],{style:{flex:b,...E}}=d.props;h.push(Sa(d,{key:Ea(),style:{...E,"--parent-col-count":s}})),g.push(f[y])}return[h,g]},[s]);return sr(()=>{let[m,u]=p(c,l);r.current=u,i.current=m},[p,c,l]),{cols:s,content:i.current,rootRef:n}};import{jsx as Ca}from"react/jsx-runtime";var ut="hwFluidGrid",eo=Ma(function(t,o){let{breakPoints:n,children:r,column:i,cols:s=12,className:a,flexFill:l,gap:c=3,fullPage:p,id:m,onSplitterMoved:u,resizeable:f,row:h,showGrid:g,spacing:y,splitterSize:d,style:b,...E}=t,{cols:R,content:S,rootRef:x}=ar({children:r,cols:s,style:b}),T=rr({breakPoints:n},x),v=La(ut,a,{[`${ut}-column`]:i,[`${ut}-row`]:h,[`${ut}-show-grid`]:g,"flex-fill":l,"full-page":p}),C={...b,"--spacing":y,"--grid-col-count":R,"--grid-gap":c};return Ca("div",{...E,className:v,"data-breakpoint":T,"data-cols":R,"data-resizeable":f||void 0,id:m,ref:va(x,o),style:C,children:S})});eo.displayName="FluidGrid";import{jsx as Aa}from"react/jsx-runtime";var lr=function(t){return Aa(eo,{...t})};lr.displayName="FluidGrid";z("FluidGrid",lr,"container");import Ga from"classnames";import Ua,{useRef as Xa,useState as xr}from"react";import{useCallback as Fe,useState as ka}from"react";var mt=(e,t,o,n)=>{var y;let{loadSessionState:r,purgeSessionState:i,purgeState:s,saveSessionState:a}=Ee(),[l,c]=ka((y=r(e,"contributions"))!=null?y:[]),p=X(),m=Fe((d,b)=>{let E=l.concat([{location:d,content:b}]);a(e,"contributions",E),c(E)},[l,e,a]),u=Fe(()=>{i(e,"contributions"),c([])},[e,i]),f=Fe(()=>{let d=r(e,"data-source");d&&d.unsubscribe(),i(e),s(e),p({type:"remove",path:o})},[p,e,r,i,s,o]),h=Fe(async(d,b,E)=>{var S;d.stopPropagation();let R=(S=t.current)==null?void 0:S.getBoundingClientRect();return new Promise((x,T)=>{p({type:"drag-start",evt:d,path:b===void 0?o:`${o}.${b}`,dragRect:R,preDragActivity:E,dropTargets:n,resolveDragStart:x,rejectDragStart:T})})},[t,p,o,n]);return[Fe(async(d,b)=>{var R;let{type:E}=d;switch(E){case"maximize":case"minimize":case"restore":return p({type:E,path:(R=d.path)!=null?R:o});case"remove":return f();case"mousedown":return console.log("2) ViewActionDispatch Hook dispatch Action mousedown"),h(b,d.index,d.preDragActivity);case"add-toolbar-contribution":return m(d.location,d.content);case"remove-toolbar-contribution":return u();default:return}},[p,o,f,h,m,u]),l]};import{useForkRef as $a,useIdMemo as Na}from"@salt-ds/core";import Fa from"classnames";import oo,{forwardRef as Va,useMemo as Wa,useRef as gr}from"react";import{useCallback as he,useMemo as cr}from"react";var pr=({id:e,rootRef:t,path:o,dropTargets:n,title:r})=>{let i=X(),{loadState:s,loadSessionState:a,purgeState:l,saveState:c,saveSessionState:p}=Ee(),[m,u]=mt(e,t,o,n),f=cr(()=>{var x;return(x=s("view-title"))!=null?x:r},[s,r]),h=he(x=>{o&&i({type:"set-title",path:o,title:x})},[i,o]),g=cr(()=>s(e),[e,s]),y=he(x=>s(e,x),[e,s]),d=he(x=>{l(e,x),i({type:"save"})},[e,i,l]),b=he((x,T)=>{c(e,T,x),i({type:"save"})},[e,i,c]),E=he(x=>a(e,x),[e,a]),R=he((x,T)=>p(e,T,x),[e,p]),S=he(({type:x,...T})=>{let{[x]:v}=T;b(v,x)},[b]);return{contributions:u,dispatchViewAction:m,load:y,loadSession:E,onConfigChange:S,onEditTitle:h,purge:d,restoredState:g,save:b,saveSession:R,title:f}};import{useResizeObserver as za,WidthHeight as Ia}from"@heswell/salt-lab";import{useCallback as ur,useRef as mr}from"react";var Ba=[],dr=({mainRef:e,resize:t="responsive",rootRef:o})=>{let n=t==="defer",r=mr({}),i=mr(),s=ur(()=>{e.current&&(e.current.style.height=r.current.height+"px",e.current.style.width=r.current.width+"px"),i.current=void 0},[e]),a=ur(({height:l,width:c})=>{r.current.height=l,r.current.width=c,i.current!==null&&clearTimeout(i.current),i.current=window.setTimeout(s,40)},[s]);za(o,n?Ia:Ba,a,n)};import Oa,{useContext as fr}from"react";var Ha={dispatch:null},dt=Oa.createContext(Ha),hr=()=>{var t;let e=fr(dt);return(t=e==null?void 0:e.dispatch)!=null?t:null},Eh=()=>fr(dt);import{jsx as to,jsxs as _a}from"react/jsx-runtime";var yr=Va(function(t,o){let{children:n,className:r,collapsed:i,closeable:s,"data-resizeable":a,dropTargets:l,expanded:c,flexFill:p,id:m,header:u,orientation:f="horizontal",path:h,resize:g="responsive",resizeable:y=a,tearOut:d,style:b={},title:E,...R}=t,S=Na(m),x=gr(null),T=gr(null),{contributions:v,dispatchViewAction:C,load:B,loadSession:L,onConfigChange:I,onEditTitle:M,purge:A,restoredState:k,save:Y,saveSession:W,title:ge}=pr({id:S,rootRef:x,path:h,dropTargets:l,title:E});dr({mainRef:T,resize:g,rootRef:x});let Te="vuuView",Ir=()=>oo.isValidElement(n)&&k?oo.cloneElement(n,k):n,Br=Wa(()=>({dispatch:C,id:S,path:h,title:ge,load:B,loadSession:L,onConfigChange:I,purge:A,save:Y,saveSession:W}),[C,S,B,L,I,h,A,Y,W,ge]),Or=typeof u=="object"?u:{};return to("div",{...R,className:Fa(Te,r,{[`${Te}-collapsed`]:i,[`${Te}-expanded`]:c,[`${Te}-resize-defer`]:g==="defer"}),"data-resizeable":y,id:S,ref:$a(o,x),style:b,tabIndex:-1,children:_a(dt.Provider,{value:Br,children:[u?to(br,{...Or,collapsed:i,contributions:v,expanded:c,closeable:s,onEditTitle:M,orientation:f,tearOut:d,title:ge}):null,to("div",{className:`${Te}-main`,ref:T,children:Ir()})]})})});yr.displayName="View";var ce=oo.memo(yr);ce.displayName="View";z("View",ce,"view");import{EditableLabel as Ya,Toolbar as Za,ToolbarButton as qa,ToolbarField as Ja,Tooltray as Rr}from"@heswell/salt-lab";import{CloseIcon as Ka}from"@salt-ds/icons";import{jsx as Se,jsxs as ja}from"react/jsx-runtime";var br=({className:e,contributions:t,collapsed:o,closeable:n,onEditTitle:r,orientation:i="horizontal",style:s,title:a="Untitled"})=>{let l=Xa(null),[c,p]=xr(a),[m,u]=xr(!1),f=hr(),h=L=>f==null?void 0:f({type:"remove"},L),g="vuuHeader",y=()=>{var L;(L=l.current)==null||L.focus()},d=L=>{L.stopPropagation()},E=Ga(g,e,`${g}-${o||i}`),R=()=>{u(!0)},S=L=>{L.key==="Enter"&&u(!0)},x=(L="",I="",M=!0,A=!1)=>{var k;u(!1),A?p(L):I!==L&&(p(I),r==null||r(I)),M===!1&&((k=l.current)==null||k.focus())},T=L=>{f==null||f({type:"mousedown"},L)},v=[],C=[],B=[];return a&&v.push(Se(Ja,{className:"vuuHeader-title",children:Se(Ya,{editing:m,value:c,onChange:p,onMouseDownCapture:y,onEnterEditMode:R,onExitEditMode:x,onKeyDown:S,ref:l,tabIndex:0},"title")},"title")),t==null||t.forEach((L,I)=>{C.push(Ua.cloneElement(L.content,{key:I}))}),n&&B.push(ja(qa,{onClick:h,onMouseDown:d,children:[Se(Ka,{})," Close"]},"close")),C.length>0&&v.push(Se(Rr,{"data-align-end":!0,children:C},"contributions")),B.length>0&&v.push(Se(Rr,{"data-align-end":!0,children:B},"actions")),Se(Za,{className:E,orientation:i,style:s,onMouseDown:T,children:v})};import{uuid as Qa}from"@vuu-ui/vuu-utils";import{List as el,ListItem as tl}from"@heswell/salt-lab";import Er from"classnames";import{cloneElement as ol,memo as nl}from"react";import{jsx as no}from"react/jsx-runtime";var rl=e=>{let t=e.cloneNode(!0);return t.id="",delete t.dataset.idx,t},Sr=nl(({className:e,children:t,idx:o,resizeable:n,header:r,closeable:i,...s})=>no(tl,{className:Er("vuuPaletteItem",e),"data-draggable":!0,...s}));Sr.displayName="PaletteItem";var il=({children:e,className:t,orientation:o="horizontal",...n})=>{let r=X(),i="vuuPalette";function s(a){var x;let c=a.target.closest(".vuuPaletteItem"),p=parseInt((x=c.dataset.idx)!=null?x:"-1");p!==-1&&console.log({children:e,idx:p,listItemElement:c});let{props:{caption:m,children:u,template:f,...h}}=e[p],{height:g,left:y,top:d,width:b}=c.getBoundingClientRect(),E=Qa(),S=f?u:no(ce,{...{id:E,key:E},...h,title:h.label,children:u});r({dragRect:{left:y,top:d,right:y+b,bottom:d+150,width:b,height:g},dragElement:rl(c),evt:a.nativeEvent,instructions:{DoNotRemove:!0,DoNotTransform:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},path:"*",payload:S,type:"drag-start"})}return no(el,{...n,borderless:!0,className:Er(i,t,`${i}-${o}`),maxHeight:800,selected:null,children:e.map((a,l)=>a.type===Sr?ol(a,{key:l,onMouseDown:s}):a)})};z("Palette",il,"view");import{uuid as sl}from"@vuu-ui/vuu-utils";import{List as al,ListItem as ll}from"@heswell/salt-lab";import cl from"classnames";import{jsx as ro}from"react/jsx-runtime";var pl="vuuPalette",kg=e=>{let{children:t,ViewProps:o,label:n,onMouseDown:r,template:i,...s}=e,a=X();return ro(ll,{onMouseDown:c=>{let{left:p,top:m,width:u}=c.currentTarget.getBoundingClientRect(),f=sl(),g=i?t:ro(ce,{...{id:f,key:f},...o,title:e.label,children:t});a({type:"drag-start",evt:c.nativeEvent,path:"*",payload:g,instructions:{DoNotRemove:!0,DoNotTransform:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},dragRect:{left:p,top:m,right:p+u,bottom:m+150,width:u,height:100}})},...s,children:n})},ul=({className:e,...t})=>ro(al,{...t,className:cl(pl,e),height:"100%",selectionStrategy:"none"});z("PaletteSalt",ul,"view");import{Tab as ml,Tabstrip as dl,Toolbar as fl,ToolbarField as hl}from"@heswell/salt-lab";import{useIdMemo as gl}from"@salt-ds/core";import yl from"classnames";import ht,{forwardRef as bl,useCallback as xl}from"react";import{jsx as ft,jsxs as Tl}from"react/jsx-runtime";var Tr="Tabs",Rl=()=>{},El=(e,t)=>{var o,n;return(n=(o=e.props)==null?void 0:o.title)!=null?n:`Tab ${t+1}`},Sl=e=>{let t=[];return ht.Children.forEach(e,o=>{ht.isValidElement(o)?t.push(o):console.warn("Stack has unexpected child element type")}),t},io=bl(function({active:t=0,children:o,className:n,enableAddTab:r,enableCloseTabs:i,getTabIcon:s=Rl,getTabLabel:a=El,id:l,keyBoardActivation:c="manual",onMouseDown:p,onTabAdd:m,onTabClose:u,onTabEdit:f,onTabSelectionChanged:h,showTabs:g,style:y,TabstripProps:d},b){var I;let E=gl(l),R=M=>{h==null||h(M)},S=M=>{u==null||u(M)},x=()=>{m==null||m(ht.Children.count(o))},T=M=>{var W;let k=M.target.closest('[role^="tab"]');if((k==null?void 0:k.getAttribute("role"))==="tab"){let ge=parseInt((W=k.dataset.idx)!=null?W:"-1");if(ge===-1)throw Error("Stack: mousedown on tab with unknown index");p==null||p(M,ge)}},v=xl((M,A,k,Y)=>{f==null||f(Y,A)},[f]),C=()=>{var M;return ht.isValidElement(o)?o:Array.isArray(o)&&(M=o[t])!=null?M:null},B=()=>Sl(o).map((M,A)=>{let k=`${E}-${A}`,{closeable:Y,id:W}=M.props;return ft(ml,{ariaControls:`${k}-tab`,"data-icon":s(M,A),draggable:!0,id:k,label:a(M,A),closeable:Y,editable:(d==null?void 0:d.enableRenameTab)!==!1},W!=null?W:A)}),L=C();return Tl("div",{className:yl(Tr,n,{[`${Tr}-horizontal`]:(d==null?void 0:d.orientation)==="vertical"}),style:y,id:E,ref:b,children:[g?ft(fl,{className:"vuuTabHeader vuuHeader",orientation:d==null?void 0:d.orientation,children:ft(hl,{disableFocusRing:!0,"data-collapsible":"dynamic","data-priority":"3",style:{alignSelf:"flex-end"},children:ft(dl,{...d,enableRenameTab:(d==null?void 0:d.enableRenameTab)!==!1,enableAddTab:r,enableCloseTab:i,keyBoardActivation:c,onActiveChange:R,onAddTab:x,onCloseTab:S,onExitEditMode:v,onMouseDown:T,activeTabIndex:(I=d==null?void 0:d.activeTabIndex)!=null?I:L===null?-1:t,children:B()})})}):null,L]})});io.displayName="Stack";import{useIdMemo as Dl}from"@salt-ds/core";import wl,{useRef as Pl}from"react";import{jsx as so}from"react/jsx-runtime";var vl=e=>so(ce,{resizeable:!0,title:`Tab ${e}`,style:{flexGrow:1,flexShrink:0,flexBasis:0},header:!0,closeable:!0,children:so(Tt,{style:{flex:1}})}),Dr=e=>{let t=Pl(null),o=X(),{loadState:n}=Ee(),{createNewChild:r=vl,id:i,onTabSelectionChanged:s,path:a,...l}=e,{children:c}=e,p=Dl(i),[m]=mt(p,t,a);return so(io,{...l,id:p,getTabLabel:(b,E)=>{let{id:R,title:S}=b.props;return n(R,"view-title")||S||`Tab ${E+1}`},onMouseDown:async(b,E)=>{let R;await m({type:"mousedown",index:E,preDragActivity:async()=>new Promise(T=>{console.log("preDragActivity: Ok, gonna release the drag"),R=T})},b)&&(R==null||R(void 0))},onTabAdd:(b,E=wl.Children.count(c))=>{if(a){console.log("[StackLayout] handleTabAdd");let R=r(E);console.log({component:R}),o({type:"add",path:a,component:R})}},onTabClose:b=>{if(Array.isArray(c)){let{props:{"data-path":E,path:R=E}}=c[b];o({type:"remove",path:R})}},onTabEdit:(b,E)=>{o({type:"set-title",path:`${a}.${b}`,title:E})},onTabSelectionChanged:b=>{console.log(`StackLayout handleTabSelection nextTab = ${b}`),a&&(o({type:"switch-tab",path:a,nextIdx:b}),s==null||s(b))},ref:t})};Dr.displayName="Stack";z("Stack",Dr,"container");import wr,{useState as Pr}from"react";import{jsx as ao,jsxs as vr}from"react/jsx-runtime";var by=({children:e})=>{let[o,n]=Pr(e),[r,i]=Pr(e),s=l=>{let c=Mo(o,l);i(c)},a=(l,c)=>{console.log(`change ${l} -> ${c}`);let p=wr.cloneElement(r,{style:{...r.props.style,[l]:c}});i(p),n(wr.cloneElement(o,{},p))};return vr("div",{"data-design-mode":`${!1}`,children:[o,ao("br",{}),vr("div",{style:{display:"flex"},children:[ao(Lr,{height:300,managedStyle:r.props.style,width:300,onChange:a,style:void 0}),ao(Mr,{layout:o,onSelect:s,style:{width:300,height:300,backgroundColor:"#ccc"}})]})]})};import{FormField as gt,Input as yt}from"@heswell/salt-lab";import{jsx as H,jsxs as co}from"react/jsx-runtime";var po={},Ll={margin:{top:"marginTop",right:"marginRight",bottom:"marginBottom",left:"marginLeft"},border:{top:"borderTopWidth",right:"borderRightWidth",bottom:"borderBottomWidth",left:"borderLeftWidth"},padding:{top:"paddingTop",right:"paddingRight",bottom:"paddingBottom",left:"paddingLeft"}},lo=({feature:e,children:t,style:o,onChange:n})=>co("div",{className:`LayoutBox layout-${e} layout-outer`,children:[co("div",{className:"layout-top",children:[H("span",{className:"layout-title",children:e}),H(gt,{className:"layout-input",style:{width:30},children:H(yt,{value:o.top,onChange:(r,i)=>n(e,"top",i)})})]}),co("div",{className:"layout-inner",children:[H("div",{className:"layout-left",children:H(gt,{className:"layout-input",style:{width:30},children:H(yt,{value:o.left,onChange:(r,i)=>n(e,"left",i)})})}),t,H("div",{className:"layout-right",children:H(gt,{className:"layout-input",style:{width:30},children:H(yt,{value:o.right,onChange:(r,i)=>n(e,"right",i)})})})]}),H("div",{className:"layout-bottom",children:H(gt,{className:"layout-input",style:{width:30},children:H(yt,{value:o.bottom,onChange:(r,i)=>n(e,"bottom",i)})})})]}),vy={margin:!0,marginTop:!0,marginRight:!0,marginBottom:!0,marginLeft:!0},Ly={padding:!0,paddingTop:!0,paddingRight:!0,paddingBottom:!0,paddingLeft:!0},My={border:!0,borderColor:!0,borderWidth:!0,borderTopWidth:!0,borderRightWidth:!0,borderBottomWidth:!0,borderLeftWidth:!0},bt="(\\d+)(?:px)?",Ml=`^(?:${bt}(?:\\s${bt}(?:\\s${bt}(?:\\s${bt})?)?)?)$`,Cr=new RegExp(Ml),Cl=/^(?:(\d+)(?:px)\ssolid\s([a-zA-Z,0-9().]+))$/,Lr=({height:e,managedStyle:t,onChange:o,style:n,width:r})=>{let i=Ar(t),s=(E,R,S)=>{let x=parseInt(S||"0",10),T=Ll[E][R];o(T,x)},{marginTop:a=0,marginRight:l=0,marginBottom:c=0,marginLeft:p=0}=i,{borderTopWidth:m=0,borderRightWidth:u=0,borderBottomWidth:f=0,borderLeftWidth:h=0}=i,{paddingTop:g=0,paddingRight:y=0,paddingBottom:d=0,paddingLeft:b=0}=i;return H("div",{className:"LayoutConfigurator",style:{width:r,height:e,...n},children:H(lo,{feature:"margin",style:{top:a,right:l,bottom:c,left:p},onChange:s,children:H(lo,{feature:"border",style:{top:m,right:u,bottom:f,left:h},onChange:s,children:H(lo,{feature:"padding",style:{top:g,right:y,bottom:d,left:b},onChange:s,children:H("div",{className:"layout-content"})})})})})};function Cy(e=po,t=po){let{margin:o,marginTop:n,marginRight:r,marginBottom:i,marginLeft:s,padding:a,paddingTop:l,paddingRight:c,paddingBottom:p,paddingLeft:m,...u}=e;if(typeof o=="number")u.marginTop=u.marginRight=u.marginBottom=u.marginLeft=o;else if(typeof o=="string"){let f=Cr.exec(o);if(f===null)console.error(`Invalid css value for margin '${o}'`);else{let[,h,g,y,d]=f,b=h&&g&&y;b&&d?(u.marginTop=parseInt(h,10),u.marginRight=parseInt(g,10),u.marginBottom=parseInt(y,10),u.marginLeft=parseInt(d,10)):b?(u.marginTop=parseInt(h,10),u.marginRight=u.marginLeft=parseInt(g,10),u.marginBottom=parseInt(y,10)):h&&g?(u.marginTop=u.marginBottom=parseInt(h,10),u.marginRight=u.marginLeft=parseInt(g,10)):u.marginTop=u.marginRight=u.marginBottom=u.marginLeft=parseInt(h,10)}}if(typeof n=="number"&&(u.marginTop=n),typeof r=="number"&&(u.marginRight=r),typeof i=="number"&&(u.marginBottom=i),typeof s=="number"&&(u.marginLeft=s),typeof a=="number")u.paddingTop=u.paddingRight=u.paddingBottom=u.paddingLeft=a;else if(typeof a=="string"){let f=Cr.exec(a);if(f===null)console.error(`Invalid css value for padding '${a}'`);else{let[,h,g,y,d]=f,b=h&&g&&y;b&&d?(u.paddingTop=parseInt(h,10),u.paddingRight=parseInt(g,10),u.paddingBottom=parseInt(y,10),u.paddingLeft=parseInt(d,10)):b?(u.paddingTop=parseInt(h,10),u.paddingRight=u.paddingLeft=parseInt(g,10),u.paddingBottom=parseInt(y,10)):h&&g?(u.paddingTop=u.paddingBottom=parseInt(h,10),u.paddingRight=u.paddingLeft=parseInt(g,10)):u.paddingTop=u.paddingRight=u.paddingBottom=u.paddinggLeft=parseInt(h,10)}}return typeof l=="number"&&(u.paddingTop=l),typeof c=="number"&&(u.paddingRight=c),typeof p=="number"&&(u.paddingBottom=p),typeof m=="number"&&(u.paddingLeft=m),Ar(u,t)}function Ar(e=po){let t={...e},o,{border:n,borderWidth:r,borderTopWidth:i,borderRightWidth:s,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,margin:p,marginTop:m,marginRight:u,marginBottom:f,marginLeft:h,padding:g,paddingTop:y,paddingRight:d,paddingBottom:b,paddingLeft:E,...R}=t,S={},x={};if(typeof p=="number"&&(t.marginTop=t.marginRight=t.marginBottom=t.marginLeft=p,S={marginTop:p,marginRight:p,marginBottom:p,marginLeft:p}),typeof g=="number"&&(t.paddingTop=t.paddingRight=t.paddingBottom=t.paddingLeft=g,x={paddingTop:g,paddingRight:g,paddingBottom:g,paddingLeft:g}),n||r||i||s||a||l){typeof n=="string"&&(o=Cl.exec(n))&&([,r,c]=o,r=parseInt(r,10)),r&&(i=i===void 0?r:i,s=s===void 0?r:s,a=a===void 0?r:a,l=l===void 0?r:l),c=c||"black";let T=`
18
+ ${c} ${l||0}px ${i||0}px 0 0 inset,
19
+ ${c} ${-s||0}px ${-a||0}px 0 0 inset`;return{...R,...S,...x,borderTopWidth:i,borderRightWidth:s,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,borderStyle:"solid",boxShadow:T}}else return t}import Al from"react";import kl from"classnames";import{Tree as zl}from"@heswell/salt-lab";import{jsx as kr}from"react/jsx-runtime";var Il="hwLayoutTreeViewer",zr=(e,t="0")=>({label:P(e),path:t,childNodes:Al.Children.map(e.props.children,(o,n)=>zr(o,t?`${t}.${n}`:`${n}`))}),Mr=({layout:e,onSelect:t,style:o})=>{let n=[zr(e)],r=(i,[{path:s}])=>{t(s)};return kr("div",{className:kl(Il),style:o,children:kr(zl,{source:n,groupSelection:"single",onSelectionChange:r})})};export{xe as Action,My as BORDER_STYLES,ni as Chest,Tt as Component,ne as ComponentRegistry,by as ConfigWrapper,oc as Dialog,Ot as Draggable,tn as DraggableLayout,Rt as Drawer,Go as DropMenu,re as DropTarget,Wt as Flexbox,Kn as FlexboxLayout,eo as FluidGrid,lr as FluidGridLayout,br as Header,df as HeightOnly,Lr as LayoutConfigurator,Jd as LayoutProvider,Ne as LayoutProviderContext,qd as LayoutProviderVersion,Mr as LayoutTreeViewer,vy as MARGIN_STYLES,Ly as PADDING_STYLES,il as Palette,Sr as PaletteItem,kg as PaletteListItem,ul as PaletteSalt,Qe as Placeholder,io as Stack,Dr as StackLayout,ce as View,dt as ViewContext,mf as WidthHeight,ff as WidthOnly,Cy as XXXnormalizeStyles,_o as computeMenuPosition,pi as containerOf,Dt as expandFlex,Tf as extractResponsiveProps,ee as findTarget,V as followPath,Mo as followPathToComponent,Q as followPathToParent,ui as getChild,Lo as getChildProp,xn as getPersistentState,w as getProp,D as getProps,Rn as hasPersistentState,Mt as identifyDropTarget,$ as isContainer,Po as isLayoutComponent,yc as isRegistered,ya as isResponsiveAttribute,fp as isTabstrip,Vc as isTypeOf,Qr as isView,Zc as nextLeaf,Z as nextStep,qc as previousLeaf,z as registerComponent,O as resetPath,En as setPersistentState,Kc as setRef,P as typeOf,rr as useBreakpoints,X as useLayoutProviderDispatch,ia as useLayoutProviderVersion,Ee as usePersistentState,tr as useResizeObserver,mt as useViewActionDispatcher,Eh as useViewContext,hr as useViewDispatch};
20
+ //# sourceMappingURL=index.js.map