@vuu-ui/vuu-layout 0.8.22 → 0.8.23
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/cjs/index.js +4 -4
- package/cjs/index.js.map +4 -4
- package/esm/index.js +4 -4
- package/esm/index.js.map +4 -4
- package/index.css +1 -1
- package/index.css.map +3 -3
- package/package.json +8 -8
- package/types/index.d.ts +0 -3
- package/types/utils/index.d.ts +0 -1
- package/types/utils/typeOf.d.ts +2 -1
- package/types/measured-container/MeasuredContainer.d.ts +0 -15
- package/types/measured-container/index.d.ts +0 -2
- package/types/measured-container/useMeasuredContainer.d.ts +0 -22
- package/types/measured-container/useResizeObserver.d.ts +0 -15
- package/types/overflow-container/OverflowContainer.d.ts +0 -17
- package/types/overflow-container/index.d.ts +0 -2
- package/types/overflow-container/overflow-utils.d.ts +0 -49
- package/types/overflow-container/useOverflowContainer.d.ts +0 -20
- package/types/toolbar/Toolbar.d.ts +0 -21
- package/types/toolbar/index.d.ts +0 -1
- package/types/toolbar/toolbar-dom-utils.d.ts +0 -3
- package/types/toolbar/useKeyboardNavigation.d.ts +0 -32
- package/types/toolbar/useSelection.d.ts +0 -22
- package/types/toolbar/useToolbar.d.ts +0 -28
- package/types/utils/react-utils.d.ts +0 -2
package/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ja=Object.create;var zt=Object.defineProperty;var Ya=Object.getOwnPropertyDescriptor;var Za=Object.getOwnPropertyNames;var Xa=Object.getPrototypeOf,Ja=Object.prototype.hasOwnProperty;var Qa=(e,t)=>{for(var o in t)zt(e,o,{get:t[o],enumerable:!0})},nn=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Za(t))!Ja.call(e,n)&&n!==o&&zt(e,n,{get:()=>t[n],enumerable:!(r=Ya(t,n))||r.enumerable});return e};var k=(e,t,o)=>(o=e!=null?ja(Xa(e)):{},nn(t||!e||!e.__esModule?zt(o,"default",{value:e,enumerable:!0}):o,e)),es=e=>nn(zt({},"__esModule",{value:!0}),e);var Gc={};Qa(Gc,{Action:()=>_e,BORDER_STYLES:()=>Fc,Component:()=>hn,ComponentRegistry:()=>xe,ConfigWrapper:()=>Hc,DockLayout:()=>mn,Draggable:()=>Qt,DraggableLayout:()=>Xo,Drawer:()=>Bt,DropMenu:()=>qo,DropTarget:()=>Be,Flexbox:()=>go,FlexboxLayout:()=>Mr,FluidGrid:()=>yo,FluidGridLayout:()=>Cr,Header:()=>yr,HeightOnly:()=>Ml,LayoutActionType:()=>_,LayoutConfigurator:()=>Zr,LayoutProvider:()=>Ll,LayoutProviderContext:()=>ot,LayoutProviderVersion:()=>Pl,LayoutTreeViewer:()=>Xr,MARGIN_STYLES:()=>Bc,MeasuredContainer:()=>pc,NO_WRAPPED_ITEMS:()=>Eo,OverflowContainer:()=>Vr,PADDING_STYLES:()=>Nc,Palette:()=>wa,PaletteItem:()=>Gr,Placeholder:()=>je,Stack:()=>Mo,StackLayout:()=>qr,Toolbar:()=>Oc,View:()=>Ue,ViewContext:()=>Lt,WidthHeight:()=>Er,WidthOnly:()=>Cl,XXXnormalizeStyles:()=>Vc,applyLayout:()=>_s,applyLayoutProps:()=>et,applyOverflowClassToWrappedItems:()=>zr,asReactElements:()=>Oe,componentToJson:()=>ur,computeMenuPosition:()=>Uo,containerOf:()=>yn,correctForWrappedHighPriorityItems:()=>$r,correctForWrappedOverflowIndicator:()=>Fr,createFlexbox:()=>ro,createPlaceHolder:()=>ie,expandFlex:()=>Vt,extractResponsiveProps:()=>Fl,findTarget:()=>de,followPath:()=>F,followPathToComponent:()=>No,followPathToParent:()=>re,getChild:()=>wn,getChildProp:()=>Bo,getDefaultTabLabel:()=>Ve,getElementsMarkedAsWrapped:()=>ua,getFlexDimensions:()=>tr,getFlexOrIntrinsicStyle:()=>oo,getFlexStyle:()=>to,getIntrinsicSize:()=>ee,getManagedDimension:()=>lr,getNonWrappedAndWrappedItems:()=>at,getPersistentState:()=>rr,getProp:()=>C,getProps:()=>D,hasPersistentState:()=>nr,hasUnboundedFlexStyle:()=>or,highPriorityItemsHaveWrappedButShouldNotHave:()=>Nr,identifyDropTarget:()=>Gt,isApplicationLevelChange:()=>rl,isContainer:()=>G,isLayoutComponent:()=>ko,isLayoutLevelChange:()=>nl,isOverflowElement:()=>mc,isResponsiveAttribute:()=>Pi,isTabstrip:()=>ys,isTypeOf:()=>is,isView:()=>ln,layoutFromJson:()=>Pe,layoutQuery:()=>pr,layoutReducer:()=>hr,layoutToJSON:()=>cr,markElementAsWrapped:()=>ca,nextLeaf:()=>ss,nextStep:()=>ne,overflowIndicatorHasWrappedButShouldNotHave:()=>Br,previousLeaf:()=>ls,processLayoutElement:()=>no,registerComponent:()=>N,removeOverflowIndicatorIfNoLongerNeeded:()=>Wr,resetPath:()=>V,resizeObserver:()=>xr,resolveJSONPath:()=>vn,resolvePath:()=>Wt,serializeProps:()=>jn,setPersistentState:()=>ir,setRef:()=>cs,sortByScreenOrder:()=>la,switchWrappedItemIntoView:()=>Ro,typeOf:()=>L,unmarkItemsWhichAreNoLongerWrapped:()=>pa,useBreakpoints:()=>Sr,useLayoutCreateNewChild:()=>gr,useLayoutProviderDispatch:()=>le,useLayoutProviderVersion:()=>wi,useMeasuredContainer:()=>Ir,usePersistentState:()=>We,useResizeObserver:()=>Dt,useViewActionDispatcher:()=>St,useViewContext:()=>Dr,useViewDispatch:()=>wr,wrapIntrinsicSizeComponentWithFlexbox:()=>Qe});module.exports=es(Gc);var Oo=require("@vuu-ui/vuu-utils"),dn=k(require("clsx"));var an={},sn={},xe={};function G(e){return an[e]===!0}function ln(e){return sn[e]===!0}var ko=e=>G(e)||ln(e);function N(e,t,o="component"){xe[e]=t,o==="container"?an[e]=!0:o==="view"&&(sn[e]=!0)}var ht=require("@salt-ds/core"),Ao=k(require("clsx")),un=require("react");var Re=require("react/jsx-runtime"),Ee="vuuDrawer",cn=e=>typeof e=="string"?e:e+"px",ts=(e,t,o)=>{let r=t!==void 0,n=o!==void 0;if(!(!e&&!n&&!r))return!n&&!r?e:{...e,"--drawer-size":r?cn(t):void 0,"--drawer-peek-size":n?cn(o):void 0}},pn=({children:e,className:t,clickToOpen:o,defaultOpen:r,sizeOpen:n,sizeClosed:i,style:a,open:s,position:l="left",inline:c,onClick:p,peekaboo:d=!1,toggleButton:u,...m})=>{let[h,g]=(0,ht.useControlled)({controlled:s,default:r!=null?r:!1,name:"Drawer",state:"open"});console.log(`Drawer sizeOpen ${n} sizeClosed ${i}`);let b=(0,Ao.default)(Ee,t,`${Ee}-${l}`,{[`${Ee}-open`]:h,[`${Ee}-inline`]:c,[`${Ee}-over`]:!c,[`${Ee}-peekaboo`]:d}),f=(0,un.useCallback)(()=>{g(!h)},[h,g]),y=ts(a,n,i),x=o?f:p,w=()=>(0,Re.jsx)("div",{className:(0,Ao.default)("vuuToggleButton-container"),children:h?(0,Re.jsx)(ht.Button,{"aria-label":"close",onClick:f,"data-icon":"close",variant:"secondary"}):(0,Re.jsx)(ht.Button,{"aria-label":"open",onClick:f,"data-icon":"close",variant:"secondary"})});return(0,Re.jsxs)("div",{...m,className:b,onClick:x,style:y,children:[u=="start"?w():null,(0,Re.jsx)("div",{className:`${Ee}-liner`,children:(0,Re.jsx)("div",{className:`${Ee}-content`,children:e})}),u=="end"?w():null]})};pn.displayName="Drawer";var Bt=pn;var Nt=require("react/jsx-runtime"),os=e=>e.type===Bt,rs=({props:{position:e="left"}})=>e.match(/top|bottom/),Ho=e=>{let{children:t,className:o,id:r,style:n}=e,i="vuuDockLayout",[a,s]=(0,Oo.partition)(t,os),[l,c]=(0,Oo.partition)(a,rs),p=l.length===0?"horizontal":c.length===0?"vertical":"both",d=(0,dn.default)(i,o,`${i}-${p}`);return(0,Nt.jsxs)("div",{className:d,id:r,style:n,children:[a,(0,Nt.jsx)("div",{className:`${i}-content`,children:s})]})};Ho.displayName="DockLayout";var mn=Ho;N("DockLayout",Ho,"container");var fn=require("react");var gn=require("react/jsx-runtime"),zo=(0,fn.forwardRef)(function({resizeable:t,...o},r){return(0,gn.jsx)("div",{...o,className:"Component",ref:r})});zo.displayName="Component";var hn=zo;N("Component",zo);var oe=k(require("react"));var ns={},C=(e,t)=>{var r;let o=D(e);return(r=o[t])!=null?r:o[`data-${t}`]},D=e=>(e==null?void 0:e.props)||e||ns,Bo=e=>{let t=D(e);if(t.children){let{children:[o,...r]}=t;return r.length>0&&console.warn(`getChild expected a single child, found ${r.length+1}`),o}};function L(e){var t;if(e){let o=e.type;if(typeof o=="function"||typeof o=="object"){let r=o.displayName||o.name||((t=o.type)==null?void 0:t.name);if(typeof r=="string")return r}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 is=(e,t)=>L(e)===t;var as=e=>{let t=e.lastIndexOf(".");return t===-1?e:e.slice(0,t)},bn=e=>oe.default.isValidElement(e.props.children)?[e.props.children]:e.props.children,Wt=(e,t="")=>{let[o,...r]=t.split(".");if(o!=null&&o.startsWith("#")){let n=Fo(e,o.slice(1),!0);if(n&&r.length)return Wt(n,r.join("."))}else if(o==="ACTIVE_CHILD"){let{active:n}=D(e),i=bn(e),{path:a}=D(i[n]);return a}return""},vn=(e,t="")=>{let[o,...r]=t.split(".");if(o!=null&&o.startsWith("#")){let n=xn(e,o.slice(1),!0);if(n&&r.length)return vn(n,r.join("."))}else if(o==="ACTIVE_CHILD"){let{children:n,props:i}=e,{active:a}=i;if(typeof a=="number"&&(n!=null&&n[a]))return n[a]}};function re(e,t){let{"data-path":o,path:r=o}=D(e);return t==="0"||t===r?null:F(e,as(t),!0)}function de(e,t){let{children:o,...r}=D(e);if(t(r))return e;if(oe.default.Children.count(o)>0){let n=oe.default.isValidElement(o)?[o]:o;for(let i of n){let a=de(i,t);if(a)return a}}}function yn(e,t){if(t===e)return null;let{path:o,children:r}=D(e),{idx:n,finalStep:i}=ne(o,C(t,"path"));return i?e:r===void 0||r[n]===void 0?null:yn(r[n],t)}var wn=(e,t)=>{if(oe.default.isValidElement(e)&&t==0)return e;if(Array.isArray(e))return e[t]};function No(e,t){let o=t.split("."),r=[e];for(let n=0;n<o.length;n++){let i=parseInt(o[n]),a=r[i];if(n===o.length-1)return a;r=bn(a)}}var Fo=(e,t,o=!0)=>{let{children:r,id:n}=e.props;if(n===t)return e;if(oe.default.Children.count(r)>0){let i=(0,oe.isValidElement)(r)?[r]:r;for(let a of i)if((0,oe.isValidElement)(a)){let s=Fo(a,t,!1);if(s)return s}}if(o===!0)throw Error(`pathUtils.findTargetById id #${t} not found in source`)},xn=(e,t,o=!0)=>{let{children:r,id:n}=e;if(n===t)return e;if(Array.isArray(r)&&r.length>0){for(let i of r)if(i!==null&&typeof i=="object"){let a=xn(i,t,!1);if(a)return a}}if(o===!0)throw Error(`pathUtils.findTargetJSONById id #${t} not found in source`)};function F(e,t,o=!1){if(t.startsWith("#"))return Fo(e,t.slice(1),o);let{"data-path":r,path:n=r}=D(e);if(t.indexOf(n)!==0)throw Error(`pathUtils.followPath path ${t} is not within source path ${n}`);let i=t.slice(n.length+1);if(i==="")return e;let a=e,s=i.split(".");for(let l=0;l<s.length;l++){if(oe.default.Children.count(a.props.children)===0){let c=`element at 0.${s.slice(0,l).join(".")} has no children, so cannot fulfill rest of path ${s.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c);return}if(a=wn(a.props.children,parseInt(s[l])),a===void 0){let c=`model at 0.${s.slice(0,l).join(".")} has no children that fulfill next step of path ${s.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c)}}return a}function ss(e,t){let o=re(e,t),r=t.split(".").map(n=>parseInt(n,10));if(o){let n=r.pop(),{children:i}=o.props;if(i.length-1>n)return Ft(i[n+1]);{let a=r.pop(),s=re(e,C(o,"path"));if(s&&typeof a=="number"&&(r=s.props.path.split(".").map(l=>parseInt(l,10)),s.props.children.length-1>a)){let l=s.props.children[a+1];return G(L(l))?Ft(l):l}}}return Ft(e)}function ls(e,t){let o=t.split(".").map(i=>parseInt(i,10)),r=o.pop(),n=re(e,t);if(n!=null&&typeof r=="number"){let{children:i}=n.props;if(r>0)return $t(i[r-1]);for(;o.length>1;)if(r=o.pop(),n=re(e,C(n,"path")),r>0){let a=n.props.children[r-1];return G(L(a))?$t(a):a}}return $t(e)}function Ft(e){if(G(L(e))){let{children:t}=e.props||e;return Ft(t[0])}return e}function $t(e){if(G(L(e))){let{children:t}=e.props||e;return $t(t[t.length-1])}return e}function ne(e,t,o=!1){if(e===t)return{idx:-1,finalStep:!0};let r=`${e}.`;if(!t.startsWith(r))throw Error("pathUtils nextStep has strayed from the path");let n=o?0:1,i=t.replace(r,"").split(".").map(a=>parseInt(a,10));return{idx:i[0],finalStep:i.length===n}}function V(e,t,o){if(C(e,"path")===t)return e;let r=[];oe.default.Children.forEach(e.props.children,(i,a)=>{C(i,"path")?r.push(V(i,`${t}.${a}`)):r.push(i)});let n=e.props["data-path"]?"data-path":"path";return oe.default.cloneElement(e,{[n]:t,...o},r)}function cs(e,t){typeof e=="function"?e(t):e&&(e.current=t)}var gt=require("react"),us=[],Oe=e=>{let t=Array.isArray(e),o=t?e.length:gt.Children.count(e);return t&&e.every(gt.isValidElement)?e:o===1&&!t&&(0,gt.isValidElement)(e)?[e]:o>1?e:us};var Vt=e=>{if(typeof e!="number")throw Error(`"no support yet for flex value ${e}`);return{flexBasis:0,flexGrow:1,flexShrink:1}};var bt=require("@vuu-ui/vuu-utils");var ze={north:1,east:2,south:4,west:8,header:16,centre:32,absolute:64},vt={AFTER:"after",BEFORE:"before"},Q=Object.freeze({North:He("north"),East:He("east"),South:He("south"),West:He("west"),Header:He("header"),Centre:He("centre"),Absolute:He("absolute")});function He(e){return Object.freeze({offset:e==="north"||e==="west"?0:e==="south"||e==="east"?1:NaN,valueOf:function(){return ze[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 En=Q.North,Rn=Q.South,$o=Q.East,Wo=Q.West,ps=Q.Header,ds=Q.Centre,Je=class{static measure(t,o=[]){let r={};return hs(t,r,o),r}static allBoxesContainingPoint(t,o,r,n,i){return Pn(t,o,r,n,i).reverse()}};function Vo(e,t,o,r=30){let n=o.right-o.left,i=o.bottom-o.top,a=e-o.left,s=t-o.top,l=0;return a<r&&(l+=8),a>n-r&&(l+=2),s<r&&(l+=1),s>i-r&&(l+=4),{pctX:a/n,pctY:s/i,closeToTheEdge:l}}function _o(e,t,o,r){let{BEFORE:n,AFTER:i}=vt,{pctX:a,pctY:s,closeToTheEdge:l}=Vo(e,t,o),c,p;if(r==="row")c=a<.5?Wo:$o;else if(o.header&&(0,bt.boxContainsPoint)(o.header,e,t))if(c=ps,o.Stack){let d=o.Stack.length;if(d===0)p={index:-1,left:o.left,positionRelativeToTab:i,width:0};else{let u=o.Stack.find(({left:m,right:h})=>e>=m&&e<=h);if(u){let m=u.right-u.left;p={index:o.Stack.indexOf(u),left:u.left,positionRelativeToTab:(e-u.left)/m<.5?n:i,width:m}}else p={left:o.Stack[d-1].right,width:0,index:d,positionRelativeToTab:i}}}else if(o.header.titleWidth){let d=o.header.titleWidth;p={index:-1,left:o.left,positionRelativeToTab:(e-o.left)/d<.5?n:i,width:d}}else p={left:o.left,width:0,positionRelativeToTab:n,index:-1};else c=ms(e,t,o,a,s);return{position:c,x:e,y:t,closeToTheEdge:l,tab:p}}function ms(e,t,o,r,n){let i=fs(o,.2);if((0,bt.boxContainsPoint)(i,e,t))return ds;switch(`${n<.5?"north":"south"}${r<.5?"west":"east"}`){case"northwest":return r>n?En:Wo;case"northeast":return 1-r>n?En:$o;case"southeast":return r>n?$o:Rn;case"southwest":return 1-r>n?Wo:Rn;default:}}function fs({right:e,left:t,top:o,bottom:r},n){let i=(1-n)/2,a=(e-t)*i,s=(r-o)*i;return{left:t+a,top:o+s,right:e-a,bottom:r-s}}function hs(e,t,o){let{id:r,"data-path":n,path:i=n}=D(e),a=L(e);if(r&&i){let[s,l]=Dn(e);Tn(e,s,l,t),G(a)&&Sn(e,t,o)}}function Tn(e,t,o,r){let{"data-path":n,path:i=n,header:a}=D(e);r[i]=t;let s=L(e);if(a||s==="Stack"){let l=s==="Stack"?".vuuTabstrip":".vuuHeader",c=o.querySelector(l);if(c){let{top:p,left:d,right:u,bottom:m}=c.getBoundingClientRect();if(r[i].header={top:Math.round(p),left:Math.round(d),right:Math.round(u),bottom:Math.round(m)},s==="Stack")r[i].Stack=Array.from(c.querySelectorAll(".vuuTab")).map(h=>h.getBoundingClientRect()).map(({left:h,right:g})=>({left:h,right:g}));else{let h=c.querySelector('[class^="vuuHeader-title"]'),{header:g}=r[i];h&&g&&(g.titleWidth=h.clientWidth)}}}return r[i]}function Sn(e,t,o,r=0,n=0,i=0,a=0){let{children:s,"data-path":l,path:c=l,style:p,active:d=0}=D(e),u=L(e),m=u==="Flexbox",h=u==="Stack",g=m&&p.flexDirection==="column",b=m&&p.flexDirection==="row",y=(h?s.filter((w,R)=>R===d):s.filter(gs)).map(w=>{let[R,v]=Dn(w);return[{...R,top:R.top-i,right:R.right+n,bottom:R.bottom+a,left:R.left-r},v,w]}),x=y.map(([w,R,v],E,S)=>{let I,M,T,P,A,O,z=S.length-1;b?(A=E===0?0:w.left-S[E-1][0].right,O=E===z?0:S[E+1][0].left-w.right,I=E===0||A===0?0:A,M=E===z||O===0?0:O-O/2,w.left-=I,w.right+=M,T=i,P=a):g&&(A=E===0?0:w.top-S[E-1][0].bottom,O=E===z?0:S[E+1][0].top-w.bottom,T=E===0||A===0?0:A,P=E===z||O===0?0:O-O/2,w.top-=T,w.bottom+=P,I=r,M=n);let W=Tn(v,w,R,t),J=L(v);return G(J)&&Sn(v,t,o,I,M,T,P),W});y.length&&(t[c].children=x)}function gs(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 Dn(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:r,left:n,right:i,bottom:a,height:s,width:l}=o.getBoundingClientRect(),c,p=L(e);if(G(p)){let d=o.scrollHeight;d>s&&(c={id:t,scrollHeight:d,scrollTop:o.scrollTop})}return[{top:Math.round(r),left:Math.round(n),right:Math.round(i),bottom:Math.round(a),height:Math.round(s),width:Math.round(l),scrolling:c},o,e]}function Pn(e,t,o,r,n,i=[]){let{children:a,"data-path":s,path:l=s}=D(e),c=L(e),p=t[l];if(!(0,bt.boxContainsPoint)(p,o,r))return i;if(n&&n.length){if(n.includes(l))i.push(e);else if(!n.some(d=>d.startsWith(l)))return i}else i.push(e);if(!G(c)||p.header&&(0,bt.boxContainsPoint)(p.header,o,r))return i;p.scrolling&&bs(p,o,r);for(let d=0;d<a.length;d++){if(c==="Stack"&&e.props.active!==d)continue;let u=Pn(a[d],t,o,r,n);if(u.length)return i.concat(u)}return i}function bs({top:e,bottom:t,scrolling:o},r,n){if(o){let{id:i,scrollTop:a,scrollHeight:s}=o,l=t-e;if(a===0&&t-n<50){let c=s-l;document.getElementById(i).scrollTo({left:0,top:c,behavior:"smooth"}),o.scrollTop=c}else if(a>0&&n-e<50)document.getElementById(i).scrollTo({left:0,top:0,behavior:"smooth"}),o.scrollTop=0;else return!1}else return!1}var vs=.4,_t=class{constructor(t,o,r,n,i){this.init(t,o,r,n,i)}init(t,o,r,n,i){let{left:a,top:s}=n,{pctX:l,pctY:c}=Vo(o,r,n),p=vs,d=l*n.width,u=n.width-d,m=c*n.height,h=n.height-m,g=n.width*p,b=n.height*p,f=1-p,y=d*f,x=m*f,w=u*f,R=h*f;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-y,hi:t.right-n.width+w},y:{lo:t.top-x,hi:t.bottom-n.height+R}},mouse:{x:{lo:t.left+g*l,hi:t.right-g*(1-l)},y:{lo:t.top+b*c,hi:t.bottom-b*(1-c)}}},this.x={pos:a,lo:!1,hi:!1,mousePos:o,mousePct:l},this.y={pos:s,lo:!1,hi:!1,mousePos:r,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 r=this[t],n=this.constraint.mouse[t],i=this.constraint.pos[t],a=r.pos,s=o-r.mousePos;return s<0?r.lo||(o<n.lo?(r.lo=!0,r.pos=i.lo):r.hi?o<n.hi&&(r.hi=!1,r.pos+=s):r.pos+=s):s>0&&(r.hi||(o>n.hi?(r.hi=!0,r.pos=i.hi):r.lo?o>n.lo&&(r.lo=!1,r.pos+=s):r.pos+=s)),r.mousePos=o,a!==r.pos}dropXY(t){let o=this[t],r=this.constraint.zone[t];return o.lo?Math.max(r.lo,o.mousePos):o.hi?Math.min(o.mousePos,Math.round(r.hi)-1):o.mousePos}};var ys=e=>e.pos.tab&&L(e.component)==="Stack"&&e.pos.position.Header,{north:ws,south:xs,east:Es,west:Rs}=ze,Ts=Es+Rs,Ss=ws+xs,Be=class e{constructor({component:t,pos:o,clientRect:r,nextDropTarget:n}){this.component=t,this.pos=o,this.clientRect=r,this.nextDropTarget=n,this.active=!1,this.dropRect=void 0}targetTabPos(t){let{left:o,width:r,positionRelativeToTab:n}=t;return n===vt.BEFORE?o:o+r}getTargetDropOutline(t,o){if(this.pos.tab)return this.getDropTabOutline(t,this.pos.tab);if(o&&o.hasIntrinsicSize())return this.getIntrinsicDropRect(o);{let[r,n,i,a]=this.getDropRectOutline(t,o);return{l:r,t:n,r:i,b:a}}}getDropTabOutline(t,o){var f,y;let{clientRect:{top:r,left:n,right:i,bottom:a,header:s}}=this,l=0,c=Math.round(t/2)+l,p=Math.round(r),d=Math.round(n+c),u=Math.round(i-c),m=Math.round(a-c),h=this.targetTabPos(o),g=60,b=((f=s==null?void 0:s.bottom)!=null?f:0)-((y=s==null?void 0:s.top)!=null?y:0);return{l:d,t:p,r:u,b:m,tabLeft:h,tabWidth:g,tabHeight:b}}getIntrinsicDropRect(t){var g,b,f,y;let{pos:o,clientRect:r}=this,{x:n,y:i}=t,a=(b=(g=t.intrinsicSize)==null?void 0:g.height)!=null?b:0,s=(y=(f=t.intrinsicSize)==null?void 0:f.height)!=null?y:0;a&&a>r.height?(console.log("DropTarget: we're going to blow the gaff"),a=r.height):s&&s>r.width&&(console.log("DropTarget: we're going to blow the gaff"),s=r.width);let l=Math.min(r.right-s,Math.max(r.left,Math.round(o.x-n.mousePct*s))),c=Math.min(r.bottom-a,Math.max(r.top,Math.round(o.y-i.mousePct*a))),[p,d,u,m]=this.dropRect=[l,c,l+s,c+a],h=o.position.EastOrWest?[p,r.top,p,r.bottom,u,r.top,u,r.bottom]:[r.left,d,r.right,d,r.left,m,r.right,m];return{l:p,r:u,t:d,b:m,guideLines:h}}getDropRectOutline(t,o){var y,x,w;let{pos:r,clientRect:n}=this,{width:i,height:a,position:s}=r,{width:l,height:c}=(y=o==null?void 0:o.intrinsicSize)!=null?y:{},p=(x=c!=null?c:a)!=null?x:0,d=(w=l!=null?l:i)!=null?w:0;this.dropRect=void 0;let{top:u,left:m,right:h,bottom:g}=n,b=0,f=Math.round(t/2)+b;switch(s){case Q.North:case Q.Header:{let R=Math.round((g-u)/2),v=p?Math.min(R,Math.round(p)):R;return d&&m+d<h?[m+f,u+f,m+d-f,u+f+v]:[m+f,u+f,h-f,u+f+v]}case Q.West:{let R=Math.round((h-m)/2),v=d?Math.min(R,Math.round(d)):R;return p&&u+p<g?[m+f,u+f,m-f+v,u+p+f]:[m+f,u+f,m-f+v,g-f]}case Q.East:{let R=Math.round((h-m)/2),v=d?Math.min(R,Math.round(d)):R;return p&&u+p<g?[h-f-v,u+f,h-f,u+p+f]:[h-f-v,u+f,h-f,g-f]}case Q.South:{let R=Math.round((g-u)/2),v=p?Math.min(R,Math.round(p)):R;return d&&m+d<h?[m+f,g-f-v,m+d-f,g-f]:[m+f,g-f-v,h-f,g-f]}case Q.Centre:return[m+f,u+f,h-f,g-f];default:return console.warn(`DropTarget does not recognize position ${s}`),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:e.getActiveDropTarget(t.nextDropTarget)}};function Gt(e,t,o,r,n,i){var l;let a=null,s=Je.allBoxesContainingPoint(o,r,e,t,i);if(s.length){let[c,...p]=s,{"data-path":d,path:u=d,"data-row-placeholder":m}=D(c),h=r[u],b=_o(e,t,h,n&&m?"row":void 0),f=r[u],y=([x,...w])=>{var R,v;if((R=b.position)!=null&&R.Header||b.closeToTheEdge){let E=Ds(x,b,f,r,e,t);if(E){let[S,I]=E;return new Be({component:x,pos:S,clientRect:I,nextDropTarget:(v=y(w))!=null?v:null})}else if(w.length)return y(w)}};a=new Be({component:c,pos:b,clientRect:h,nextDropTarget:(l=y(p))!=null?l:null}).activate()}return a}function Ds(e,{closeToTheEdge:t,position:o},r,n,i,a){if(!e||e.type==="DraggableLayout")return;let s=n[e.props.path],l=t&ze.north,c=t&ze.east,p=t&ze.south,d=t&ze.west,u=(l||o.Header)&&Math.round(r.top)===Math.round(s.top),m=c&&Math.round(r.right)===Math.round(s.right),h=p&&Math.round(r.bottom)===Math.round(s.bottom),g=d&&Math.round(r.left)===Math.round(s.left);if(u||m||h||g){let{"data-path":b,path:f=b}=e.props,y=n[f],x=_o(i,a,y);if((Ps(e)||Ln(e))&&t&Ts)return x.width=120,[x,y];if((Ls(e)||Ln(e))&&(o.Header||t&Ss))return x.height=120,[x,y]}}function Ln(e){return L(e)==="Stack"}function Ps(e){return L(e)==="Flexbox"&&e.props.style.flexDirection==="column"}function Ls(e){return L(e)==="Flexbox"&&e.props.style.flexDirection==="row"}var Kt=require("@vuu-ui/vuu-popups");var Mn=k(require("clsx"));var Ko=require("react/jsx-runtime");function Uo(e,t=0,o=0){let{pos:r,clientRect:n}=e,i=20;return r.position.West?[n.left-o+i,r.y-t,"left"]:r.position.South?[r.x-o,n.bottom-t-i,"bottom"]:r.position.East?[n.right-o-i,r.y-t,"right"]:[r.x-o,n.top-t+i,"top"]}var Go="vuuDropMenu",qo=({className:e,dropTarget:t,onHover:o,orientation:r})=>{let n=t.toArray();return(0,Ko.jsx)("div",{className:(0,Mn.default)(Go,e,`${Go}-${r}`),onMouseLeave:()=>o(null),children:n.map((i,a)=>(0,Ko.jsx)("div",{className:`${Go}-item`,"data-icon":a===0?"column-2A":"column-2B",onMouseEnter:()=>o(i)},a))})};var An=require("react/jsx-runtime"),jo=!1,yt=null,se=null,Ms=e=>yt=e,Cs=([e,t])=>`M${e},${t}`,Is=([e,t])=>`L${e},${t}`,Cn=([e,...t])=>`${Cs(e)} ${t.map(Is)}Z`,ks=e=>{if(e){let[t,o,r,n,i,a,s,l]=e;return`M${t},${o} L${r},${n} M${i},${a} L${s},${l}`}else return""};function As(){if(document.getElementById("hw-drag-canvas")===null){let e=document.getElementById("root"),t=document.createElement("div");t.id="hw-drag-canvas",t.innerHTML=`
|
|
1
|
+
"use strict";var Ai=Object.create;var mt=Object.defineProperty;var zi=Object.getOwnPropertyDescriptor;var Ii=Object.getOwnPropertyNames;var Bi=Object.getPrototypeOf,Oi=Object.prototype.hasOwnProperty;var Ni=(e,t)=>{for(var o in t)mt(e,o,{get:t[o],enumerable:!0})},br=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ii(t))!Oi.call(e,n)&&n!==o&&mt(e,n,{get:()=>t[n],enumerable:!(r=zi(t,n))||r.enumerable});return e};var C=(e,t,o)=>(o=e!=null?Ai(Bi(e)):{},br(t||!e||!e.__esModule?mt(o,"default",{value:e,enumerable:!0}):o,e)),Fi=e=>br(mt({},"__esModule",{value:!0}),e);var ol={};Ni(ol,{Action:()=>Ie,BORDER_STYLES:()=>qs,Component:()=>Lr,ComponentRegistry:()=>me,ConfigWrapper:()=>Ys,DockLayout:()=>Tr,Draggable:()=>Mt,DraggableLayout:()=>Eo,Drawer:()=>ft,DropMenu:()=>xo,DropTarget:()=>Le,Flexbox:()=>Jt,FlexboxLayout:()=>tr,FluidGrid:()=>Xt,FluidGridLayout:()=>or,Header:()=>Uo,HeightOnly:()=>ms,LayoutActionType:()=>$,LayoutConfigurator:()=>cr,LayoutProvider:()=>ds,LayoutProviderContext:()=>Ue,LayoutProviderVersion:()=>ps,LayoutTreeViewer:()=>ur,MARGIN_STYLES:()=>Xs,PADDING_STYLES:()=>js,Palette:()=>xi,PaletteItem:()=>nr,Placeholder:()=>He,Stack:()=>eo,StackLayout:()=>sr,View:()=>Ne,ViewContext:()=>ct,WidthHeight:()=>Zo,WidthOnly:()=>fs,XXXnormalizeStyles:()=>el,applyLayout:()=>Pa,applyLayoutProps:()=>Ge,componentToJson:()=>Oo,computeMenuPosition:()=>bo,containerOf:()=>Ar,createFlexbox:()=>It,createPlaceHolder:()=>te,expandFlex:()=>xt,extractResponsiveProps:()=>Es,findTarget:()=>se,followPath:()=>F,followPathToComponent:()=>co,followPathToParent:()=>K,getChild:()=>zr,getChildProp:()=>lo,getDefaultTabLabel:()=>ze,getFlexDimensions:()=>Po,getFlexOrIntrinsicStyle:()=>zt,getFlexStyle:()=>At,getIntrinsicSize:()=>Z,getManagedDimension:()=>Io,getPersistentState:()=>Co,getProp:()=>P,getProps:()=>D,hasPersistentState:()=>Mo,hasUnboundedFlexStyle:()=>Lo,identifyDropTarget:()=>wt,isApplicationLevelChange:()=>Va,isContainer:()=>V,isLayoutComponent:()=>ro,isLayoutJSON:()=>Wi,isLayoutLevelChange:()=>_a,isResponsiveAttribute:()=>Vn,isTabstrip:()=>ra,isTypeOf:()=>Gi,isView:()=>wr,layoutFromJson:()=>xe,layoutQuery:()=>No,layoutReducer:()=>Vo,layoutToJSON:()=>Bo,nextLeaf:()=>Ji,nextStep:()=>ee,previousLeaf:()=>Yi,processLayoutElement:()=>Bt,registerComponent:()=>N,resetPath:()=>H,resizeObserver:()=>Yo,resolveJSONPath:()=>kr,resolvePath:()=>bt,serializeProps:()=>ln,setPersistentState:()=>ko,setRef:()=>Zi,typeOf:()=>S,useBreakpoints:()=>qo,useLayoutCreateNewChild:()=>_o,useLayoutProviderDispatch:()=>ne,useLayoutProviderVersion:()=>In,usePersistentState:()=>Ae,useResizeObserver:()=>st,useViewActionDispatcher:()=>at,useViewContext:()=>Qo,useViewDispatch:()=>Jo,wrapIntrinsicSizeComponentWithFlexbox:()=>_e});module.exports=Fi(ol);var io=require("@vuu-ui/vuu-utils"),Sr=C(require("clsx"));var xr={},vr={},me={};function V(e){return xr[e]===!0}function wr(e){return vr[e]===!0}var ro=e=>V(e)||wr(e);function N(e,t,o="component"){me[e]=t,o==="container"?xr[e]=!0:o==="view"&&(vr[e]=!0)}var qe=require("@salt-ds/core"),no=C(require("clsx")),Er=require("react");var he=require("react/jsx-runtime"),fe="vuuDrawer",Rr=e=>typeof e=="string"?e:e+"px",Hi=(e,t,o)=>{let r=t!==void 0,n=o!==void 0;if(!(!e&&!n&&!r))return!n&&!r?e:{...e,"--drawer-size":r?Rr(t):void 0,"--drawer-peek-size":n?Rr(o):void 0}},Dr=({children:e,className:t,clickToOpen:o,defaultOpen:r,sizeOpen:n,sizeClosed:a,style:i,open:s,position:l="left",inline:c,onClick:u,peekaboo:d=!1,toggleButton:p,...m})=>{let[h,g]=(0,qe.useControlled)({controlled:s,default:r!=null?r:!1,name:"Drawer",state:"open"});console.log(`Drawer sizeOpen ${n} sizeClosed ${a}`);let y=(0,no.default)(fe,t,`${fe}-${l}`,{[`${fe}-open`]:h,[`${fe}-inline`]:c,[`${fe}-over`]:!c,[`${fe}-peekaboo`]:d}),f=(0,Er.useCallback)(()=>{g(!h)},[h,g]),x=Hi(i,n,a),R=o?f:u,w=()=>(0,he.jsx)("div",{className:(0,no.default)("vuuToggleButton-container"),children:h?(0,he.jsx)(qe.Button,{"aria-label":"close",onClick:f,"data-icon":"close",variant:"secondary"}):(0,he.jsx)(qe.Button,{"aria-label":"open",onClick:f,"data-icon":"close",variant:"secondary"})});return(0,he.jsxs)("div",{...m,className:y,onClick:R,style:x,children:[p=="start"?w():null,(0,he.jsx)("div",{className:`${fe}-liner`,children:(0,he.jsx)("div",{className:`${fe}-content`,children:e})}),p=="end"?w():null]})};Dr.displayName="Drawer";var ft=Dr;var ht=require("react/jsx-runtime"),$i=e=>e.type===ft,Vi=({props:{position:e="left"}})=>e.match(/top|bottom/),ao=e=>{let{children:t,className:o,id:r,style:n}=e,a="vuuDockLayout",[i,s]=(0,io.partition)(t,$i),[l,c]=(0,io.partition)(i,Vi),u=l.length===0?"horizontal":c.length===0?"vertical":"both",d=(0,Sr.default)(a,o,`${a}-${u}`);return(0,ht.jsxs)("div",{className:d,id:r,style:n,children:[i,(0,ht.jsx)("div",{className:`${a}-content`,children:s})]})};ao.displayName="DockLayout";var Tr=ao;N("DockLayout",ao,"container");var Pr=require("react");var Cr=require("react/jsx-runtime"),so=(0,Pr.forwardRef)(function({resizeable:t,...o},r){return(0,Cr.jsx)("div",{...o,className:"Component",ref:r})});so.displayName="Component";var Lr=so;N("Component",so);var Q=C(require("react"));var _i={},P=(e,t)=>{var r;let o=D(e);return(r=o[t])!=null?r:o[`data-${t}`]},D=e=>(e==null?void 0:e.props)||e||_i,lo=e=>{let t=D(e);if(t.children){let{children:[o,...r]}=t;return r.length>0&&console.warn(`getChild expected a single child, found ${r.length+1}`),o}};function S(e){var t;if(e){let o=e.type;if(typeof o=="function"||typeof o=="object"){let r=o.displayName||o.name||((t=o.type)==null?void 0:t.name);if(typeof r=="string")return r}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 Gi=(e,t)=>S(e)===t,Wi=e=>e!==void 0&&"type"in e;var Ui=e=>{let t=e.lastIndexOf(".");return t===-1?e:e.slice(0,t)},Mr=e=>Q.default.isValidElement(e.props.children)?[e.props.children]:e.props.children,bt=(e,t="")=>{let[o,...r]=t.split(".");if(o!=null&&o.startsWith("#")){let n=uo(e,o.slice(1),!0);if(n&&r.length)return bt(n,r.join("."))}else if(o==="ACTIVE_CHILD"){let{active:n}=D(e),a=Mr(e),{path:i}=D(a[n]);return i}return""},kr=(e,t="")=>{let[o,...r]=t.split(".");if(o!=null&&o.startsWith("#")){let n=Ir(e,o.slice(1),!0);if(n&&r.length)return kr(n,r.join("."))}else if(o==="ACTIVE_CHILD"){let{children:n,props:a}=e,{active:i}=a;if(typeof i=="number"&&(n!=null&&n[i]))return n[i]}};function K(e,t){let{"data-path":o,path:r=o}=D(e);return t==="0"||t===r?null:F(e,Ui(t),!0)}function se(e,t){let{children:o,...r}=D(e);if(t(r))return e;if(Q.default.Children.count(o)>0){let n=Q.default.isValidElement(o)?[o]:o;for(let a of n){let i=se(a,t);if(i)return i}}}function Ar(e,t){if(t===e)return null;let{path:o,children:r}=D(e),{idx:n,finalStep:a}=ee(o,P(t,"path"));return a?e:r===void 0||r[n]===void 0?null:Ar(r[n],t)}var zr=(e,t)=>{if(Q.default.isValidElement(e)&&t==0)return e;if(Array.isArray(e))return e[t]};function co(e,t){let o=t.split("."),r=[e];for(let n=0;n<o.length;n++){let a=parseInt(o[n]),i=r[a];if(n===o.length-1)return i;r=Mr(i)}}var uo=(e,t,o=!0)=>{let{children:r,id:n}=e.props;if(n===t)return e;if(Q.default.Children.count(r)>0){let a=(0,Q.isValidElement)(r)?[r]:r;for(let i of a)if((0,Q.isValidElement)(i)){let s=uo(i,t,!1);if(s)return s}}if(o===!0)throw Error(`pathUtils.findTargetById id #${t} not found in source`)},Ir=(e,t,o=!0)=>{let{children:r,id:n}=e;if(n===t)return e;if(Array.isArray(r)&&r.length>0){for(let a of r)if(a!==null&&typeof a=="object"){let i=Ir(a,t,!1);if(i)return i}}if(o===!0)throw Error(`pathUtils.findTargetJSONById id #${t} not found in source`)};function F(e,t,o=!1){if(t.startsWith("#"))return uo(e,t.slice(1),o);let{"data-path":r,path:n=r}=D(e);if(t.indexOf(n)!==0)throw Error(`pathUtils.followPath path ${t} is not within source path ${n}`);let a=t.slice(n.length+1);if(a==="")return e;let i=e,s=a.split(".");for(let l=0;l<s.length;l++){if(Q.default.Children.count(i.props.children)===0){let c=`element at 0.${s.slice(0,l).join(".")} has no children, so cannot fulfill rest of path ${s.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c);return}if(i=zr(i.props.children,parseInt(s[l])),i===void 0){let c=`model at 0.${s.slice(0,l).join(".")} has no children that fulfill next step of path ${s.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c)}}return i}function Ji(e,t){let o=K(e,t),r=t.split(".").map(n=>parseInt(n,10));if(o){let n=r.pop(),{children:a}=o.props;if(a.length-1>n)return gt(a[n+1]);{let i=r.pop(),s=K(e,P(o,"path"));if(s&&typeof i=="number"&&(r=s.props.path.split(".").map(l=>parseInt(l,10)),s.props.children.length-1>i)){let l=s.props.children[i+1];return V(S(l))?gt(l):l}}}return gt(e)}function Yi(e,t){let o=t.split(".").map(a=>parseInt(a,10)),r=o.pop(),n=K(e,t);if(n!=null&&typeof r=="number"){let{children:a}=n.props;if(r>0)return yt(a[r-1]);for(;o.length>1;)if(r=o.pop(),n=K(e,P(n,"path")),r>0){let i=n.props.children[r-1];return V(S(i))?yt(i):i}}return yt(e)}function gt(e){if(V(S(e))){let{children:t}=e.props||e;return gt(t[0])}return e}function yt(e){if(V(S(e))){let{children:t}=e.props||e;return yt(t[t.length-1])}return e}function ee(e,t,o=!1){if(e===t)return{idx:-1,finalStep:!0};let r=`${e}.`;if(!t.startsWith(r))throw Error("pathUtils nextStep has strayed from the path");let n=o?0:1,a=t.replace(r,"").split(".").map(i=>parseInt(i,10));return{idx:a[0],finalStep:a.length===n}}function H(e,t,o){if(P(e,"path")===t)return e;let r=[];Q.default.Children.forEach(e.props.children,(a,i)=>{P(a,"path")?r.push(H(a,`${t}.${i}`)):r.push(a)});let n=e.props["data-path"]?"data-path":"path";return Q.default.cloneElement(e,{[n]:t,...o},r)}function Zi(e,t){typeof e=="function"?e(t):e&&(e.current=t)}var xt=e=>{if(typeof e!="number")throw Error(`"no support yet for flex value ${e}`);return{flexBasis:0,flexGrow:1,flexShrink:1}};var Qe=require("@vuu-ui/vuu-utils");var Pe={north:1,east:2,south:4,west:8,header:16,centre:32,absolute:64},Ke={AFTER:"after",BEFORE:"before"},Y=Object.freeze({North:Te("north"),East:Te("east"),South:Te("south"),West:Te("west"),Header:Te("header"),Centre:Te("centre"),Absolute:Te("absolute")});function Te(e){return Object.freeze({offset:e==="north"||e==="west"?0:e==="south"||e==="east"?1:NaN,valueOf:function(){return Pe[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 Br=Y.North,Or=Y.South,po=Y.East,mo=Y.West,Xi=Y.Header,ji=Y.Centre,Ve=class{static measure(t,o=[]){let r={};return Ki(t,r,o),r}static allBoxesContainingPoint(t,o,r,n,a){return $r(t,o,r,n,a).reverse()}};function fo(e,t,o,r=30){let n=o.right-o.left,a=o.bottom-o.top,i=e-o.left,s=t-o.top,l=0;return i<r&&(l+=8),i>n-r&&(l+=2),s<r&&(l+=1),s>a-r&&(l+=4),{pctX:i/n,pctY:s/a,closeToTheEdge:l}}function ho(e,t,o,r){let{BEFORE:n,AFTER:a}=Ke,{pctX:i,pctY:s,closeToTheEdge:l}=fo(e,t,o),c,u;if(r==="row")c=i<.5?mo:po;else if(o.header&&(0,Qe.boxContainsPoint)(o.header,e,t))if(c=Xi,o.Stack){let d=o.Stack.length;if(d===0)u={index:-1,left:o.left,positionRelativeToTab:a,width:0};else{let p=o.Stack.find(({left:m,right:h})=>e>=m&&e<=h);if(p){let m=p.right-p.left;u={index:o.Stack.indexOf(p),left:p.left,positionRelativeToTab:(e-p.left)/m<.5?n:a,width:m}}else u={left:o.Stack[d-1].right,width:0,index:d,positionRelativeToTab:a}}}else if(o.header.titleWidth){let d=o.header.titleWidth;u={index:-1,left:o.left,positionRelativeToTab:(e-o.left)/d<.5?n:a,width:d}}else u={left:o.left,width:0,positionRelativeToTab:n,index:-1};else c=qi(e,t,o,i,s);return{position:c,x:e,y:t,closeToTheEdge:l,tab:u}}function qi(e,t,o,r,n){let a=Qi(o,.2);if((0,Qe.boxContainsPoint)(a,e,t))return ji;switch(`${n<.5?"north":"south"}${r<.5?"west":"east"}`){case"northwest":return r>n?Br:mo;case"northeast":return 1-r>n?Br:po;case"southeast":return r>n?po:Or;case"southwest":return 1-r>n?mo:Or;default:}}function Qi({right:e,left:t,top:o,bottom:r},n){let a=(1-n)/2,i=(e-t)*a,s=(r-o)*a;return{left:t+i,top:o+s,right:e-i,bottom:r-s}}function Ki(e,t,o){let{id:r,"data-path":n,path:a=n}=D(e),i=S(e);if(r&&a){let[s,l]=Hr(e);Nr(e,s,l,t),V(i)&&Fr(e,t,o)}}function Nr(e,t,o,r){let{"data-path":n,path:a=n,header:i}=D(e);r[a]=t;let s=S(e);if(i||s==="Stack"){let l=s==="Stack"?".vuuTabstrip":".vuuHeader",c=o.querySelector(l);if(c){let{top:u,left:d,right:p,bottom:m}=c.getBoundingClientRect();if(r[a].header={top:Math.round(u),left:Math.round(d),right:Math.round(p),bottom:Math.round(m)},s==="Stack")r[a].Stack=Array.from(c.querySelectorAll(".vuuTab")).map(h=>h.getBoundingClientRect()).map(({left:h,right:g})=>({left:h,right:g}));else{let h=c.querySelector('[class^="vuuHeader-title"]'),{header:g}=r[a];h&&g&&(g.titleWidth=h.clientWidth)}}}return r[a]}function Fr(e,t,o,r=0,n=0,a=0,i=0){let{children:s,"data-path":l,path:c=l,style:u,active:d=0}=D(e),p=S(e),m=p==="Flexbox",h=p==="Stack",g=m&&u.flexDirection==="column",y=m&&u.flexDirection==="row",x=(h?s.filter((w,E)=>E===d):s.filter(ea)).map(w=>{let[E,b]=Hr(w);return[{...E,top:E.top-a,right:E.right+n,bottom:E.bottom+i,left:E.left-r},b,w]}),R=x.map(([w,E,b],v,T)=>{let M,L,k,O,I,A,j=T.length-1;y?(I=v===0?0:w.left-T[v-1][0].right,A=v===j?0:T[v+1][0].left-w.right,M=v===0||I===0?0:I,L=v===j||A===0?0:A-A/2,w.left-=M,w.right+=L,k=a,O=i):g&&(I=v===0?0:w.top-T[v-1][0].bottom,A=v===j?0:T[v+1][0].top-w.bottom,k=v===0||I===0?0:I,O=v===j||A===0?0:A-A/2,w.top-=k,w.bottom+=O,M=r,L=n);let q=Nr(b,w,E,t),De=S(b);return V(De)&&Fr(b,t,o,M,L,k,O),q});x.length&&(t[c].children=R)}function ea(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 Hr(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:r,left:n,right:a,bottom:i,height:s,width:l}=o.getBoundingClientRect(),c,u=S(e);if(V(u)){let d=o.scrollHeight;d>s&&(c={id:t,scrollHeight:d,scrollTop:o.scrollTop})}return[{top:Math.round(r),left:Math.round(n),right:Math.round(a),bottom:Math.round(i),height:Math.round(s),width:Math.round(l),scrolling:c},o,e]}function $r(e,t,o,r,n,a=[]){let{children:i,"data-path":s,path:l=s}=D(e),c=S(e),u=t[l];if(!(0,Qe.boxContainsPoint)(u,o,r))return a;if(n&&n.length){if(n.includes(l))a.push(e);else if(!n.some(d=>d.startsWith(l)))return a}else a.push(e);if(!V(c)||u.header&&(0,Qe.boxContainsPoint)(u.header,o,r))return a;u.scrolling&&ta(u,o,r);for(let d=0;d<i.length;d++){if(c==="Stack"&&e.props.active!==d)continue;let p=$r(i[d],t,o,r,n);if(p.length)return a.concat(p)}return a}function ta({top:e,bottom:t,scrolling:o},r,n){if(o){let{id:a,scrollTop:i,scrollHeight:s}=o,l=t-e;if(i===0&&t-n<50){let c=s-l;document.getElementById(a).scrollTo({left:0,top:c,behavior:"smooth"}),o.scrollTop=c}else if(i>0&&n-e<50)document.getElementById(a).scrollTo({left:0,top:0,behavior:"smooth"}),o.scrollTop=0;else return!1}else return!1}var oa=.4,vt=class{constructor(t,o,r,n,a){this.init(t,o,r,n,a)}init(t,o,r,n,a){let{left:i,top:s}=n,{pctX:l,pctY:c}=fo(o,r,n),u=oa,d=l*n.width,p=n.width-d,m=c*n.height,h=n.height-m,g=n.width*u,y=n.height*u,f=1-u,x=d*f,R=m*f,w=p*f,E=h*f;this.intrinsicSize=a,this.constraint={zone:{x:{lo:t.left,hi:t.right},y:{lo:t.top,hi:t.bottom}},pos:{x:{lo:t.left-x,hi:t.right-n.width+w},y:{lo:t.top-R,hi:t.bottom-n.height+E}},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:i,lo:!1,hi:!1,mousePos:o,mousePct:l},this.y={pos:s,lo:!1,hi:!1,mousePos:r,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 r=this[t],n=this.constraint.mouse[t],a=this.constraint.pos[t],i=r.pos,s=o-r.mousePos;return s<0?r.lo||(o<n.lo?(r.lo=!0,r.pos=a.lo):r.hi?o<n.hi&&(r.hi=!1,r.pos+=s):r.pos+=s):s>0&&(r.hi||(o>n.hi?(r.hi=!0,r.pos=a.hi):r.lo?o>n.lo&&(r.lo=!1,r.pos+=s):r.pos+=s)),r.mousePos=o,i!==r.pos}dropXY(t){let o=this[t],r=this.constraint.zone[t];return o.lo?Math.max(r.lo,o.mousePos):o.hi?Math.min(o.mousePos,Math.round(r.hi)-1):o.mousePos}};var ra=e=>e.pos.tab&&S(e.component)==="Stack"&&e.pos.position.Header,{north:na,south:ia,east:aa,west:sa}=Pe,la=aa+sa,ca=na+ia,Le=class e{constructor({component:t,pos:o,clientRect:r,nextDropTarget:n}){this.component=t,this.pos=o,this.clientRect=r,this.nextDropTarget=n,this.active=!1,this.dropRect=void 0}targetTabPos(t){let{left:o,width:r,positionRelativeToTab:n}=t;return n===Ke.BEFORE?o:o+r}getTargetDropOutline(t,o){if(this.pos.tab)return this.getDropTabOutline(t,this.pos.tab);if(o&&o.hasIntrinsicSize())return this.getIntrinsicDropRect(o);{let[r,n,a,i]=this.getDropRectOutline(t,o);return{l:r,t:n,r:a,b:i}}}getDropTabOutline(t,o){var f,x;let{clientRect:{top:r,left:n,right:a,bottom:i,header:s}}=this,l=0,c=Math.round(t/2)+l,u=Math.round(r),d=Math.round(n+c),p=Math.round(a-c),m=Math.round(i-c),h=this.targetTabPos(o),g=60,y=((f=s==null?void 0:s.bottom)!=null?f:0)-((x=s==null?void 0:s.top)!=null?x:0);return{l:d,t:u,r:p,b:m,tabLeft:h,tabWidth:g,tabHeight:y}}getIntrinsicDropRect(t){var g,y,f,x;let{pos:o,clientRect:r}=this,{x:n,y:a}=t,i=(y=(g=t.intrinsicSize)==null?void 0:g.height)!=null?y:0,s=(x=(f=t.intrinsicSize)==null?void 0:f.height)!=null?x:0;i&&i>r.height?(console.log("DropTarget: we're going to blow the gaff"),i=r.height):s&&s>r.width&&(console.log("DropTarget: we're going to blow the gaff"),s=r.width);let l=Math.min(r.right-s,Math.max(r.left,Math.round(o.x-n.mousePct*s))),c=Math.min(r.bottom-i,Math.max(r.top,Math.round(o.y-a.mousePct*i))),[u,d,p,m]=this.dropRect=[l,c,l+s,c+i],h=o.position.EastOrWest?[u,r.top,u,r.bottom,p,r.top,p,r.bottom]:[r.left,d,r.right,d,r.left,m,r.right,m];return{l:u,r:p,t:d,b:m,guideLines:h}}getDropRectOutline(t,o){var x,R,w;let{pos:r,clientRect:n}=this,{width:a,height:i,position:s}=r,{width:l,height:c}=(x=o==null?void 0:o.intrinsicSize)!=null?x:{},u=(R=c!=null?c:i)!=null?R:0,d=(w=l!=null?l:a)!=null?w:0;this.dropRect=void 0;let{top:p,left:m,right:h,bottom:g}=n,y=0,f=Math.round(t/2)+y;switch(s){case Y.North:case Y.Header:{let E=Math.round((g-p)/2),b=u?Math.min(E,Math.round(u)):E;return d&&m+d<h?[m+f,p+f,m+d-f,p+f+b]:[m+f,p+f,h-f,p+f+b]}case Y.West:{let E=Math.round((h-m)/2),b=d?Math.min(E,Math.round(d)):E;return u&&p+u<g?[m+f,p+f,m-f+b,p+u+f]:[m+f,p+f,m-f+b,g-f]}case Y.East:{let E=Math.round((h-m)/2),b=d?Math.min(E,Math.round(d)):E;return u&&p+u<g?[h-f-b,p+f,h-f,p+u+f]:[h-f-b,p+f,h-f,g-f]}case Y.South:{let E=Math.round((g-p)/2),b=u?Math.min(E,Math.round(u)):E;return d&&m+d<h?[m+f,g-f-b,m+d-f,g-f]:[m+f,g-f-b,h-f,g-f]}case Y.Centre:return[m+f,p+f,h-f,g-f];default:return console.warn(`DropTarget does not recognize position ${s}`),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:e.getActiveDropTarget(t.nextDropTarget)}};function wt(e,t,o,r,n,a){var l;let i=null,s=Ve.allBoxesContainingPoint(o,r,e,t,a);if(s.length){let[c,...u]=s,{"data-path":d,path:p=d,"data-row-placeholder":m}=D(c),h=r[p],y=ho(e,t,h,n&&m?"row":void 0),f=r[p],x=([R,...w])=>{var E,b;if((E=y.position)!=null&&E.Header||y.closeToTheEdge){let v=ua(R,y,f,r,e,t);if(v){let[T,M]=v;return new Le({component:R,pos:T,clientRect:M,nextDropTarget:(b=x(w))!=null?b:null})}else if(w.length)return x(w)}};i=new Le({component:c,pos:y,clientRect:h,nextDropTarget:(l=x(u))!=null?l:null}).activate()}return i}function ua(e,{closeToTheEdge:t,position:o},r,n,a,i){if(!e||e.type==="DraggableLayout")return;let s=n[e.props.path],l=t&Pe.north,c=t&Pe.east,u=t&Pe.south,d=t&Pe.west,p=(l||o.Header)&&Math.round(r.top)===Math.round(s.top),m=c&&Math.round(r.right)===Math.round(s.right),h=u&&Math.round(r.bottom)===Math.round(s.bottom),g=d&&Math.round(r.left)===Math.round(s.left);if(p||m||h||g){let{"data-path":y,path:f=y}=e.props,x=n[f],R=ho(a,i,x);if((pa(e)||Vr(e))&&t&la)return R.width=120,[R,x];if((da(e)||Vr(e))&&(o.Header||t&ca))return R.height=120,[R,x]}}function Vr(e){return S(e)==="Stack"}function pa(e){return S(e)==="Flexbox"&&e.props.style.flexDirection==="column"}function da(e){return S(e)==="Flexbox"&&e.props.style.flexDirection==="row"}var Rt=require("@vuu-ui/vuu-popups");var _r=C(require("clsx"));var yo=require("react/jsx-runtime");function bo(e,t=0,o=0){let{pos:r,clientRect:n}=e,a=20;return r.position.West?[n.left-o+a,r.y-t,"left"]:r.position.South?[r.x-o,n.bottom-t-a,"bottom"]:r.position.East?[n.right-o-a,r.y-t,"right"]:[r.x-o,n.top-t+a,"top"]}var go="vuuDropMenu",xo=({className:e,dropTarget:t,onHover:o,orientation:r})=>{let n=t.toArray();return(0,yo.jsx)("div",{className:(0,_r.default)(go,e,`${go}-${r}`),onMouseLeave:()=>o(null),children:n.map((a,i)=>(0,yo.jsx)("div",{className:`${go}-item`,"data-icon":i===0?"column-2A":"column-2B",onMouseEnter:()=>o(a)},i))})};var Jr=require("react/jsx-runtime"),vo=!1,et=null,re=null,ma=e=>et=e,fa=([e,t])=>`M${e},${t}`,ha=([e,t])=>`L${e},${t}`,Gr=([e,...t])=>`${fa(e)} ${t.map(ha)}Z`,ga=e=>{if(e){let[t,o,r,n,a,i,s,l]=e;return`M${t},${o} L${r},${n} M${a},${i} L${s},${l}`}else return""};function ya(){if(document.getElementById("hw-drag-canvas")===null){let e=document.getElementById("root"),t=document.createElement("div");t.id="hw-drag-canvas",t.innerHTML=`
|
|
2
2
|
<svg width="100%" height="100%">
|
|
3
3
|
<path id="hw-drop-guides" />
|
|
4
4
|
<path
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
/>
|
|
15
15
|
</path>
|
|
16
16
|
</svg>
|
|
17
|
-
`,document.body.insertBefore(t,e)}}var wt=class{constructor(){this.currentPath=null;this.tabMode=null;As()}prepare(t,o="full-view"){document.body.classList.add("drawing"),this.currentPath=null,this.tabMode=o;let r=this.getPoints(0,0,0,0),n=Cn(r),i=document.getElementById("vuu-drop-outline");i==null||i.setAttribute("d",n),this.currentPath=n}clear(){yt=null,Ut(),document.body.classList.remove("drawing"),Kt.PopupService.hidePopup()}get hoverDropTarget(){return yt}getPoints(t,o,r,n,i=0,a=0,s=0){let l=this.tabMode==="tab-only";if(a===0)return[[t,o+s],[t,o+s],[t,o],[t+a,o],[t+a,o],[t+r,o],[t+r,o+n],[t,o+n]];if(l){let c=i;return[[c,o],[c,o],[c+a,o],[c+a,o],[c+a,o+s],[c+a,o+s],[c,o+s],[c,o+s]]}else return i===0?[[t,o+s],[t,o+s],[t,o],[t+a,o],[t+a,o+s],[t+r,o+s],[t+r,o+n],[t,o+n]]:[[t,o+s],[t+i,o+s],[t+i,o],[t+i,o],[t+i,o+s],[t+r,o+s],[t+r,o+n],[t,o+n]]}draw(t,o){let n=jo;if(yt!==null)this.drawTarget(yt);else if(jo=t.nextDropTarget!=null,t.pos.tab?Os(t):se&&Ut(),this.drawTarget(t,o),jo){let[i,a,s]=Uo(t);{let l=(0,An.jsx)(qo,{dropTarget:t,onHover:Ms,orientation:s});Kt.PopupService.showPopup({left:i,top:a,component:l})}}else Kt.PopupService.hidePopup()}drawTarget(t,o){let n=t.getTargetDropOutline(6,o);if(n){let{l:i,t:a,r:s,b:l,tabLeft:c,tabWidth:p,tabHeight:d,guideLines:u}=n,m=s-i,h=l-a;if(this.currentPath){let x=document.getElementById("vuu-drop-outline");x==null||x.setAttribute("d",this.currentPath)}let g=this.getPoints(i,a,m,h,c,p,d),b=Cn(g),f=document.getElementById("hw-drop-outline-animate");f==null||f.setAttribute("to",b),f==null||f.beginElement(),this.currentPath=b;let y=document.getElementById("hw-drop-guides");y==null||y.setAttribute("d",ks(u))}}},In="transition:margin-left .4s ease-out;margin-left: 63px",kn="transition:margin-left .4s ease-out;margin-left: 0px";function Os(e){var s,l;let{AFTER:t,BEFORE:o}=vt,{clientRect:{Stack:r},pos:{tab:n}}=e,{id:i}=e.component.props,a=null;if(r&&n&&n.positionRelativeToTab!==t){let c=n.positionRelativeToTab===o?1:2,p=`:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${n.index+c})`;a=(s=document.getElementById(i))==null?void 0:s.querySelector(p),a?(se===null||se!==a)&&(a.style.cssText=In,se&&(se.style.cssText=kn),se=a):Ut()}else if((n==null?void 0:n.positionRelativeToTab)===o){if(se===null){let c=".vuuHeader-title";a=(l=document.getElementById(i))==null?void 0:l.querySelector(c),a.style.cssText=In,se=a}}else Ut()}function Ut(){se&&(se.style.cssText=kn,se=null)}var ge,xt,Te,Hn,zn,Ne,qt,Fe=null,Zo,Bn,Yt,Nn,Yo,jt=null,Hs=3,Zt=new wt,On=.4;function zs(e,t){return t?F(e,t):de(e,o=>o.dropTarget)}var Qt={handleMousedown(e,t,o={}){ge=t,Bn=o,Hn=e.clientX,zn=e.clientY,Yo=o.dragThreshold===void 0?Hs:o.dragThreshold,Yo===0?ge(e,0,0):(window.addEventListener("mousemove",Xt,!1),window.addEventListener("mouseup",Jt,!1),jt=window.setTimeout(()=>{window.removeEventListener("mousemove",Xt,!1),window.removeEventListener("mouseup",Jt,!1),ge==null||ge(e,0,0)},500)),e.preventDefault()},initDrag(e,t,{top:o,left:r,right:n,bottom:i},a,s,l,c){return{drag:xt,drop:Te}=s,Bs(e,t,{top:o,left:r,right:n,bottom:i},a,l,c)}};function Xt(e){let r=e.clientX-Hn,n=e.clientY-zn;Math.max(Math.abs(r),Math.abs(n))>Yo&&(window.removeEventListener("mousemove",Xt,!1),window.removeEventListener("mouseup",Jt,!1),ge==null||ge(e,r,n),ge=null)}function Jt(){jt&&(window.clearTimeout(jt),jt=null),window.removeEventListener("mousemove",Xt,!1),window.removeEventListener("mouseup",Jt,!1)}function Bs(e,t,o,r,n,i){Ne=zs(e,t);let{"data-path":a,path:s=a}=D(Ne);i&&(Zo=i.map(u=>de(e,m=>m.id===u)).map(u=>u.props.path)),Yt=Je.measure(Ne,i);let l=Yt[s];qt=new _t(l,r.x,r.y,o,n);let c=Math.round(qt.x.mousePct*100),p=Math.round(qt.y.mousePct*100);return window.addEventListener("mousemove",Fn,!1),window.addEventListener("mouseup",Wn,!1),window.addEventListener("keydown",$n,!1),Nn=!1,Zt.prepare(o,"tab-only"),Bn.DoNotTransform?"transform:none":`transform:scale(${On},${On});transform-origin:${c}% ${p}%;`}function Fn(e){let t=e.clientX,o=e.clientY,r=qt,n=Fe,i,a,s;r.update("x",t)&&(a=r.x.pos),r.update("y",o)&&(s=r.y.pos),a===void 0&&s===void 0||xt==null||xt(a,s),!(Nn||Ne===void 0)&&(r.inBounds()?i=Gt(t,o,Ne,Yt,r.hasIntrinsicSize(),Zo):i=Gt(r.dropX(),r.dropY(),Ne,Yt),n&&(i==null||i.box!==n.box)&&(Fe=null),i&&(Zt.draw(i,r),Fe=i))}function $n(e){e.key==="Escape"&&(Fe=null,Vn())}function Wn(){Vn()}function Vn(){if(Fe){let e=Zt.hoverDropTarget||Be.getActiveDropTarget(Fe);Te==null||Te(e),Fe=null}else Te==null||Te();xt=null,Te=null,Ne=void 0,Zt.clear(),Zo=void 0,window.removeEventListener("mousemove",Fn,!1),window.removeEventListener("mouseup",Wn,!1),window.removeEventListener("keydown",$n,!1)}var _n=k(require("clsx")),Gn=require("react");var Un=require("react/jsx-runtime"),Xo=(0,Gn.forwardRef)(function({children:t,className:o,dropTarget:r,resizeable:n,...i},a){let s=(0,_n.default)("DraggableLayout",o);return(0,Un.jsx)("div",{className:s,ref:a,...i,children:t})}),Kn="DraggableLayout";Xo.displayName=Kn;N(Kn,Xo,"container");var Gi=require("@salt-ds/core"),Ki=k(require("clsx")),Ui=require("react");var Vi=require("@vuu-ui/vuu-utils"),B=k(require("react"));var Hi=k(require("clsx"));var Ai=require("@salt-ds/core"),mo=require("react");var Me=require("react");var q=require("react");var Qo=require("@vuu-ui/vuu-utils"),er=k(require("react"));var Ns={"data-placeholder":!0,"data-resizeable":!0},eo={},Se="auto",Jo={flexBasis:0,flexGrow:1,flexShrink:1,height:Se,width:Se},qn={height:"width",width:"height"},tr=(e="row")=>e==="row"?["width","height","column"]:["height","width","row"],Fs=e=>typeof e=="string"&&e.endsWith("%"),ee=e=>{let{style:{width:t=Se,height:o=Se}=eo}=e.props,r=typeof o=="number",n=typeof t=="number";return r&&n?{height:o,width:t}:r?{height:o}:n?{width:t}:void 0};function to(e,t,o){let r=qn[t],{style:{[r]:n=Se,...i}=eo}=e.props;return o&&o[t]?{...i,...Jo,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...i,...Jo,[r]:n}}function or(e){let{style:{flex:t,flexGrow:o,flexShrink:r,flexBasis:n}=eo}=e.props;return typeof t=="number"||n===0&&o===1&&r===1?!0:typeof n!="number"}function oo(e,t,o){let r=qn[t],{style:{[t]:n=Se,[r]:i=Se,...a}=eo}=e.props;return n!==Se?Fs(n)?{flexBasis:0,flexGrow:1,flexShrink:1,[t]:void 0,[r]:i}:{flexBasis:n,flexGrow:0,flexShrink:0,[t]:n,[r]:i}:o&&o[t]?{...a,...Jo,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...a,[r]:i}}function Qe(e,t,o,r,n){let i=[],a=0,s;if(r&&n){let p,[d,u,m,h]=n;[p,s]=t==="column"?[u-r.top,r.bottom-h]:[d-r.left,r.right-m],p&&i.push(ie(`${o}.${a++}`,p,{flexGrow:0,flexShrink:0}))}else s=!0;let{version:l=0,style:c}=D(e);return i.push(V(e,`${o}.${a++}`,{version:l+1,style:{...c,flexBasis:"auto",flexGrow:0,flexShrink:0}})),s&&i.push(ie(`${o}.${a++}`,0,void 0,{[`data-${t}-placeholder`]:!0})),ro(t,{resizeable:!1,style:{flexBasis:"auto"}},i,o)}var $s=(e,t)=>{if(!t)return e===0?1:0};function ro(e,t,o,r){let n=(0,Qo.uuid)(),{flexFill:i,style:a,resizeable:s=!0}=t,{flexBasis:l=i?void 0:"auto"}=a,c=$s(l,i);return er.default.createElement(xe.Flexbox,{id:n,key:n,path:r,flexFill:i,style:{...a,flexDirection:e,flexBasis:l,flexGrow:c,flexShrink:c},resizeable:s},o)}var Ws={flexGrow:1,flexShrink:1};function ie(e,t,o,r){let n=(0,Qo.uuid)();return er.default.createElement("div",{...Ns,...r,"data-path":e,id:n,key:n,style:{...Ws,...o,flexBasis:t}})}var co=k(require("react"));var dr=require("@vuu-ui/vuu-utils"),tt=k(require("react"));var sr=require("@vuu-ui/vuu-utils"),De=k(require("react"));var $e=require("react"),K=new Map,ae=new Map,rr=e=>K.get(e),nr=e=>K.has(e),ir=(e,t)=>K.set(e,t),We=()=>{let e=(0,$e.useCallback)((a,s)=>{let l=ae.get(a);if(l)return s!==void 0&&l[s]!==void 0?l[s]:s!==void 0?void 0:l},[]),t=(0,$e.useCallback)((a,s,l)=>{if(s===void 0)ae.set(a,l);else if(ae.has(a)){let c=ae.get(a);ae.set(a,{...c,[s]:l})}else ae.set(a,{[s]:l})},[]),o=(0,$e.useCallback)((a,s)=>{if(ae.has(a)){if(s===void 0)ae.delete(a);else if(ae.get(a)[s]){let{[s]:c,...p}=ae.get(a);Object.keys(p).length>0?ae.set(a,p):ae.delete(a)}}},[]),r=(0,$e.useCallback)((a,s)=>{let l=K.get(a);if(l)return s!==void 0?l[s]:l},[]),n=(0,$e.useCallback)((a,s,l)=>{if(s===void 0)K.set(a,l);else if(K.has(a)){let c=K.get(a);K.set(a,{...c,[s]:l})}else K.set(a,{[s]:l})},[]),i=(0,$e.useCallback)((a,s)=>{if(K.has(a)){if(s===void 0)K.delete(a);else if(K.get(a)[s]){let{[s]:c,...p}=K.get(a);Object.keys(p).length>0?K.set(a,p):K.delete(a)}}},[]);return{loadSessionState:e,loadState:r,saveSessionState:t,saveState:n,purgeState:i,purgeSessionState:o}};var lr=e=>e.flexDirection==="column"?["height","width"]:["width","height"],Vs={},et=(e,t="0")=>{let[o,r]=io(L(e),e.props,t);return De.default.cloneElement(e,o,r)},no=(e,t)=>{let o=L(e),[r,n]=io(o,e.props,"0",void 0,t);return(0,De.cloneElement)(e,r,n)},_s=(e,t,o)=>{let[r,n]=io(e,t,"0",void 0,o);return{...t,...r,type:e,children:n}};function Gs(e,t,o="0",r=null,n){var g,b;let{active:i=0,"data-path":a,path:s=a,id:l,style:c}=D(n),p=L(n)===e&&o===s,d=p?l:(g=t.id)!=null?g:(0,sr.uuid)(),u=e==="Stack"?(b=t.active)!=null?b:i:void 0,m=d,h=p?c:Us(e,t,r);return ko(e)?{id:d,key:m,path:o,style:h,type:e,active:u}:{id:d,key:m,style:h,"data-path":o}}function io(e,t,o,r=null,n){var c,p;let i=Gs(e,t,o,r,n);if(t.layout&&!n)return[i,[Pe(t.layout,`${o}.0`)]];let a=(p=n==null?void 0:n.children)!=null?p:(c=n==null?void 0:n.props)==null?void 0:c.children,l=t.dropTarget&&a?a:Ks(e,t.children,o,a);return[i,l]}function Ks(e,t,o="0",r){let n=Array.isArray(t)?t:De.default.isValidElement(t)?[t]:[];return G(e)?n.map((i,a)=>{let s=L(i),l=L(r==null?void 0:r[a]);if(!l||s===l){let[c,p]=io(s,i.props,`${o}.${a}`,e,r==null?void 0:r[a]);return De.default.cloneElement(i,c,p)}return r==null?void 0:r[a]}):t}var Us=(e,t,o)=>{let{style:r=Vs}=t;if(e==="Flexbox"&&(r={flexDirection:t.column?"column":"row",...r,display:"flex"}),r.flex){let{flex:n,...i}=r;r={...i,...Vt(typeof n=="number"?n:0)}}else o==="Stack"?r={...r,...Vt(1)}:o==="Flexbox"&&(r.width||r.height)&&r.flexBasis===void 0&&(r={...r,flexBasis:"auto",flexGrow:0,flexShrink:0});return r};function Pe({id:e=(0,sr.uuid)(),type:t,children:o,props:r,state:n},i){let a=t.match(/^[a-z]/)?t:xe[t];if(a===void 0)throw Error(`layoutUtils unable to create component from JSON, unknown type ${t}`);return n&&ir(e,n),De.default.createElement(a,{id:e,...r,key:e,path:i},o?o.map((s,l)=>Pe(s,`${i}.${l}`)):void 0)}function cr(e){return ur(e)}function ur(e){let t=L(e),{id:o,children:r,type:n,...i}=D(e),a=nr(o)?rr(o):void 0;return{id:o,type:t,props:jn(i),state:a,children:De.default.Children.map(r,ur)}}function jn(e){if(e){let{path:t,...o}=e,r={};for(let[n,i]of Object.entries(o))r[n]=ar(i);return r}}function ar(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(ar);if(typeof e=="object"&&e!==null){let t={};for(let[o,r]of Object.entries(e))t[o]=ar(r);return t}}var pr=(e,t,o)=>{if(t&&o){let r=re(o,t);if(r){let{id:n}=D(r),i=L(r);return{parentContainerId:n,parentContainerType:i}}return{parentContainerType:"Stack",parentContainerId:"blah"}}},Ve=(e,t,o=[])=>{var n,i,a;let r=(a=(n=e.props)==null?void 0:n.title)!=null?a:(i=e.props)==null?void 0:i["data-tab-title"];if(r)return r;{let s=t;do r=`Tab ${++s}`;while(o.includes(r));return r}};function Yn(e,t){var a;let o=e.props.children,r=o.length,{index:n=-1,positionRelativeToTab:i="after"}=t.tab||{};return n===-1||n>=r?[o[r-1],"after"]:[(a=o[n])!=null?a:null,i]}function ao(e,t,o){let{active:r,children:n=[],path:i}=D(e),a=C(t,"path"),{idx:s,finalStep:l}=ne(i,a,!0),[c,p]=l?Ys(e,n,o):[r,n==null?void 0:n.map((u,m)=>m===s?ao(u,t,o):u)],d=L(e)==="Stack"?Array.isArray(c)?c[0]:c:r;return tt.default.cloneElement(e,{active:d},p)}var qs=(e,t,o,r)=>e==="Stack"?Ve(t,o,r):void 0,js=e=>e.map(t=>t.props.title);function Ys(e,t,o){let r=C(e,"path"),n=t==null?void 0:t.length,{id:i=(0,dr.uuid)(),title:a=qs(L(e),o,n!=null?n:0,js(t))}=D(o);return n?[n,t.concat(V(o,`${r}.${n}`,{id:i,key:i,title:a}))]:[0,[V(o,`${r}.0`,{id:i,title:a})]]}function so(e,t,o,r,n,i,a){let{active:s,children:l,path:c}=D(e),p=C(t,"path"),{idx:d,finalStep:u}=ne(c,p),[m,h]=u?Zs(e,l,d,o,r,n,i,a):[s,l.map((b,f)=>f===d?so(b,t,o,r,n,i,a):b)],g=L(e)==="Stack"?m:s;return tt.default.cloneElement(e,{active:g},h)}function Zs(e,t,o,r,n,i,a,s){let l=ee(r);return l!=null&&l.width&&(l!=null&&l.height)?Js(e,t,o,r,n,a,s):Zn(e,t,o,r,n,(i==null?void 0:i.width)||(i==null?void 0:i.height),a)}var Xs=(e,t,{top:o,right:r,bottom:n,left:i},[a,s,l,c])=>{if(e==="column"&&t==="before")return s-o;if(e==="column")return n-c;if(e==="row"&&t==="before")return a-i;if(e==="row")return r-l};function Js(e,t,o,r,n,i,a){let{style:{flexDirection:s}}=D(e),[l,c,p]=tr(s),{[c]:d,[l]:u}=ee(r),m=C(t[o],"path"),h=Xs(s,n,i,a),[g,b]=d<i[c]?[Qe(r,p,m,i,a),u]:[r,void 0],f=h?ie(m,h,{flexGrow:0,flexShrink:0}):void 0;return d>i[c]&&(t=t.map(y=>{if(C(y,"placeholder"))return y;{let{[c]:x}=ee(y);return x&&x<d?Qe(y,p,C(y,"path")):y}})),Zn(e,t,o,g,n,b,i,f)}function Zn(e,t,o,r,n,i,a,s){let l=C(e,"path"),c=0,p=!t||t.length===0?[r]:t.reduce((d,u,m)=>{if(o===m){let[h,g]=Qs(e,u,r,a);n==="before"?s?d.push(s,g,h):d.push(g,h):s?d.push(h,g,s):d.push(h,g),c=d.indexOf(g)}else d.push(u);return d},[]).map((d,u)=>u<c?d:V(d,`${l}.${u}`));return[c,p]}function Qs(e,t,o,r){let n=(0,dr.uuid)(),{version:i=0}=D(o);if(i+=1,L(e)==="Flexbox"){let[a]=lr(e.props.style),s=6,l={[a]:(r[a]-s)/2},c=oo(t,a,l),p=oo(o,a,l);return[tt.default.cloneElement(t,{style:c}),tt.default.cloneElement(o,{id:n,version:i,style:p})]}else{let{style:{left:a,top:s,flex:l,...c}={left:void 0,top:void 0,flex:void 0}}=D(o);return[t,tt.default.cloneElement(o,{id:n,version:i,style:{...c,flex:"1 1 0px"}})]}}var Jn=require("react");var Et=k(require("react"));var _e={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",LAYOUT_RESIZE:"layout-resize",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"};function Xn(e,{target:t,replacement:o}){return mr(e,t,o)}function mr(e,t,o){let r=C(t,"path"),n=C(t,"resizeable"),{style:i}=D(t),a=et(Et.default.cloneElement(o,{resizeable:n,style:{...i,...o.props.style}}),r);return U(e,t,a)}function U(e,t,o,r){if(e===t)return o;let{idx:n,finalStep:i}=ne(C(e,"path"),C(t,"path")),a=e.props.children.slice();return i?r?r===_e.MINIMIZE?a[n]=el(e,a[n]):r===_e.RESTORE&&(a[n]=tl(a[n])):a[n]=o:a[n]=U(a[n],t,o,r),Et.default.cloneElement(e,void 0,a)}function el(e,t){let{style:o}=D(e),{style:r}=D(t),{width:n,height:i,flexBasis:a,flexShrink:s,flexGrow:l,...c}=r,p={width:n,height:i,flexBasis:a,flexShrink:s,flexGrow:l},d={...c,flexBasis:0,flexGrow:0,flexShrink:0},u=o.flexDirection==="row"?"vertical":o.flexDirection==="column"?"horizontal":!1;return u?Et.default.cloneElement(t,{collapsed:u,restoreStyle:p,style:d}):t}function tl(e){let{style:t,restoreStyle:o}=D(e),{flexBasis:r,flexShrink:n,flexGrow:i,...a}=t,s={...a,...o};return Et.default.cloneElement(e,{collapsed:!1,style:s,restoreStyle:void 0})}function Qn(e,{fromIndex:t,path:o,toIndex:r}){let n=F(e,o,!0),{children:i}=D(n),a=ol(i,t,r),s=(0,Jn.cloneElement)(n,void 0,a);return U(e,n,s)}function ol(e,t,o){let r=e.slice(),[n]=r.splice(t,1);return o===-1?r.concat(n):(r.splice(o,0,n),r)}var _={ADD:"add",DRAG_START:"drag-start",DRAG_DROP:"drag-drop",LAYOUT_RESIZE:"layout-resize",MAXIMIZE:"maximize",MINIMIZE:"minimize",MOVE_CHILD:"move-child",QUERY:"query",REMOVE:"remove",REPLACE:"replace",RESTORE:"restore",SAVE:"save",SET_PROP:"set-prop",SET_PROPS:"set-props",SET_TITLE:"set-title",SPLITTER_RESIZE:"splitter-resize",SWITCH_TAB:"switch-tab",TEAROUT:"tearout"},rl=e=>["switch-active-layout","open-layout","close-layout","rename-layout"].includes(e),nl=e=>["switch-active-tab","edit-feature-title","save-feature-props","remove-component","resize-component","drag-drop-operation"].includes(e);var Le=k(require("react"));function fr(e,{path:t}){let o=F(e,t),r=re(e,t);if(r===null)return e;let{children:n}=D(r);if(n.length>1&&L(r)!=="Stack"&&ti(n,t)){let{style:{flexBasis:i,display:a,flexDirection:s,...l}}=D(r),c=C(r,"path"),p=U(e,r,ie(c,i,l));for(;(r=re(p,c))&&C(r,"path")!=="0";){let{children:d}=D(r);if(ti(d)){c=C(r,"path");let{style:{flexBasis:u,display:m,flexDirection:h,...g}}=D(r);p=U(e,r,ie(c,u,g))}else if(ll(d))p=ni(e,r);else break}return p}return oi(e,o)}function oi(e,t){let o=D(e),{children:r,path:n,preserve:i}=o,{active:a,id:s}=o,{idx:l,finalStep:c}=ne(n,C(t,"path")),p=L(e),d=r.slice();if(c){if(d.splice(l,1),a!==void 0&&a>=l&&(a=Math.max(0,a-1)),d.length===0&&i&&p==="Stack"){let{path:u,style:{flexBasis:m}}=D(t),h=s==="main-tabs"?Pe({props:{style:{flexGrow:1,flexShrink:1,flexBasis:m},title:"Tab 1"},type:"Placeholder"},u):ie(u,m);d.push(h)}else if(d.length===1&&!i&&n!=="0"&&p.match(/Flexbox|Stack/))return il(e,d[0]);!d.some(al)&&d.some(ri)&&(d=sl(d))}else d[l]=oi(d[l],t);return d=d.map((u,m)=>V(u,`${n}.${m}`)),Le.default.cloneElement(e,{active:a},d)}function il(e,t){let o=L(e),{path:r,style:{flexBasis:n,flexGrow:i,flexShrink:a,width:s,height:l}}=D(e),c=V(t,r);if(r==="0")c=Le.default.cloneElement(c,{style:{...t.props.style,width:s,height:l}});else if(o==="Flexbox"){let p=e.props.style.flexDirection==="column"?"height":"width",{style:{[p]:d,...u}}=c.props;c=Le.default.cloneElement(c,{flexFill:void 0,style:{...u,flexGrow:i,flexShrink:a,flexBasis:n,width:s,height:l}})}return c}var al=e=>e.props.style.flexGrow>0,ri=e=>{let{width:t,height:o,flexGrow:r}=e.props.style;return r===0&&typeof t!="number"&&typeof o!="number"},sl=e=>e.map(t=>ri(t)?Le.default.cloneElement(t,{style:{...t.props.style,flexGrow:1}}):t),ll=e=>{if(e&&e.length>0){let t=C(e[0],"placeholder"),o=!1;for(let r=1;r<e.length;r++){if(o=C(e[r],"placeholder"),t&&o)return!0;t=o}}},ni=(e,t)=>{let{children:o,path:r}=D(e),{idx:n,finalStep:i}=ne(r,C(t,"path")),a=o.slice();return i?a[n]=cl(t):a[n]=ni(a[n],t),a=a.map((s,l)=>V(s,`${r}.${l}`)),Le.default.cloneElement(e,void 0,a)},cl=e=>{let{children:t}=D(e),o=[],r=[];for(let i=0;i<t.length;i++)C(t[i],"placeholder")?r.push(t[i]):(r.length===1?o.push(r.pop()):r.length>0&&(o.push(ei(r)),r.length=0),o.push(t[i]));r.length===1?o.push(r.pop()):r.length>0&&o.push(ei(r));let n=C(e,"path");return Le.default.cloneElement(e,void 0,o.map((i,a)=>V(i,`${n}.${a}`)))},ei=([e,...t])=>{let o=C(e,"style"),{flexBasis:r,flexGrow:n,flexShrink:i}=o;for(let{props:{style:a}}of t)r+=a.flexBasis,n=Math.max(n,a.flexGrow),i=Math.max(i,a.flexShrink);return Le.default.cloneElement(e,{style:{...o,flexBasis:r,flexGrow:n,flexShrink:i}})},ti=(e,t)=>e.every(o=>C(o,"placeholder")||t&&C(o,"path")===t);var lo=k(require("react"));function ii(e,{path:t,size:o}){let r=F(e,t,!0),{style:n}=D(r),i={...n,width:o},a=lo.default.cloneElement(r,{style:i});return U(e,r,a)}function ai(e,{path:t,sizes:o}){let r=F(e,t,!0),{children:n,style:i}=D(r),a=i.flexDirection==="column"?"height":"width",s=ul(n,o,a),l=lo.default.cloneElement(r,void 0,s);return U(e,r,l)}function ul(e,t,o){return e.map((r,n)=>{let{style:{[o]:i,flexBasis:a}}=D(r),s=t[n],{currentSize:l,flexBasis:c}=s,d=l!==void 0?s.currentSize:c;return d===void 0||i===d||a===d?r:lo.default.cloneElement(r,{style:pl(r.props.style,o,d)})})}function pl(e,t,o){let r=typeof e[t]=="number",{flexShrink:n=1,flexGrow:i=1}=e;return{...e,[t]:r?o:"auto",flexBasis:r?"auto":o,flexShrink:n,flexGrow:i}}var si=require("@vuu-ui/vuu-utils"),Rt=k(require("react"));var li=e=>{let[t]=L(e);return t===t.toLowerCase()};function Tt(e,t,o,r,n,i){let{children:a,path:s}=D(e),l=C(t,"path"),{idx:c,finalStep:p}=ne(s,l),d=p?dl(e,a,t,o,r,n,i):a.map((u,m)=>m===c?Tt(u,t,o,r,n,i):u);return Rt.default.cloneElement(e,void 0,d)}function dl(e,t,o,r,n,i,a){let s=ee(r);if(s!=null&&s.width&&(s!=null&&s.height)){if(i===void 0||a===void 0)throw Error("wrap-layout-element, updateChildren clientRect and dropRect must both be available");return fl(t,o,r,n,i,a)}return ml(e,t,o,r,n)}function ml(e,t,o,r,n){var E;let{version:i=0}=D(r),{path:a,title:s}=D(o),{type:l,flexDirection:c,showTabs:p}=ui(n),[d,u,m]=hl(l,o,r,c,n),h=ci(n),g=h?1:0,b={resizeable:!0,style:m,version:i+1},y={[li(o)?"data-resizeable":"resizeable"]:!0,style:u},x=l==="Stack"?{showTabs:p}:void 0,w=l==="Flexbox"?{splitterSize:(E=L(e)==="Flexbox"&&e.props.splitterSize)!=null?E:void 0}:void 0,R=(0,si.uuid)(),v=Rt.default.createElement(xe[l],{active:g,id:R,key:R,path:C(o,"path"),flexFill:C(o,"flexFill"),...w,...x,style:d,title:s,resizeable:C(o,"resizeable")},h?[V(o,`${a}.0`,y),et(Rt.default.cloneElement(r,b),`${a}.1`)]:[et(Rt.default.cloneElement(r,b),`${a}.0`),V(o,`${a}.1`,y)]);return t.map(S=>S===o?v:S)}function fl(e,t,o,r,n,i){let{flexDirection:a}=ui(r),s=a==="column"?"row":"column",l=ci(r),[c,p,d,u]=i,[m,h]=a==="column"?[p-n.top,n.bottom-u]:[c-n.left,n.right-d],g=C(t,"path"),b=0,f=li(t)?"data-resizeable":"resizeable",y=[];m&&y.push(l?V(t,`${g}.${b++}`,{[f]:!0,style:{flexBasis:m,flexGrow:1,flexShrink:1}}):ie(`${g}.${b++}`,m,{flexGrow:0,flexShrink:0})),y.push(Qe(o,s,`${g}.${b++}`,n,i)),h&&y.push(l?ie(`${g}.${b++}`,0):V(t,`${g}.${b++}`,{[f]:!0,style:{flexBasis:0,flexGrow:1,flexShrink:1}}));let x=ro(a,t.props,y,g);return e.map(w=>w===t?x:w)}function hl(e,t,o,r,n){let i={...t.props.style,flexDirection:r},a=e==="Flexbox"&&r==="column"?"height":"width",s=to(o,a,n),l=to(t,a);return[i,l,s]}var ci=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 ui(e){return e.position.Header?{type:"Stack",flexDirection:"column",showTabs:!0}:{type:"Flexbox",flexDirection:e.position.EastOrWest?"row":"column"}}var hr=(e,t)=>{switch(t.type){case _.ADD:return wl(e,t);case _.DRAG_DROP:return yl(e,t);case _.MAXIMIZE:return vl(e,t);case _.REMOVE:return fr(e,t);case _.REPLACE:return Xn(e,t);case _.SET_PROP:return pi(e,t);case _.SET_PROPS:return bl(e,t);case _.SET_TITLE:return pi(e,{type:"set-prop",path:t.path,propName:"title",propValue:t.title});case _.SPLITTER_RESIZE:return ai(e,t);case _.LAYOUT_RESIZE:return ii(e,t);case _.SWITCH_TAB:return gl(e,t);case _.MOVE_CHILD:return Qn(e,t);default:return e}},gl=(e,{path:t,nextIdx:o})=>{let r=F(e,t,!0),n=co.default.cloneElement(r,{active:o});return U(e,r,n)},pi=(e,{path:t,propName:o,propValue:r})=>{let n=F(e,t,!0),i=co.default.cloneElement(n,{[o]:r});return U(e,n,i)},bl=(e,{path:t,props:o})=>{let r=F(e,t,!0),n=co.default.cloneElement(r,o);return U(e,r,n)},vl=(e,{path:t,type:o})=>{if(t){let r=F(e,t,!0);return U(e,r,r,o)}else return e},yl=(e,t)=>{var h,g;let{draggedReactElement:o,dragInstructions:r,dropTarget:n}=t,i=n.component,{pos:a}=n,s=((h=a==null?void 0:a.position)==null?void 0:h.Header)&&L(i)==="Stack",{id:l,version:c}=D(o),p=ee(o),d;if(s){let[b,f]=Yn(i,a);b===void 0?d=ao(e,i,o):d=so(e,b,o,f)}else!p&&((g=a==null?void 0:a.position)!=null&&g.Centre)?d=mr(e,i,o):d=xl(e,n,o);if(r.DoNotRemove)return d;let u=de(d,b=>b.id===l&&b.version===c),m=C(u,"path");return fr(d,{path:m,type:"remove"})},wl=(e,{path:t,component:o})=>ao(e,F(e,t),o),xl=(e,t,o)=>{let{component:r,pos:n,clientRect:i,dropRect:a}=t,s=r,l=C(s,"path");if(l==="0.0")return Tt(e,s,o,n);let c=re(e,l);if(di(n,c)){let p=n.position.SouthOrEast?"after":"before";return so(e,s,o,p,n,i,a)}if(!di(n,c))return Tt(e,s,o,n,i,a);if(G(L(c)))return Tt(e,s,o,n);throw Error(`no support right now for position = ${n.position}`)},di=(e,t)=>e.position.Centre?fi(t)||mi(t):e.position.NorthOrSouth?mi(t):e.position.EastOrWest?fi(t):!1,mi=e=>L(e)==="Flexbox"&&e.props.style.flexDirection==="column",fi=e=>L(e)==="Flexbox"&&e.props.style.flexDirection!=="column";var hi=require("react"),El=e=>console.log(`dispatch ${e.type}, have you forgotten to provide a LayoutProvider ?`),ot=(0,hi.createContext)({dispatchLayoutProvider:El,version:-1});var be=require("react");var Rl={},gi=[0,0],Tl=(e,t,o)=>{let r=document.createElement("div");r.className="vuuSimpleDraggableWrapper",r.classList.add("vuuSimpleDraggableWrapper","salt-theme","salt-density-medium"),r.dataset.dragging="true";let n=o!=null?o:document.createElement("div");n.id=t,r.appendChild(n),document.body.appendChild(r);let i=`top:${e.top}px;left:${e.left}px;width:${e.width}px;height:${e.height}px;`;return[r,i,e.left,e.top]},Sl=e=>{let{offsetParent:t}=e;if(t===null)return gi;{let{left:o,top:r}=t.getBoundingClientRect();return[o,r]}},bi=(e,t,o)=>{let r=(0,be.useRef)(),n=(0,be.useRef)(),i=(0,be.useRef)(),a=(0,be.useCallback)((p,d)=>{if(n.current&&i.current){let{dragOffsets:[u,m],targetPosition:h}=n.current,g=typeof p=="number"?p-u:h.left,b=typeof d=="number"?d-m:h.top;(g!==h.left||b!==h.top)&&(n.current.targetPosition.left=g,n.current.targetPosition.top=b,i.current.style.top=b+"px",i.current.style.left=g+"px")}},[]),s=(0,be.useCallback)(p=>{if(n.current){let{dragInstructions:d,payload:u,originalCSS:m}=n.current;p&&t({type:"drag-drop",draggedReactElement:u,dragInstructions:d,dropTarget:p}),i.current&&(!p&&d.DriftHomeIfNoDropTarget?(console.log("drift back to start"),document.body.removeChild(i.current)):d.RemoveDraggableOnDragEnd?document.body.removeChild(i.current):(i.current.style.cssText=m,delete i.current.dataset.dragging)),r.current=void 0,n.current=void 0,i.current=void 0}},[t]),l=(0,be.useCallback)(p=>{if(r.current){let{payload:d,dragContainerPath:u,dragElement:m,dragRect:h,instructions:g=Rl,path:b}=r.current,{current:f}=e,y={x:p.clientX,y:p.clientY},x=d!=null?d:F(f,b,!0),{id:w}=x.props,R=ee(x),v="",E="",S="",I=-1,M=-1,T=gi,P=document.getElementById(w);if(P===null)[P,E,I,M]=Tl(h,w,m);else{T=Sl(P);let[A,O]=T,{width:z,height:W,left:J,top:pe}=P.getBoundingClientRect();I=J-A,M=pe-O,E=`width:${z}px;height:${W}px;left:${I}px;top:${M}px;z-index: 100;background-color:#ccc;opacity: 0.6;`,P.dataset.dragging="true",v=P.style.cssText}S=Qt.initDrag(e.current,u,h,y,{drag:a,drop:s},R),P.style.cssText=E+S,i.current=P,n.current={payload:x,originalCSS:v,dragRect:h,dragOffsets:T,dragInstructions:g,targetPosition:{left:I,top:M}}}},[a,s,e]);return(0,be.useCallback)(p=>{let{evt:d,...u}=p;r.current={...u,dragContainerPath:Wt(e.current,o)},Qt.handleMousedown(d,l,u.instructions)},[l,o,e])};var br=require("react/jsx-runtime"),vi=e=>e.dropTarget,Dl=e=>["drag-drop","remove","set-title","splitter-resize","switch-tab"].includes(e.type),yi=e=>{switch(e.type){case"switch-tab":return e.id==="main-tabs"?"switch-active-layout":"switch-active-tab";case"save":return"save-feature-props";case"drag-drop":return"drag-drop-operation";case"remove":return"remove-component";case"splitter-resize":return"resize-component";case"set-title":return"edit-feature-title";default:throw Error("unknown layout action")}},Pl=()=>{let e=wi();return(0,br.jsx)("div",{children:`Context: ${e} `})},Ll=e=>{let{children:t,createNewChild:o,pathToDropTarget:r,layout:n,onLayoutChange:i}=e,a=(0,q.useRef)(void 0),s=(0,q.useRef)(t),[,l]=(0,q.useState)(null),c=(0,q.useCallback)((m,h)=>{if(i){let g=de(m,vi)||a.current,f=L(g)==="DraggableLayout"?D(g).children[0]:g,y=cr(f);i(y,h)}},[i]),p=(0,q.useCallback)((m,h=!1)=>{let g=hr(a.current,m);g!==a.current&&(a.current=g,l({}),!h&&Dl(m)&&c(g,yi(m)))},[l,c]),d=(0,q.useCallback)(m=>{switch(m.type){case"drag-start":{u(m);break}case"save":{c(a.current,yi(m));break}case"query":if(m.query==="PARENT_CONTAINER")return pr(m.query,m.path,a.current);break;default:{p(m);break}}},[p,c]),u=bi(a,d,r);return(0,q.useEffect)(()=>{if(n){let m=de(a.current,vi);if(m){let h=Bo(m),g=Pe(n,`${m.props.path}.0`),b=h?{type:_.REPLACE,target:h,replacement:g}:{type:_.ADD,path:m.props.path,component:g};p(b,!0)}else if(n.id===C(a.current,"id")){let h=Pe(n,"0"),g={type:_.REPLACE,target:a.current,replacement:h};p(g,!0)}}},[p,n]),a.current===void 0?a.current=no(t):t!==s.current&&(a.current=no(t,a.current),s.current=t),(0,br.jsx)(ot.Provider,{value:{createNewChild:o,dispatchLayoutProvider:d,version:0},children:a.current})},le=()=>{let{dispatchLayoutProvider:e}=(0,q.useContext)(ot);return e},gr=()=>{let{createNewChild:e}=(0,q.useContext)(ot);return e},wi=()=>{let{version:e}=(0,q.useContext)(ot);return e};var St=(e,t,o,r)=>{var b;let{loadSessionState:n,purgeSessionState:i,purgeState:a,saveSessionState:s}=We(),[l,c]=(0,Me.useState)((b=n(e,"contributions"))!=null?b:[]),p=le(),d=(0,Me.useCallback)((f,y)=>{let x=l.concat([{location:f,content:y}]);s(e,"contributions",x),c(x)},[l,e,s]),u=(0,Me.useCallback)(()=>{i(e,"contributions"),c([])},[e,i]),m=(0,Me.useCallback)(()=>{let f=n(e,"data-source");f&&f.unsubscribe(),i(e),a(e),p({type:"remove",path:o})},[p,e,n,i,a,o]),h=(0,Me.useCallback)(async(f,y,x)=>{var R;f.stopPropagation();let w=(R=t.current)==null?void 0:R.getBoundingClientRect();return new Promise((v,E)=>{p({type:"drag-start",evt:f,path:y===void 0?o:`${o}.${y}`,dragRect:w,preDragActivity:x,dropTargets:r,resolveDragStart:v,rejectDragStart:E})})},[t,p,o,r]);return[(0,Me.useCallback)(async(f,y)=>{var w;let{type:x}=f;switch(x){case"maximize":case"minimize":case"restore":return p({type:x,path:(w=f.path)!=null?w:o});case"remove":return m();case"mousedown":return h(y,f.index,f.preDragActivity);case"add-toolbar-contribution":return d(f.location,f.content);case"remove-toolbar-contribution":return u();case"query":return p({type:x,path:f.path,query:f.query});default:return}},[p,o,m,h,d,u]),l]};var Mi=require("@vuu-ui/vuu-utils"),Ci=require("@salt-ds/core"),Ii=k(require("clsx")),j=k(require("react"));var xi=require("@vuu-ui/vuu-ui-controls"),Ei=require("@salt-ds/core"),uo=k(require("clsx")),Ce=require("react");var rt=require("react/jsx-runtime"),vr="vuuHeader",yr=({className:e,contributions:t,collapsed:o,closeable:r,onEditTitle:n,orientation:i="horizontal",style:a,title:s="Untitled"})=>{let l=(0,Ce.useRef)(null),[c,p]=(0,Ce.useState)(s),[d,u]=(0,Ce.useState)(!1),m=wr(),h=M=>m==null?void 0:m({type:"remove"},M),g=()=>{var M;(M=l.current)==null||M.focus()},b=M=>{M.stopPropagation()},y=(0,uo.default)(vr,e,`${vr}-${o||i}`),x=()=>{u(!0)},w=M=>{M.key==="Enter"&&u(!0)},R=(M="",T="",P=!0,A=!1)=>{var O;u(!1),A?p(M):T!==M&&(p(T),n==null||n(T)),P===!1&&((O=l.current)==null||O.focus())},v=M=>{m==null||m({type:"mousedown"},M)},E=[],S=[],I=[];return t==null||t.forEach((M,T)=>{switch(M.location){case"pre-title":E.push((0,Ce.cloneElement)(M.content,{key:T}));break;default:S.push((0,Ce.cloneElement)(M.content,{key:T}))}}),s&&E.push((0,rt.jsx)(xi.EditableLabel,{className:`${vr}-title`,editing:d,value:c,onChange:p,onMouseDownCapture:g,onEnterEditMode:x,onExitEditMode:R,onKeyDown:w,ref:l,tabIndex:0},"title")),r&&I.push((0,rt.jsx)(Ei.Button,{"data-icon":"close",onClick:h,onMouseDown:b,variant:"secondary"},"close")),S.length>0&&E.push((0,rt.jsx)("div",{className:"vuuTooltrayProxy","data-align":"end",children:S},"contributions")),I.length>0&&E.push((0,rt.jsx)("div",{className:"vuuTooltrayProxy","data-align":"end",children:I},"actions")),(0,rt.jsx)("div",{className:(0,uo.default)("vuuToolbarProxy",y),style:a,onMouseDown:v,children:E})};var ce=require("react");var Ri=({id:e,rootRef:t,path:o,dropTargets:r,title:n})=>{let i=le(),{loadState:a,loadSessionState:s,purgeState:l,saveState:c,saveSessionState:p}=We(),[d,u]=St(e,t,o,r),m=(0,ce.useMemo)(()=>{var v;return(v=a("view-title"))!=null?v:n},[a,n]),h=(0,ce.useCallback)(v=>{o&&i({type:"set-title",path:o,title:v})},[i,o]),g=(0,ce.useMemo)(()=>a(e),[e,a]),b=(0,ce.useCallback)(v=>a(e,v),[e,a]),f=(0,ce.useCallback)(v=>{l(e,v),i({type:"save"})},[e,i,l]),y=(0,ce.useCallback)((v,E)=>{c(e,E,v),i({type:"save"})},[e,i,c]),x=(0,ce.useCallback)(v=>s(e,v),[e,s]),w=(0,ce.useCallback)((v,E)=>p(e,E,v),[e,p]),R=(0,ce.useCallback)(({type:v,...E})=>{let{[v]:S}=E;y(S,v)},[y]);return{contributions:u,dispatchViewAction:d,load:b,loadSession:x,onConfigChange:R,onEditTitle:h,purge:f,restoredState:g,save:y,saveSession:w,title:m}};var ue=require("react");var Ke=require("react"),Er=["height","width"],Ml=["height"],Cl=["width"],Ge=new WeakMap,Ti=(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}},xr=new ResizeObserver(e=>{for(let t of e){let{target:o,contentRect:r}=t,n=Ge.get(o);if(n){let{onResize:i,measurements:a}=n,s=!1;for(let[l,c]of Object.entries(a)){let p=Ti(o,r,l);p!==c&&(s=!0,a[l]=p)}s&&i&&i(a)}}});function Dt(e,t,o,r=!1){let n=(0,Ke.useRef)(t),i=(0,Ke.useCallback)(a=>{let s=a.getBoundingClientRect();return n.current.reduce((l,c)=>(l[c]=Ti(a,s,c),l),{})},[]);(0,Ke.useLayoutEffect)(()=>{let a=e.current,s=!1;async function l(){Ge.set(a,{measurements:{}}),s=!1;let{fonts:c}=document;if(c&&await c.ready,!s){let p=Ge.get(a);if(p){let d=i(a);p.measurements=d,xr.observe(a),r&&o(d)}}}if(a){if(Ge.has(a))throw Error("useResizeObserver attemping to observe same element twice");l()}return()=>{a&&Ge.has(a)&&(xr.unobserve(a),Ge.delete(a),s=!0)}},[e,i,r,o]),(0,Ke.useLayoutEffect)(()=>{let a=e.current,s=Ge.get(a);if(s){if(n.current!==t){n.current=t;let l=i(a);s.measurements=l}s.onResize=o}},[t,i,e,o])}function Il(e,t){let o=document.body.querySelector(`.${e}`),r={get:function(n,i){let a=n.getPropertyValue(`--${e}-breakpoint-${i}`);return a?parseInt(a):void 0}};return o?new Proxy(getComputedStyle(o),r):t!=null?t:{}}var kl=([,e],[,t])=>t-e,Tr=e=>Object.entries(e).sort(kl).map(([t,o],r,n)=>[t,o,r<n.length-1?n[r+1][1]:9999]),Rr=null,Al=(e="salt")=>{let{xs:t,sm:o,md:r,lg:n,xl:i}=Il(e);return Tr({xs:t,sm:o,md:r,lg:n,xl:i})},Si=e=>(Rr===null&&(Rr=Al(e)),Rr);var Ol=[],Sr=({breakPoints:e,smallerThan:t},o)=>{let[r,n]=(0,ue.useState)(t?!1:"lg"),i=(0,ue.useRef)(document.body),a=(0,ue.useRef)(e?Tr(e):Si()),s=(0,ue.useRef)("lg"),l=(0,ue.useCallback)(p=>{if(a.current){for(let[d,u]of a.current)if(p>=u)return d}},[a]),c=(0,ue.useCallback)(p=>{if(t){let d=a.current.find(([u])=>u===t);if(d){let[,,u]=d;return p<u}}else return l(p);return p},[t,l]);return Dt(o||i,a.current?["width"]:Ol,({width:p})=>{let d=c(p);d!==s.current&&(s.current=d,n(d))},!0),(0,ue.useEffect)(()=>{let p=o||i;if(p.current){let d=s.current;if(a.current){let{clientWidth:u}=p.current,m=c(u);s.current=m,m!==d&&n(m)}}},[n,c,o]),r};var Di="data-collapsible",Hl={[Di]:!0,"data-pad-start":!0,"data-pad-end":!0},Pi=e=>{var t;return(t=Hl[e])!=null?t:!1},zl=e=>e===Di,Bl={dynamic:"dynamic",instant:"instant",true:"instant"},Nl=e=>{var t;return(t=Bl[e])!=null?t:"none"},Fl=e=>Object.keys(e).reduce((t,o)=>{let[r,n]=t;if(Pi(o)){let i=zl(o)?Nl(e[o]):e[o];r[o]=i,n[o]=void 0}return t},[{},{}]);var nt=require("react"),$l=[],Li=({mainRef:e,resize:t="responsive",rootRef:o})=>{let r=t==="defer",n=(0,nt.useRef)({}),i=(0,nt.useRef)(),a=(0,nt.useCallback)(()=>{e.current&&(e.current.style.height=n.current.height+"px",e.current.style.width=n.current.width+"px"),i.current=void 0},[e]),s=(0,nt.useCallback)(({height:l,width:c})=>{n.current.height=l,n.current.width=c,i.current!==null&&clearTimeout(i.current),i.current=window.setTimeout(a,40)},[a]);Dt(o,r?Er:$l,s,r)};var Pt=k(require("react")),Wl={dispatch:null},Lt=Pt.default.createContext(Wl),wr=()=>{var t;let e=(0,Pt.useContext)(Lt);return(t=e==null?void 0:e.dispatch)!=null?t:null},Dr=()=>(0,Pt.useContext)(Lt);var it=require("react/jsx-runtime"),Mt="vuuView",Vl=(e,t)=>e&&t?{...e,...t}:e||t,ki=(0,j.forwardRef)(function(t,o){let{Header:r=yr,children:n,className:i,collapsed:a,closeable:s,"data-path":l,"data-resizeable":c,dropTargets:p,expanded:d,flexFill:u,id:m,header:h,orientation:g="horizontal",path:b=l,resize:f="responsive",resizeable:y=c,tearOut:x,style:w={},title:R,...v}=t,E=(0,Mi.useId)(m),S=(0,j.useRef)(null),I=(0,j.useRef)(null),[M,T]=(0,j.useState)(),{contributions:P,dispatchViewAction:A,load:O,loadSession:z,onConfigChange:W,onEditTitle:J,purge:pe,restoredState:ft,save:tn,saveSession:on,title:Io}=Ri({id:E,rootRef:S,path:b,dropTargets:p,title:R});Li({mainRef:I,resize:f,rootRef:S});let rn=(0,j.useCallback)(qa=>{T(qa)},[]),Ga=()=>j.default.isValidElement(n)&&(ft||M)?j.default.cloneElement(n,Vl(ft,M)):n,Ka=(0,j.useMemo)(()=>({dispatch:A,id:E,path:b,title:Io,load:O,loadSession:z,onConfigChange:W,purge:pe,save:tn,saveSession:on,setComponentProps:rn}),[A,E,O,z,W,b,pe,tn,on,rn,Io]),Ua=typeof h=="object"?h:{};return(0,it.jsx)("div",{...v,className:(0,Ii.default)(Mt,i,{[`${Mt}-collapsed`]:a,[`${Mt}-expanded`]:d,[`${Mt}-resize-defer`]:f==="defer"}),"data-resizeable":y,id:E,ref:(0,Ci.useForkRef)(o,S),style:w,tabIndex:-1,children:(0,it.jsxs)(Lt.Provider,{value:Ka,children:[h?(0,it.jsx)(r,{...Ua,collapsed:a,contributions:P,expanded:d,closeable:s,onEditTitle:J,orientation:g,tearOut:x,title:Io}):null,(0,it.jsx)("div",{className:`${Mt}-main`,ref:I,children:Ga()})]})})});ki.displayName="View";var Ue=j.default.memo(ki);Ue.displayName="View";N("View",Ue,"view");var ve=require("react/jsx-runtime"),po="vuuLayoutStartPanel",Oi=e=>{let{dispatch:t,path:o}=Dr(),[r,n]=(0,mo.useState)();return(0,mo.useMemo)(()=>{t==null||t({type:"query",path:o,query:"PARENT_CONTAINER"}).then(a=>{(a==null?void 0:a.parentContainerId)==="main-tabs"?n("initial"):n("nested")})},[t,o]),r===void 0?null:(0,ve.jsxs)("div",{...e,className:po,children:[r==="initial"?(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)("header",{className:`${po}-title`,children:"Start by adding a table"}),(0,ve.jsx)("div",{className:`${po}-text`,children:"To add a table, drag any of the Vuu Tables to this area or click the button below"})]}):null,(0,ve.jsx)(Ai.Button,{className:`${po}-addButton`,"data-icon":"add",variant:"cta"})]})};var qe=require("react/jsx-runtime"),_l="vuuPlaceholder",Gl=({showStartMenu:e=!0})=>(0,qe.jsx)(qe.Fragment,{children:e?(0,qe.jsx)(Oi,{}):null}),je=({className:e,showStartMenu:t,...o})=>{let r=(0,Hi.default)(_l,e);return(0,qe.jsx)(Ue,{...o,className:r,"data-placeholder":!0,resizeable:!0,children:(0,qe.jsx)(Gl,{showStartMenu:t})})};je.displayName="Placeholder";N("Placeholder",je);var zi=k(require("clsx")),Y=k(require("react"));var Pr=require("react/jsx-runtime"),fo="vuuSplitter",Bi=Y.default.memo(function({column:t,index:o,onDrag:r,onDragEnd:n,onDragStart:i,style:a}){let s=(0,Y.useRef)(),l=(0,Y.useRef)(null),c=(0,Y.useRef)(0),[p,d]=(0,Y.useState)(!1),u=(0,Y.useCallback)(({key:v,shiftKey:E})=>{let S=E?10:1;t&&v==="ArrowDown"?r(o,S):t&&v==="ArrowUp"||!t&&v==="ArrowLeft"?r(o,-S):!t&&v==="ArrowRight"&&r(o,S)},[t,o,r]),m=(0,Y.useCallback)(v=>{let{key:E}=v;(t&&(E==="ArrowUp"||E==="ArrowDown")||!t&&(E==="ArrowLeft"||E==="ArrowRight"))&&(i(o),u(v),h.current=u)},[t,u,o,i]),h=(0,Y.useRef)(m),g=v=>h.current(v),b=(0,Y.useCallback)(v=>{s.current=!0;let E=v[t?"clientY":"clientX"],S=E-c.current;E&&E!==c.current&&r(o,S),c.current=E},[t,o,r]),f=(0,Y.useCallback)(()=>{var v;window.removeEventListener("mousemove",b,!1),window.removeEventListener("mouseup",f,!1),n(),d(!1),(v=l.current)==null||v.focus()},[b,n,d]),y=(0,Y.useCallback)(v=>{c.current=t?v.clientY:v.clientX,i(o),window.addEventListener("mousemove",b,!1),window.addEventListener("mouseup",f,!1),v.preventDefault(),d(!0)},[t,b,f,o,i,d]),x=()=>{var v;s.current?s.current=!1:(v=l.current)==null||v.focus()},w=()=>{h.current=m},R=(0,zi.default)(fo,{[`${fo}-active`]:p,[`${fo}-column`]:t});return(0,Pr.jsx)("div",{className:R,"data-splitter":!0,ref:l,role:"separator",style:a,onBlur:w,onClick:x,onKeyDown:g,onMouseDown:y,tabIndex:0,children:(0,Pr.jsx)("div",{className:`${fo}-grab-zone`})})});var Kl={},Ct=1,It=2,Ul=e=>typeof e.intrinsicSize=="number",ql=(e,t)=>{let o={};return e.forEach(r=>{o[r]=C(t,r)}),o},ho=(e,t,o)=>e.map((r,n)=>{var l;let i=C(r,"resizeable"),{[t]:a}=(l=ee(r))!=null?l:Kl,s=or(r);return o?{index:n,flexOpen:s,intrinsicSize:a,resizeable:i,...ql(o,r)}:{index:n,flexOpen:s,intrinsicSize:a,resizeable:i}}),Ni=e=>{let t=e.length,o=e.every(Ul),r=Array(t).fill(0);if(o&&t>0&&(r[0]=It,r[t-1]=It),t<2)return r;for(let n=0,i=0;n<t-1;n++)e[n].resizeable&&!i&&(i=Ct),r[n]+=i;for(let n=t-1;n>0&&(r[n]&Ct&&(r[n]-=Ct),!e[n].resizeable);n--);return r},Fi=(e,t)=>{let o=Yl(e,t),r=Zl(e,t),n=o!==-1&&r!==-1?[o,r]:void 0,i=jl(e,n);return[n,i]};function jl(e,t){if(t){let o=[];for(let r=0;r<e.length;r++)e[r].flexOpen&&!t.includes(r)&&o.push(r);return o}}function Yl(e,t){let o=t,r=!1;for(;o>=1&&!r;)o=o-1,r=$i(e,o);return o}function Zl(e,t){let o=t,r=!1,n=e.length;for(;o<n-1&&!r;)o=o+1,r=$i(e,o);return o===n?-1:o}function $i(e,t){let{placeholder:o,splitter:r,resizeable:n,intrinsicSize:i}=e[t];return!!(!r&&!i&&(o||n))}var Xl=e=>!e.splitter&&!e.placeholder,_i=({children:e,onSplitterMoved:t,style:o})=>{let r=(0,B.useRef)(null),n=(0,B.useRef)(),i=(0,B.useRef)(),a=(0,B.useRef)([]),[,s]=(0,B.useState)({}),l=b=>{i.current=b,s({})},c=(o==null?void 0:o.flexDirection)==="column",p=c?"height":"width",d=(0,B.useMemo)(()=>Array.isArray(e)?e:B.default.isValidElement(e)?[e]:[],[e]),u=(0,B.useCallback)(b=>{let{current:f}=n;if(f){let[y,x]=Fi(f,b);y&&(y.forEach(w=>{var v;let R=(v=r.current)==null?void 0:v.childNodes[w];if(R){let{size:E,minSize:S}=tc(R,p);f[w].currentSize=E,f[w].minSize=S}}),x&&x.forEach(w=>{var v;let R=(v=r.current)==null?void 0:v.childNodes[w];if(R){let{[p]:E}=R.getBoundingClientRect();f[w].flexBasis=E}}))}},[p]),m=(0,B.useCallback)((b,f)=>{i.current&&n.current&&l(Ql(i.current,n.current,f,p))},[p]),h=(0,B.useCallback)(()=>{let b=n.current;b&&(t==null||t(b.filter(Xl))),b==null||b.forEach(f=>{f.currentSize=void 0,f.flexBasis=void 0,f.flexOpen=!1})},[t]),g=(0,B.useCallback)(b=>B.default.createElement(Bi,{column:c,index:b,key:`splitter-${b}`,onDrag:m,onDragEnd:h,onDragStart:u}),[m,h,u,c]);return(0,B.useMemo)(()=>{let[b,f]=Jl(d,p,g,a.current);n.current=f,i.current=b},[d,g,p]),{content:i.current||[],rootRef:r}};function Jl(e,t,o,r){let n=ho(e,t),i=Ni(n),a=[],s=[];for(let l=0;l<e.length;l++){let c=e[l];if(l===0&&i[l]&It&&(a.push(Wi(l)),s.push({placeholder:!0,shim:!0})),c.key==null){let p=r[l]||(r[l]=(0,Vi.getUniqueId)());a.push(B.default.cloneElement(c,{key:p}))}else a.push(c);s.push(n[l]),l>0&&i[l]&It?(a.push(Wi(l)),s.push({placeholder:!0})):i[l]&Ct&&(a.push(o(a.length)),s.push({splitter:!0}))}return[a,s]}function Ql(e,t,o,r){return ec(t,o)?e.map((i,a)=>{let s=t[a],{currentSize:l,flexOpen:c,flexBasis:p}=s,d=l!==void 0;if(d||c){let{flexBasis:u}=i.props.style||{},m=d?s.currentSize:p;return m!==u?B.default.cloneElement(i,{style:{...i.props.style,flexBasis:m,[r]:"auto"}}):i}else return i}):e}function ec(e,t){let o=[];e.forEach((p,d)=>{p.currentSize!==void 0&&o.push(d)});let r=t<0?o[0]:o[1],{currentSize:n=0,minSize:i=0}=e[r];if(n===i)return!1;if(Math.abs(t)>n-i){let p=t<0?-1:1;t=Math.max(0,n-i)*p}let a=e[o[0]],{currentSize:s=0}=a;a.currentSize=s+t;let l=e[o[1]],{currentSize:c=0}=l;return l.currentSize=c-t,!0}function Wi(e){return B.default.createElement(je,{shim:e===0,key:`placeholder-${e}`})}function tc(e,t){let{[t]:o}=e.getBoundingClientRect(),n=getComputedStyle(e).getPropertyValue(`min-${t}`),i=n.endsWith("px")?parseInt(n,10):0;return{size:o,minSize:i}}var ji=require("react/jsx-runtime"),Lr="hwFlexbox",qi=(0,Ui.forwardRef)(function(t,o){let{breakPoints:r,children:n,column:i,className:a,flexFill:s,gap:l,fullPage:c,id:p,onSplitterMoved:d,resizeable:u,row:m,spacing:h,splitterSize:g,style:b,...f}=t,{content:y,rootRef:x}=_i({children:n,onSplitterMoved:d,style:b}),w=(0,Ki.default)(Lr,a,{[`${Lr}-column`]:i,[`${Lr}-row`]:m,"flex-fill":s,"full-page":c});return(0,ji.jsx)("div",{...f,className:w,"data-resizeable":u||void 0,id:p,ref:(0,Gi.useForkRef)(x,o),style:{...b,gap:l,"--spacing":h},children:y})});qi.displayName="Flexbox";var go=qi;var Yi=require("react");var Zi=require("react/jsx-runtime"),Mr=function(t){let{path:o}=t,r=le(),n=(0,Yi.useCallback)(i=>{r({type:_e.SPLITTER_RESIZE,path:o,sizes:i})},[r,o]);return(0,Zi.jsx)(go,{...t,onSplitterMoved:n})};Mr.displayName="Flexbox";N("Flexbox",Mr,"container");var Qi=require("@salt-ds/core"),ea=k(require("clsx")),vo=require("react");var Xi=require("@vuu-ui/vuu-utils"),te=require("react");var oc=["xs","sm","md","lg","xl"],rc=12,Ji=({children:e,cols:t,style:o})=>{let r=(0,te.useRef)(null),n=(0,te.useRef)(null),i=(0,te.useRef)(),a=t!=null?t:rc,l=(o==null?void 0:o.flexDirection)==="column"?"height":"width",c=(0,te.useMemo)(()=>Array.isArray(e)?e:(0,te.isValidElement)(e)?[e]:[],[e]),p=(0,te.useCallback)((d,u)=>{let m=ho(d,u,oc),h=[],g=[];for(let b=0;b<d.length;b++){let f=d[b],{style:{flex:y,...x}}=f.props;h.push((0,te.cloneElement)(f,{key:(0,Xi.getUniqueId)(),style:{...x,"--parent-col-count":a}})),g.push(m[b])}return[h,g]},[a]);return(0,te.useMemo)(()=>{let[d,u]=p(c,l);n.current=u,i.current=d},[p,c,l]),{cols:a,content:i.current,rootRef:r}};var ta=require("react/jsx-runtime"),bo="hwFluidGrid",yo=(0,vo.forwardRef)(function(t,o){let{breakPoints:r,children:n,column:i,cols:a=12,className:s,flexFill:l,gap:c=3,fullPage:p,id:d,onSplitterMoved:u,resizeable:m,row:h,showGrid:g,spacing:b,splitterSize:f,style:y,...x}=t,w=(0,vo.useMemo)(()=>Oe(n),[n]),{cols:R,content:v,rootRef:E}=Ji({children:w,cols:a,style:y}),S=Sr({breakPoints:r},E),I=(0,ea.default)(bo,s,{[`${bo}-column`]:i,[`${bo}-row`]:h,[`${bo}-show-grid`]:g,"flex-fill":l,"full-page":p}),M={...y,"--spacing":b,"--grid-col-count":R,"--grid-gap":c};return(0,ta.jsx)("div",{...x,className:I,"data-breakpoint":S,"data-cols":R,"data-resizeable":m||void 0,id:d,ref:(0,Qi.useForkRef)(E,o),style:M,children:v})});yo.displayName="FluidGrid";var oa=require("react/jsx-runtime"),Cr=function(t){return(0,oa.jsx)(yo,{...t})};Cr.displayName="FluidGrid";N("FluidGrid",Cr,"container");var aa=require("react");var ye=require("@vuu-ui/vuu-utils"),me=require("react");var Ze=require("react");var Ye=new Map,na=(e,t,o)=>{switch(o){case"height":return t.height;case"clientHeight":return Math.floor(e.clientHeight);case"clientWidth":return Math.floor(e.clientWidth);case"contentHeight":return t.contentHeight;case"contentWidth":return t.contentWidth;case"scrollHeight":return Math.ceil(Math.floor(e.scrollHeight));case"scrollWidth":return Math.ceil(Math.floor(e.scrollWidth));case"width":return t.width;default:return 0}},ra=new ResizeObserver(e=>{for(let t of e){let{target:o,borderBoxSize:r,contentBoxSize:n}=t,i=Ye.get(o);if(i){let[{blockSize:a,inlineSize:s}]=r,[{blockSize:l,inlineSize:c}]=n,{onResize:p,measurements:d}=i,u=!1;for(let[m,h]of Object.entries(d)){let g=na(o,{height:a,width:s,contentHeight:l,contentWidth:c},m);g!==h&&(u=!0,d[m]=g)}u&&p&&p(d)}}});function ia(e,t,o,r=!1){let n=(0,Ze.useRef)(t),i=(0,Ze.useCallback)(a=>{let{width:s,height:l}=a.getBoundingClientRect(),{clientWidth:c,clientHeight:p}=a,d=Math.floor(l),u=Math.floor(s);return n.current.reduce((m,h)=>(m[h]=na(a,{width:u,height:d,contentHeight:p,contentWidth:c},h),m),{})},[]);(0,Ze.useEffect)(()=>{let a=e.current;async function s(){Ye.set(a,{measurements:{}});let l=Ye.get(a);if(l){let c=i(a);l.measurements=c,ra.observe(a),r&&o(c)}else console.log("%cuseResizeObserver an target expected to be under observation wa snot found. This warrants investigation","font-weight:bold; color:red;")}return a&&(Ye.has(a)&&console.log("useResizeObserver attemping to observe same element twice",{target:a}),s()),()=>{a&&Ye.has(a)&&(ra.unobserve(a),Ye.delete(a))}},[i,e]),(0,Ze.useEffect)(()=>{let a=e.current,s=Ye.get(a);if(s){if(n.current!==t){n.current=t;let l=i(a);s.measurements=l}s.onResize=o}},[t,i,e,o])}var nc=["clientHeight","clientWidth"],ic=["clientWidth"],ac=["clientHeight"],sc=[],wo=e=>Number.isFinite(e),lc={height:"100%",width:"auto"},cc=(e,t)=>(0,ye.isValidNumber)(e)&&(0,ye.isValidNumber)(t)?{height:`${e}px`,width:`${t}px`}:typeof e=="string"||typeof t=="string"?{height:e!=null?e:"100%",width:t!=null?t:"auto"}:lc,uc=(e,t)=>{if((0,ye.isValidNumber)(e)&&(0,ye.isValidNumber)(t))return{height:e,width:t}},Ir=({defaultHeight:e=0,defaultWidth:t=0,height:o,onResize:r,width:n})=>{let i=(0,me.useRef)(null),[a,s]=(0,me.useState)({css:cc(o,n),inner:uc(o,n),outer:{height:o!=null?o:"100%",width:n!=null?n:"auto"}}),l=typeof o=="number",c=typeof n=="number",p=l&&c?sc:l?ic:c?ac:nc;(0,me.useMemo)(()=>{s(u=>{let{inner:m,outer:h}=u;if((0,ye.isValidNumber)(o)&&(0,ye.isValidNumber)(n)&&m&&h){let{height:g,width:b}=m,{height:f,width:y}=h;if(f!==o||y!==n){let x=(0,ye.isValidNumber)(f)?f-g:0,w=(0,ye.isValidNumber)(y)?y-b:0;return{...u,outer:{height:o,width:n},inner:{height:o-x,width:n-w}}}}return u})},[o,n]);let d=(0,me.useCallback)(({clientWidth:u,clientHeight:m})=>{let{css:h,inner:g,outer:b}=a,f=a;l&&wo(u)&&Math.floor(u)!==(g==null?void 0:g.width)?f={css:h,outer:b,inner:{width:Math.floor(u)||t,height:o}}:c&&wo(m)&&Math.floor(m)!==(g==null?void 0:g.height)?f={css:h,outer:b,inner:{height:Math.floor(m)||e,width:n}}:wo(m)&&wo(u)&&(u!==(g==null?void 0:g.width)||m!==(g==null?void 0:g.height))&&(f={css:h,outer:b,inner:{width:Math.floor(u)||t,height:Math.floor(m)||e}}),f!==a&&s(f)},[e,t,l,c,o,a,n]);return(0,me.useEffect)(()=>{a.inner&&(r==null||r(a.inner))},[r,a.inner]),ia(i,p,d,!0),{containerRef:i,cssSize:a.css,outerSize:a.outer,innerSize:a.inner}};var sa=require("@salt-ds/core"),Ar=k(require("clsx"));var Or=require("react/jsx-runtime"),kr="vuuMeasuredContainer",pc=(0,aa.forwardRef)(function({children:t,className:o,height:r,onResize:n,style:i,width:a,...s},l){let{containerRef:c,...p}=Ir({height:r,onResize:n,width:a}),{cssSize:d,innerSize:u}=p,m=u===void 0,h=()=>m?{"--measured-css-height":`${d.height}`,"--measured-css-width":`${d.width}`}:{...i,"--measured-css-height":`${d.height}`,"--measured-css-width":`${d.width}`,"--measured-px-height":`${u==null?void 0:u.height}px`,"--measured-px-width":`${u==null?void 0:u.width}px`},g=(0,sa.useForkRef)(c,l);return m?(0,Or.jsx)("div",{...s,className:(0,Ar.default)(kr,`${kr}-ummeasured`),style:h(),ref:c}):(0,Or.jsx)("div",{...s,className:(0,Ar.default)(kr,o),ref:g,style:h(),children:t})});var ga=require("@vuu-ui/vuu-popups"),ba=require("@vuu-ui/vuu-utils"),kt=k(require("clsx")),To=k(require("react"));var fa=require("@vuu-ui/vuu-ui-controls"),st=require("@vuu-ui/vuu-utils"),X=require("react");var Hr=require("@vuu-ui/vuu-utils"),dc=".vuuOverflowContainer-item:not(.wrapped)",mc=e=>e!==null&&e.dataset.index==="overflow"&&e.parentElement!==null&&e.parentElement.classList.contains("vuuOverflowContainer-wrapContainer-overflowed"),la=e=>e.sort((t,o)=>{let{dataset:{index:r="?"}}=t,{dataset:{index:n="?"}}=o,i=t.classList.contains("wrapped"),a=o.classList.contains("wrapped"),s=r==="overflow",l=n==="overflow";return i&&!a?1:!i&&a?-1:s?1:l?-1:parseInt(r)>parseInt(n)?1:-1}),Eo=[],at=(e,t="horizontal")=>{let o=[],r=[],n=-1,i=!1,a=la(Array.from(e.children)),s=t==="vertical"?"top":"left";for(let l of a){let c=l,{dataset:{index:p="?",label:d="?",overflowPriority:u="0"}}=c,{[s]:m}=c.getBoundingClientRect();m<=n?(p==="overflow"?r.push(o.pop()):r.push({index:p,label:d,overflowPriority:u}),i=!0):i?r.push({index:p,label:d,overflowPriority:u}):o.push({index:p,label:d,overflowPriority:u}),n=m}return[o,r]},zr=(e,t,o)=>{let r=!1,n=o?`${o}-overflowed`:"overflow";t.find(({index:i})=>i==="overflow")&&t.length===1&&(r=!0);for(let i of e.children){let{dataset:{index:a="?"}}=i;t.length===0||r?e.classList.remove(n):e.classList.add(n),a!=="overflow"&&t.find(s=>s.index===a)?i.classList.add("wrapped"):i.classList.remove("wrapped")}},fc=(e,{overflowPriority:t})=>Math.max(e,parseInt(t)),hc=(e,{overflowPriority:t})=>Math.min(e,parseInt(t)),Br=e=>{var t;return e.length>1&&((t=e.at(-1))==null?void 0:t.index)==="overflow"},gc=e=>{let[t]=e;for(let o=1;o<e.length;o++){let r=e[o];parseInt(r.overflowPriority)>parseInt(t.overflowPriority)&&(t=r)}return t},Nr=(e,t)=>{var n;let o=e.reduce(hc,Number.MAX_SAFE_INTEGER);return t.reduce(fc,0)>o?!0:t.length>1&&((n=t.at(-1))==null?void 0:n.index)==="overflow"},Fr=(e,t)=>new Promise(o=>{requestAnimationFrame(()=>{let[,r]=at(e);bc(t,r).forEach(i=>ca(e,i)),o(r)})}),$r=(e,t,o)=>new Promise(r=>{requestAnimationFrame(()=>{let[,n]=at(e),i=gc(n);if(i){let[a,s]=Ro(e,i);r([a,s])}else r([t,o])})}),ca=(e,t)=>{let o=(0,Hr.getElementByDataIndex)(e,t.index);if(o)o.classList.add("wrapped");else throw Error(`markElementAsWrapped element item with index ${t.index} not found`)},ua=e=>Array.from(e.querySelectorAll(".wrapped")),bc=(e,t)=>{let o=[];for(let r of t)e.find(({index:n})=>n===r.index)||o.push(r);return o},pa=(e,t)=>{ua(e).forEach(r=>{let{dataset:{index:n="?"}}=r;t.find(i=>i.index===n)||r.classList.remove("wrapped")})},da=e=>e.querySelector('[data-index="overflow"]'),vc=e=>e.querySelector(".wrapped"),xo=e=>parseInt(getComputedStyle(e).getPropertyValue("width")),ma=(e,t)=>{let{right:o}=e.getBoundingClientRect(),r=parseInt(getComputedStyle(e).getPropertyValue("padding-right")),{right:n}=t.getBoundingClientRect();return o-r-n},Wr=e=>{let t=da(e),o=ma(e,t),r=xo(t),n=vc(e);return xo(n)<=o+r?(e.classList.remove("overflowed"),n.classList.remove("wrapped"),!0):!1},yc=(e,t)=>{let{dataset:{index:o="0",overflowPriority:r="0"}}=e,{dataset:{index:n="0",overflowPriority:i="0"}}=t;return r>i?-1:r<i?1:parseInt(o)-parseInt(n)},wc=e=>Array.from(e.querySelectorAll(dc)).sort(yc),Ro=(e,t)=>{let o=wc(e),r=(0,Hr.getElementByDataIndex)(e,t.index,!0),n=-1,i=o.at(n),a=xo(i),s=xo(r),l=da(e),c=ma(e,l)+a;if(c>=s)xc(r,i);else{let{left:u}=i.getBoundingClientRect(),m=c,h=[i];for(;c<s;){n-=1,i=o.at(n),h.push(i);let{left:g}=i.getBoundingClientRect(),b=u-g;c=m+b}r==null||r.classList.remove("wrapped"),h.forEach(g=>{g.classList.add("wrapped")})}let[p,d]=at(e);return pa(e,d),[p,d]},xc=(e,t)=>{if(!e||!t)throw Error("switchWrapOnElements, element undefined");e.classList.remove("wrapped"),t.classList.add("wrapped")};var ha=({allowDragDrop:e=!1,itemCount:t,onMoveItem:o,onSwitchWrappedItemIntoView:r,orientation:n="horizontal"})=>{let[i,a]=(0,X.useState)(null),s=(0,X.useRef)(Eo),l=(0,X.useRef)(null),c=(0,X.useCallback)(x=>{var w;l.current&&((w=l.current.querySelector(".vuuOverflowContainer-OverflowIndicator button"))==null||w.setAttribute("tabindex",x))},[]),p=(0,X.useCallback)(async()=>{if(i){let[x,w]=at(i,n);for(zr(i,w,"vuuOverflowContainer-wrapContainer"),Br(w)&&(w=await Fr(i,w));Nr(x,w);)[x,w]=await $r(i,x,w);w.length===1&&Wr(i)&&(w=Eo),s.current.length===0&&w.length>0?c("0"):s.current.length>0&&w.length===0&&c("-1"),s.current=w}},[i,n,c]),d=x=>typeof x=="object"&&x!==null&&"overflowItem"in x,[u,m]=(0,X.useMemo)(()=>[()=>{let{current:x}=s;return x.map(w=>({label:w.label,action:`activate-item-${w.index}`,options:{overflowItem:w}}))},({options:x})=>{if(i&&d(x)){let[,w]=Ro(i,x.overflowItem);s.current=w,r==null||r(x.overflowItem)}return!0}],[i,r]),h=(0,X.useMemo)(()=>{let{sizeProp:x}=st.MEASURES[n],w=0;return new ResizeObserver(R=>{for(let v of R){let{[x]:E}=v.contentRect,S=Math.round(E);(0,st.isValidNumber)(S)&&w!==S&&(w=S,p())}})},[p,n]);(0,st.useLayoutEffectSkipFirst)(()=>{p()},[p,t]),(0,X.useMemo)(()=>{i&&h.observe(i)},[i,h]);let g=(0,X.useCallback)(x=>{a(l.current=x)},[]),b=(0,X.useCallback)((x,w)=>{o==null||o(x,w)},[o]),{onMouseDown:f,...y}=(0,fa.useDragDrop)({allowDragDrop:e,containerRef:l,draggableClassName:"vuuOverflowContainer",onDrop:b,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"});return{menuActionHandler:m,menuBuilder:u,onItemMouseDown:f,rootRef:g,...y}};var Ie=require("react/jsx-runtime"),lt="vuuOverflowContainer",va=To.default.memo(({PopupMenuProps:e,allowDragDrop:t,children:o,className:r,height:n,id:i,onMoveItem:a,onSwitchWrappedItemIntoView:s,orientation:l="horizontal",overflowIcon:c,overflowPosition:p="end"})=>{let d=Oe(o),{draggable:u,draggedItemIndex:m,menuActionHandler:h,menuBuilder:g,onItemMouseDown:b,rootRef:f}=ha({allowDragDrop:t,itemCount:d.length,onMoveItem:a,onSwitchWrappedItemIntoView:s,orientation:l}),x={"--overflow-container-height":`${l==="vertical"?"100%":`${n}px`}`},w=(0,kt.default)(`${lt}-wrapContainer`,r,{[`${lt}-horizontal`]:l==="horizontal",[`${lt}-vertical`]:l==="vertical"}),R=d.map((E,S)=>{let{"data-align":I,"data-overflow-priority":M="0",id:T=`${i}-${S}`,label:P=`Item ${S+1}`}=E.props;return(0,Ie.jsx)("div",{className:(0,kt.default)(`${lt}-item`,{"vuuDraggable-dragAway":m===S}),"data-index":S,"data-align":I,"data-label":P,"data-overflow-priority":M,id:`${T}-wrapper`,onMouseDown:b,children:E},S)}),v=(0,Ie.jsx)("div",{className:`${lt}-OverflowIndicator`,"data-index":"overflow",children:(0,Ie.jsx)(ga.PopupMenu,{...e,icon:c,menuBuilder:g,menuActionHandler:h,tabIndex:-1})},"overflow");return R.push(v),(0,Ie.jsxs)("div",{className:w,ref:f,style:x,children:[R,u]})});va.displayName="OverflowContainer.InnerContainer";var Vr=(0,To.forwardRef)(function({PopupMenuProps:t,allowDragDrop:o=!1,children:r,className:n,height:i=44,id:a,onMoveItem:s,onSwitchWrappedItemIntoView:l,orientation:c,overflowIcon:p,overflowPosition:d,...u},m){let h=(0,ba.useId)(a);return(0,Ie.jsx)("div",{...u,className:(0,kt.default)((0,kt.default)(n,lt)),id:h,ref:m,children:(0,Ie.jsx)(va,{PopupMenuProps:t,allowDragDrop:o,height:i,id:h,orientation:c,overflowIcon:p,overflowPosition:d,onMoveItem:s,onSwitchWrappedItemIntoView:l,children:r})})});var ya=require("@vuu-ui/vuu-utils"),Do=require("@vuu-ui/vuu-ui-controls"),_r=k(require("clsx")),Po=require("react");var So=require("react/jsx-runtime"),Ec=e=>{let t=e.cloneNode(!0);return t.id="",delete t.dataset.idx,t},Gr=(0,Po.memo)(({className:e,children:t,idx:o,resizeable:r,header:n,closeable:i,...a})=>(0,So.jsx)(Do.ListItem,{className:(0,_r.default)("vuuPaletteItem",e),"data-draggable":!0,"data-icon":"draggable",...a}));Gr.displayName="PaletteItem";var wa=({ListProps:e,ViewProps:t,children:o,className:r,itemHeight:n=41,orientation:i="horizontal",...a})=>{let s=le(),l="vuuPalette";function c(p){var M,T;let u=p.target.closest(".vuuPaletteItem"),m=parseInt((T=(M=u.dataset)==null?void 0:M.index)!=null?T:"-1"),{props:{caption:h,children:g,template:b,...f}}=o[m],{ViewProps:y}=g.props,{height:x,left:w,top:R,width:v}=u.getBoundingClientRect(),E=(0,ya.uuid)(),I=b?g:(0,So.jsx)(Ue,{...t,...{id:E,key:E},...f,...y,title:f.label,children:g});s({dragRect:{left:w,top:R,right:w+v,bottom:R+150,width:v,height:x},dragElement:Ec(u),evt:p.nativeEvent,instructions:{DoNotRemove:!0,DoNotTransform:!0,DriftHomeIfNoDropTarget:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},path:"*",payload:I,type:"drag-start"})}return(0,So.jsx)(Do.List,{...e,...a,className:(0,_r.default)(l,r,`${l}-${i}`),itemHeight:n,selected:null,children:o.map((p,d)=>p.type===Gr?(0,Po.cloneElement)(p,{key:d,onMouseDown:c}):p)})};N("Palette",wa,"view");var Lo=require("@vuu-ui/vuu-ui-controls"),xa=require("@vuu-ui/vuu-utils"),Ur=k(require("clsx")),fe=k(require("react"));var ct=require("react/jsx-runtime"),Kr="vuuTabs",Rc=()=>{},Tc=e=>{let t=[];return fe.default.Children.forEach(e,o=>{fe.default.isValidElement(o)?t.push(o):console.warn("Stack has unexpected child element type")}),t},Sc={allowAddTab:!1,allowCloseTab:!1,allowRenameTab:!1},Mo=(0,fe.forwardRef)(function({TabstripProps:t=Sc,active:o=0,children:r,className:n,getTabIcon:i=Rc,getTabLabel:a=Ve,id:s,keyBoardActivation:l="manual",onAddTab:c,onMoveTab:p,onTabClose:d,onTabEdit:u,onTabSelectionChanged:m,showTabs:h="top",style:g},b){var P;let f=(0,xa.useId)(s),y=(0,fe.useRef)([]),{allowCloseTab:x,allowRenameTab:w,className:R}=t,v=(0,fe.useCallback)((A,O,z,W)=>{u==null||u(W,O)},[u]),E=()=>{var A;return fe.default.isValidElement(r)?r:Array.isArray(r)&&(A=r[o])!=null?A:null},S=()=>Tc(r).map((A,O)=>{let{closeable:z=x,id:W=`${f}-${O}`,"data-tab-location":J}=A.props,pe=a(A,O,y.current);return y.current.push(pe),(0,ct.jsx)(Lo.Tab,{ariaControls:W,"data-icon":i(A,O),id:`${W}-tab`,index:O,label:pe,location:J,closeable:z,editable:w},W)}),I=E(),M=h==="left"||h==="right",T=M?"vertical":"horizontal";return(0,ct.jsxs)("div",{className:(0,Ur.default)(Kr,n,{[`${Kr}-horizontal`]:M}),style:g,id:f,ref:b,children:[h?(0,ct.jsx)(Lo.Tabstrip,{...t,activeTabIndex:(P=t==null?void 0:t.activeTabIndex)!=null?P:I===null?-1:o,allowDragDrop:t.allowDragDrop!==!1,animateSelectionThumb:!0,className:(0,Ur.default)("vuuTabHeader",R),"aria-label":"data tabs",keyBoardActivation:l,onActiveChange:m,onAddTab:c,onCloseTab:d,onExitEditMode:v,onMoveTab:p,orientation:T,children:S()}):null,(0,ct.jsx)("div",{"aria-labelledby":`${f}-${o}`,className:`${Kr}-tabPanel`,role:"tabpanel",children:I})]})});Mo.displayName="Stack";var Ea=require("@vuu-ui/vuu-utils"),ke=k(require("react"));var jr=require("react/jsx-runtime"),Dc=()=>(0,jr.jsx)(je,{resizeable:!0,style:{flexGrow:1,flexShrink:0,flexBasis:0}}),qr=e=>{var R;let t=(0,ke.useRef)(null),o=le(),{loadState:r}=We(),{createNewChild:n,id:i,onTabSelectionChanged:a,path:s,...l}=e,{children:c}=e,p=(0,Ea.useId)(i),[d]=St(p,t,s),u=gr(),m=(R=n!=null?n:u)!=null?R:Dc,h=v=>{s&&(o({type:"switch-tab",id:p,path:s,nextIdx:v}),a==null||a(v))},g=(0,ke.useCallback)(v=>{if(Array.isArray(c)){let{props:{"data-path":E,path:S=E}}=c[v];o({type:"remove",path:S})}},[c,o]),b=(0,ke.useCallback)(()=>{if(s){let v=ke.default.Children.count(c),E=m(v);o({type:"add",path:s,component:E})}},[c,m,o,s]),f=(0,ke.useCallback)((v,E)=>{s&&o({fromIndex:v,toIndex:E,path:s,type:"move-child"})},[o,s]);return(0,jr.jsx)(Mo,{...l,id:p,getTabLabel:(v,E,S)=>{let{id:I,title:M}=v.props;return r(I,"view-title")||M||Ve(v,E,S)},onMouseDown:async(v,E)=>{let S;await d({type:"mousedown",index:E,preDragActivity:async()=>new Promise(T=>{console.log("preDragActivity: Ok, gonna release the drag"),S=T})},v)&&(S==null||S(void 0))},onMoveTab:f,onAddTab:b,onTabClose:g,onTabEdit:(v,E)=>{o({type:"set-title",path:`${s}.${v}`,title:E})},onTabSelectionChanged:h,ref:t})};qr.displayName="Stack";N("Stack",qr,"container");var Ha=require("@vuu-ui/vuu-ui-controls"),za=require("@vuu-ui/vuu-utils"),Yr=k(require("clsx")),dt=k(require("react"));var Aa=require("@vuu-ui/vuu-utils"),pt=require("react");var Pa=require("@salt-ds/core"),Ae=require("@vuu-ui/vuu-utils"),$=require("react"),Z=require("@vuu-ui/vuu-utils");var Ra=require("@vuu-ui/vuu-utils"),Pc=(e,t)=>{if(e){let o=e.querySelector(`[data-index]:has(${t})`);return(0,Ra.getElementDataIndex)(o)}return-1};var Ta=e=>Pc(e,".vuuEditableLabel-editing");var La={horizontal:{[Z.Home]:"start",[Z.End]:"end",[Z.ArrowLeft]:"bwd",[Z.ArrowRight]:"fwd"},vertical:{[Z.Home]:"start",[Z.End]:"end",[Z.ArrowUp]:"bwd",[Z.ArrowDown]:"fwd"}},Ma=e=>e!==null&&e.dataset.index==="overflow",Lc=(e,t,o,r,n)=>{if(e){let i=t==="bwd"&&r>0,a=t==="fwd"&&r<o,s=i||a,l=At(e,r,!0),c=n&&!Da(l),p=!n&&Ma(l);return n&&Da(l),s&&(c||p)}else return!1},Mc=(e,t="horizontal")=>La[t][e]!==void 0,Cc=e=>e===Z.ArrowDown;function Sa(e,t,o){return t==="start"?0:t==="end"?e-1:t==="bwd"?o>0?o-1:o:o===null?0:o===e-1?o:o+1}var Da=e=>e!==null&&!e.classList.contains("wrapped"),Ca=e=>Array.from(e.querySelectorAll("[data-index]")),Ic=e=>e===null?-1:Ca(e).map(r=>r.dataset.index).indexOf("overflow"),At=(e,t,o=!1)=>{if(e!==null){let n=Ca(e)[t];return!o&&Ma(n)?null:n}return null},Ia=({containerRef:e,defaultHighlightedIdx:t=-1,highlightedIdx:o,onNavigateOutOfBounds:r,orientation:n})=>{let i=(0,$.useRef)(!1),a=(0,$.useRef)(-1),[s,l]=(0,$.useState)(!1),[c,p]=(0,Pa.useControlled)({controlled:o,default:t,name:"UseKeyboardNavigation"}),d=(0,$.useCallback)(T=>{p(a.current=T)},[p]),u=(0,$.useRef)(!1),m=(0,$.useCallback)((T,P=!1,A,O=70)=>{console.log(`focus item ${T}`),d(T),A===!0&&!u.current&&(u.current=!0);let z=()=>{let W=At(e.current,T,!0);if(W){let J=(0,Ae.getFocusableElement)(W);J==null||J.focus()}};P?z():setTimeout(z,O)},[e,d]),h=T=>{if(a.current===-1){if(T.target.tabIndex===0){let P=(0,Ae.getElementDataIndex)((0,Ae.getClosest)(T.target,"index"));d(P)}else if(T.target.tabIndex!==-1){let P=Ta(e.current);P!==-1&&requestAnimationFrame(()=>{d(P)})}}},g=(0,$.useCallback)(()=>{var T,P;return(P=(T=e.current)==null?void 0:T.querySelectorAll("[data-index]").length)!=null?P:0},[e]),b=(0,$.useCallback)((T="fwd",P)=>{var pe;let A=g(),O=typeof P=="number"?P:A,z=Sa(A,T,O),W=T==="start"?"fwd":T==="end"?"bwd":T,J=((pe=e.current)==null?void 0:pe.querySelector(".vuuOverflowContainer-wrapContainer-overflowed"))!=null;for(;Lc(e.current,W,A,z,J);){let ft=Sa(A,W,z);if(ft===z)return O;z=ft}return z},[e,g]),f=(0,$.useCallback)(T=>{let P=La[n][T.key],A=b(P,c);console.log(`highlightedIdx = ${c}, nextIdx = ${A} `),A!==c?m(A,!0):r==null||r(P==="bwd"?"start":"end")},[n,b,c,m,r]),y=(0,$.useCallback)(()=>{let T=At(e.current,c);return T?T.querySelector(".vuuPopupMenu")!=null:!1},[e,c]),x=(0,$.useCallback)(()=>{let T=At(e.current,c);return T?T.querySelector(".vuuEditableLabel-input")!=null:!1},[e,c]),w=(0,$.useCallback)(()=>{let T=At(e.current,c),P=T==null?void 0:T.querySelector(".vuuPopupMenu");return P&&(0,Ae.dispatchMouseEvent)(P,"click"),!1},[e,c]),R=(0,$.useCallback)(T=>{g()>0&&Mc(T.key,n)?(T.preventDefault(),u.current||(u.current=!0),f(T)):Cc(T.key)&&y()&&!x()&&w()},[w,g,y,x,f,n]),v=(T,P)=>{d(P)},E=(0,$.useCallback)(()=>{s||(l(!0),i.current?i.current=!1:u.current=!0)},[s]),S=(0,$.useCallback)(()=>{s||(i.current=!0),u.current=!1},[s]),I=(0,$.useCallback)(T=>{if((T==null?void 0:T.type)==="escape"){let P=Ic(e.current);P!==-1&&m(P)}},[e,m]);return{containerProps:{onBlur:T=>{let P=T.target.closest(".vuuToolbar"),A=T.relatedTarget;P&&!(P!=null&&P.contains(A))&&(d(-1),l(!1))},onMouseDownCapture:S,onFocus:E,onMouseLeave:()=>{u.current=!0,d(-1),i.current=!1}},focusVisible:u.current?c:-1,focusIsWithinComponent:s,highlightedIdx:c,focusableIdx:0,focusItem:m,onClick:v,onFocus:h,onKeyDown:R,onOverflowMenuClose:I,setHighlightedIdx:d}};var Ot=require("@vuu-ui/vuu-utils"),we=require("@vuu-ui/vuu-ui-controls"),ut=require("react"),kc=["Enter"," "],Ac={},ka=({containerRef:e,defaultSelected:t,highlightedIdx:o,itemQuery:r,onSelectionChange:n,selected:i,selectionStrategy:a})=>{let[s,l,c]=(0,we.useControlled)({controlled:i,default:t!=null?t:[],name:"useSelection",state:"selected"}),p=(0,ut.useCallback)(b=>kc.includes(b.key),[]),d=(0,ut.useCallback)((b,f=!1)=>{let y=(0,we.allowMultipleSelection)(a,f)?s.concat(b):[b];l(y),n==null||n(y)},[n,s,a,l]),u=(0,ut.useCallback)((b,f=!1)=>{let y=a==="deselectable"||a==="multiple-special-key"&&!f?[]:s.filter(x=>x!==b);l(y),n==null||n(y)},[n,s,a,l]),m=(0,ut.useCallback)(b=>{p(b)&&(0,Ot.isSelectableElement)(b.target)&&(s.includes(o)?(0,we.deselectionIsAllowed)(a)&&(b.stopPropagation(),b.preventDefault(),u(o,b.shiftKey)):(b.stopPropagation(),b.preventDefault(),d(o,b.shiftKey)))},[p,s,o,a,d,u]),h=(0,ut.useCallback)((b,f)=>{let y=(0,Ot.getClosestIndexItem)(b.target);(0,Ot.isSelectableElement)(y)&&(s.includes(f)?(0,we.deselectionIsAllowed)(a)&&u(f,b.shiftKey):d(f,b.shiftKey))},[u,d,s,a]),g=(0,we.selectionIsDisallowed)(a)?Ac:{onClick:h,onKeyDown:m};return{activateItem:d,itemHandlers:g,isControlled:c,selected:s}};var Oa=({activeItemIndex:e,defaultActiveItemIndex:t,containerRef:o,itemQuery:r="vuuToolbarItem",onActiveChange:n,onNavigateOutOfBounds:i,orientation:a,selectionStrategy:s})=>{let l=(0,pt.useRef)(e),{focusItem:c,highlightedIdx:p,onClick:d,onKeyDown:u,setHighlightedIdx:m,...h}=Ia({containerRef:o,onNavigateOutOfBounds:i,orientation:a}),{activateItem:g,itemHandlers:{onClick:b,onKeyDown:f},selected:y}=ka({containerRef:o,defaultSelected:t,highlightedIdx:p,itemQuery:r,onSelectionChange:n,selected:e,selectionStrategy:s});l.current=y;let x=(0,pt.useCallback)(E=>{var M;let I=E.target.closest("[data-index]");if(I){let T=parseInt((M=I.dataset.index)!=null?M:"-1");T!==-1&&(0,Aa.isValidNumber)(T)&&(d(E,T),b==null||b(E,T))}},[d,b]),w=(0,pt.useCallback)(E=>{u(E),E.defaultPrevented||f==null||f(E)},[u,f]),R=(0,pt.useCallback)(E=>{let S=parseInt(E.index);isNaN(S)||(g(S),c(S))},[c,g]),v={onClick:x,onFocus:h.onFocus,onKeyDown:w};return{activeItemIndex:y,focusableIdx:h.focusableIdx,focusVisible:h.focusVisible,containerProps:{PopupMenuProps:{onKeyDown:w,onMenuClose:h.onOverflowMenuClose},...h.containerProps,onSwitchWrappedItemIntoView:R},itemProps:v}};var Ba=require("react/jsx-runtime"),Ht="vuuToolbar",Oc=({activeItemIndex:e,alignItems:t="start",defaultActiveItemIndex:o,children:r,className:n,id:i,onActiveChange:a,onNavigateOutOfBounds:s,orientation:l="horizontal",selectionStrategy:c="none",showSeparators:p=!1,...d})=>{let u=(0,dt.useRef)(null),{activeItemIndex:m,focusableIdx:h,focusVisible:g,itemProps:b,...f}=Oa({activeItemIndex:e,defaultActiveItemIndex:o,containerRef:u,onActiveChange:a,onNavigateOutOfBounds:s,orientation:l,selectionStrategy:c}),y=(0,za.useId)(i),x=(0,dt.useMemo)(()=>Oe(r).map((w,R)=>{let{id:v=`${y}-tab-${R}`,className:E,...S}=w.props,I=m.includes(R);return dt.default.cloneElement(w,{...(0,Ha.forwardCallbackProps)(S,b),className:(0,Yr.default)("vuuToolbarItem",E),"data-overflow-priority":I?"1":void 0,id:v,key:R,"aria-selected":I,tabIndex:h===R?0:-1})}),[m,r,h,y,b]);return(0,Ba.jsx)(Vr,{...d,...f.containerProps,className:(0,Yr.default)(n,Ht,`${Ht}-${l}`,{[`${Ht}-alignCenter`]:t==="center",[`${Ht}-alignEnd`]:t==="end",[`${Ht}-withSeparators`]:p}),...d,ref:u,children:x})};var mt=k(require("react"));var Xe=require("react/jsx-runtime"),Hc=({children:e})=>{let[o,r]=(0,mt.useState)(e),[n,i]=(0,mt.useState)(e),a=l=>{let c=No(o,l);i(c)},s=(l,c)=>{console.log(`change ${l} -> ${c}`);let p=mt.default.cloneElement(n,{style:{...n.props.style,[l]:c}});i(p),r(mt.default.cloneElement(o,{},p))};return(0,Xe.jsxs)("div",{"data-design-mode":`${!1}`,children:[o,(0,Xe.jsx)("br",{}),(0,Xe.jsxs)("div",{style:{display:"flex"},children:[(0,Xe.jsx)(Zr,{height:300,managedStyle:n.props.style,width:300,onChange:s,style:void 0}),(0,Xe.jsx)(Xr,{layout:o,onSelect:a,style:{width:300,height:300,backgroundColor:"#ccc"}})]})]})};var he=require("@salt-ds/core"),H=require("react/jsx-runtime"),Qr={},zc={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"}},Jr=({feature:e,children:t,style:o,onChange:r})=>(0,H.jsxs)("div",{className:`LayoutBox layout-${e} layout-outer`,children:[(0,H.jsxs)("div",{className:"layout-top",children:[(0,H.jsx)("span",{className:"layout-title",children:e}),(0,H.jsx)(he.FormField,{className:"layout-input",style:{width:30},children:(0,H.jsx)(he.Input,{value:o.top,onChange:(n,i)=>r(e,"top",i)})})]}),(0,H.jsxs)("div",{className:"layout-inner",children:[(0,H.jsx)("div",{className:"layout-left",children:(0,H.jsx)(he.FormField,{className:"layout-input",style:{width:30},children:(0,H.jsx)(he.Input,{value:o.left,onChange:(n,i)=>r(e,"left",i)})})}),t,(0,H.jsx)("div",{className:"layout-right",children:(0,H.jsx)(he.FormField,{className:"layout-input",style:{width:30},children:(0,H.jsx)(he.Input,{value:o.right,onChange:(n,i)=>r(e,"right",i)})})})]}),(0,H.jsx)("div",{className:"layout-bottom",children:(0,H.jsx)(he.FormField,{className:"layout-input",style:{width:30},children:(0,H.jsx)(he.Input,{value:o.bottom,onChange:(n,i)=>r(e,"bottom",i)})})})]}),Bc={margin:!0,marginTop:!0,marginRight:!0,marginBottom:!0,marginLeft:!0},Nc={padding:!0,paddingTop:!0,paddingRight:!0,paddingBottom:!0,paddingLeft:!0},Fc={border:!0,borderColor:!0,borderWidth:!0,borderTopWidth:!0,borderRightWidth:!0,borderBottomWidth:!0,borderLeftWidth:!0},Co="(\\d+)(?:px)?",$c=`^(?:${Co}(?:\\s${Co}(?:\\s${Co}(?:\\s${Co})?)?)?)$`,Na=new RegExp($c),Wc=/^(?:(\d+)(?:px)\ssolid\s([a-zA-Z,0-9().]+))$/,Zr=({height:e,managedStyle:t,onChange:o,style:r,width:n})=>{let i=Fa(t),a=(x,w,R)=>{let v=parseInt(R||"0",10),E=zc[x][w];o(E,v)},{marginTop:s=0,marginRight:l=0,marginBottom:c=0,marginLeft:p=0}=i,{borderTopWidth:d=0,borderRightWidth:u=0,borderBottomWidth:m=0,borderLeftWidth:h=0}=i,{paddingTop:g=0,paddingRight:b=0,paddingBottom:f=0,paddingLeft:y=0}=i;return(0,H.jsx)("div",{className:"LayoutConfigurator",style:{width:n,height:e,...r},children:(0,H.jsx)(Jr,{feature:"margin",style:{top:s,right:l,bottom:c,left:p},onChange:a,children:(0,H.jsx)(Jr,{feature:"border",style:{top:d,right:u,bottom:m,left:h},onChange:a,children:(0,H.jsx)(Jr,{feature:"padding",style:{top:g,right:b,bottom:f,left:y},onChange:a,children:(0,H.jsx)("div",{className:"layout-content"})})})})})};function Vc(e=Qr,t=Qr){let{margin:o,marginTop:r,marginRight:n,marginBottom:i,marginLeft:a,padding:s,paddingTop:l,paddingRight:c,paddingBottom:p,paddingLeft:d,...u}=e;if(typeof o=="number")u.marginTop=u.marginRight=u.marginBottom=u.marginLeft=o;else if(typeof o=="string"){let m=Na.exec(o);if(m===null)console.error(`Invalid css value for margin '${o}'`);else{let[,h,g,b,f]=m,y=h&&g&&b;y&&f?(u.marginTop=parseInt(h,10),u.marginRight=parseInt(g,10),u.marginBottom=parseInt(b,10),u.marginLeft=parseInt(f,10)):y?(u.marginTop=parseInt(h,10),u.marginRight=u.marginLeft=parseInt(g,10),u.marginBottom=parseInt(b,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 r=="number"&&(u.marginTop=r),typeof n=="number"&&(u.marginRight=n),typeof i=="number"&&(u.marginBottom=i),typeof a=="number"&&(u.marginLeft=a),typeof s=="number")u.paddingTop=u.paddingRight=u.paddingBottom=u.paddingLeft=s;else if(typeof s=="string"){let m=Na.exec(s);if(m===null)console.error(`Invalid css value for padding '${s}'`);else{let[,h,g,b,f]=m,y=h&&g&&b;y&&f?(u.paddingTop=parseInt(h,10),u.paddingRight=parseInt(g,10),u.paddingBottom=parseInt(b,10),u.paddingLeft=parseInt(f,10)):y?(u.paddingTop=parseInt(h,10),u.paddingRight=u.paddingLeft=parseInt(g,10),u.paddingBottom=parseInt(b,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 d=="number"&&(u.paddingLeft=d),Fa(u,t)}function Fa(e=Qr){let t={...e},o,{border:r,borderWidth:n,borderTopWidth:i,borderRightWidth:a,borderBottomWidth:s,borderLeftWidth:l,borderColor:c,margin:p,marginTop:d,marginRight:u,marginBottom:m,marginLeft:h,padding:g,paddingTop:b,paddingRight:f,paddingBottom:y,paddingLeft:x,...w}=t,R={},v={};if(typeof p=="number"&&(t.marginTop=t.marginRight=t.marginBottom=t.marginLeft=p,R={marginTop:p,marginRight:p,marginBottom:p,marginLeft:p}),typeof g=="number"&&(t.paddingTop=t.paddingRight=t.paddingBottom=t.paddingLeft=g,v={paddingTop:g,paddingRight:g,paddingBottom:g,paddingLeft:g}),r||n||i||a||s||l){typeof r=="string"&&(o=Wc.exec(r))&&([,n,c]=o,n=parseInt(n,10)),n&&(i=i===void 0?n:i,a=a===void 0?n:a,s=s===void 0?n:s,l=l===void 0?n:l),c=c||"black";let E=`
|
|
18
|
-
${c} ${l||0}px ${
|
|
19
|
-
${c} ${-
|
|
17
|
+
`,document.body.insertBefore(t,e)}}var tt=class{constructor(){this.currentPath=null;this.tabMode=null;ya()}prepare(t,o="full-view"){document.body.classList.add("drawing"),this.currentPath=null,this.tabMode=o;let r=this.getPoints(0,0,0,0),n=Gr(r),a=document.getElementById("vuu-drop-outline");a==null||a.setAttribute("d",n),this.currentPath=n}clear(){et=null,Et(),document.body.classList.remove("drawing"),Rt.PopupService.hidePopup()}get hoverDropTarget(){return et}getPoints(t,o,r,n,a=0,i=0,s=0){let l=this.tabMode==="tab-only";if(i===0)return[[t,o+s],[t,o+s],[t,o],[t+i,o],[t+i,o],[t+r,o],[t+r,o+n],[t,o+n]];if(l){let c=a;return[[c,o],[c,o],[c+i,o],[c+i,o],[c+i,o+s],[c+i,o+s],[c,o+s],[c,o+s]]}else return a===0?[[t,o+s],[t,o+s],[t,o],[t+i,o],[t+i,o+s],[t+r,o+s],[t+r,o+n],[t,o+n]]:[[t,o+s],[t+a,o+s],[t+a,o],[t+a,o],[t+a,o+s],[t+r,o+s],[t+r,o+n],[t,o+n]]}draw(t,o){let n=vo;if(et!==null)this.drawTarget(et);else if(vo=t.nextDropTarget!=null,t.pos.tab?ba(t):re&&Et(),this.drawTarget(t,o),vo){let[a,i,s]=bo(t);{let l=(0,Jr.jsx)(xo,{dropTarget:t,onHover:ma,orientation:s});Rt.PopupService.showPopup({left:a,top:i,component:l})}}else Rt.PopupService.hidePopup()}drawTarget(t,o){let n=t.getTargetDropOutline(6,o);if(n){let{l:a,t:i,r:s,b:l,tabLeft:c,tabWidth:u,tabHeight:d,guideLines:p}=n,m=s-a,h=l-i;if(this.currentPath){let R=document.getElementById("vuu-drop-outline");R==null||R.setAttribute("d",this.currentPath)}let g=this.getPoints(a,i,m,h,c,u,d),y=Gr(g),f=document.getElementById("hw-drop-outline-animate");f==null||f.setAttribute("to",y),f==null||f.beginElement(),this.currentPath=y;let x=document.getElementById("hw-drop-guides");x==null||x.setAttribute("d",ga(p))}}},Wr="transition:margin-left .4s ease-out;margin-left: 63px",Ur="transition:margin-left .4s ease-out;margin-left: 0px";function ba(e){var s,l;let{AFTER:t,BEFORE:o}=Ke,{clientRect:{Stack:r},pos:{tab:n}}=e,{id:a}=e.component.props,i=null;if(r&&n&&n.positionRelativeToTab!==t){let c=n.positionRelativeToTab===o?1:2,u=`:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${n.index+c})`;i=(s=document.getElementById(a))==null?void 0:s.querySelector(u),i?(re===null||re!==i)&&(i.style.cssText=Wr,re&&(re.style.cssText=Ur),re=i):Et()}else if((n==null?void 0:n.positionRelativeToTab)===o){if(re===null){let c=".vuuHeader-title";i=(l=document.getElementById(a))==null?void 0:l.querySelector(c),i.style.cssText=Wr,re=i}}else Et()}function Et(){re&&(re.style.cssText=Ur,re=null)}var ue,ot,ge,Zr,Xr,Ce,Dt,Me=null,Ro,jr,Tt,qr,wo,St=null,xa=3,Pt=new tt,Yr=.4;function va(e,t){return t?F(e,t):se(e,o=>o.dropTarget)}var Mt={handleMousedown(e,t,o={}){ue=t,jr=o,Zr=e.clientX,Xr=e.clientY,wo=o.dragThreshold===void 0?xa:o.dragThreshold,wo===0?ue(e,0,0):(window.addEventListener("mousemove",Lt,!1),window.addEventListener("mouseup",Ct,!1),St=window.setTimeout(()=>{window.removeEventListener("mousemove",Lt,!1),window.removeEventListener("mouseup",Ct,!1),ue==null||ue(e,0,0)},500)),e.preventDefault()},initDrag(e,t,{top:o,left:r,right:n,bottom:a},i,s,l,c){return{drag:ot,drop:ge}=s,wa(e,t,{top:o,left:r,right:n,bottom:a},i,l,c)}};function Lt(e){let r=e.clientX-Zr,n=e.clientY-Xr;Math.max(Math.abs(r),Math.abs(n))>wo&&(window.removeEventListener("mousemove",Lt,!1),window.removeEventListener("mouseup",Ct,!1),ue==null||ue(e,r,n),ue=null)}function Ct(){St&&(window.clearTimeout(St),St=null),window.removeEventListener("mousemove",Lt,!1),window.removeEventListener("mouseup",Ct,!1)}function wa(e,t,o,r,n,a){Ce=va(e,t);let{"data-path":i,path:s=i}=D(Ce);a&&(Ro=a.map(p=>se(e,m=>m.id===p)).map(p=>p.props.path)),Tt=Ve.measure(Ce,a);let l=Tt[s];Dt=new vt(l,r.x,r.y,o,n);let c=Math.round(Dt.x.mousePct*100),u=Math.round(Dt.y.mousePct*100);return window.addEventListener("mousemove",Qr,!1),window.addEventListener("mouseup",en,!1),window.addEventListener("keydown",Kr,!1),qr=!1,Pt.prepare(o,"tab-only"),jr.DoNotTransform?"transform:none":`transform:scale(${Yr},${Yr});transform-origin:${c}% ${u}%;`}function Qr(e){let t=e.clientX,o=e.clientY,r=Dt,n=Me,a,i,s;r.update("x",t)&&(i=r.x.pos),r.update("y",o)&&(s=r.y.pos),i===void 0&&s===void 0||ot==null||ot(i,s),!(qr||Ce===void 0)&&(r.inBounds()?a=wt(t,o,Ce,Tt,r.hasIntrinsicSize(),Ro):a=wt(r.dropX(),r.dropY(),Ce,Tt),n&&(a==null||a.box!==n.box)&&(Me=null),a&&(Pt.draw(a,r),Me=a))}function Kr(e){e.key==="Escape"&&(Me=null,tn())}function en(){tn()}function tn(){if(Me){let e=Pt.hoverDropTarget||Le.getActiveDropTarget(Me);ge==null||ge(e),Me=null}else ge==null||ge();ot=null,ge=null,Ce=void 0,Pt.clear(),Ro=void 0,window.removeEventListener("mousemove",Qr,!1),window.removeEventListener("mouseup",en,!1),window.removeEventListener("keydown",Kr,!1)}var on=C(require("clsx")),rn=require("react");var an=require("react/jsx-runtime"),Eo=(0,rn.forwardRef)(function({children:t,className:o,dropTarget:r,resizeable:n,...a},i){let s=(0,on.default)("DraggableLayout",o);return(0,an.jsx)("div",{className:s,ref:i,...a,children:t})}),nn="DraggableLayout";Eo.displayName=nn;N(nn,Eo,"container");var ni=require("@salt-ds/core"),ii=C(require("clsx")),ai=require("react");var oi=require("@vuu-ui/vuu-utils"),B=C(require("react"));var Xn=C(require("clsx"));var Yn=require("@salt-ds/core"),Gt=require("react");var we=require("react");var W=require("react");var So=require("@vuu-ui/vuu-utils"),To=C(require("react"));var Ra={"data-placeholder":!0,"data-resizeable":!0},kt={},ye="auto",Do={flexBasis:0,flexGrow:1,flexShrink:1,height:ye,width:ye},sn={height:"width",width:"height"},Po=(e="row")=>e==="row"?["width","height","column"]:["height","width","row"],Ea=e=>typeof e=="string"&&e.endsWith("%"),Z=e=>{let{style:{width:t=ye,height:o=ye}=kt}=e.props,r=typeof o=="number",n=typeof t=="number";return r&&n?{height:o,width:t}:r?{height:o}:n?{width:t}:void 0};function At(e,t,o){let r=sn[t],{style:{[r]:n=ye,...a}=kt}=e.props;return o&&o[t]?{...a,...Do,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...a,...Do,[r]:n}}function Lo(e){let{style:{flex:t,flexGrow:o,flexShrink:r,flexBasis:n}=kt}=e.props;return typeof t=="number"||n===0&&o===1&&r===1?!0:typeof n!="number"}function zt(e,t,o){let r=sn[t],{style:{[t]:n=ye,[r]:a=ye,...i}=kt}=e.props;return n!==ye?Ea(n)?{flexBasis:0,flexGrow:1,flexShrink:1,[t]:void 0,[r]:a}:{flexBasis:n,flexGrow:0,flexShrink:0,[t]:n,[r]:a}:o&&o[t]?{...i,...Do,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...i,[r]:a}}function _e(e,t,o,r,n){let a=[],i=0,s;if(r&&n){let u,[d,p,m,h]=n;[u,s]=t==="column"?[p-r.top,r.bottom-h]:[d-r.left,r.right-m],u&&a.push(te(`${o}.${i++}`,u,{flexGrow:0,flexShrink:0}))}else s=!0;let{version:l=0,style:c}=D(e);return a.push(H(e,`${o}.${i++}`,{version:l+1,style:{...c,flexBasis:"auto",flexGrow:0,flexShrink:0}})),s&&a.push(te(`${o}.${i++}`,0,void 0,{[`data-${t}-placeholder`]:!0})),It(t,{resizeable:!1,style:{flexBasis:"auto"}},a,o)}var Da=(e,t)=>{if(!t)return e===0?1:0};function It(e,t,o,r){let n=(0,So.uuid)(),{flexFill:a,style:i,resizeable:s=!0}=t,{flexBasis:l=a?void 0:"auto"}=i,c=Da(l,a);return To.default.createElement(me.Flexbox,{id:n,key:n,path:r,flexFill:a,style:{...i,flexDirection:e,flexBasis:l,flexGrow:c,flexShrink:c},resizeable:s},o)}var Sa={flexGrow:1,flexShrink:1};function te(e,t,o,r){let n=(0,So.uuid)();return To.default.createElement("div",{...Ra,...r,"data-path":e,id:n,key:n,style:{...Sa,...o,flexBasis:t}})}var $t=C(require("react"));var Fo=require("@vuu-ui/vuu-utils"),We=C(require("react"));var zo=require("@vuu-ui/vuu-utils"),be=C(require("react"));var ke=require("react"),_=new Map,oe=new Map,Co=e=>_.get(e),Mo=e=>_.has(e),ko=(e,t)=>_.set(e,t),Ae=()=>{let e=(0,ke.useCallback)((i,s)=>{let l=oe.get(i);if(l)return s!==void 0&&l[s]!==void 0?l[s]:s!==void 0?void 0:l},[]),t=(0,ke.useCallback)((i,s,l)=>{if(s===void 0)oe.set(i,l);else if(oe.has(i)){let c=oe.get(i);oe.set(i,{...c,[s]:l})}else oe.set(i,{[s]:l})},[]),o=(0,ke.useCallback)((i,s)=>{if(oe.has(i)){if(s===void 0)oe.delete(i);else if(oe.get(i)[s]){let{[s]:c,...u}=oe.get(i);Object.keys(u).length>0?oe.set(i,u):oe.delete(i)}}},[]),r=(0,ke.useCallback)((i,s)=>{let l=_.get(i);if(l)return s!==void 0?l[s]:l},[]),n=(0,ke.useCallback)((i,s,l)=>{if(s===void 0)_.set(i,l);else if(_.has(i)){let c=_.get(i);_.set(i,{...c,[s]:l})}else _.set(i,{[s]:l})},[]),a=(0,ke.useCallback)((i,s)=>{if(_.has(i)){if(s===void 0)_.delete(i);else if(_.get(i)[s]){let{[s]:c,...u}=_.get(i);Object.keys(u).length>0?_.set(i,u):_.delete(i)}}},[]);return{loadSessionState:e,loadState:r,saveSessionState:t,saveState:n,purgeState:a,purgeSessionState:o}};var Io=e=>e.flexDirection==="column"?["height","width"]:["width","height"],Ta={},Ge=(e,t="0")=>{let[o,r]=Ot(S(e),e.props,t);return be.default.cloneElement(e,o,r)},Bt=(e,t)=>{let o=S(e),[r,n]=Ot(o,e.props,"0",void 0,t);return(0,be.cloneElement)(e,r,n)},Pa=(e,t,o)=>{let[r,n]=Ot(e,t,"0",void 0,o);return{...t,...r,type:e,children:n}};function La(e,t,o="0",r=null,n){var g,y;let{active:a=0,"data-path":i,path:s=i,id:l,style:c}=D(n),u=S(n)===e&&o===s,d=u?l:(g=t.id)!=null?g:(0,zo.uuid)(),p=e==="Stack"?(y=t.active)!=null?y:a:void 0,m=d,h=u?c:Ma(e,t,r);return ro(e)?{id:d,key:m,path:o,style:h,type:e,active:p}:{id:d,key:m,style:h,"data-path":o}}function Ot(e,t,o,r=null,n){var c,u;let a=La(e,t,o,r,n);if(t.layout&&!n)return[a,[xe(t.layout,`${o}.0`)]];let i=(u=n==null?void 0:n.children)!=null?u:(c=n==null?void 0:n.props)==null?void 0:c.children,l=t.dropTarget&&i?i:Ca(e,t.children,o,i);return[a,l]}function Ca(e,t,o="0",r){let n=Array.isArray(t)?t:be.default.isValidElement(t)?[t]:[];return V(e)?n.map((a,i)=>{let s=S(a),l=S(r==null?void 0:r[i]);if(!l||s===l){let[c,u]=Ot(s,a.props,`${o}.${i}`,e,r==null?void 0:r[i]);return be.default.cloneElement(a,c,u)}return r==null?void 0:r[i]}):t}var Ma=(e,t,o)=>{let{style:r=Ta}=t;if(e==="Flexbox"&&(r={flexDirection:t.column?"column":"row",...r,display:"flex"}),r.flex){let{flex:n,...a}=r;r={...a,...xt(typeof n=="number"?n:0)}}else o==="Stack"?r={...r,...xt(1)}:o==="Flexbox"&&(r.width||r.height)&&r.flexBasis===void 0&&(r={...r,flexBasis:"auto",flexGrow:0,flexShrink:0});return r};function xe({id:e=(0,zo.uuid)(),type:t,children:o,props:r,state:n},a){let i=t.match(/^[a-z]/)?t:me[t];if(i===void 0)throw Error(`layoutUtils unable to create component from JSON, unknown type ${t}`);return n&&ko(e,n),be.default.createElement(i,{id:e,...r,key:e,path:a},o?o.map((s,l)=>xe(s,`${a}.${l}`)):void 0)}function Bo(e){return Oo(e)}function Oo(e){let t=S(e),{id:o,children:r,type:n,...a}=D(e),i=Mo(o)?Co(o):void 0;return{id:o,type:t,props:ln(a),state:i,children:be.default.Children.map(r,Oo)}}function ln(e){if(e){let{path:t,...o}=e,r={};for(let[n,a]of Object.entries(o))r[n]=Ao(a);return r}}function Ao(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(Ao);if(typeof e=="object"&&e!==null){let t={};for(let[o,r]of Object.entries(e))t[o]=Ao(r);return t}}var No=(e,t,o)=>{if(t&&o){let r=K(o,t);if(r){let{id:n}=D(r),a=S(r);return{parentContainerId:n,parentContainerType:a}}return{parentContainerType:"Stack",parentContainerId:"blah"}}},ze=(e,t,o=[])=>{var n,a,i;let r=(i=(n=e.props)==null?void 0:n.title)!=null?i:(a=e.props)==null?void 0:a["data-tab-title"];if(r)return r;{let s=t;do r=`Tab ${++s}`;while(o.includes(r));return r}};function cn(e,t){var i;let o=e.props.children,r=o.length,{index:n=-1,positionRelativeToTab:a="after"}=t.tab||{};return n===-1||n>=r?[o[r-1],"after"]:[(i=o[n])!=null?i:null,a]}function Nt(e,t,o){let{active:r,children:n=[],path:a}=D(e),i=P(t,"path"),{idx:s,finalStep:l}=ee(a,i,!0),[c,u]=l?za(e,n,o):[r,n==null?void 0:n.map((p,m)=>m===s?Nt(p,t,o):p)],d=S(e)==="Stack"?Array.isArray(c)?c[0]:c:r;return We.default.cloneElement(e,{active:d},u)}var ka=(e,t,o,r)=>e==="Stack"?ze(t,o,r):void 0,Aa=e=>e.map(t=>t.props.title);function za(e,t,o){let r=P(e,"path"),n=t==null?void 0:t.length,{id:a=(0,Fo.uuid)(),title:i=ka(S(e),o,n!=null?n:0,Aa(t))}=D(o);return n?[n,t.concat(H(o,`${r}.${n}`,{id:a,key:a,title:i}))]:[0,[H(o,`${r}.0`,{id:a,title:i})]]}function Ft(e,t,o,r,n,a,i){let{active:s,children:l,path:c}=D(e),u=P(t,"path"),{idx:d,finalStep:p}=ee(c,u),[m,h]=p?Ia(e,l,d,o,r,n,a,i):[s,l.map((y,f)=>f===d?Ft(y,t,o,r,n,a,i):y)],g=S(e)==="Stack"?m:s;return We.default.cloneElement(e,{active:g},h)}function Ia(e,t,o,r,n,a,i,s){let l=Z(r);return l!=null&&l.width&&(l!=null&&l.height)?Oa(e,t,o,r,n,i,s):un(e,t,o,r,n,(a==null?void 0:a.width)||(a==null?void 0:a.height),i)}var Ba=(e,t,{top:o,right:r,bottom:n,left:a},[i,s,l,c])=>{if(e==="column"&&t==="before")return s-o;if(e==="column")return n-c;if(e==="row"&&t==="before")return i-a;if(e==="row")return r-l};function Oa(e,t,o,r,n,a,i){let{style:{flexDirection:s}}=D(e),[l,c,u]=Po(s),{[c]:d,[l]:p}=Z(r),m=P(t[o],"path"),h=Ba(s,n,a,i),[g,y]=d<a[c]?[_e(r,u,m,a,i),p]:[r,void 0],f=h?te(m,h,{flexGrow:0,flexShrink:0}):void 0;return d>a[c]&&(t=t.map(x=>{if(P(x,"placeholder"))return x;{let{[c]:R}=Z(x);return R&&R<d?_e(x,u,P(x,"path")):x}})),un(e,t,o,g,n,y,a,f)}function un(e,t,o,r,n,a,i,s){let l=P(e,"path"),c=0,u=!t||t.length===0?[r]:t.reduce((d,p,m)=>{if(o===m){let[h,g]=Na(e,p,r,i);n==="before"?s?d.push(s,g,h):d.push(g,h):s?d.push(h,g,s):d.push(h,g),c=d.indexOf(g)}else d.push(p);return d},[]).map((d,p)=>p<c?d:H(d,`${l}.${p}`));return[c,u]}function Na(e,t,o,r){let n=(0,Fo.uuid)(),{version:a=0}=D(o);if(a+=1,S(e)==="Flexbox"){let[i]=Io(e.props.style),s=6,l={[i]:(r[i]-s)/2},c=zt(t,i,l),u=zt(o,i,l);return[We.default.cloneElement(t,{style:c}),We.default.cloneElement(o,{id:n,version:a,style:u})]}else{let{style:{left:i,top:s,flex:l,...c}={left:void 0,top:void 0,flex:void 0}}=D(o);return[t,We.default.cloneElement(o,{id:n,version:a,style:{...c,flex:"1 1 0px"}})]}}var dn=require("react");var rt=C(require("react"));var Ie={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",LAYOUT_RESIZE:"layout-resize",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"};function pn(e,{target:t,replacement:o}){return Ho(e,t,o)}function Ho(e,t,o){let r=P(t,"path"),n=P(t,"resizeable"),{style:a}=D(t),i=Ge(rt.default.cloneElement(o,{resizeable:n,style:{...a,...o.props.style}}),r);return G(e,t,i)}function G(e,t,o,r){if(e===t)return o;let{idx:n,finalStep:a}=ee(P(e,"path"),P(t,"path")),i=e.props.children.slice();return a?r?r===Ie.MINIMIZE?i[n]=Fa(e,i[n]):r===Ie.RESTORE&&(i[n]=Ha(i[n])):i[n]=o:i[n]=G(i[n],t,o,r),rt.default.cloneElement(e,void 0,i)}function Fa(e,t){let{style:o}=D(e),{style:r}=D(t),{width:n,height:a,flexBasis:i,flexShrink:s,flexGrow:l,...c}=r,u={width:n,height:a,flexBasis:i,flexShrink:s,flexGrow:l},d={...c,flexBasis:0,flexGrow:0,flexShrink:0},p=o.flexDirection==="row"?"vertical":o.flexDirection==="column"?"horizontal":!1;return p?rt.default.cloneElement(t,{collapsed:p,restoreStyle:u,style:d}):t}function Ha(e){let{style:t,restoreStyle:o}=D(e),{flexBasis:r,flexShrink:n,flexGrow:a,...i}=t,s={...i,...o};return rt.default.cloneElement(e,{collapsed:!1,style:s,restoreStyle:void 0})}function mn(e,{fromIndex:t,path:o,toIndex:r}){let n=F(e,o,!0),{children:a}=D(n),i=$a(a,t,r),s=(0,dn.cloneElement)(n,void 0,i);return G(e,n,s)}function $a(e,t,o){let r=e.slice(),[n]=r.splice(t,1);return o===-1?r.concat(n):(r.splice(o,0,n),r)}var $={ADD:"add",DRAG_START:"drag-start",DRAG_DROP:"drag-drop",LAYOUT_RESIZE:"layout-resize",MAXIMIZE:"maximize",MINIMIZE:"minimize",MOVE_CHILD:"move-child",QUERY:"query",REMOVE:"remove",REPLACE:"replace",RESTORE:"restore",SAVE:"save",SET_PROP:"set-prop",SET_PROPS:"set-props",SET_TITLE:"set-title",SPLITTER_RESIZE:"splitter-resize",SWITCH_TAB:"switch-tab",TEAROUT:"tearout"},Va=e=>["switch-active-layout","open-layout","close-layout","rename-layout"].includes(e),_a=e=>["switch-active-tab","edit-feature-title","save-feature-props","remove-component","resize-component","drag-drop-operation"].includes(e);var ve=C(require("react"));function $o(e,{path:t}){let o=F(e,t),r=K(e,t);if(r===null)return e;let{children:n}=D(r);if(n.length>1&&S(r)!=="Stack"&&hn(n,t)){let{style:{flexBasis:a,display:i,flexDirection:s,...l}}=D(r),c=P(r,"path"),u=G(e,r,te(c,a,l));for(;(r=K(u,c))&&P(r,"path")!=="0";){let{children:d}=D(r);if(hn(d)){c=P(r,"path");let{style:{flexBasis:p,display:m,flexDirection:h,...g}}=D(r);u=G(e,r,te(c,p,g))}else if(Ja(d))u=bn(e,r);else break}return u}return gn(e,o)}function gn(e,t){let o=D(e),{children:r,path:n,preserve:a}=o,{active:i,id:s}=o,{idx:l,finalStep:c}=ee(n,P(t,"path")),u=S(e),d=r.slice();if(c){if(d.splice(l,1),i!==void 0&&i>=l&&(i=Math.max(0,i-1)),d.length===0&&a&&u==="Stack"){let{path:p,style:{flexBasis:m}}=D(t),h=s==="main-tabs"?xe({props:{style:{flexGrow:1,flexShrink:1,flexBasis:m},title:"Tab 1"},type:"Placeholder"},p):te(p,m);d.push(h)}else if(d.length===1&&!a&&n!=="0"&&u.match(/Flexbox|Stack/))return Ga(e,d[0]);!d.some(Wa)&&d.some(yn)&&(d=Ua(d))}else d[l]=gn(d[l],t);return d=d.map((p,m)=>H(p,`${n}.${m}`)),ve.default.cloneElement(e,{active:i},d)}function Ga(e,t){let o=S(e),{path:r,style:{flexBasis:n,flexGrow:a,flexShrink:i,width:s,height:l}}=D(e),c=H(t,r);if(r==="0")c=ve.default.cloneElement(c,{style:{...t.props.style,width:s,height:l}});else if(o==="Flexbox"){let u=e.props.style.flexDirection==="column"?"height":"width",{style:{[u]:d,...p}}=c.props;c=ve.default.cloneElement(c,{flexFill:void 0,style:{...p,flexGrow:a,flexShrink:i,flexBasis:n,width:s,height:l}})}return c}var Wa=e=>e.props.style.flexGrow>0,yn=e=>{let{width:t,height:o,flexGrow:r}=e.props.style;return r===0&&typeof t!="number"&&typeof o!="number"},Ua=e=>e.map(t=>yn(t)?ve.default.cloneElement(t,{style:{...t.props.style,flexGrow:1}}):t),Ja=e=>{if(e&&e.length>0){let t=P(e[0],"placeholder"),o=!1;for(let r=1;r<e.length;r++){if(o=P(e[r],"placeholder"),t&&o)return!0;t=o}}},bn=(e,t)=>{let{children:o,path:r}=D(e),{idx:n,finalStep:a}=ee(r,P(t,"path")),i=o.slice();return a?i[n]=Ya(t):i[n]=bn(i[n],t),i=i.map((s,l)=>H(s,`${r}.${l}`)),ve.default.cloneElement(e,void 0,i)},Ya=e=>{let{children:t}=D(e),o=[],r=[];for(let a=0;a<t.length;a++)P(t[a],"placeholder")?r.push(t[a]):(r.length===1?o.push(r.pop()):r.length>0&&(o.push(fn(r)),r.length=0),o.push(t[a]));r.length===1?o.push(r.pop()):r.length>0&&o.push(fn(r));let n=P(e,"path");return ve.default.cloneElement(e,void 0,o.map((a,i)=>H(a,`${n}.${i}`)))},fn=([e,...t])=>{let o=P(e,"style"),{flexBasis:r,flexGrow:n,flexShrink:a}=o;for(let{props:{style:i}}of t)r+=i.flexBasis,n=Math.max(n,i.flexGrow),a=Math.max(a,i.flexShrink);return ve.default.cloneElement(e,{style:{...o,flexBasis:r,flexGrow:n,flexShrink:a}})},hn=(e,t)=>e.every(o=>P(o,"placeholder")||t&&P(o,"path")===t);var Ht=C(require("react"));function xn(e,{path:t,size:o}){let r=F(e,t,!0),{style:n}=D(r),a={...n,width:o},i=Ht.default.cloneElement(r,{style:a});return G(e,r,i)}function vn(e,{path:t,sizes:o}){let r=F(e,t,!0),{children:n,style:a}=D(r),i=a.flexDirection==="column"?"height":"width",s=Za(n,o,i),l=Ht.default.cloneElement(r,void 0,s);return G(e,r,l)}function Za(e,t,o){return e.map((r,n)=>{let{style:{[o]:a,flexBasis:i}}=D(r),s=t[n],{currentSize:l,flexBasis:c}=s,d=l!==void 0?s.currentSize:c;return d===void 0||a===d||i===d?r:Ht.default.cloneElement(r,{style:Xa(r.props.style,o,d)})})}function Xa(e,t,o){let r=typeof e[t]=="number",{flexShrink:n=1,flexGrow:a=1}=e;return{...e,[t]:r?o:"auto",flexBasis:r?"auto":o,flexShrink:n,flexGrow:a}}var wn=require("@vuu-ui/vuu-utils"),nt=C(require("react"));var Rn=e=>{let[t]=S(e);return t===t.toLowerCase()};function it(e,t,o,r,n,a){let{children:i,path:s}=D(e),l=P(t,"path"),{idx:c,finalStep:u}=ee(s,l),d=u?ja(e,i,t,o,r,n,a):i.map((p,m)=>m===c?it(p,t,o,r,n,a):p);return nt.default.cloneElement(e,void 0,d)}function ja(e,t,o,r,n,a,i){let s=Z(r);if(s!=null&&s.width&&(s!=null&&s.height)){if(a===void 0||i===void 0)throw Error("wrap-layout-element, updateChildren clientRect and dropRect must both be available");return Qa(t,o,r,n,a,i)}return qa(e,t,o,r,n)}function qa(e,t,o,r,n){var v;let{version:a=0}=D(r),{path:i,title:s}=D(o),{type:l,flexDirection:c,showTabs:u}=Dn(n),[d,p,m]=Ka(l,o,r,c,n),h=En(n),g=h?1:0,y={resizeable:!0,style:m,version:a+1},x={[Rn(o)?"data-resizeable":"resizeable"]:!0,style:p},R=l==="Stack"?{showTabs:u}:void 0,w=l==="Flexbox"?{splitterSize:(v=S(e)==="Flexbox"&&e.props.splitterSize)!=null?v:void 0}:void 0,E=(0,wn.uuid)(),b=nt.default.createElement(me[l],{active:g,id:E,key:E,path:P(o,"path"),flexFill:P(o,"flexFill"),...w,...R,style:d,title:s,resizeable:P(o,"resizeable")},h?[H(o,`${i}.0`,x),Ge(nt.default.cloneElement(r,y),`${i}.1`)]:[Ge(nt.default.cloneElement(r,y),`${i}.0`),H(o,`${i}.1`,x)]);return t.map(T=>T===o?b:T)}function Qa(e,t,o,r,n,a){let{flexDirection:i}=Dn(r),s=i==="column"?"row":"column",l=En(r),[c,u,d,p]=a,[m,h]=i==="column"?[u-n.top,n.bottom-p]:[c-n.left,n.right-d],g=P(t,"path"),y=0,f=Rn(t)?"data-resizeable":"resizeable",x=[];m&&x.push(l?H(t,`${g}.${y++}`,{[f]:!0,style:{flexBasis:m,flexGrow:1,flexShrink:1}}):te(`${g}.${y++}`,m,{flexGrow:0,flexShrink:0})),x.push(_e(o,s,`${g}.${y++}`,n,a)),h&&x.push(l?te(`${g}.${y++}`,0):H(t,`${g}.${y++}`,{[f]:!0,style:{flexBasis:0,flexGrow:1,flexShrink:1}}));let R=It(i,t.props,x,g);return e.map(w=>w===t?R:w)}function Ka(e,t,o,r,n){let a={...t.props.style,flexDirection:r},i=e==="Flexbox"&&r==="column"?"height":"width",s=At(o,i,n),l=At(t,i);return[a,l,s]}var En=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 Dn(e){return e.position.Header?{type:"Stack",flexDirection:"column",showTabs:!0}:{type:"Flexbox",flexDirection:e.position.EastOrWest?"row":"column"}}var Vo=(e,t)=>{switch(t.type){case $.ADD:return ns(e,t);case $.DRAG_DROP:return rs(e,t);case $.MAXIMIZE:return os(e,t);case $.REMOVE:return $o(e,t);case $.REPLACE:return pn(e,t);case $.SET_PROP:return Sn(e,t);case $.SET_PROPS:return ts(e,t);case $.SET_TITLE:return Sn(e,{type:"set-prop",path:t.path,propName:"title",propValue:t.title});case $.SPLITTER_RESIZE:return vn(e,t);case $.LAYOUT_RESIZE:return xn(e,t);case $.SWITCH_TAB:return es(e,t);case $.MOVE_CHILD:return mn(e,t);default:return e}},es=(e,{path:t,nextIdx:o})=>{let r=F(e,t,!0),n=$t.default.cloneElement(r,{active:o});return G(e,r,n)},Sn=(e,{path:t,propName:o,propValue:r})=>{let n=F(e,t,!0),a=$t.default.cloneElement(n,{[o]:r});return G(e,n,a)},ts=(e,{path:t,props:o})=>{let r=F(e,t,!0),n=$t.default.cloneElement(r,o);return G(e,r,n)},os=(e,{path:t,type:o})=>{if(t){let r=F(e,t,!0);return G(e,r,r,o)}else return e},rs=(e,t)=>{var h,g;let{draggedReactElement:o,dragInstructions:r,dropTarget:n}=t,a=n.component,{pos:i}=n,s=((h=i==null?void 0:i.position)==null?void 0:h.Header)&&S(a)==="Stack",{id:l,version:c}=D(o),u=Z(o),d;if(s){let[y,f]=cn(a,i);y===void 0?d=Nt(e,a,o):d=Ft(e,y,o,f)}else!u&&((g=i==null?void 0:i.position)!=null&&g.Centre)?d=Ho(e,a,o):d=is(e,n,o);if(r.DoNotRemove)return d;let p=se(d,y=>y.id===l&&y.version===c),m=P(p,"path");return $o(d,{path:m,type:"remove"})},ns=(e,{path:t,component:o})=>Nt(e,F(e,t),o),is=(e,t,o)=>{let{component:r,pos:n,clientRect:a,dropRect:i}=t,s=r,l=P(s,"path");if(l==="0.0")return it(e,s,o,n);let c=K(e,l);if(Tn(n,c)){let u=n.position.SouthOrEast?"after":"before";return Ft(e,s,o,u,n,a,i)}if(!Tn(n,c))return it(e,s,o,n,a,i);if(V(S(c)))return it(e,s,o,n);throw Error(`no support right now for position = ${n.position}`)},Tn=(e,t)=>e.position.Centre?Ln(t)||Pn(t):e.position.NorthOrSouth?Pn(t):e.position.EastOrWest?Ln(t):!1,Pn=e=>S(e)==="Flexbox"&&e.props.style.flexDirection==="column",Ln=e=>S(e)==="Flexbox"&&e.props.style.flexDirection!=="column";var Cn=require("react"),as=e=>console.log(`dispatch ${e.type}, have you forgotten to provide a LayoutProvider ?`),Ue=(0,Cn.createContext)({dispatchLayoutProvider:as,version:-1});var pe=require("react");var ss={},Mn=[0,0],ls=(e,t,o)=>{let r=document.createElement("div");r.className="vuuSimpleDraggableWrapper",r.classList.add("vuuSimpleDraggableWrapper","salt-theme","salt-density-medium"),r.dataset.dragging="true";let n=o!=null?o:document.createElement("div");n.id=t,r.appendChild(n),document.body.appendChild(r);let a=`top:${e.top}px;left:${e.left}px;width:${e.width}px;height:${e.height}px;`;return[r,a,e.left,e.top]},cs=e=>{let{offsetParent:t}=e;if(t===null)return Mn;{let{left:o,top:r}=t.getBoundingClientRect();return[o,r]}},kn=(e,t,o)=>{let r=(0,pe.useRef)(),n=(0,pe.useRef)(),a=(0,pe.useRef)(),i=(0,pe.useCallback)((u,d)=>{if(n.current&&a.current){let{dragOffsets:[p,m],targetPosition:h}=n.current,g=typeof u=="number"?u-p:h.left,y=typeof d=="number"?d-m:h.top;(g!==h.left||y!==h.top)&&(n.current.targetPosition.left=g,n.current.targetPosition.top=y,a.current.style.top=y+"px",a.current.style.left=g+"px")}},[]),s=(0,pe.useCallback)(u=>{if(n.current){let{dragInstructions:d,payload:p,originalCSS:m}=n.current;u&&t({type:"drag-drop",draggedReactElement:p,dragInstructions:d,dropTarget:u}),a.current&&(!u&&d.DriftHomeIfNoDropTarget?(console.log("drift back to start"),document.body.removeChild(a.current)):d.RemoveDraggableOnDragEnd?document.body.removeChild(a.current):(a.current.style.cssText=m,delete a.current.dataset.dragging)),r.current=void 0,n.current=void 0,a.current=void 0}},[t]),l=(0,pe.useCallback)(u=>{if(r.current){let{payload:d,dragContainerPath:p,dragElement:m,dragRect:h,instructions:g=ss,path:y}=r.current,{current:f}=e,x={x:u.clientX,y:u.clientY},R=d!=null?d:F(f,y,!0),{id:w}=R.props,E=Z(R),b="",v="",T="",M=-1,L=-1,k=Mn,O=document.getElementById(w);if(O===null)[O,v,M,L]=ls(h,w,m);else{k=cs(O);let[I,A]=k,{width:j,height:q,left:De,top:Se}=O.getBoundingClientRect();M=De-I,L=Se-A,v=`width:${j}px;height:${q}px;left:${M}px;top:${L}px;z-index: 100;background-color:#ccc;opacity: 0.6;`,O.dataset.dragging="true",b=O.style.cssText}T=Mt.initDrag(e.current,p,h,x,{drag:i,drop:s},E),O.style.cssText=v+T,a.current=O,n.current={payload:R,originalCSS:b,dragRect:h,dragOffsets:k,dragInstructions:g,targetPosition:{left:M,top:L}}}},[i,s,e]);return(0,pe.useCallback)(u=>{let{evt:d,...p}=u;r.current={...p,dragContainerPath:bt(e.current,o)},Mt.handleMousedown(d,l,p.instructions)},[l,o,e])};var Go=require("react/jsx-runtime"),An=e=>e.dropTarget,us=e=>["drag-drop","remove","set-title","splitter-resize","switch-tab"].includes(e.type),zn=e=>{switch(e.type){case"switch-tab":return e.id==="main-tabs"?"switch-active-layout":"switch-active-tab";case"save":return"save-feature-props";case"drag-drop":return"drag-drop-operation";case"remove":return"remove-component";case"splitter-resize":return"resize-component";case"set-title":return"edit-feature-title";default:throw Error("unknown layout action")}},ps=()=>{let e=In();return(0,Go.jsx)("div",{children:`Context: ${e} `})},ds=e=>{let{children:t,createNewChild:o,pathToDropTarget:r,layout:n,onLayoutChange:a}=e,i=(0,W.useRef)(void 0),s=(0,W.useRef)(t),[,l]=(0,W.useState)(null),c=(0,W.useCallback)((m,h)=>{if(a){let g=se(m,An)||i.current,f=S(g)==="DraggableLayout"?D(g).children[0]:g,x=Bo(f);a(x,h)}},[a]),u=(0,W.useCallback)((m,h=!1)=>{let g=Vo(i.current,m);g!==i.current&&(i.current=g,l({}),!h&&us(m)&&c(g,zn(m)))},[l,c]),d=(0,W.useCallback)(m=>{switch(m.type){case"drag-start":{p(m);break}case"save":{c(i.current,zn(m));break}case"query":if(m.query==="PARENT_CONTAINER")return No(m.query,m.path,i.current);break;default:{u(m);break}}},[u,c]),p=kn(i,d,r);return(0,W.useEffect)(()=>{if(n){let m=se(i.current,An);if(m){let h=lo(m),g=xe(n,`${m.props.path}.0`),y=h?{type:$.REPLACE,target:h,replacement:g}:{type:$.ADD,path:m.props.path,component:g};u(y,!0)}else if(n.id===P(i.current,"id")){let h=xe(n,"0"),g={type:$.REPLACE,target:i.current,replacement:h};u(g,!0)}}},[u,n]),i.current===void 0?i.current=Bt(t):t!==s.current&&(i.current=Bt(t,i.current),s.current=t),(0,Go.jsx)(Ue.Provider,{value:{createNewChild:o,dispatchLayoutProvider:d,version:0},children:i.current})},ne=()=>{let{dispatchLayoutProvider:e}=(0,W.useContext)(Ue);return e},_o=()=>{let{createNewChild:e}=(0,W.useContext)(Ue);return e},In=()=>{let{version:e}=(0,W.useContext)(Ue);return e};var at=(e,t,o,r)=>{var y;let{loadSessionState:n,purgeSessionState:a,purgeState:i,saveSessionState:s}=Ae(),[l,c]=(0,we.useState)((y=n(e,"contributions"))!=null?y:[]),u=ne(),d=(0,we.useCallback)((f,x)=>{let R=l.concat([{location:f,content:x}]);s(e,"contributions",R),c(R)},[l,e,s]),p=(0,we.useCallback)(()=>{a(e,"contributions"),c([])},[e,a]),m=(0,we.useCallback)(()=>{let f=n(e,"data-source");f&&f.unsubscribe(),a(e),i(e),u({type:"remove",path:o})},[u,e,n,a,i,o]),h=(0,we.useCallback)(async(f,x,R)=>{var E;f.stopPropagation();let w=(E=t.current)==null?void 0:E.getBoundingClientRect();return new Promise((b,v)=>{u({type:"drag-start",evt:f,path:x===void 0?o:`${o}.${x}`,dragRect:w,preDragActivity:R,dropTargets:r,resolveDragStart:b,rejectDragStart:v})})},[t,u,o,r]);return[(0,we.useCallback)(async(f,x)=>{var w;let{type:R}=f;switch(R){case"maximize":case"minimize":case"restore":return u({type:R,path:(w=f.path)!=null?w:o});case"remove":return m();case"mousedown":return h(x,f.index,f.preDragActivity);case"add-toolbar-contribution":return d(f.location,f.content);case"remove-toolbar-contribution":return p();case"query":return u({type:R,path:f.path,query:f.query});default:return}},[u,o,m,h,d,p]),l]};var Gn=require("@vuu-ui/vuu-utils"),Wn=require("@salt-ds/core"),Un=C(require("clsx")),U=C(require("react"));var Bn=require("@vuu-ui/vuu-ui-controls"),On=require("@salt-ds/core"),Vt=C(require("clsx")),Re=require("react");var Je=require("react/jsx-runtime"),Wo="vuuHeader",Uo=({className:e,contributions:t,collapsed:o,closeable:r,onEditTitle:n,orientation:a="horizontal",style:i,title:s="Untitled"})=>{let l=(0,Re.useRef)(null),[c,u]=(0,Re.useState)(s),[d,p]=(0,Re.useState)(!1),m=Jo(),h=L=>m==null?void 0:m({type:"remove"},L),g=()=>{var L;(L=l.current)==null||L.focus()},y=L=>{L.stopPropagation()},x=(0,Vt.default)(Wo,e,`${Wo}-${o||a}`),R=()=>{p(!0)},w=L=>{L.key==="Enter"&&p(!0)},E=(L="",k="",O=!0,I=!1)=>{var A;p(!1),I?u(L):k!==L&&(u(k),n==null||n(k)),O===!1&&((A=l.current)==null||A.focus())},b=L=>{m==null||m({type:"mousedown"},L)},v=[],T=[],M=[];return t==null||t.forEach((L,k)=>{switch(L.location){case"pre-title":v.push((0,Re.cloneElement)(L.content,{key:k}));break;default:T.push((0,Re.cloneElement)(L.content,{key:k}))}}),s&&v.push((0,Je.jsx)(Bn.EditableLabel,{className:`${Wo}-title`,editing:d,value:c,onChange:u,onMouseDownCapture:g,onEnterEditMode:R,onExitEditMode:E,onKeyDown:w,ref:l,tabIndex:0},"title")),r&&M.push((0,Je.jsx)(On.Button,{"data-icon":"close",onClick:h,onMouseDown:y,variant:"secondary"},"close")),T.length>0&&v.push((0,Je.jsx)("div",{className:"vuuTooltrayProxy","data-align":"end",children:T},"contributions")),M.length>0&&v.push((0,Je.jsx)("div",{className:"vuuTooltrayProxy","data-align":"end",children:M},"actions")),(0,Je.jsx)("div",{className:(0,Vt.default)("vuuToolbarProxy",x),style:i,onMouseDown:b,children:v})};var ie=require("react");var Nn=({id:e,rootRef:t,path:o,dropTargets:r,title:n})=>{let a=ne(),{loadState:i,loadSessionState:s,purgeState:l,saveState:c,saveSessionState:u}=Ae(),[d,p]=at(e,t,o,r),m=(0,ie.useMemo)(()=>{var b;return(b=i("view-title"))!=null?b:n},[i,n]),h=(0,ie.useCallback)(b=>{o&&a({type:"set-title",path:o,title:b})},[a,o]),g=(0,ie.useMemo)(()=>i(e),[e,i]),y=(0,ie.useCallback)(b=>i(e,b),[e,i]),f=(0,ie.useCallback)(b=>{l(e,b),a({type:"save"})},[e,a,l]),x=(0,ie.useCallback)((b,v)=>{c(e,v,b),a({type:"save"})},[e,a,c]),R=(0,ie.useCallback)(b=>s(e,b),[e,s]),w=(0,ie.useCallback)((b,v)=>u(e,v,b),[e,u]),E=(0,ie.useCallback)(({type:b,...v})=>{let{[b]:T}=v;x(T,b)},[x]);return{contributions:p,dispatchViewAction:d,load:y,loadSession:R,onConfigChange:E,onEditTitle:h,purge:f,restoredState:g,save:x,saveSession:w,title:m}};var ae=require("react");var Oe=require("react"),Zo=["height","width"],ms=["height"],fs=["width"],Be=new WeakMap,Fn=(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}},Yo=new ResizeObserver(e=>{for(let t of e){let{target:o,contentRect:r}=t,n=Be.get(o);if(n){let{onResize:a,measurements:i}=n,s=!1;for(let[l,c]of Object.entries(i)){let u=Fn(o,r,l);u!==c&&(s=!0,i[l]=u)}s&&a&&a(i)}}});function st(e,t,o,r=!1){let n=(0,Oe.useRef)(t),a=(0,Oe.useCallback)(i=>{let s=i.getBoundingClientRect();return n.current.reduce((l,c)=>(l[c]=Fn(i,s,c),l),{})},[]);(0,Oe.useLayoutEffect)(()=>{let i=e.current,s=!1;async function l(){Be.set(i,{measurements:{}}),s=!1;let{fonts:c}=document;if(c&&await c.ready,!s){let u=Be.get(i);if(u){let d=a(i);u.measurements=d,Yo.observe(i),r&&o(d)}}}if(i){if(Be.has(i))throw Error("useResizeObserver attemping to observe same element twice");l()}return()=>{i&&Be.has(i)&&(Yo.unobserve(i),Be.delete(i),s=!0)}},[e,a,r,o]),(0,Oe.useLayoutEffect)(()=>{let i=e.current,s=Be.get(i);if(s){if(n.current!==t){n.current=t;let l=a(i);s.measurements=l}s.onResize=o}},[t,a,e,o])}function hs(e,t){let o=document.body.querySelector(`.${e}`),r={get:function(n,a){let i=n.getPropertyValue(`--${e}-breakpoint-${a}`);return i?parseInt(i):void 0}};return o?new Proxy(getComputedStyle(o),r):t!=null?t:{}}var gs=([,e],[,t])=>t-e,jo=e=>Object.entries(e).sort(gs).map(([t,o],r,n)=>[t,o,r<n.length-1?n[r+1][1]:9999]),Xo=null,ys=(e="salt")=>{let{xs:t,sm:o,md:r,lg:n,xl:a}=hs(e);return jo({xs:t,sm:o,md:r,lg:n,xl:a})},Hn=e=>(Xo===null&&(Xo=ys(e)),Xo);var bs=[],qo=({breakPoints:e,smallerThan:t},o)=>{let[r,n]=(0,ae.useState)(t?!1:"lg"),a=(0,ae.useRef)(document.body),i=(0,ae.useRef)(e?jo(e):Hn()),s=(0,ae.useRef)("lg"),l=(0,ae.useCallback)(u=>{if(i.current){for(let[d,p]of i.current)if(u>=p)return d}},[i]),c=(0,ae.useCallback)(u=>{if(t){let d=i.current.find(([p])=>p===t);if(d){let[,,p]=d;return u<p}}else return l(u);return u},[t,l]);return st(o||a,i.current?["width"]:bs,({width:u})=>{let d=c(u);d!==s.current&&(s.current=d,n(d))},!0),(0,ae.useEffect)(()=>{let u=o||a;if(u.current){let d=s.current;if(i.current){let{clientWidth:p}=u.current,m=c(p);s.current=m,m!==d&&n(m)}}},[n,c,o]),r};var $n="data-collapsible",xs={[$n]:!0,"data-pad-start":!0,"data-pad-end":!0},Vn=e=>{var t;return(t=xs[e])!=null?t:!1},vs=e=>e===$n,ws={dynamic:"dynamic",instant:"instant",true:"instant"},Rs=e=>{var t;return(t=ws[e])!=null?t:"none"},Es=e=>Object.keys(e).reduce((t,o)=>{let[r,n]=t;if(Vn(o)){let a=vs(o)?Rs(e[o]):e[o];r[o]=a,n[o]=void 0}return t},[{},{}]);var Ye=require("react"),Ds=[],_n=({mainRef:e,resize:t="responsive",rootRef:o})=>{let r=t==="defer",n=(0,Ye.useRef)({}),a=(0,Ye.useRef)(),i=(0,Ye.useCallback)(()=>{e.current&&(e.current.style.height=n.current.height+"px",e.current.style.width=n.current.width+"px"),a.current=void 0},[e]),s=(0,Ye.useCallback)(({height:l,width:c})=>{n.current.height=l,n.current.width=c,a.current!==null&&clearTimeout(a.current),a.current=window.setTimeout(i,40)},[i]);st(o,r?Zo:Ds,s,r)};var lt=C(require("react")),Ss={dispatch:null},ct=lt.default.createContext(Ss),Jo=()=>{var t;let e=(0,lt.useContext)(ct);return(t=e==null?void 0:e.dispatch)!=null?t:null},Qo=()=>(0,lt.useContext)(ct);var Ze=require("react/jsx-runtime"),ut="vuuView",Ts=(e,t)=>e&&t?{...e,...t}:e||t,Jn=(0,U.forwardRef)(function(t,o){let{Header:r=Uo,children:n,className:a,collapsed:i,closeable:s,"data-path":l,"data-resizeable":c,dropTargets:u,expanded:d,flexFill:p,id:m,header:h,orientation:g="horizontal",path:y=l,resize:f="responsive",resizeable:x=c,tearOut:R,style:w={},title:E,...b}=t,v=(0,Gn.useId)(m),T=(0,U.useRef)(null),M=(0,U.useRef)(null),[L,k]=(0,U.useState)(),{contributions:O,dispatchViewAction:I,load:A,loadSession:j,onConfigChange:q,onEditTitle:De,purge:Se,restoredState:fr,save:hr,saveSession:gr,title:oo}=Nn({id:v,rootRef:T,path:y,dropTargets:u,title:E});_n({mainRef:M,resize:f,rootRef:T});let yr=(0,U.useCallback)(ki=>{k(ki)},[]),Li=()=>U.default.isValidElement(n)&&(fr||L)?U.default.cloneElement(n,Ts(fr,L)):n,Ci=(0,U.useMemo)(()=>({dispatch:I,id:v,path:y,title:oo,load:A,loadSession:j,onConfigChange:q,purge:Se,save:hr,saveSession:gr,setComponentProps:yr}),[I,v,A,j,q,y,Se,hr,gr,yr,oo]),Mi=typeof h=="object"?h:{};return(0,Ze.jsx)("div",{...b,className:(0,Un.default)(ut,a,{[`${ut}-collapsed`]:i,[`${ut}-expanded`]:d,[`${ut}-resize-defer`]:f==="defer"}),"data-resizeable":x,id:v,ref:(0,Wn.useForkRef)(o,T),style:w,tabIndex:-1,children:(0,Ze.jsxs)(ct.Provider,{value:Ci,children:[h?(0,Ze.jsx)(r,{...Mi,collapsed:i,contributions:O,expanded:d,closeable:s,onEditTitle:De,orientation:g,tearOut:R,title:oo}):null,(0,Ze.jsx)("div",{className:`${ut}-main`,ref:M,children:Li()})]})})});Jn.displayName="View";var Ne=U.default.memo(Jn);Ne.displayName="View";N("View",Ne,"view");var de=require("react/jsx-runtime"),_t="vuuLayoutStartPanel",Zn=e=>{let{dispatch:t,path:o}=Qo(),[r,n]=(0,Gt.useState)();return(0,Gt.useMemo)(()=>{t==null||t({type:"query",path:o,query:"PARENT_CONTAINER"}).then(i=>{(i==null?void 0:i.parentContainerId)==="main-tabs"?n("initial"):n("nested")})},[t,o]),r===void 0?null:(0,de.jsxs)("div",{...e,className:_t,children:[r==="initial"?(0,de.jsxs)(de.Fragment,{children:[(0,de.jsx)("header",{className:`${_t}-title`,children:"Start by adding a table"}),(0,de.jsx)("div",{className:`${_t}-text`,children:"To add a table, drag any of the Vuu Tables to this area or click the button below"})]}):null,(0,de.jsx)(Yn.Button,{className:`${_t}-addButton`,"data-icon":"add",variant:"cta"})]})};var Fe=require("react/jsx-runtime"),Ps="vuuPlaceholder",Ls=({showStartMenu:e=!0})=>(0,Fe.jsx)(Fe.Fragment,{children:e?(0,Fe.jsx)(Zn,{}):null}),He=({className:e,showStartMenu:t,...o})=>{let r=(0,Xn.default)(Ps,e);return(0,Fe.jsx)(Ne,{...o,className:r,"data-placeholder":!0,resizeable:!0,children:(0,Fe.jsx)(Ls,{showStartMenu:t})})};He.displayName="Placeholder";N("Placeholder",He);var jn=C(require("clsx")),J=C(require("react"));var Ko=require("react/jsx-runtime"),Wt="vuuSplitter",qn=J.default.memo(function({column:t,index:o,onDrag:r,onDragEnd:n,onDragStart:a,style:i}){let s=(0,J.useRef)(),l=(0,J.useRef)(null),c=(0,J.useRef)(0),[u,d]=(0,J.useState)(!1),p=(0,J.useCallback)(({key:b,shiftKey:v})=>{let T=v?10:1;t&&b==="ArrowDown"?r(o,T):t&&b==="ArrowUp"||!t&&b==="ArrowLeft"?r(o,-T):!t&&b==="ArrowRight"&&r(o,T)},[t,o,r]),m=(0,J.useCallback)(b=>{let{key:v}=b;(t&&(v==="ArrowUp"||v==="ArrowDown")||!t&&(v==="ArrowLeft"||v==="ArrowRight"))&&(a(o),p(b),h.current=p)},[t,p,o,a]),h=(0,J.useRef)(m),g=b=>h.current(b),y=(0,J.useCallback)(b=>{s.current=!0;let v=b[t?"clientY":"clientX"],T=v-c.current;v&&v!==c.current&&r(o,T),c.current=v},[t,o,r]),f=(0,J.useCallback)(()=>{var b;window.removeEventListener("mousemove",y,!1),window.removeEventListener("mouseup",f,!1),n(),d(!1),(b=l.current)==null||b.focus()},[y,n,d]),x=(0,J.useCallback)(b=>{c.current=t?b.clientY:b.clientX,a(o),window.addEventListener("mousemove",y,!1),window.addEventListener("mouseup",f,!1),b.preventDefault(),d(!0)},[t,y,f,o,a,d]),R=()=>{var b;s.current?s.current=!1:(b=l.current)==null||b.focus()},w=()=>{h.current=m},E=(0,jn.default)(Wt,{[`${Wt}-active`]:u,[`${Wt}-column`]:t});return(0,Ko.jsx)("div",{className:E,"data-splitter":!0,ref:l,role:"separator",style:i,onBlur:w,onClick:R,onKeyDown:g,onMouseDown:x,tabIndex:0,children:(0,Ko.jsx)("div",{className:`${Wt}-grab-zone`})})});var Cs={},pt=1,dt=2,Ms=e=>typeof e.intrinsicSize=="number",ks=(e,t)=>{let o={};return e.forEach(r=>{o[r]=P(t,r)}),o},Ut=(e,t,o)=>e.map((r,n)=>{var l;let a=P(r,"resizeable"),{[t]:i}=(l=Z(r))!=null?l:Cs,s=Lo(r);return o?{index:n,flexOpen:s,intrinsicSize:i,resizeable:a,...ks(o,r)}:{index:n,flexOpen:s,intrinsicSize:i,resizeable:a}}),Qn=e=>{let t=e.length,o=e.every(Ms),r=Array(t).fill(0);if(o&&t>0&&(r[0]=dt,r[t-1]=dt),t<2)return r;for(let n=0,a=0;n<t-1;n++)e[n].resizeable&&!a&&(a=pt),r[n]+=a;for(let n=t-1;n>0&&(r[n]&pt&&(r[n]-=pt),!e[n].resizeable);n--);return r},Kn=(e,t)=>{let o=zs(e,t),r=Is(e,t),n=o!==-1&&r!==-1?[o,r]:void 0,a=As(e,n);return[n,a]};function As(e,t){if(t){let o=[];for(let r=0;r<e.length;r++)e[r].flexOpen&&!t.includes(r)&&o.push(r);return o}}function zs(e,t){let o=t,r=!1;for(;o>=1&&!r;)o=o-1,r=ei(e,o);return o}function Is(e,t){let o=t,r=!1,n=e.length;for(;o<n-1&&!r;)o=o+1,r=ei(e,o);return o===n?-1:o}function ei(e,t){let{placeholder:o,splitter:r,resizeable:n,intrinsicSize:a}=e[t];return!!(!r&&!a&&(o||n))}var Bs=e=>!e.splitter&&!e.placeholder,ri=({children:e,onSplitterMoved:t,style:o})=>{let r=(0,B.useRef)(null),n=(0,B.useRef)(),a=(0,B.useRef)(),i=(0,B.useRef)([]),[,s]=(0,B.useState)({}),l=y=>{a.current=y,s({})},c=(o==null?void 0:o.flexDirection)==="column",u=c?"height":"width",d=(0,B.useMemo)(()=>Array.isArray(e)?e:B.default.isValidElement(e)?[e]:[],[e]),p=(0,B.useCallback)(y=>{let{current:f}=n;if(f){let[x,R]=Kn(f,y);x&&(x.forEach(w=>{var b;let E=(b=r.current)==null?void 0:b.childNodes[w];if(E){let{size:v,minSize:T}=Hs(E,u);f[w].currentSize=v,f[w].minSize=T}}),R&&R.forEach(w=>{var b;let E=(b=r.current)==null?void 0:b.childNodes[w];if(E){let{[u]:v}=E.getBoundingClientRect();f[w].flexBasis=v}}))}},[u]),m=(0,B.useCallback)((y,f)=>{a.current&&n.current&&l(Ns(a.current,n.current,f,u))},[u]),h=(0,B.useCallback)(()=>{let y=n.current;y&&(t==null||t(y.filter(Bs))),y==null||y.forEach(f=>{f.currentSize=void 0,f.flexBasis=void 0,f.flexOpen=!1})},[t]),g=(0,B.useCallback)(y=>B.default.createElement(qn,{column:c,index:y,key:`splitter-${y}`,onDrag:m,onDragEnd:h,onDragStart:p}),[m,h,p,c]);return(0,B.useMemo)(()=>{let[y,f]=Os(d,u,g,i.current);n.current=f,a.current=y},[d,g,u]),{content:a.current||[],rootRef:r}};function Os(e,t,o,r){let n=Ut(e,t),a=Qn(n),i=[],s=[];for(let l=0;l<e.length;l++){let c=e[l];if(l===0&&a[l]&dt&&(i.push(ti(l)),s.push({placeholder:!0,shim:!0})),c.key==null){let u=r[l]||(r[l]=(0,oi.getUniqueId)());i.push(B.default.cloneElement(c,{key:u}))}else i.push(c);s.push(n[l]),l>0&&a[l]&dt?(i.push(ti(l)),s.push({placeholder:!0})):a[l]&pt&&(i.push(o(i.length)),s.push({splitter:!0}))}return[i,s]}function Ns(e,t,o,r){return Fs(t,o)?e.map((a,i)=>{let s=t[i],{currentSize:l,flexOpen:c,flexBasis:u}=s,d=l!==void 0;if(d||c){let{flexBasis:p}=a.props.style||{},m=d?s.currentSize:u;return m!==p?B.default.cloneElement(a,{style:{...a.props.style,flexBasis:m,[r]:"auto"}}):a}else return a}):e}function Fs(e,t){let o=[];e.forEach((u,d)=>{u.currentSize!==void 0&&o.push(d)});let r=t<0?o[0]:o[1],{currentSize:n=0,minSize:a=0}=e[r];if(n===a)return!1;if(Math.abs(t)>n-a){let u=t<0?-1:1;t=Math.max(0,n-a)*u}let i=e[o[0]],{currentSize:s=0}=i;i.currentSize=s+t;let l=e[o[1]],{currentSize:c=0}=l;return l.currentSize=c-t,!0}function ti(e){return B.default.createElement(He,{shim:e===0,key:`placeholder-${e}`})}function Hs(e,t){let{[t]:o}=e.getBoundingClientRect(),n=getComputedStyle(e).getPropertyValue(`min-${t}`),a=n.endsWith("px")?parseInt(n,10):0;return{size:o,minSize:a}}var li=require("react/jsx-runtime"),er="hwFlexbox",si=(0,ai.forwardRef)(function(t,o){let{breakPoints:r,children:n,column:a,className:i,flexFill:s,gap:l,fullPage:c,id:u,onSplitterMoved:d,resizeable:p,row:m,spacing:h,splitterSize:g,style:y,...f}=t,{content:x,rootRef:R}=ri({children:n,onSplitterMoved:d,style:y}),w=(0,ii.default)(er,i,{[`${er}-column`]:a,[`${er}-row`]:m,"flex-fill":s,"full-page":c});return(0,li.jsx)("div",{...f,className:w,"data-resizeable":p||void 0,id:u,ref:(0,ni.useForkRef)(R,o),style:{...y,gap:l,"--spacing":h},children:x})});si.displayName="Flexbox";var Jt=si;var ci=require("react");var ui=require("react/jsx-runtime"),tr=function(t){let{path:o}=t,r=ne(),n=(0,ci.useCallback)(a=>{r({type:Ie.SPLITTER_RESIZE,path:o,sizes:a})},[r,o]);return(0,ui.jsx)(Jt,{...t,onSplitterMoved:n})};tr.displayName="Flexbox";N("Flexbox",tr,"container");var mi=require("@vuu-ui/vuu-utils"),fi=require("@salt-ds/core"),hi=C(require("clsx")),Zt=require("react");var pi=require("@vuu-ui/vuu-utils"),X=require("react");var $s=["xs","sm","md","lg","xl"],Vs=12,di=({children:e,cols:t,style:o})=>{let r=(0,X.useRef)(null),n=(0,X.useRef)(null),a=(0,X.useRef)(),i=t!=null?t:Vs,l=(o==null?void 0:o.flexDirection)==="column"?"height":"width",c=(0,X.useMemo)(()=>Array.isArray(e)?e:(0,X.isValidElement)(e)?[e]:[],[e]),u=(0,X.useCallback)((d,p)=>{let m=Ut(d,p,$s),h=[],g=[];for(let y=0;y<d.length;y++){let f=d[y],{style:{flex:x,...R}}=f.props;h.push((0,X.cloneElement)(f,{key:(0,pi.getUniqueId)(),style:{...R,"--parent-col-count":i}})),g.push(m[y])}return[h,g]},[i]);return(0,X.useMemo)(()=>{let[d,p]=u(c,l);n.current=p,a.current=d},[u,c,l]),{cols:i,content:a.current,rootRef:r}};var gi=require("react/jsx-runtime"),Yt="hwFluidGrid",Xt=(0,Zt.forwardRef)(function(t,o){let{breakPoints:r,children:n,column:a,cols:i=12,className:s,flexFill:l,gap:c=3,fullPage:u,id:d,onSplitterMoved:p,resizeable:m,row:h,showGrid:g,spacing:y,splitterSize:f,style:x,...R}=t,w=(0,Zt.useMemo)(()=>(0,mi.asReactElements)(n),[n]),{cols:E,content:b,rootRef:v}=di({children:w,cols:i,style:x}),T=qo({breakPoints:r},v),M=(0,hi.default)(Yt,s,{[`${Yt}-column`]:a,[`${Yt}-row`]:h,[`${Yt}-show-grid`]:g,"flex-fill":l,"full-page":u}),L={...x,"--spacing":y,"--grid-col-count":E,"--grid-gap":c};return(0,gi.jsx)("div",{...R,className:M,"data-breakpoint":T,"data-cols":E,"data-resizeable":m||void 0,id:d,ref:(0,fi.useForkRef)(v,o),style:L,children:b})});Xt.displayName="FluidGrid";var yi=require("react/jsx-runtime"),or=function(t){return(0,yi.jsx)(Xt,{...t})};or.displayName="FluidGrid";N("FluidGrid",or,"container");var bi=require("@vuu-ui/vuu-utils"),qt=require("@vuu-ui/vuu-ui-controls"),rr=C(require("clsx")),Qt=require("react");var jt=require("react/jsx-runtime"),_s=e=>{let t=e.cloneNode(!0);return t.id="",delete t.dataset.idx,t},nr=(0,Qt.memo)(({className:e,children:t,idx:o,resizeable:r,header:n,closeable:a,...i})=>(0,jt.jsx)(qt.ListItem,{className:(0,rr.default)("vuuPaletteItem",e),"data-draggable":!0,"data-icon":"draggable",...i}));nr.displayName="PaletteItem";var xi=({ListProps:e,ViewProps:t,children:o,className:r,itemHeight:n=41,orientation:a="horizontal",...i})=>{let s=ne(),l="vuuPalette";function c(u){var L,k;let p=u.target.closest(".vuuPaletteItem"),m=parseInt((k=(L=p.dataset)==null?void 0:L.index)!=null?k:"-1"),{props:{caption:h,children:g,template:y,...f}}=o[m],{ViewProps:x}=g.props,{height:R,left:w,top:E,width:b}=p.getBoundingClientRect(),v=(0,bi.uuid)(),M=y?g:(0,jt.jsx)(Ne,{...t,...{id:v,key:v},...f,...x,title:f.label,children:g});s({dragRect:{left:w,top:E,right:w+b,bottom:E+150,width:b,height:R},dragElement:_s(p),evt:u.nativeEvent,instructions:{DoNotRemove:!0,DoNotTransform:!0,DriftHomeIfNoDropTarget:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},path:"*",payload:M,type:"drag-start"})}return(0,jt.jsx)(qt.List,{...e,...i,className:(0,rr.default)(l,r,`${l}-${a}`),itemHeight:n,selected:null,children:o.map((u,d)=>u.type===nr?(0,Qt.cloneElement)(u,{key:d,onMouseDown:c}):u)})};N("Palette",xi,"view");var Kt=require("@vuu-ui/vuu-ui-controls"),vi=require("@vuu-ui/vuu-utils"),ar=C(require("clsx")),le=C(require("react"));var Xe=require("react/jsx-runtime"),ir="vuuTabs",Gs=()=>{},Ws=e=>{let t=[];return le.default.Children.forEach(e,o=>{le.default.isValidElement(o)?t.push(o):console.warn("Stack has unexpected child element type")}),t},Us={allowAddTab:!1,allowCloseTab:!1,allowRenameTab:!1},eo=(0,le.forwardRef)(function({TabstripProps:t=Us,active:o=0,children:r,className:n,getTabIcon:a=Gs,getTabLabel:i=ze,id:s,keyBoardActivation:l="manual",onAddTab:c,onMoveTab:u,onTabClose:d,onTabEdit:p,onTabSelectionChanged:m,showTabs:h="top",style:g},y){var O;let f=(0,vi.useId)(s),x=(0,le.useRef)([]),{allowCloseTab:R,allowRenameTab:w,className:E}=t,b=(0,le.useCallback)((I,A,j,q)=>{p==null||p(q,A)},[p]),v=()=>{var I;return le.default.isValidElement(r)?r:Array.isArray(r)&&(I=r[o])!=null?I:null},T=()=>Ws(r).map((I,A)=>{let{closeable:j=R,id:q=`${f}-${A}`,"data-tab-location":De}=I.props,Se=i(I,A,x.current);return x.current.push(Se),(0,Xe.jsx)(Kt.Tab,{ariaControls:q,"data-icon":a(I,A),id:`${q}-tab`,index:A,label:Se,location:De,closeable:j,editable:w},q)}),M=v(),L=h==="left"||h==="right",k=L?"vertical":"horizontal";return(0,Xe.jsxs)("div",{className:(0,ar.default)(ir,n,{[`${ir}-horizontal`]:L}),style:g,id:f,ref:y,children:[h?(0,Xe.jsx)(Kt.Tabstrip,{...t,activeTabIndex:(O=t==null?void 0:t.activeTabIndex)!=null?O:M===null?-1:o,allowDragDrop:t.allowDragDrop!==!1,animateSelectionThumb:!0,className:(0,ar.default)("vuuTabHeader",E),"aria-label":"data tabs",keyBoardActivation:l,onActiveChange:m,onAddTab:c,onCloseTab:d,onExitEditMode:b,onMoveTab:u,orientation:k,children:T()}):null,(0,Xe.jsx)("div",{"aria-labelledby":`${f}-${o}`,className:`${ir}-tabPanel`,role:"tabpanel",children:M})]})});eo.displayName="Stack";var wi=require("@vuu-ui/vuu-utils"),Ee=C(require("react"));var lr=require("react/jsx-runtime"),Js=()=>(0,lr.jsx)(He,{resizeable:!0,style:{flexGrow:1,flexShrink:0,flexBasis:0}}),sr=e=>{var E;let t=(0,Ee.useRef)(null),o=ne(),{loadState:r}=Ae(),{createNewChild:n,id:a,onTabSelectionChanged:i,path:s,...l}=e,{children:c}=e,u=(0,wi.useId)(a),[d]=at(u,t,s),p=_o(),m=(E=n!=null?n:p)!=null?E:Js,h=b=>{s&&(o({type:"switch-tab",id:u,path:s,nextIdx:b}),i==null||i(b))},g=(0,Ee.useCallback)(b=>{if(Array.isArray(c)){let{props:{"data-path":v,path:T=v}}=c[b];o({type:"remove",path:T})}},[c,o]),y=(0,Ee.useCallback)(()=>{if(s){let b=Ee.default.Children.count(c),v=m(b);o({type:"add",path:s,component:v})}},[c,m,o,s]),f=(0,Ee.useCallback)((b,v)=>{s&&o({fromIndex:b,toIndex:v,path:s,type:"move-child"})},[o,s]);return(0,lr.jsx)(eo,{...l,id:u,getTabLabel:(b,v,T)=>{let{id:M,title:L}=b.props;return r(M,"view-title")||L||ze(b,v,T)},onMouseDown:async(b,v)=>{let T;await d({type:"mousedown",index:v,preDragActivity:async()=>new Promise(k=>{console.log("preDragActivity: Ok, gonna release the drag"),T=k})},b)&&(T==null||T(void 0))},onMoveTab:f,onAddTab:y,onTabClose:g,onTabEdit:(b,v)=>{o({type:"set-title",path:`${s}.${b}`,title:v})},onTabSelectionChanged:h,ref:t})};sr.displayName="Stack";N("Stack",sr,"container");var je=C(require("react"));var $e=require("react/jsx-runtime"),Ys=({children:e})=>{let[o,r]=(0,je.useState)(e),[n,a]=(0,je.useState)(e),i=l=>{let c=co(o,l);a(c)},s=(l,c)=>{console.log(`change ${l} -> ${c}`);let u=je.default.cloneElement(n,{style:{...n.props.style,[l]:c}});a(u),r(je.default.cloneElement(o,{},u))};return(0,$e.jsxs)("div",{"data-design-mode":`${!1}`,children:[o,(0,$e.jsx)("br",{}),(0,$e.jsxs)("div",{style:{display:"flex"},children:[(0,$e.jsx)(cr,{height:300,managedStyle:n.props.style,width:300,onChange:s,style:void 0}),(0,$e.jsx)(ur,{layout:o,onSelect:i,style:{width:300,height:300,backgroundColor:"#ccc"}})]})]})};var ce=require("@salt-ds/core"),z=require("react/jsx-runtime"),dr={},Zs={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"}},pr=({feature:e,children:t,style:o,onChange:r})=>(0,z.jsxs)("div",{className:`LayoutBox layout-${e} layout-outer`,children:[(0,z.jsxs)("div",{className:"layout-top",children:[(0,z.jsx)("span",{className:"layout-title",children:e}),(0,z.jsx)(ce.FormField,{className:"layout-input",style:{width:30},children:(0,z.jsx)(ce.Input,{value:o.top,onChange:(n,a)=>r(e,"top",a)})})]}),(0,z.jsxs)("div",{className:"layout-inner",children:[(0,z.jsx)("div",{className:"layout-left",children:(0,z.jsx)(ce.FormField,{className:"layout-input",style:{width:30},children:(0,z.jsx)(ce.Input,{value:o.left,onChange:(n,a)=>r(e,"left",a)})})}),t,(0,z.jsx)("div",{className:"layout-right",children:(0,z.jsx)(ce.FormField,{className:"layout-input",style:{width:30},children:(0,z.jsx)(ce.Input,{value:o.right,onChange:(n,a)=>r(e,"right",a)})})})]}),(0,z.jsx)("div",{className:"layout-bottom",children:(0,z.jsx)(ce.FormField,{className:"layout-input",style:{width:30},children:(0,z.jsx)(ce.Input,{value:o.bottom,onChange:(n,a)=>r(e,"bottom",a)})})})]}),Xs={margin:!0,marginTop:!0,marginRight:!0,marginBottom:!0,marginLeft:!0},js={padding:!0,paddingTop:!0,paddingRight:!0,paddingBottom:!0,paddingLeft:!0},qs={border:!0,borderColor:!0,borderWidth:!0,borderTopWidth:!0,borderRightWidth:!0,borderBottomWidth:!0,borderLeftWidth:!0},to="(\\d+)(?:px)?",Qs=`^(?:${to}(?:\\s${to}(?:\\s${to}(?:\\s${to})?)?)?)$`,Ri=new RegExp(Qs),Ks=/^(?:(\d+)(?:px)\ssolid\s([a-zA-Z,0-9().]+))$/,cr=({height:e,managedStyle:t,onChange:o,style:r,width:n})=>{let a=Ei(t),i=(R,w,E)=>{let b=parseInt(E||"0",10),v=Zs[R][w];o(v,b)},{marginTop:s=0,marginRight:l=0,marginBottom:c=0,marginLeft:u=0}=a,{borderTopWidth:d=0,borderRightWidth:p=0,borderBottomWidth:m=0,borderLeftWidth:h=0}=a,{paddingTop:g=0,paddingRight:y=0,paddingBottom:f=0,paddingLeft:x=0}=a;return(0,z.jsx)("div",{className:"LayoutConfigurator",style:{width:n,height:e,...r},children:(0,z.jsx)(pr,{feature:"margin",style:{top:s,right:l,bottom:c,left:u},onChange:i,children:(0,z.jsx)(pr,{feature:"border",style:{top:d,right:p,bottom:m,left:h},onChange:i,children:(0,z.jsx)(pr,{feature:"padding",style:{top:g,right:y,bottom:f,left:x},onChange:i,children:(0,z.jsx)("div",{className:"layout-content"})})})})})};function el(e=dr,t=dr){let{margin:o,marginTop:r,marginRight:n,marginBottom:a,marginLeft:i,padding:s,paddingTop:l,paddingRight:c,paddingBottom:u,paddingLeft:d,...p}=e;if(typeof o=="number")p.marginTop=p.marginRight=p.marginBottom=p.marginLeft=o;else if(typeof o=="string"){let m=Ri.exec(o);if(m===null)console.error(`Invalid css value for margin '${o}'`);else{let[,h,g,y,f]=m,x=h&&g&&y;x&&f?(p.marginTop=parseInt(h,10),p.marginRight=parseInt(g,10),p.marginBottom=parseInt(y,10),p.marginLeft=parseInt(f,10)):x?(p.marginTop=parseInt(h,10),p.marginRight=p.marginLeft=parseInt(g,10),p.marginBottom=parseInt(y,10)):h&&g?(p.marginTop=p.marginBottom=parseInt(h,10),p.marginRight=p.marginLeft=parseInt(g,10)):p.marginTop=p.marginRight=p.marginBottom=p.marginLeft=parseInt(h,10)}}if(typeof r=="number"&&(p.marginTop=r),typeof n=="number"&&(p.marginRight=n),typeof a=="number"&&(p.marginBottom=a),typeof i=="number"&&(p.marginLeft=i),typeof s=="number")p.paddingTop=p.paddingRight=p.paddingBottom=p.paddingLeft=s;else if(typeof s=="string"){let m=Ri.exec(s);if(m===null)console.error(`Invalid css value for padding '${s}'`);else{let[,h,g,y,f]=m,x=h&&g&&y;x&&f?(p.paddingTop=parseInt(h,10),p.paddingRight=parseInt(g,10),p.paddingBottom=parseInt(y,10),p.paddingLeft=parseInt(f,10)):x?(p.paddingTop=parseInt(h,10),p.paddingRight=p.paddingLeft=parseInt(g,10),p.paddingBottom=parseInt(y,10)):h&&g?(p.paddingTop=p.paddingBottom=parseInt(h,10),p.paddingRight=p.paddingLeft=parseInt(g,10)):p.paddingTop=p.paddingRight=p.paddingBottom=p.paddinggLeft=parseInt(h,10)}}return typeof l=="number"&&(p.paddingTop=l),typeof c=="number"&&(p.paddingRight=c),typeof u=="number"&&(p.paddingBottom=u),typeof d=="number"&&(p.paddingLeft=d),Ei(p,t)}function Ei(e=dr){let t={...e},o,{border:r,borderWidth:n,borderTopWidth:a,borderRightWidth:i,borderBottomWidth:s,borderLeftWidth:l,borderColor:c,margin:u,marginTop:d,marginRight:p,marginBottom:m,marginLeft:h,padding:g,paddingTop:y,paddingRight:f,paddingBottom:x,paddingLeft:R,...w}=t,E={},b={};if(typeof u=="number"&&(t.marginTop=t.marginRight=t.marginBottom=t.marginLeft=u,E={marginTop:u,marginRight:u,marginBottom:u,marginLeft:u}),typeof g=="number"&&(t.paddingTop=t.paddingRight=t.paddingBottom=t.paddingLeft=g,b={paddingTop:g,paddingRight:g,paddingBottom:g,paddingLeft:g}),r||n||a||i||s||l){typeof r=="string"&&(o=Ks.exec(r))&&([,n,c]=o,n=parseInt(n,10)),n&&(a=a===void 0?n:a,i=i===void 0?n:i,s=s===void 0?n:s,l=l===void 0?n:l),c=c||"black";let v=`
|
|
18
|
+
${c} ${l||0}px ${a||0}px 0 0 inset,
|
|
19
|
+
${c} ${-i||0}px ${-s||0}px 0 0 inset`;return{...w,...E,...b,borderTopWidth:a,borderRightWidth:i,borderBottomWidth:s,borderLeftWidth:l,borderColor:c,borderStyle:"solid",boxShadow:v}}else return t}var Di=C(require("react")),Si=C(require("clsx"));var Ti=require("@vuu-ui/vuu-ui-controls"),mr=require("react/jsx-runtime"),tl="hwLayoutTreeViewer",Pi=(e,t="0")=>({label:S(e),path:t,childNodes:Di.default.Children.map(e.props.children,(o,r)=>Pi(o,t?`${t}.${r}`:`${r}`))}),ur=({layout:e,onSelect:t,style:o})=>{let r=[Pi(e)],n=(a,[{path:i}])=>{t(i)};return(0,mr.jsx)("div",{className:(0,Si.default)(tl),style:o,children:(0,mr.jsx)(Ti.Tree,{source:r,groupSelection:"single",onSelectionChange:n})})};
|
|
20
20
|
//# sourceMappingURL=index.js.map
|